Lower C_Memory operands.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26346 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2006-02-24 01:11:24 +00:00
parent 2b7401e28e
commit 87bc3bd121

View File

@ -1549,7 +1549,9 @@ void SelectionDAGLowering::visitInlineAsm(CallInst &I) {
// Use the produced MatchedRegs object to // Use the produced MatchedRegs object to
MatchedRegs.getCopyToRegs(InOperandVal, DAG, Chain, Flag); MatchedRegs.getCopyToRegs(InOperandVal, DAG, Chain, Flag);
MatchedRegs.AddInlineAsmOperands(1 /*REGUSE*/, DAG, AsmNodeOperands); MatchedRegs.AddInlineAsmOperands(1 /*REGUSE*/, DAG, AsmNodeOperands);
} else { break;
}
TargetLowering::ConstraintType CTy = TargetLowering::C_RegisterClass; TargetLowering::ConstraintType CTy = TargetLowering::C_RegisterClass;
if (ConstraintCode.size() == 1) // not a physreg name. if (ConstraintCode.size() == 1) // not a physreg name.
CTy = TLI.getConstraintType(ConstraintCode[0]); CTy = TLI.getConstraintType(ConstraintCode[0]);
@ -1559,7 +1561,26 @@ void SelectionDAGLowering::visitInlineAsm(CallInst &I) {
assert(0 && "MATCH FAIL!"); assert(0 && "MATCH FAIL!");
// Add information to the INLINEASM node to know about this input. // Add information to the INLINEASM node to know about this input.
unsigned ResOpType = 3 /*imm*/ | (1 << 3); unsigned ResOpType = 3 /*IMM*/ | (1 << 3);
AsmNodeOperands.push_back(DAG.getConstant(ResOpType, MVT::i32));
AsmNodeOperands.push_back(InOperandVal);
break;
} else if (CTy == TargetLowering::C_Memory) {
// Memory input.
// Check that the operand isn't a float.
if (!MVT::isInteger(InOperandVal.getValueType()))
assert(0 && "MATCH FAIL!");
// Extend/truncate to the right pointer type if needed.
MVT::ValueType PtrType = TLI.getPointerTy();
if (InOperandVal.getValueType() < PtrType)
InOperandVal = DAG.getNode(ISD::ZERO_EXTEND, PtrType, InOperandVal);
else if (InOperandVal.getValueType() > PtrType)
InOperandVal = DAG.getNode(ISD::TRUNCATE, PtrType, InOperandVal);
// Add information to the INLINEASM node to know about this input.
unsigned ResOpType = 4/*MEM*/ | (1 << 3);
AsmNodeOperands.push_back(DAG.getConstant(ResOpType, MVT::i32)); AsmNodeOperands.push_back(DAG.getConstant(ResOpType, MVT::i32));
AsmNodeOperands.push_back(InOperandVal); AsmNodeOperands.push_back(InOperandVal);
break; break;
@ -1579,8 +1600,6 @@ void SelectionDAGLowering::visitInlineAsm(CallInst &I) {
InRegs.AddInlineAsmOperands(1/*REGUSE*/, DAG, AsmNodeOperands); InRegs.AddInlineAsmOperands(1/*REGUSE*/, DAG, AsmNodeOperands);
break; break;
} }
break;
}
case InlineAsm::isClobber: { case InlineAsm::isClobber: {
RegsForValue ClobberedRegs = RegsForValue ClobberedRegs =
GetRegistersForValue(ConstraintCode, MVT::Other, false, false, GetRegistersForValue(ConstraintCode, MVT::Other, false, false,