@@ -267,31 +267,6 @@ static Error isTrivialOperatorNode(const TreePatternNode &N) {
267
267
return failedImport (Explanation);
268
268
}
269
269
270
- static const Record *getInitValueAsRegClass (const CodeGenTarget &Target,
271
- const Init *V) {
272
- if (const DefInit *VDefInit = dyn_cast<DefInit>(V)) {
273
- const Record *RegClass = VDefInit->getDef ();
274
- if (RegClass->isSubClassOf (" RegisterOperand" ))
275
- RegClass = RegClass->getValueAsDef (" RegClass" );
276
-
277
- if (RegClass->isSubClassOf (" RegisterClass" ))
278
- return RegClass;
279
-
280
- // FIXME: We should figure out the hwmode and dispatch. But this interface
281
- // is broken, we should be returning a register class. The expected uses
282
- // will use the same RegBanks in all modes.
283
- if (RegClass->isSubClassOf (" RegClassByHwMode" )) {
284
- const HwModeSelect &ModeSelect =
285
- Target.getHwModes ().getHwModeSelect (RegClass);
286
- if (ModeSelect.Items .empty ())
287
- return nullptr ;
288
- return ModeSelect.Items .front ().second ;
289
- }
290
- }
291
-
292
- return nullptr ;
293
- }
294
-
295
270
static std::string getScopedName (unsigned Scope, const std::string &Name) {
296
271
return (" pred:" + Twine (Scope) + " :" + Name).str ();
297
272
}
@@ -1161,8 +1136,8 @@ Error GlobalISelEmitter::importChildMatcher(
1161
1136
if (ChildRec->isSubClassOf (" RegisterClass" ) ||
1162
1137
ChildRec->isSubClassOf (" RegisterOperand" ) ||
1163
1138
ChildRec->isSubClassOf (" RegClassByHwMode" )) {
1164
- OM.addPredicate <RegisterBankOperandMatcher>(Target. getRegisterClass (
1165
- getInitValueAsRegClass (Target, ChildDefInit)));
1139
+ OM.addPredicate <RegisterBankOperandMatcher>(
1140
+ Target. getRegisterClass (Target. getInitValueAsRegClass ( ChildDefInit)));
1166
1141
return Error::success ();
1167
1142
}
1168
1143
@@ -1660,7 +1635,7 @@ Expected<action_iterator> GlobalISelEmitter::importExplicitUseRenderers(
1660
1635
1661
1636
// If this is a source operand, this is just a subregister copy.
1662
1637
const Record *RCDef =
1663
- getInitValueAsRegClass (Target, ValChild.getLeafValue ());
1638
+ Target. getInitValueAsRegClass (ValChild.getLeafValue ());
1664
1639
if (!RCDef)
1665
1640
return failedImport (" EXTRACT_SUBREG child #0 could not "
1666
1641
" be coerced to a register class" );
@@ -1692,7 +1667,7 @@ Expected<action_iterator> GlobalISelEmitter::importExplicitUseRenderers(
1692
1667
return failedImport (" REG_SEQUENCE child #0 is not a leaf" );
1693
1668
1694
1669
const Record *RCDef =
1695
- getInitValueAsRegClass (Target, Dst.getChild (0 ).getLeafValue ());
1670
+ Target. getInitValueAsRegClass (Dst.getChild (0 ).getLeafValue ());
1696
1671
if (!RCDef)
1697
1672
return failedImport (" REG_SEQUENCE child #0 could not "
1698
1673
" be coerced to a register class" );
@@ -1811,7 +1786,7 @@ Error GlobalISelEmitter::constrainOperands(action_iterator InsertPt,
1811
1786
// COPY_TO_REGCLASS does not provide operand constraints itself but the
1812
1787
// result is constrained to the class given by the second child.
1813
1788
const Record *DstIOpRec =
1814
- getInitValueAsRegClass (Target, Dst.getChild (1 ).getLeafValue ());
1789
+ Target. getInitValueAsRegClass (Dst.getChild (1 ).getLeafValue ());
1815
1790
1816
1791
if (DstIOpRec == nullptr )
1817
1792
return failedImport (" COPY_TO_REGCLASS operand #1 isn't a register class" );
@@ -1917,7 +1892,7 @@ Error GlobalISelEmitter::constrainOperands(action_iterator InsertPt,
1917
1892
const CodeGenRegisterClass *
1918
1893
GlobalISelEmitter::getRegClassFromLeaf (const TreePatternNode &Leaf) const {
1919
1894
assert (Leaf.isLeaf () && " Expected leaf?" );
1920
- const Record *RCRec = getInitValueAsRegClass (Target, Leaf.getLeafValue ());
1895
+ const Record *RCRec = Target. getInitValueAsRegClass (Leaf.getLeafValue ());
1921
1896
if (!RCRec)
1922
1897
return nullptr ;
1923
1898
return CGRegs.getRegClass (RCRec);
@@ -2158,7 +2133,7 @@ Expected<RuleMatcher> GlobalISelEmitter::runOnPattern(const PatternToMatch &P) {
2158
2133
2159
2134
if (Dst.isLeaf ()) {
2160
2135
if (const Record *RCDef =
2161
- getInitValueAsRegClass (Target, Dst.getLeafValue ())) {
2136
+ Target. getInitValueAsRegClass (Dst.getLeafValue ())) {
2162
2137
const CodeGenRegisterClass &RC = Target.getRegisterClass (RCDef);
2163
2138
2164
2139
// We need to replace the def and all its uses with the specified
0 commit comments