[AArch64] Allow label arithmetic with add/sub/cmp
authorDiana Picus <diana.picus@linaro.org>
Tue, 11 Oct 2016 09:17:47 +0000 (09:17 +0000)
committerDiana Picus <diana.picus@linaro.org>
Tue, 11 Oct 2016 09:17:47 +0000 (09:17 +0000)
commitc93518db8c29e474abb5b8914a3c8cd301c1bfcc
tree61412de11e0f73c3aa6e444ada87afb563dde006
parent750f6a780b9c786ea45398436371b2656bb2cf4d
[AArch64] Allow label arithmetic with add/sub/cmp

Allow instructions such as 'cmp w0, #(end - start)' by folding the
expression into a constant. For ELF, we fold only if the symbols are in
the same section. For MachO, we fold if the expression contains only
symbols that are not linker visible.

Fixes https://llvm.org/bugs/show_bug.cgi?id=18920

Differential Revision: https://reviews.llvm.org/D23834

llvm-svn: 283862
llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp
llvm/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp
llvm/test/MC/AArch64/basic-a64-diagnostics.s
llvm/test/MC/AArch64/label-arithmetic-darwin.s [new file with mode: 0644]
llvm/test/MC/AArch64/label-arithmetic-diags-darwin.s [new file with mode: 0644]
llvm/test/MC/AArch64/label-arithmetic-diags-elf.s [new file with mode: 0644]
llvm/test/MC/AArch64/label-arithmetic-elf.s [new file with mode: 0644]