1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00

minor changes.

llvm-svn: 29740
This commit is contained in:
Chris Lattner 2006-08-16 22:57:46 +00:00
parent c0e2997872
commit 62b0dcb385
2 changed files with 24 additions and 22 deletions

View File

@ -1459,26 +1459,21 @@ SDOperand SelectionDAG::getVecLoad(unsigned Count, MVT::ValueType EVT,
SDOperand SV) { SDOperand SV) {
SDOperand Ops[] = { Chain, Ptr, SV, getConstant(Count, MVT::i32), SDOperand Ops[] = { Chain, Ptr, SV, getConstant(Count, MVT::i32),
getValueType(EVT) }; getValueType(EVT) };
// Add token chain. return getNode(ISD::VLOAD, getVTList(MVT::Vector, MVT::Other), Ops, 5);
const MVT::ValueType *VTs = getNodeValueTypes(MVT::Vector, MVT::Other);
return getNode(ISD::VLOAD, VTs, 2, Ops, 5);
} }
SDOperand SelectionDAG::getExtLoad(unsigned Opcode, MVT::ValueType VT, SDOperand SelectionDAG::getExtLoad(unsigned Opcode, MVT::ValueType VT,
SDOperand Chain, SDOperand Ptr, SDOperand SV, SDOperand Chain, SDOperand Ptr, SDOperand SV,
MVT::ValueType EVT) { MVT::ValueType EVT) {
SDOperand Ops[] = { Chain, Ptr, SV, getValueType(EVT) }; SDOperand Ops[] = { Chain, Ptr, SV, getValueType(EVT) };
const MVT::ValueType *VTs = getNodeValueTypes(VT, MVT::Other); return getNode(Opcode, getVTList(VT, MVT::Other), Ops, 4);
return getNode(Opcode, VTs, 2, Ops, 4);
} }
SDOperand SelectionDAG::getVAArg(MVT::ValueType VT, SDOperand SelectionDAG::getVAArg(MVT::ValueType VT,
SDOperand Chain, SDOperand Ptr, SDOperand Chain, SDOperand Ptr,
SDOperand SV) { SDOperand SV) {
SDOperand Ops[] = { Chain, Ptr, SV }; SDOperand Ops[] = { Chain, Ptr, SV };
// Add token chain. return getNode(ISD::VAARG, getVTList(VT, MVT::Other), Ops, 3);
const MVT::ValueType *VTs = getNodeValueTypes(VT, MVT::Other);
return getNode(ISD::VAARG, VTs, 2, Ops, 3);
} }
SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT, SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT,
@ -1562,27 +1557,34 @@ SDOperand SelectionDAG::getNode(unsigned Opcode,
const SDOperand *Ops, unsigned NumOps) { const SDOperand *Ops, unsigned NumOps) {
if (NumVTs == 1) if (NumVTs == 1)
return getNode(Opcode, VTs[0], Ops, NumOps); return getNode(Opcode, VTs[0], Ops, NumOps);
return getNode(Opcode, makeVTList(VTs, NumVTs), Ops, NumOps);
}
SDOperand SelectionDAG::getNode(unsigned Opcode, SDVTList VTList,
const SDOperand *Ops, unsigned NumOps) {
if (VTList.NumVTs == 1)
return getNode(Opcode, VTList.VTs[0], Ops, NumOps);
switch (Opcode) { switch (Opcode) {
case ISD::EXTLOAD: case ISD::EXTLOAD:
case ISD::SEXTLOAD: case ISD::SEXTLOAD:
case ISD::ZEXTLOAD: { case ISD::ZEXTLOAD: {
MVT::ValueType EVT = cast<VTSDNode>(Ops[3])->getVT(); MVT::ValueType EVT = cast<VTSDNode>(Ops[3])->getVT();
assert(NumOps == 4 && NumVTs == 2 && "Bad *EXTLOAD!"); assert(NumOps == 4 && VTList.NumVTs == 2 && "Bad *EXTLOAD!");
// If they are asking for an extending load from/to the same thing, return a // If they are asking for an extending load from/to the same thing, return a
// normal load. // normal load.
if (VTs[0] == EVT) if (VTList.VTs[0] == EVT)
return getLoad(VTs[0], Ops[0], Ops[1], Ops[2]); return getLoad(VTList.VTs[0], Ops[0], Ops[1], Ops[2]);
if (MVT::isVector(VTs[0])) { if (MVT::isVector(VTList.VTs[0])) {
assert(EVT == MVT::getVectorBaseType(VTs[0]) && assert(EVT == MVT::getVectorBaseType(VTList.VTs[0]) &&
"Invalid vector extload!"); "Invalid vector extload!");
} else { } else {
assert(EVT < VTs[0] && assert(EVT < VTList.VTs[0] &&
"Should only be an extending load, not truncating!"); "Should only be an extending load, not truncating!");
} }
assert((Opcode == ISD::EXTLOAD || MVT::isInteger(VTs[0])) && assert((Opcode == ISD::EXTLOAD || MVT::isInteger(VTList.VTs[0])) &&
"Cannot sign/zero extend a FP/Vector load!"); "Cannot sign/zero extend a FP/Vector load!");
assert(MVT::isInteger(VTs[0]) == MVT::isInteger(EVT) && assert(MVT::isInteger(VTList.VTs[0]) == MVT::isInteger(EVT) &&
"Cannot convert from FP to Int or Int -> FP!"); "Cannot convert from FP to Int or Int -> FP!");
break; break;
} }
@ -1611,8 +1613,7 @@ SDOperand SelectionDAG::getNode(unsigned Opcode,
// Memoize the node unless it returns a flag. // Memoize the node unless it returns a flag.
SDNode *N; SDNode *N;
SDVTList VTList = makeVTList(VTs, NumVTs); if (VTList.VTs[VTList.NumVTs-1] != MVT::Flag) {
if (VTs[NumVTs-1] != MVT::Flag) {
SelectionDAGCSEMap::NodeID ID; SelectionDAGCSEMap::NodeID ID;
ID.SetOpcode(Opcode); ID.SetOpcode(Opcode);
ID.SetValueTypes(VTList); ID.SetValueTypes(VTList);

View File

@ -2515,7 +2515,7 @@ TargetLowering::LowerCallTo(SDOperand Chain, const Type *RetTy, bool isVarArg,
unsigned CallingConv, bool isTailCall, unsigned CallingConv, bool isTailCall,
SDOperand Callee, SDOperand Callee,
ArgListTy &Args, SelectionDAG &DAG) { ArgListTy &Args, SelectionDAG &DAG) {
std::vector<SDOperand> Ops; SmallVector<SDOperand, 32> Ops;
Ops.push_back(Chain); // Op#0 - Chain Ops.push_back(Chain); // Op#0 - Chain
Ops.push_back(DAG.getConstant(CallingConv, getPointerTy())); // Op#1 - CC Ops.push_back(DAG.getConstant(CallingConv, getPointerTy())); // Op#1 - CC
Ops.push_back(DAG.getConstant(isVarArg, getPointerTy())); // Op#2 - VarArg Ops.push_back(DAG.getConstant(isVarArg, getPointerTy())); // Op#2 - VarArg
@ -2592,7 +2592,7 @@ TargetLowering::LowerCallTo(SDOperand Chain, const Type *RetTy, bool isVarArg,
} }
// Figure out the result value types. // Figure out the result value types.
std::vector<MVT::ValueType> RetTys; SmallVector<MVT::ValueType, 4> RetTys;
if (RetTy != Type::VoidTy) { if (RetTy != Type::VoidTy) {
MVT::ValueType VT = getValueType(RetTy); MVT::ValueType VT = getValueType(RetTy);
@ -2636,8 +2636,9 @@ TargetLowering::LowerCallTo(SDOperand Chain, const Type *RetTy, bool isVarArg,
RetTys.push_back(MVT::Other); // Always has a chain. RetTys.push_back(MVT::Other); // Always has a chain.
// Finally, create the CALL node. // Finally, create the CALL node.
SDOperand Res = DAG.getNode(ISD::CALL, DAG.getNodeValueTypes(RetTys), SDOperand Res = DAG.getNode(ISD::CALL,
RetTys.size(), &Ops[0], Ops.size()); DAG.getVTList(&RetTys[0], RetTys.size()),
&Ops[0], Ops.size());
// This returns a pair of operands. The first element is the // This returns a pair of operands. The first element is the
// return value for the function (if RetTy is not VoidTy). The second // return value for the function (if RetTy is not VoidTy). The second