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

Fixed uninitialized stuff inside LegalizeDAG. Fortunately, the only

affected part is codegen of "memove" inside x86 backend. This fixes
PR1144

llvm-svn: 33752
This commit is contained in:
Anton Korobeynikov 2007-02-01 08:39:52 +00:00
parent fe31060a23
commit c469cbc2e7
3 changed files with 11 additions and 4 deletions

View File

@ -732,6 +732,8 @@ public:
bool isSigned; bool isSigned;
bool isInReg; bool isInReg;
bool isSRet; bool isSRet;
ArgListEntry():isSigned(false), isInReg(false), isSRet(false) { };
}; };
typedef std::vector<ArgListEntry> ArgListTy; typedef std::vector<ArgListEntry> ArgListTy;
virtual std::pair<SDOperand, SDOperand> virtual std::pair<SDOperand, SDOperand>

View File

@ -2178,7 +2178,7 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
const char *FnName = 0; const char *FnName = 0;
if (Node->getOpcode() == ISD::MEMSET) { if (Node->getOpcode() == ISD::MEMSET) {
Entry.Node = Tmp2; Entry.isSigned = false; Entry.Ty = IntPtrTy; Entry.Node = Tmp2; Entry.isSigned = false; Entry.Ty = IntPtrTy;
Entry.isInReg = false; Entry.isInReg = false; Entry.isSRet = false;
Args.push_back(Entry); Args.push_back(Entry);
// Extend the (previously legalized) ubyte argument to be an int value // Extend the (previously legalized) ubyte argument to be an int value
// for the call. // for the call.
@ -2187,7 +2187,7 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
else else
Tmp3 = DAG.getNode(ISD::ZERO_EXTEND, MVT::i32, Tmp3); Tmp3 = DAG.getNode(ISD::ZERO_EXTEND, MVT::i32, Tmp3);
Entry.Node = Tmp3; Entry.Ty = Type::Int32Ty; Entry.isSigned = true; Entry.Node = Tmp3; Entry.Ty = Type::Int32Ty; Entry.isSigned = true;
Entry.isInReg = false; Entry.isInReg = false; Entry.isSRet = false;
Args.push_back(Entry); Args.push_back(Entry);
Entry.Node = Tmp4; Entry.Ty = IntPtrTy; Entry.isSigned = false; Entry.Node = Tmp4; Entry.Ty = IntPtrTy; Entry.isSigned = false;
Args.push_back(Entry); Args.push_back(Entry);
@ -2195,7 +2195,8 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
FnName = "memset"; FnName = "memset";
} else if (Node->getOpcode() == ISD::MEMCPY || } else if (Node->getOpcode() == ISD::MEMCPY ||
Node->getOpcode() == ISD::MEMMOVE) { Node->getOpcode() == ISD::MEMMOVE) {
Entry.Ty = IntPtrTy; Entry.isSigned = false; Entry.isInReg = false; Entry.Ty = IntPtrTy;
Entry.isSigned = false; Entry.isInReg = false; Entry.isSRet = false;
Entry.Node = Tmp2; Args.push_back(Entry); Entry.Node = Tmp2; Args.push_back(Entry);
Entry.Node = Tmp3; Args.push_back(Entry); Entry.Node = Tmp3; Args.push_back(Entry);
Entry.Node = Tmp4; Args.push_back(Entry); Entry.Node = Tmp4; Args.push_back(Entry);
@ -4122,7 +4123,7 @@ SDOperand SelectionDAGLegalize::ExpandLibCall(const char *Name, SDNode *Node,
MVT::ValueType ArgVT = Node->getOperand(i).getValueType(); MVT::ValueType ArgVT = Node->getOperand(i).getValueType();
const Type *ArgTy = MVT::getTypeForValueType(ArgVT); const Type *ArgTy = MVT::getTypeForValueType(ArgVT);
Entry.Node = Node->getOperand(i); Entry.Ty = ArgTy; Entry.Node = Node->getOperand(i); Entry.Ty = ArgTy;
Entry.isSigned = isSigned; Entry.isInReg = false; Entry.isSigned = isSigned; Entry.isInReg = false; Entry.isSRet = false;
Args.push_back(Entry); Args.push_back(Entry);
} }
SDOperand Callee = DAG.getExternalSymbol(Name, TLI.getPointerTy()); SDOperand Callee = DAG.getExternalSymbol(Name, TLI.getPointerTy());

View File

@ -777,6 +777,10 @@ SDOperand X86TargetLowering::LowerCCCCallTo(SDOperand Op, SelectionDAG &DAG,
} }
} }
// Sanity check: we haven't seen NumSRetBytes > 4
assert((NumSRetBytes<=4) &&
"Too much space for struct-return pointer requested");
if (!MemOpChains.empty()) if (!MemOpChains.empty())
Chain = DAG.getNode(ISD::TokenFactor, MVT::Other, Chain = DAG.getNode(ISD::TokenFactor, MVT::Other,
&MemOpChains[0], MemOpChains.size()); &MemOpChains[0], MemOpChains.size());