aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/SelectionDAG/TargetLowering.cpp
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2009-07-07 23:26:33 +0000
committerDale Johannesen <dalej@apple.com>2009-07-07 23:26:33 +0000
commit8ea5ec681bd4838c84e545f8a1226a62d3b2f089 (patch)
tree47fe38ea6dd09331a132f28359896dcd67a0626b /lib/CodeGen/SelectionDAG/TargetLowering.cpp
parentc2c27b3627cf7a8724f2e1ec6a93b1dceea09c25 (diff)
downloadexternal_llvm-8ea5ec681bd4838c84e545f8a1226a62d3b2f089.tar.gz
external_llvm-8ea5ec681bd4838c84e545f8a1226a62d3b2f089.tar.bz2
external_llvm-8ea5ec681bd4838c84e545f8a1226a62d3b2f089.zip
Operand of asm("call") (the callee function) is represented
as "X" constraint and "P" modifier on x86. Make this work. (Change may not be sufficient to fix it for non-Darwin, but I'm pretty sure it won't break anything.) gcc.apple/asm-block-32.c gcc.apple/asm-block-33.c git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74967 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/TargetLowering.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/TargetLowering.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index 83357e0660..b9b518afc0 100644
--- a/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -2405,11 +2405,24 @@ void TargetLowering::ComputeConstraintToUse(AsmOperandInfo &OpInfo,
// 'X' matches anything.
if (OpInfo.ConstraintCode == "X" && OpInfo.CallOperandVal) {
+ // Look through bitcasts over functions. In the context of an asm
+ // argument we don't care about bitcasting function types; the parameters
+ // to the function, if any, will have been handled elsewhere.
+ Value *v = OpInfo.CallOperandVal;
+ ConstantExpr *CE = NULL;
+ while ((CE = dyn_cast<ConstantExpr>(v)) &&
+ CE->getOpcode()==Instruction::BitCast)
+ v = CE->getOperand(0);
+ if (!isa<Function>(v))
+ v = OpInfo.CallOperandVal;
// Labels and constants are handled elsewhere ('X' is the only thing
- // that matches labels).
- if (isa<BasicBlock>(OpInfo.CallOperandVal) ||
- isa<ConstantInt>(OpInfo.CallOperandVal))
+ // that matches labels). For Functions, the type here is the type of
+ // the result, which is not what we want to look at; leave them alone
+ // (minus any bitcasts).
+ if (isa<BasicBlock>(v) || isa<ConstantInt>(v) || isa<Function>(v)) {
+ OpInfo.CallOperandVal = v;
return;
+ }
// Otherwise, try to resolve it to something we know about by looking at
// the actual operand type.