[PATCH] D51792: [AArch64] Attempt to parse expressions as adr/adrp operands

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 14 05:32:17 PDT 2018


dmgreen updated this revision to Diff 165473.
dmgreen added a comment.

I seem to have stepped into a bit of a rabbit hole here.. and a lot of things seem to be a bit broken.

As far as I understand, something like `(lab2-lab1)*2  + Sym` should be accepted (if the difference between lab2 and lab1 is know, Sym can be relocated against). This is handled by gcc, but I don't see how it would be easily handled by clang atm. We are trying to classify these operands quite early.

I haven't managed to fix that here, but have added a number of tests around the place for things I couldn't see otherwise tested. Let me know if I should add any more.

I've also made mov's only accept 0 addends and ld/st accept addends > 0 and not mod scale. I think this is OK (it seems to be what gcc does, you don't know the alignment of Sym afterall), but I'm not sure if it needs to work that way for darwin.


https://reviews.llvm.org/D51792

Files:
  lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
  test/MC/AArch64/adr-diagnostics.s
  test/MC/AArch64/adr.s
  test/MC/AArch64/arm64-elf-relocs.s
  test/MC/AArch64/basic-a64-diagnostics.s
  test/MC/AArch64/elf-reloc-movw.s
  test/MC/AArch64/label-arithmetic-elf.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51792.165473.patch
Type: text/x-patch
Size: 17183 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180914/ce7e99b5/attachment.bin>


More information about the llvm-commits mailing list