[AArch64] Support "S" inline assembler constraint
authorPeter Smith <peter.smith@linaro.org>
Wed, 16 May 2018 09:33:25 +0000 (09:33 +0000)
committerPeter Smith <peter.smith@linaro.org>
Wed, 16 May 2018 09:33:25 +0000 (09:33 +0000)
commitc811758da63837912a1cae1639ff0739aed5317f
treef6822ffc68e6c726285f02b0b2c567864187b7eb
parentca0d30cd813c0309d03b4ba587fb53a150e73f5c
[AArch64] Support "S" inline assembler constraint

This patch re-introduces the "S" inline assembler constraint. This matches
an absolute symbolic address or a label reference. The primary use case is

asm("adrp %0, %1\n\t"
    "add %0, %0, :lo12:%1" : "=r"(addr) : "S"(&var));

I say re-introduces as it seems like "S" was implemented in the original
AArch64 backend, but it looks like it wasn't carried forward to the merged
backend. The original implementation had A and L modifiers that could be
used to print ":lo12:" to the string. It looks like gcc doesn't use these
and :lo12: is expected to be written in the inline assembly string so I've
not implemented A and L. Clang already supports the S modifier.

Fixes PR37180

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

llvm-svn: 332444
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
llvm/test/CodeGen/AArch64/inlineasm-S-constraint.ll [new file with mode: 0644]