diff options
| author | Chris Lattner <sabre@nondot.org> | 2007-08-25 00:47:38 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2007-08-25 00:47:38 +0000 |
| commit | d8c9cb918273165cfd6e25ecff0f9a94b9e0a591 (patch) | |
| tree | d7afdcdafe7e0740578c108892171ae025fad423 /llvm/lib/CodeGen/SelectionDAG | |
| parent | 45e608ad752874f0bc74ad32715977142f2947f6 (diff) | |
| download | bcm5719-llvm-d8c9cb918273165cfd6e25ecff0f9a94b9e0a591.tar.gz bcm5719-llvm-d8c9cb918273165cfd6e25ecff0f9a94b9e0a591.zip | |
rename isOperandValidForConstraint to LowerAsmOperandForConstraint,
changing the interface to allow for future changes.
llvm-svn: 41384
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 12 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | 24 |
2 files changed, 19 insertions, 17 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 1dde705bf59..7439e617d3e 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -3623,20 +3623,20 @@ void SelectionDAGLowering::visitInlineAsm(CallInst &I) { assert(!OpInfo.isIndirect && "Don't know how to handle indirect other inputs yet!"); - InOperandVal = TLI.isOperandValidForConstraint(InOperandVal, - OpInfo.ConstraintCode[0], - DAG); - if (!InOperandVal.Val) { + std::vector<SDOperand> Ops; + TLI.LowerAsmOperandForConstraint(InOperandVal, OpInfo.ConstraintCode[0], + Ops, DAG); + if (Ops.empty()) { cerr << "Invalid operand for inline asm constraint '" << OpInfo.ConstraintCode << "'!\n"; exit(1); } // Add information to the INLINEASM node to know about this input. - unsigned ResOpType = 3 /*IMM*/ | (1 << 3); + unsigned ResOpType = 3 /*IMM*/ | (Ops.size() << 3); AsmNodeOperands.push_back(DAG.getTargetConstant(ResOpType, TLI.getPointerTy())); - AsmNodeOperands.push_back(InOperandVal); + AsmNodeOperands.insert(AsmNodeOperands.end(), Ops.begin(), Ops.end()); break; } else if (OpInfo.ConstraintType == TargetLowering::C_Memory) { assert(OpInfo.isIndirect && "Operand must be indirect to be a mem!"); diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp index 2e91359b430..9597696d2dc 100644 --- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -1354,12 +1354,12 @@ TargetLowering::getConstraintType(const std::string &Constraint) const { return C_Unknown; } -/// isOperandValidForConstraint - Return the specified operand (possibly -/// modified) if the specified SDOperand is valid for the specified target -/// constraint letter, otherwise return null. -SDOperand TargetLowering::isOperandValidForConstraint(SDOperand Op, - char ConstraintLetter, - SelectionDAG &DAG) { +/// LowerAsmOperandForConstraint - Lower the specified operand into the Ops +/// vector. If it is invalid, don't add anything to Ops. +void TargetLowering::LowerAsmOperandForConstraint(SDOperand Op, + char ConstraintLetter, + std::vector<SDOperand> &Ops, + SelectionDAG &DAG) { switch (ConstraintLetter) { default: break; case 'i': // Simple Integer or Relocatable Constant @@ -1390,19 +1390,21 @@ SDOperand TargetLowering::isOperandValidForConstraint(SDOperand Op, if (ConstraintLetter != 'n') { int64_t Offs = GA->getOffset(); if (C) Offs += C->getValue(); - return DAG.getTargetGlobalAddress(GA->getGlobal(), Op.getValueType(), - Offs); + Ops.push_back(DAG.getTargetGlobalAddress(GA->getGlobal(), + Op.getValueType(), Offs)); + return; } } if (C) { // just C, no GV. // Simple constants are not allowed for 's'. - if (ConstraintLetter != 's') - return DAG.getTargetConstant(C->getValue(), Op.getValueType()); + if (ConstraintLetter != 's') { + Ops.push_back(DAG.getTargetConstant(C->getValue(), Op.getValueType())); + return; + } } break; } } - return SDOperand(0,0); } std::vector<unsigned> TargetLowering:: |

