[PATCH] D23834: [AArch64] Allow label arithmetic with add/sub/cmp

Peter Smith via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 24 08:33:43 PDT 2016


peter.smith added a subscriber: peter.smith.
peter.smith added a comment.

I agree with Renato that the ELF side looks good.

Some suggestions the tests:

- All of the instructions are either add or cmp and all use the w registers. It may be worth varying these a bit more to cover the other cases within the switch(Inst.getOpcode())
- The labels used in the instructions look to be backwards references to labels already defined. It would be good to have some tests that use forward references to labels that are defined later in the file.
- All the Darwin tests are of the form (label1 - label2 + constant), are there other forms that can be expressed?

I note that the label expression must evaluate to a positive value. For example #(end - start) is ok, but #(start - end) or #-(end-start) is not. I don't think that there is much that you can do about this in the general case as IIRC the value of the expression is evaluated after the fragments are fixed and it is too late to easily change an ADD into a SUB or vice-versa.

To the best of my knowledge the Mach-O side looks ok, but I agree with Renato that someone more familar with Mach-O should take a look.


https://reviews.llvm.org/D23834





More information about the llvm-commits mailing list