[PATCH] D101657: [PowerPC] Handle inline assembly clobber of link regsiter

Stefan Pintilie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 5 13:26:26 PDT 2021


stefanp added a comment.

In D101657#2735219 <https://reviews.llvm.org/D101657#2735219>, @efriedma wrote:

> You probably also want the following testcase:
>
>   define void @UseLR() {
>     tail call void asm sideeffect "", "{lr}"(i32 1)
>     ret void
>   }

I looked into doing this but PowerPC does not have enough support for special registers (like `lr`) for us to be able to do this test correctly. The backend does not recognize the copy of the value `1` to the `LR` register and it does not know how to correctly spill special registers. This is on our TODO list and we will address these issues in a separate patch. Also, at this point, the clang frontend does not recognize the `lr` register as a valid input register anyway. (This work is also on our TODO list.) The plan is to address both of these deficiencies in future patches.

Basically, if we try this example from C source we get:

  $ cat useLR.c
  
  void foo() {
    asm(""
        : 
        : "l"(1));
  }
  
  $ clang -O2 -S useLR.c
  clang: /data/stefanp/Wyvern/main/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:8657: void llvm::SelectionDAGBuilder::visitInlineAsm(const llvm::CallBase &): Assertion `(OpInfo.ConstraintType == TargetLowering::C_RegisterClass || OpInfo.ConstraintType == TargetLowering::C_Register) && "Unknown constraint type!"' failed.
  PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.

We will add this test when we add more support for special regsiters on PowerPC.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101657/new/

https://reviews.llvm.org/D101657



More information about the llvm-commits mailing list