types into the DAG if they were not already there.
Check this with an assertion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60997
91177308-0d34-0410-b5e6-
96231b3b80d8
///
/// Note that this is an involved process that may invalidate pointers into
/// the graph.
///
/// Note that this is an involved process that may invalidate pointers into
/// the graph.
+ void Legalize(bool TypesNeedLegalizing);
/// RemoveDeadNodes - This method deletes all unreachable nodes in the
/// SelectionDAG.
/// RemoveDeadNodes - This method deletes all unreachable nodes in the
/// SelectionDAG.
class VISIBILITY_HIDDEN SelectionDAGLegalize {
TargetLowering &TLI;
SelectionDAG &DAG;
class VISIBILITY_HIDDEN SelectionDAGLegalize {
TargetLowering &TLI;
SelectionDAG &DAG;
+ bool TypesNeedLegalizing;
// Libcall insertion helpers.
// Libcall insertion helpers.
- explicit SelectionDAGLegalize(SelectionDAG &DAG);
+ explicit SelectionDAGLegalize(SelectionDAG &DAG, bool TypesNeedLegalizing);
/// 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
/// 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
return TLI.isShuffleMaskLegal(Mask, VT) ? Mask.getNode() : 0;
}
return TLI.isShuffleMaskLegal(Mask, VT) ? Mask.getNode() : 0;
}
-SelectionDAGLegalize::SelectionDAGLegalize(SelectionDAG &dag)
- : TLI(dag.getTargetLoweringInfo()), DAG(dag),
+SelectionDAGLegalize::SelectionDAGLegalize(SelectionDAG &dag, bool types)
+ : TLI(dag.getTargetLoweringInfo()), DAG(dag), TypesNeedLegalizing(types),
ValueTypeActions(TLI.getValueTypeActions()) {
assert(MVT::LAST_VALUETYPE <= 32 &&
"Too many value types for ValueTypeActions to hold!");
ValueTypeActions(TLI.getValueTypeActions()) {
assert(MVT::LAST_VALUETYPE <= 32 &&
"Too many value types for ValueTypeActions to hold!");
/// appropriate for its type.
void SelectionDAGLegalize::HandleOp(SDValue Op) {
MVT VT = Op.getValueType();
/// appropriate for its type.
void SelectionDAGLegalize::HandleOp(SDValue Op) {
MVT VT = Op.getValueType();
+ assert((TypesNeedLegalizing || getTypeAction(VT) == Legal) &&
+ "Illegal type introduced after type legalization?");
switch (getTypeAction(VT)) {
default: assert(0 && "Bad type action!");
case Legal: (void)LegalizeOp(Op); break;
switch (getTypeAction(VT)) {
default: assert(0 && "Bad type action!");
case Legal: (void)LegalizeOp(Op); break;
// 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();
if (TimePassesIsEnabled) {
NamedRegionTimer T("DAG Legalization", GroupName);
if (TimePassesIsEnabled) {
NamedRegionTimer T("DAG Legalization", GroupName);
+ CurDAG->Legalize(DisableLegalizeTypes);
+ CurDAG->Legalize(DisableLegalizeTypes);
}
DOUT << "Legalized selection DAG:\n";
}
DOUT << "Legalized selection DAG:\n";