[PATCH] D105254: [RISCV] Support machine constraint "S"

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 30 18:09:32 PDT 2021


MaskRay created this revision.
Herald added subscribers: vkmr, frasercrmck, evandro, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya.
MaskRay requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

Similar to D46745 <https://reviews.llvm.org/D46745>, "S" represents an absolute symbolic operand, which
can be used to specify the access models, e.g.

  extern int var;
  void *addr_via_asm() {
    void *ret;
    asm("lui %0, %%hi(%1)\naddi %0,%0,%%lo(%1)" : "=r"(ret) : "S"(&var));
    return ret;
  }

We need 'S' to be documented on GCC: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101275


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D105254

Files:
  clang/lib/Basic/Targets/RISCV.cpp
  clang/test/CodeGen/RISCV/riscv-inline-asm.c
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp
  llvm/test/CodeGen/RISCV/inline-asm-S-constraint.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105254.355740.patch
Type: text/x-patch
Size: 4093 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210701/9e3d0ca8/attachment-0001.bin>


More information about the cfe-commits mailing list