[PATCH] D110267: [InlineAsm, SystemZ] Handle inline assembly address operands.

Jonas Paulsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 22 09:56:12 PDT 2021


jonpa created this revision.
jonpa added reviewers: uweigand, rnk, Amanieu, cynecx, lewis-revill, dsanders.
Herald added subscribers: dexonsmith, hiraditya.
jonpa requested review of this revision.
Herald added a project: LLVM.

Handle ZQ, ZR, ZS, ZT and p inline assembly operand constraints. These represent address operands on SystemZ as used by the Load Address instruction.

These have most things in common with memory operands in the way they need to be handled, except that the instruction using the address does not actually touch memory.

Just like with memory operands, the address can be folded into the using instruction to various degrees. For example, ZT and p allow Base + Index + 20-bit displacement, while ZS does not allow the index register.

In order to handle address operands I made them a subclass of the possible memory operands. They are recognized by their memory constraint codes and a new method isAddress() returns true for these. That way a memory operand can be recognized to actually touch memory or not. I first experimented with a new ConstraintType C_Address (like C_Memory), but it seemed simpler to let them be a type of memory operands instead.

There is still the general/default handling of 'p' which seems to be to treat it as a register. Currently it would be up to each target to handle addresses differently (per this patch).

Todo: CodeGenPrepare could also optimize for address folding for these just like for memory operands, I think.

Feedback most welcome!


https://reviews.llvm.org/D110267

Files:
  clang/lib/Basic/Targets/SystemZ.cpp
  clang/lib/Basic/Targets/SystemZ.h
  clang/test/CodeGen/SystemZ/systemz-inline-asm-03.c
  llvm/include/llvm/CodeGen/TargetLowering.h
  llvm/include/llvm/IR/InlineAsm.h
  llvm/lib/CodeGen/CodeGenPrepare.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  llvm/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp
  llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
  llvm/lib/Target/SystemZ/SystemZISelLowering.h
  llvm/test/CodeGen/SystemZ/inline-asm-addr.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110267.374276.patch
Type: text/x-patch
Size: 23448 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210922/14da32ac/attachment.bin>


More information about the llvm-commits mailing list