X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FCodeGen%2FSelectionDAG%2FCallingConvLower.cpp;h=c0077793d0e3cf844ac1741d3eb0af0b0980b7d5;hb=b3bc6352defdf1a5c6b1b0770d0c4d603f6524a8;hp=4788b15d95947a09c3a7f8303180d140107dd200;hpb=c89d2feb35560883688e43b553b8e94e7cd371de;p=oota-llvm.git diff --git a/lib/CodeGen/SelectionDAG/CallingConvLower.cpp b/lib/CodeGen/SelectionDAG/CallingConvLower.cpp index 4788b15d959..c0077793d0e 100644 --- a/lib/CodeGen/SelectionDAG/CallingConvLower.cpp +++ b/lib/CodeGen/SelectionDAG/CallingConvLower.cpp @@ -91,12 +91,11 @@ void CCState::AnalyzeReturn(SDNode *TheRet, CCAssignFn Fn) { /// AnalyzeCallOperands - Analyze an ISD::CALL node, incorporating info /// about the passed values into this state. -void CCState::AnalyzeCallOperands(SDNode *TheCall, CCAssignFn Fn) { - unsigned NumOps = (TheCall->getNumOperands() - 5) / 2; +void CCState::AnalyzeCallOperands(CallSDNode *TheCall, CCAssignFn Fn) { + unsigned NumOps = TheCall->getNumArgs(); for (unsigned i = 0; i != NumOps; ++i) { - MVT ArgVT = TheCall->getOperand(5+2*i).getValueType(); - ISD::ArgFlagsTy ArgFlags = - cast(TheCall->getOperand(5+2*i+1))->getArgFlags(); + MVT ArgVT = TheCall->getArg(i).getValueType(); + ISD::ArgFlagsTy ArgFlags = TheCall->getArgFlags(i); if (Fn(i, ArgVT, ArgVT, CCValAssign::Full, ArgFlags, *this)) { cerr << "Call operand #" << i << " has unhandled type " << ArgVT.getMVTString() << "\n"; @@ -107,7 +106,7 @@ void CCState::AnalyzeCallOperands(SDNode *TheCall, CCAssignFn Fn) { /// AnalyzeCallOperands - Same as above except it takes vectors of types /// and argument flags. -void CCState::AnalyzeCallOperands(SmallVectorImpl ArgVTs, +void CCState::AnalyzeCallOperands(SmallVectorImpl &ArgVTs, SmallVectorImpl &Flags, CCAssignFn Fn) { unsigned NumOps = ArgVTs.size(); @@ -124,13 +123,26 @@ void CCState::AnalyzeCallOperands(SmallVectorImpl ArgVTs, /// AnalyzeCallResult - Analyze the return values of an ISD::CALL node, /// incorporating info about the passed values into this state. -void CCState::AnalyzeCallResult(SDNode *TheCall, CCAssignFn Fn) { - for (unsigned i = 0, e = TheCall->getNumValues() - 1; i != e; ++i) { - MVT VT = TheCall->getValueType(i); - if (Fn(i, VT, VT, CCValAssign::Full, ISD::ArgFlagsTy(), *this)) { +void CCState::AnalyzeCallResult(CallSDNode *TheCall, CCAssignFn Fn) { + for (unsigned i = 0, e = TheCall->getNumRetVals(); i != e; ++i) { + MVT VT = TheCall->getRetValType(i); + ISD::ArgFlagsTy Flags = ISD::ArgFlagsTy(); + if (TheCall->isInreg()) + Flags.setInReg(); + if (Fn(i, VT, VT, CCValAssign::Full, Flags, *this)) { cerr << "Call result #" << i << " has unhandled type " << VT.getMVTString() << "\n"; abort(); } } } + +/// AnalyzeCallResult - Same as above except it's specialized for calls which +/// produce a single value. +void CCState::AnalyzeCallResult(MVT VT, CCAssignFn Fn) { + if (Fn(0, VT, VT, CCValAssign::Full, ISD::ArgFlagsTy(), *this)) { + cerr << "Call result has unhandled type " + << VT.getMVTString() << "\n"; + abort(); + } +}