diff options
author | Nick Desaulniers <ndesaulniers@google.com> | 2019-07-10 17:08:25 +0000 |
---|---|---|
committer | Nick Desaulniers <ndesaulniers@google.com> | 2019-07-10 17:08:25 +0000 |
commit | 8728e457065365f8f6fbbf86a665885d9dde082a (patch) | |
tree | 7a8e125118bb8535c2ab58604902c897fd9128a5 /llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | |
parent | 20b45a61156af8d9b86b1c3711aaede650f0d5c6 (diff) | |
download | bcm5719-llvm-8728e457065365f8f6fbbf86a665885d9dde082a.tar.gz bcm5719-llvm-8728e457065365f8f6fbbf86a665885d9dde082a.zip |
[TargetLowering] support BlockAddress as "i" inline asm constraint
Summary:
This allows passing address of labels to inline assembly "i" input
constraints.
Fixes pr/42502.
Reviewers: ostannard
Reviewed By: ostannard
Subscribers: void, echristo, nathanchance, ostannard, javed.absar, hiraditya, llvm-commits, srhines
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D64167
llvm-svn: 365664
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp index bbde8e97df3..e00fe94f9c9 100644 --- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -3632,6 +3632,7 @@ void TargetLowering::LowerAsmOperandForConstraint(SDValue Op, GlobalAddressSDNode *GA; ConstantSDNode *C; + BlockAddressSDNode *BA; uint64_t Offset = 0; // Match (GA) or (C) or (GA+C) or (GA-C) or ((GA+C)+C) or (((GA+C)+C)+C), @@ -3659,6 +3660,12 @@ void TargetLowering::LowerAsmOperandForConstraint(SDValue Op, Ops.push_back(DAG.getTargetConstant(Offset + ExtVal, SDLoc(C), MVT::i64)); return; + } else if ((BA = dyn_cast<BlockAddressSDNode>(Op)) && + ConstraintLetter != 'n') { + Ops.push_back(DAG.getTargetBlockAddress( + BA->getBlockAddress(), BA->getValueType(0), + Offset + BA->getOffset(), BA->getTargetFlags())); + return; } else { const unsigned OpCode = Op.getOpcode(); if (OpCode == ISD::ADD || OpCode == ISD::SUB) { |