mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 20:29:48 +00:00
Tweak the handling of MERGE_VALUES nodes: remove the need for
DecomposeMERGE_VALUES to "know" that results are legalized in a particular order, by passing it the number of the result being legalized (the type legalization core provides this, it just needs to be passed on). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140373 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c56d65f63c
commit
4c19e12d28
@ -55,7 +55,7 @@ void DAGTypeLegalizer::SoftenFloatResult(SDNode *N, unsigned ResNo) {
|
||||
#endif
|
||||
llvm_unreachable("Do not know how to soften the result of this operator!");
|
||||
|
||||
case ISD::MERGE_VALUES:R = SoftenFloatRes_MERGE_VALUES(N); break;
|
||||
case ISD::MERGE_VALUES:R = SoftenFloatRes_MERGE_VALUES(N, ResNo); break;
|
||||
case ISD::BITCAST: R = SoftenFloatRes_BITCAST(N); break;
|
||||
case ISD::BUILD_PAIR: R = SoftenFloatRes_BUILD_PAIR(N); break;
|
||||
case ISD::ConstantFP:
|
||||
@ -108,8 +108,9 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_BITCAST(SDNode *N) {
|
||||
return BitConvertToInteger(N->getOperand(0));
|
||||
}
|
||||
|
||||
SDValue DAGTypeLegalizer::SoftenFloatRes_MERGE_VALUES(SDNode *N) {
|
||||
SDValue Op = DecomposeMERGE_VALUES(N);
|
||||
SDValue DAGTypeLegalizer::SoftenFloatRes_MERGE_VALUES(SDNode *N,
|
||||
unsigned ResNo) {
|
||||
SDValue Op = DisintegrateMERGE_VALUES(N, ResNo);
|
||||
return BitConvertToInteger(Op);
|
||||
}
|
||||
|
||||
@ -837,7 +838,7 @@ void DAGTypeLegalizer::ExpandFloatResult(SDNode *N, unsigned ResNo) {
|
||||
case ISD::SELECT: SplitRes_SELECT(N, Lo, Hi); break;
|
||||
case ISD::SELECT_CC: SplitRes_SELECT_CC(N, Lo, Hi); break;
|
||||
|
||||
case ISD::MERGE_VALUES: ExpandRes_MERGE_VALUES(N, Lo, Hi); break;
|
||||
case ISD::MERGE_VALUES: ExpandRes_MERGE_VALUES(N, ResNo, Lo, Hi); break;
|
||||
case ISD::BITCAST: ExpandRes_BITCAST(N, Lo, Hi); break;
|
||||
case ISD::BUILD_PAIR: ExpandRes_BUILD_PAIR(N, Lo, Hi); break;
|
||||
case ISD::EXTRACT_ELEMENT: ExpandRes_EXTRACT_ELEMENT(N, Lo, Hi); break;
|
||||
|
@ -48,7 +48,7 @@ void DAGTypeLegalizer::PromoteIntegerResult(SDNode *N, unsigned ResNo) {
|
||||
N->dump(&DAG); dbgs() << "\n";
|
||||
#endif
|
||||
llvm_unreachable("Do not know how to promote this operator!");
|
||||
case ISD::MERGE_VALUES:Res = PromoteIntRes_MERGE_VALUES(N); break;
|
||||
case ISD::MERGE_VALUES:Res = PromoteIntRes_MERGE_VALUES(N, ResNo); break;
|
||||
case ISD::AssertSext: Res = PromoteIntRes_AssertSext(N); break;
|
||||
case ISD::AssertZext: Res = PromoteIntRes_AssertZext(N); break;
|
||||
case ISD::BITCAST: Res = PromoteIntRes_BITCAST(N); break;
|
||||
@ -143,8 +143,9 @@ void DAGTypeLegalizer::PromoteIntegerResult(SDNode *N, unsigned ResNo) {
|
||||
SetPromotedInteger(SDValue(N, ResNo), Res);
|
||||
}
|
||||
|
||||
SDValue DAGTypeLegalizer::PromoteIntRes_MERGE_VALUES(SDNode *N) {
|
||||
SDValue Op = DecomposeMERGE_VALUES(N);
|
||||
SDValue DAGTypeLegalizer::PromoteIntRes_MERGE_VALUES(SDNode *N,
|
||||
unsigned ResNo) {
|
||||
SDValue Op = DisintegrateMERGE_VALUES(N, ResNo);
|
||||
return GetPromotedInteger(Op);
|
||||
}
|
||||
|
||||
@ -1077,7 +1078,7 @@ void DAGTypeLegalizer::ExpandIntegerResult(SDNode *N, unsigned ResNo) {
|
||||
#endif
|
||||
llvm_unreachable("Do not know how to expand the result of this operator!");
|
||||
|
||||
case ISD::MERGE_VALUES: SplitRes_MERGE_VALUES(N, Lo, Hi); break;
|
||||
case ISD::MERGE_VALUES: SplitRes_MERGE_VALUES(N, ResNo, Lo, Hi); break;
|
||||
case ISD::SELECT: SplitRes_SELECT(N, Lo, Hi); break;
|
||||
case ISD::SELECT_CC: SplitRes_SELECT_CC(N, Lo, Hi); break;
|
||||
case ISD::UNDEF: SplitRes_UNDEF(N, Lo, Hi); break;
|
||||
@ -1600,9 +1601,9 @@ void DAGTypeLegalizer::ExpandIntRes_ADDSUBE(SDNode *N,
|
||||
ReplaceValueWith(SDValue(N, 1), Hi.getValue(1));
|
||||
}
|
||||
|
||||
void DAGTypeLegalizer::ExpandIntRes_MERGE_VALUES(SDNode *N,
|
||||
void DAGTypeLegalizer::ExpandIntRes_MERGE_VALUES(SDNode *N, unsigned ResNo,
|
||||
SDValue &Lo, SDValue &Hi) {
|
||||
SDValue Res = DecomposeMERGE_VALUES(N);
|
||||
SDValue Res = DisintegrateMERGE_VALUES(N, ResNo);
|
||||
SplitInteger(Res, Lo, Hi);
|
||||
}
|
||||
|
||||
|
@ -946,24 +946,11 @@ bool DAGTypeLegalizer::CustomWidenLowerNode(SDNode *N, EVT VT) {
|
||||
return true;
|
||||
}
|
||||
|
||||
SDValue DAGTypeLegalizer::DecomposeMERGE_VALUES(SDNode *N) {
|
||||
unsigned i;
|
||||
// A MERGE_VALUES node can produce any number of values.
|
||||
// Replace the results other than the first illegal one with the
|
||||
// corresponding input operands.
|
||||
for (i = 0; isTypeLegal(N->getValueType(i)); ++i)
|
||||
ReplaceValueWith(SDValue(N, i), SDValue(N->getOperand(i)));
|
||||
|
||||
// The first illegal result is the one which needs to be handled;
|
||||
// type legalization legalizes values in order.
|
||||
SDValue IllegalValue = N->getOperand(i);
|
||||
|
||||
// Continue replacing results.
|
||||
unsigned e = N->getNumValues();
|
||||
for (++i; i != e; ++i)
|
||||
ReplaceValueWith(SDValue(N, i), SDValue(N->getOperand(i)));
|
||||
|
||||
return IllegalValue;
|
||||
SDValue DAGTypeLegalizer::DisintegrateMERGE_VALUES(SDNode *N, unsigned ResNo) {
|
||||
for (unsigned i = 0, e = N->getNumValues(); i != e; ++i)
|
||||
if (i != ResNo)
|
||||
ReplaceValueWith(SDValue(N, i), SDValue(N->getOperand(i)));
|
||||
return SDValue(N, ResNo);
|
||||
}
|
||||
|
||||
/// GetSplitDestVTs - Compute the VTs needed for the low/hi parts of a type
|
||||
|
@ -149,10 +149,10 @@ private:
|
||||
bool CustomLowerNode(SDNode *N, EVT VT, bool LegalizeResult);
|
||||
bool CustomWidenLowerNode(SDNode *N, EVT VT);
|
||||
|
||||
// DecomposeMERGE_VALUES takes a SDNode and returns the first
|
||||
// illegal value. All other results are replaced with the
|
||||
// corresponding input operand.
|
||||
SDValue DecomposeMERGE_VALUES(SDNode *N);
|
||||
/// DisintegrateMERGE_VALUES - Replace each result of the given MERGE_VALUES
|
||||
/// node with the corresponding input operand, except for the result 'ResNo',
|
||||
/// which is returned.
|
||||
SDValue DisintegrateMERGE_VALUES(SDNode *N, unsigned ResNo);
|
||||
|
||||
SDValue GetVectorElementPointer(SDValue VecPtr, EVT EltVT, SDValue Index);
|
||||
SDValue JoinIntegers(SDValue Lo, SDValue Hi);
|
||||
@ -213,7 +213,7 @@ private:
|
||||
|
||||
// Integer Result Promotion.
|
||||
void PromoteIntegerResult(SDNode *N, unsigned ResNo);
|
||||
SDValue PromoteIntRes_MERGE_VALUES(SDNode *N);
|
||||
SDValue PromoteIntRes_MERGE_VALUES(SDNode *N, unsigned ResNo);
|
||||
SDValue PromoteIntRes_AssertSext(SDNode *N);
|
||||
SDValue PromoteIntRes_AssertZext(SDNode *N);
|
||||
SDValue PromoteIntRes_Atomic0(AtomicSDNode *N);
|
||||
@ -302,7 +302,8 @@ private:
|
||||
|
||||
// Integer Result Expansion.
|
||||
void ExpandIntegerResult(SDNode *N, unsigned ResNo);
|
||||
void ExpandIntRes_MERGE_VALUES (SDNode *N, SDValue &Lo, SDValue &Hi);
|
||||
void ExpandIntRes_MERGE_VALUES (SDNode *N, unsigned ResNo,
|
||||
SDValue &Lo, SDValue &Hi);
|
||||
void ExpandIntRes_ANY_EXTEND (SDNode *N, SDValue &Lo, SDValue &Hi);
|
||||
void ExpandIntRes_AssertSext (SDNode *N, SDValue &Lo, SDValue &Hi);
|
||||
void ExpandIntRes_AssertZext (SDNode *N, SDValue &Lo, SDValue &Hi);
|
||||
@ -379,7 +380,7 @@ private:
|
||||
|
||||
// Result Float to Integer Conversion.
|
||||
void SoftenFloatResult(SDNode *N, unsigned OpNo);
|
||||
SDValue SoftenFloatRes_MERGE_VALUES(SDNode *N);
|
||||
SDValue SoftenFloatRes_MERGE_VALUES(SDNode *N, unsigned ResNo);
|
||||
SDValue SoftenFloatRes_BITCAST(SDNode *N);
|
||||
SDValue SoftenFloatRes_BUILD_PAIR(SDNode *N);
|
||||
SDValue SoftenFloatRes_ConstantFP(ConstantFPSDNode *N);
|
||||
@ -506,7 +507,7 @@ private:
|
||||
|
||||
// Vector Result Scalarization: <1 x ty> -> ty.
|
||||
void ScalarizeVectorResult(SDNode *N, unsigned OpNo);
|
||||
SDValue ScalarizeVecRes_MERGE_VALUES(SDNode *N);
|
||||
SDValue ScalarizeVecRes_MERGE_VALUES(SDNode *N, unsigned ResNo);
|
||||
SDValue ScalarizeVecRes_BinOp(SDNode *N);
|
||||
SDValue ScalarizeVecRes_UnaryOp(SDNode *N);
|
||||
SDValue ScalarizeVecRes_InregOp(SDNode *N);
|
||||
@ -601,7 +602,7 @@ private:
|
||||
|
||||
// Widen Vector Result Promotion.
|
||||
void WidenVectorResult(SDNode *N, unsigned ResNo);
|
||||
SDValue WidenVecRes_MERGE_VALUES(SDNode* N);
|
||||
SDValue WidenVecRes_MERGE_VALUES(SDNode* N, unsigned ResNo);
|
||||
SDValue WidenVecRes_BITCAST(SDNode* N);
|
||||
SDValue WidenVecRes_BUILD_VECTOR(SDNode* N);
|
||||
SDValue WidenVecRes_CONCAT_VECTORS(SDNode* N);
|
||||
@ -698,7 +699,8 @@ private:
|
||||
void GetPairElements(SDValue Pair, SDValue &Lo, SDValue &Hi);
|
||||
|
||||
// Generic Result Splitting.
|
||||
void SplitRes_MERGE_VALUES(SDNode *N, SDValue &Lo, SDValue &Hi);
|
||||
void SplitRes_MERGE_VALUES(SDNode *N, unsigned ResNo,
|
||||
SDValue &Lo, SDValue &Hi);
|
||||
void SplitRes_SELECT (SDNode *N, SDValue &Lo, SDValue &Hi);
|
||||
void SplitRes_SELECT_CC (SDNode *N, SDValue &Lo, SDValue &Hi);
|
||||
void SplitRes_UNDEF (SDNode *N, SDValue &Lo, SDValue &Hi);
|
||||
@ -720,7 +722,8 @@ private:
|
||||
}
|
||||
|
||||
// Generic Result Expansion.
|
||||
void ExpandRes_MERGE_VALUES (SDNode *N, SDValue &Lo, SDValue &Hi);
|
||||
void ExpandRes_MERGE_VALUES (SDNode *N, unsigned ResNo,
|
||||
SDValue &Lo, SDValue &Hi);
|
||||
void ExpandRes_BITCAST (SDNode *N, SDValue &Lo, SDValue &Hi);
|
||||
void ExpandRes_BUILD_PAIR (SDNode *N, SDValue &Lo, SDValue &Hi);
|
||||
void ExpandRes_EXTRACT_ELEMENT (SDNode *N, SDValue &Lo, SDValue &Hi);
|
||||
|
@ -31,9 +31,9 @@ using namespace llvm;
|
||||
// These routines assume that the Lo/Hi part is stored first in memory on
|
||||
// little/big-endian machines, followed by the Hi/Lo part. This means that
|
||||
// they cannot be used as is on vectors, for which Lo is always stored first.
|
||||
void DAGTypeLegalizer::ExpandRes_MERGE_VALUES(SDNode *N,
|
||||
void DAGTypeLegalizer::ExpandRes_MERGE_VALUES(SDNode *N, unsigned ResNo,
|
||||
SDValue &Lo, SDValue &Hi) {
|
||||
SDValue Op = DecomposeMERGE_VALUES(N);
|
||||
SDValue Op = DisintegrateMERGE_VALUES(N, ResNo);
|
||||
GetExpandedOp(Op, Lo, Hi);
|
||||
}
|
||||
|
||||
@ -431,9 +431,9 @@ SDValue DAGTypeLegalizer::ExpandOp_NormalStore(SDNode *N, unsigned OpNo) {
|
||||
// bytes; for integers and floats it is Lo first if and only if the machine is
|
||||
// little-endian).
|
||||
|
||||
void DAGTypeLegalizer::SplitRes_MERGE_VALUES(SDNode *N,
|
||||
void DAGTypeLegalizer::SplitRes_MERGE_VALUES(SDNode *N, unsigned ResNo,
|
||||
SDValue &Lo, SDValue &Hi) {
|
||||
SDValue Op = DecomposeMERGE_VALUES(N);
|
||||
SDValue Op = DisintegrateMERGE_VALUES(N, ResNo);
|
||||
GetSplitOp(Op, Lo, Hi);
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ void DAGTypeLegalizer::ScalarizeVectorResult(SDNode *N, unsigned ResNo) {
|
||||
report_fatal_error("Do not know how to scalarize the result of this "
|
||||
"operator!\n");
|
||||
|
||||
case ISD::MERGE_VALUES: R = ScalarizeVecRes_MERGE_VALUES(N); break;
|
||||
case ISD::MERGE_VALUES: R = ScalarizeVecRes_MERGE_VALUES(N, ResNo);break;
|
||||
case ISD::BITCAST: R = ScalarizeVecRes_BITCAST(N); break;
|
||||
case ISD::BUILD_VECTOR: R = N->getOperand(0); break;
|
||||
case ISD::CONVERT_RNDSAT: R = ScalarizeVecRes_CONVERT_RNDSAT(N); break;
|
||||
@ -129,8 +129,9 @@ SDValue DAGTypeLegalizer::ScalarizeVecRes_BinOp(SDNode *N) {
|
||||
LHS.getValueType(), LHS, RHS);
|
||||
}
|
||||
|
||||
SDValue DAGTypeLegalizer::ScalarizeVecRes_MERGE_VALUES(SDNode *N) {
|
||||
SDValue Op = DecomposeMERGE_VALUES(N);
|
||||
SDValue DAGTypeLegalizer::ScalarizeVecRes_MERGE_VALUES(SDNode *N,
|
||||
unsigned ResNo) {
|
||||
SDValue Op = DisintegrateMERGE_VALUES(N, ResNo);
|
||||
return GetScalarizedVector(Op);
|
||||
}
|
||||
|
||||
@ -414,7 +415,7 @@ void DAGTypeLegalizer::SplitVectorResult(SDNode *N, unsigned ResNo) {
|
||||
#endif
|
||||
llvm_unreachable("Do not know how to split the result of this operator!");
|
||||
|
||||
case ISD::MERGE_VALUES: SplitRes_MERGE_VALUES(N, Lo, Hi); break;
|
||||
case ISD::MERGE_VALUES: SplitRes_MERGE_VALUES(N, ResNo, Lo, Hi); break;
|
||||
case ISD::VSELECT:
|
||||
case ISD::SELECT: SplitRes_SELECT(N, Lo, Hi); break;
|
||||
case ISD::SELECT_CC: SplitRes_SELECT_CC(N, Lo, Hi); break;
|
||||
@ -1227,7 +1228,7 @@ void DAGTypeLegalizer::WidenVectorResult(SDNode *N, unsigned ResNo) {
|
||||
#endif
|
||||
llvm_unreachable("Do not know how to widen the result of this operator!");
|
||||
|
||||
case ISD::MERGE_VALUES: Res = WidenVecRes_MERGE_VALUES(N); break;
|
||||
case ISD::MERGE_VALUES: Res = WidenVecRes_MERGE_VALUES(N, ResNo); break;
|
||||
case ISD::BITCAST: Res = WidenVecRes_BITCAST(N); break;
|
||||
case ISD::BUILD_VECTOR: Res = WidenVecRes_BUILD_VECTOR(N); break;
|
||||
case ISD::CONCAT_VECTORS: Res = WidenVecRes_CONCAT_VECTORS(N); break;
|
||||
@ -1576,9 +1577,8 @@ SDValue DAGTypeLegalizer::WidenVecRes_InregOp(SDNode *N) {
|
||||
WidenVT, WidenLHS, DAG.getValueType(ExtVT));
|
||||
}
|
||||
|
||||
SDValue DAGTypeLegalizer::WidenVecRes_MERGE_VALUES(SDNode *N)
|
||||
{
|
||||
SDValue WidenVec = DecomposeMERGE_VALUES(N);
|
||||
SDValue DAGTypeLegalizer::WidenVecRes_MERGE_VALUES(SDNode *N, unsigned ResNo) {
|
||||
SDValue WidenVec = DisintegrateMERGE_VALUES(N, ResNo);
|
||||
return GetWidenedVector(WidenVec);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user