diff options
| author | Dale Johannesen <dalej@apple.com> | 2009-07-20 23:27:39 +0000 |
|---|---|---|
| committer | Dale Johannesen <dalej@apple.com> | 2009-07-20 23:27:39 +0000 |
| commit | ade297d496e8daebf1dfea9c04a84977e75579e3 (patch) | |
| tree | 6b046d8e5dd83ab0178aa391b109ea1b7af8816d /llvm/lib/CodeGen/SelectionDAG | |
| parent | 0d76d075e4a68fba52482be6a6c18ffc1abc7acb (diff) | |
| download | bcm5719-llvm-ade297d496e8daebf1dfea9c04a84977e75579e3.tar.gz bcm5719-llvm-ade297d496e8daebf1dfea9c04a84977e75579e3.zip | |
Move stripping of bitcasts in inline asm arguments
to a place where it affects everything. Occurs
only on calls AFAIK.
llvm-svn: 76502
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp | 5 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | 14 |
2 files changed, 7 insertions, 12 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp index 05622f2d6c7..3fa6047ad54 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp @@ -5059,6 +5059,11 @@ void SelectionDAGLowering::visitInlineAsm(CallSite CS) { // If this is an input or an indirect output, process the call argument. // BasicBlocks are labels, currently appearing only in asm's. if (OpInfo.CallOperandVal) { + // Strip bitcasts, if any. This mostly comes up for functions. + ConstantExpr* CE = NULL; + while ((CE = dyn_cast<ConstantExpr>(OpInfo.CallOperandVal)) && + CE->getOpcode()==Instruction::BitCast) + OpInfo.CallOperandVal = CE->getOperand(0); if (BasicBlock *BB = dyn_cast<BasicBlock>(OpInfo.CallOperandVal)) { OpInfo.CallOperand = DAG.getBasicBlock(FuncInfo.MBBMap[BB]); } else { diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp index dc25041da60..1ee181fb69d 100644 --- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -2406,20 +2406,10 @@ 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). 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). + // the result, which is not what we want to look at; leave them alone. + Value *v = OpInfo.CallOperandVal; if (isa<BasicBlock>(v) || isa<ConstantInt>(v) || isa<Function>(v)) { OpInfo.CallOperandVal = v; return; |

