Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2023-11

Arm compiler limitation

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

J. Gareth Moreton

Hi everyone,

So one of my recent merge requests
(https://gitlab.com/freepascal.org/fpc/source/-/merge_requests/516) has been having test failures on arm-linux, and this has confused me for a while because they don't occur on aarch64-linux (the two platforms share the same code in this particular case).  Well, after a lot of debugging and random shots in the dark, I've found the problem.

RegModifiedByInstruction and RegInInstruction doesn't handle NR_DEFAULTFLAGS on the Arm implementation - it always returns False, so calling RegUsedBetween or RegModifiedBetween for the flags register always returns a false negative.  The other fault is that it doesn't check if the input object is an instruction (there's no "if p.typ ait_instruction then Exit;" check).

I guess taking a step back and taking a breath can help find the solution, so I'll be fixing this with the merge request.

Kit

P.S. The above compiler methods are only used by the peephole optimizer, and Arm's peephole optimizer is relatively basic currently.

Reply by email