[llvm-commits] [llvm] r74967 - /llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
Dale Johannesen
dalej at apple.com
Tue Jul 7 16:26:37 PDT 2009
Author: johannes
Date: Tue Jul 7 18:26:33 2009
New Revision: 74967
URL: http://llvm.org/viewvc/llvm-project?rev=74967&view=rev
Log:
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
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp?rev=74967&r1=74966&r2=74967&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp Tue Jul 7 18:26:33 2009
@@ -2405,11 +2405,24 @@
// '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.
More information about the llvm-commits
mailing list