mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-12 06:31:14 +00:00
Reapply r60997, this time without forgetting that
target constants are allowed to have an illegal type. llvm-svn: 61006
This commit is contained in:
parent
4231a32eaf
commit
ef671b5627
@ -212,7 +212,7 @@ public:
|
|||||||
///
|
///
|
||||||
/// Note that this is an involved process that may invalidate pointers into
|
/// Note that this is an involved process that may invalidate pointers into
|
||||||
/// the graph.
|
/// the graph.
|
||||||
void Legalize();
|
void Legalize(bool TypesNeedLegalizing);
|
||||||
|
|
||||||
/// RemoveDeadNodes - This method deletes all unreachable nodes in the
|
/// RemoveDeadNodes - This method deletes all unreachable nodes in the
|
||||||
/// SelectionDAG.
|
/// SelectionDAG.
|
||||||
|
@ -51,6 +51,7 @@ namespace {
|
|||||||
class VISIBILITY_HIDDEN SelectionDAGLegalize {
|
class VISIBILITY_HIDDEN SelectionDAGLegalize {
|
||||||
TargetLowering &TLI;
|
TargetLowering &TLI;
|
||||||
SelectionDAG &DAG;
|
SelectionDAG &DAG;
|
||||||
|
bool TypesNeedLegalizing;
|
||||||
|
|
||||||
// Libcall insertion helpers.
|
// Libcall insertion helpers.
|
||||||
|
|
||||||
@ -127,7 +128,7 @@ class VISIBILITY_HIDDEN SelectionDAGLegalize {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit SelectionDAGLegalize(SelectionDAG &DAG);
|
explicit SelectionDAGLegalize(SelectionDAG &DAG, bool TypesNeedLegalizing);
|
||||||
|
|
||||||
/// getTypeAction - Return how we should legalize values of this type, either
|
/// getTypeAction - Return how we should legalize values of this type, either
|
||||||
/// it is already legal or we need to expand it into multiple registers of
|
/// it is already legal or we need to expand it into multiple registers of
|
||||||
@ -348,8 +349,8 @@ SDNode *SelectionDAGLegalize::isShuffleLegal(MVT VT, SDValue Mask) const {
|
|||||||
return TLI.isShuffleMaskLegal(Mask, VT) ? Mask.getNode() : 0;
|
return TLI.isShuffleMaskLegal(Mask, VT) ? Mask.getNode() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SelectionDAGLegalize::SelectionDAGLegalize(SelectionDAG &dag)
|
SelectionDAGLegalize::SelectionDAGLegalize(SelectionDAG &dag, bool types)
|
||||||
: TLI(dag.getTargetLoweringInfo()), DAG(dag),
|
: TLI(dag.getTargetLoweringInfo()), DAG(dag), TypesNeedLegalizing(types),
|
||||||
ValueTypeActions(TLI.getValueTypeActions()) {
|
ValueTypeActions(TLI.getValueTypeActions()) {
|
||||||
assert(MVT::LAST_VALUETYPE <= 32 &&
|
assert(MVT::LAST_VALUETYPE <= 32 &&
|
||||||
"Too many value types for ValueTypeActions to hold!");
|
"Too many value types for ValueTypeActions to hold!");
|
||||||
@ -488,6 +489,12 @@ bool SelectionDAGLegalize::LegalizeAllNodesNotLeadingTo(SDNode *N, SDNode *Dest,
|
|||||||
/// appropriate for its type.
|
/// appropriate for its type.
|
||||||
void SelectionDAGLegalize::HandleOp(SDValue Op) {
|
void SelectionDAGLegalize::HandleOp(SDValue Op) {
|
||||||
MVT VT = Op.getValueType();
|
MVT VT = Op.getValueType();
|
||||||
|
// If the type legalizer was run then we should never see any illegal result
|
||||||
|
// types here except for target constants (the type legalizer does not touch
|
||||||
|
// those).
|
||||||
|
assert((TypesNeedLegalizing || getTypeAction(VT) == Legal ||
|
||||||
|
Op.getOpcode() == ISD::TargetConstant) &&
|
||||||
|
"Illegal type introduced after type legalization?");
|
||||||
switch (getTypeAction(VT)) {
|
switch (getTypeAction(VT)) {
|
||||||
default: assert(0 && "Bad type action!");
|
default: assert(0 && "Bad type action!");
|
||||||
case Legal: (void)LegalizeOp(Op); break;
|
case Legal: (void)LegalizeOp(Op); break;
|
||||||
@ -8602,9 +8609,9 @@ SDValue SelectionDAGLegalize::StoreWidenVectorOp(StoreSDNode *ST,
|
|||||||
|
|
||||||
// SelectionDAG::Legalize - This is the entry point for the file.
|
// SelectionDAG::Legalize - This is the entry point for the file.
|
||||||
//
|
//
|
||||||
void SelectionDAG::Legalize() {
|
void SelectionDAG::Legalize(bool TypesNeedLegalizing) {
|
||||||
/// run - This is the main entry point to this class.
|
/// run - This is the main entry point to this class.
|
||||||
///
|
///
|
||||||
SelectionDAGLegalize(*this).LegalizeDAG();
|
SelectionDAGLegalize(*this, TypesNeedLegalizing).LegalizeDAG();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -620,9 +620,9 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
|
|||||||
|
|
||||||
if (TimePassesIsEnabled) {
|
if (TimePassesIsEnabled) {
|
||||||
NamedRegionTimer T("DAG Legalization", GroupName);
|
NamedRegionTimer T("DAG Legalization", GroupName);
|
||||||
CurDAG->Legalize();
|
CurDAG->Legalize(DisableLegalizeTypes);
|
||||||
} else {
|
} else {
|
||||||
CurDAG->Legalize();
|
CurDAG->Legalize(DisableLegalizeTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
DOUT << "Legalized selection DAG:\n";
|
DOUT << "Legalized selection DAG:\n";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user