mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-23 14:25:07 +00:00
Fix a bug legalizing call instructions (make sure to remember all result
values), and eliminate some switch statements. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19417 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -332,9 +332,15 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
|
|||||||
RetTyVTs.reserve(Node->getNumValues());
|
RetTyVTs.reserve(Node->getNumValues());
|
||||||
for (unsigned i = 0, e = Node->getNumValues(); i != e; ++i)
|
for (unsigned i = 0, e = Node->getNumValues(); i != e; ++i)
|
||||||
RetTyVTs.push_back(Node->getValueType(i));
|
RetTyVTs.push_back(Node->getValueType(i));
|
||||||
Result = SDOperand(DAG.getCall(RetTyVTs, Tmp1, Tmp2), Op.ResNo);
|
Result = SDOperand(DAG.getCall(RetTyVTs, Tmp1, Tmp2), 0);
|
||||||
|
} else {
|
||||||
|
Result = Result.getValue(0);
|
||||||
}
|
}
|
||||||
break;
|
// Since calls produce multiple values, make sure to remember that we
|
||||||
|
// legalized all of them.
|
||||||
|
for (unsigned i = 0, e = Node->getNumValues(); i != e; ++i)
|
||||||
|
AddLegalizedOperand(SDOperand(Node, i), Result.getValue(i));
|
||||||
|
return Result.getValue(Op.ResNo);
|
||||||
|
|
||||||
case ISD::BR:
|
case ISD::BR:
|
||||||
Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain.
|
Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain.
|
||||||
@@ -499,13 +505,7 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
|
|||||||
// FIXME: These two stores are independent of each other!
|
// FIXME: These two stores are independent of each other!
|
||||||
Result = DAG.getNode(ISD::STORE, MVT::Other, Tmp1, Lo, Tmp2);
|
Result = DAG.getNode(ISD::STORE, MVT::Other, Tmp1, Lo, Tmp2);
|
||||||
|
|
||||||
unsigned IncrementSize;
|
unsigned IncrementSize = MVT::getSizeInBits(Lo.getValueType())/8;
|
||||||
switch (Lo.getValueType()) {
|
|
||||||
default: assert(0 && "Unknown ValueType to expand to!");
|
|
||||||
case MVT::i32: IncrementSize = 4; break;
|
|
||||||
case MVT::i16: IncrementSize = 2; break;
|
|
||||||
case MVT::i8: IncrementSize = 1; break;
|
|
||||||
}
|
|
||||||
Tmp2 = DAG.getNode(ISD::ADD, Tmp2.getValueType(), Tmp2,
|
Tmp2 = DAG.getNode(ISD::ADD, Tmp2.getValueType(), Tmp2,
|
||||||
getIntPtrConstant(IncrementSize));
|
getIntPtrConstant(IncrementSize));
|
||||||
assert(isTypeLegal(Tmp2.getValueType()) &&
|
assert(isTypeLegal(Tmp2.getValueType()) &&
|
||||||
@@ -701,13 +701,7 @@ void SelectionDAGLegalize::ExpandOp(SDOperand Op, SDOperand &Lo, SDOperand &Hi){
|
|||||||
Lo = DAG.getLoad(NVT, Ch, Ptr);
|
Lo = DAG.getLoad(NVT, Ch, Ptr);
|
||||||
|
|
||||||
// Increment the pointer to the other half.
|
// Increment the pointer to the other half.
|
||||||
unsigned IncrementSize;
|
unsigned IncrementSize = MVT::getSizeInBits(Lo.getValueType())/8;
|
||||||
switch (Lo.getValueType()) {
|
|
||||||
default: assert(0 && "Unknown ValueType to expand to!");
|
|
||||||
case MVT::i32: IncrementSize = 4; break;
|
|
||||||
case MVT::i16: IncrementSize = 2; break;
|
|
||||||
case MVT::i8: IncrementSize = 1; break;
|
|
||||||
}
|
|
||||||
Ptr = DAG.getNode(ISD::ADD, Ptr.getValueType(), Ptr,
|
Ptr = DAG.getNode(ISD::ADD, Ptr.getValueType(), Ptr,
|
||||||
getIntPtrConstant(IncrementSize));
|
getIntPtrConstant(IncrementSize));
|
||||||
// FIXME: This load is independent of the first one.
|
// FIXME: This load is independent of the first one.
|
||||||
|
Reference in New Issue
Block a user