[GlobalISel] Add RegBankSelected MachineFunction property.
RegBankSelected: the RegBankSelect pass ran and all generic virtual registers have been assigned to a register bank. This lets us enforce certain invariants across passes. This property is GlobalISel-specific, but is always available. llvm-svn: 277475
This commit is contained in:
parent
18d8898317
commit
2471265508
|
@ -386,6 +386,7 @@ struct MachineFunction {
|
|||
bool AllVRegsAllocated = false;
|
||||
// GISel MachineFunctionProperties.
|
||||
bool Legalized = false;
|
||||
bool RegBankSelected = false;
|
||||
// Register information
|
||||
bool IsSSA = false;
|
||||
bool TracksRegLiveness = false;
|
||||
|
@ -411,6 +412,7 @@ template <> struct MappingTraits<MachineFunction> {
|
|||
YamlIO.mapOptional("hasInlineAsm", MF.HasInlineAsm);
|
||||
YamlIO.mapOptional("allVRegsAllocated", MF.AllVRegsAllocated);
|
||||
YamlIO.mapOptional("legalized", MF.Legalized);
|
||||
YamlIO.mapOptional("regBankSelected", MF.RegBankSelected);
|
||||
YamlIO.mapOptional("isSSA", MF.IsSSA);
|
||||
YamlIO.mapOptional("tracksRegLiveness", MF.TracksRegLiveness);
|
||||
YamlIO.mapOptional("tracksSubRegLiveness", MF.TracksSubRegLiveness);
|
||||
|
|
|
@ -122,11 +122,14 @@ public:
|
|||
// - generic and always legal (e.g., COPY)
|
||||
// - target-specific
|
||||
// - legal pre-isel generic instructions.
|
||||
// RegBankSelected: In GlobalISel: the RegBankSelect pass ran and all generic
|
||||
// virtual registers have been assigned to a register bank.
|
||||
enum class Property : unsigned {
|
||||
IsSSA,
|
||||
TracksLiveness,
|
||||
AllVRegsAllocated,
|
||||
Legalized,
|
||||
RegBankSelected,
|
||||
LastProperty,
|
||||
};
|
||||
|
||||
|
|
|
@ -295,6 +295,9 @@ bool MIRParserImpl::initializeMachineFunction(MachineFunction &MF) {
|
|||
|
||||
if (YamlMF.Legalized)
|
||||
MF.getProperties().set(MachineFunctionProperties::Property::Legalized);
|
||||
if (YamlMF.RegBankSelected)
|
||||
MF.getProperties().set(
|
||||
MachineFunctionProperties::Property::RegBankSelected);
|
||||
|
||||
PerFunctionMIParsingState PFS(MF, SM, IRSlots);
|
||||
if (initializeRegisterInfo(PFS, YamlMF))
|
||||
|
|
|
@ -180,6 +180,8 @@ void MIRPrinter::print(const MachineFunction &MF) {
|
|||
|
||||
YamlMF.Legalized = MF.getProperties().hasProperty(
|
||||
MachineFunctionProperties::Property::Legalized);
|
||||
YamlMF.RegBankSelected = MF.getProperties().hasProperty(
|
||||
MachineFunctionProperties::Property::RegBankSelected);
|
||||
|
||||
convert(YamlMF, MF.getRegInfo(), MF.getSubtarget().getRegisterInfo());
|
||||
ModuleSlotTracker MST(MF.getFunction()->getParent());
|
||||
|
|
|
@ -79,6 +79,9 @@ void MachineFunctionProperties::print(raw_ostream &ROS, bool OnlySet) const {
|
|||
case Property::Legalized:
|
||||
ROS << (HasProperty ? "" : "not ") << "legalized";
|
||||
break;
|
||||
case Property::RegBankSelected:
|
||||
ROS << (HasProperty ? "" : "not ") << "RegBank-selected";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
---
|
||||
# CHECK-LABEL: name: test_defaults
|
||||
# CHECK: legalized: false
|
||||
# CHECK-NEXT: regBankSelected: false
|
||||
name: test_defaults
|
||||
body: |
|
||||
bb.0:
|
||||
|
@ -27,8 +28,10 @@ body: |
|
|||
---
|
||||
# CHECK-LABEL: name: test
|
||||
# CHECK: legalized: true
|
||||
# CHECK-NEXT: regBankSelected: true
|
||||
name: test
|
||||
legalized: true
|
||||
regBankSelected: true
|
||||
body: |
|
||||
bb.0:
|
||||
...
|
||||
|
|
Loading…
Reference in New Issue