diff options
author | Fangrui Song <i@maskray.me> | 2024-01-16 23:57:42 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-16 23:57:42 -0800 |
commit | d4cb5d9f2ba636b0049fc5791d378e224e3a3ae7 (patch) | |
tree | 6a7d460575e891e526c5562f33594489d0468847 /llvm/docs/LangRef.rst | |
parent | 2b3cdd69f7fa8f84513390fff06d0a9c28126717 (diff) | |
download | llvm-d4cb5d9f2ba636b0049fc5791d378e224e3a3ae7.zip llvm-d4cb5d9f2ba636b0049fc5791d378e224e3a3ae7.tar.gz llvm-d4cb5d9f2ba636b0049fc5791d378e224e3a3ae7.tar.bz2 |
[X86] Add "Ws" constraint and "p" modifier for symbolic address/label reference (#77886)
Printing the raw symbol is useful in inline asm (e.g. getting the C++
mangled name, referencing a symbol in a custom way while ensuring it is
not optimized out even if internal). Similar constraints are available
in other targets (e.g. "S" for aarch64/riscv, "Cs" for m68k).
```
namespace ns { extern int var, a[4]; }
void foo() {
asm(".pushsection .xxx,\"aw\"; .dc.a %p0; .popsection" :: "Ws"(&ns::var));
asm(".reloc ., BFD_RELOC_NONE, %p0" :: "Ws"(&ns::a[3]));
}
```
Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105576
Diffstat (limited to 'llvm/docs/LangRef.rst')
-rw-r--r-- | llvm/docs/LangRef.rst | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst index d881deb..27429ad 100644 --- a/llvm/docs/LangRef.rst +++ b/llvm/docs/LangRef.rst @@ -5336,6 +5336,8 @@ X86: operand in a SSE register. If AVX is also enabled, can also be a 256-bit vector operand in an AVX register. If AVX-512 is also enabled, can also be a 512-bit vector operand in an AVX512 register. Otherwise, an error. +- ``Ws``: A symbolic reference with an optional constant addend or a label + reference. - ``x``: The same as ``v``, except that when AVX-512 is enabled, the ``x`` code only allocates into the first 16 AVX-512 registers, while the ``v`` code allocates into any of the 32 AVX-512 registers. @@ -5518,6 +5520,7 @@ X86: the operand. (The behavior for relocatable symbol expressions is a target-specific behavior for this typically target-independent modifier) - ``H``: Print a memory reference with additional offset +8. +- ``p``: Print a raw symbol name (without syntax-specific prefixes). - ``P``: Print a memory reference used as the argument of a call instruction or used with explicit base reg and index reg as its offset. So it can not use additional regs to present the memory reference. (E.g. omit ``(rip)``, even |