File tree Expand file tree Collapse file tree 4 files changed +20
-1
lines changed Expand file tree Collapse file tree 4 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -777,6 +777,10 @@ class Instruction : InstructionEncoding {
777
777
/// SelectionDAG can.
778
778
bit FastISelShouldIgnore = false;
779
779
780
+ /// Should DAGISel ignore this instruction. In cases where lowering may
781
+ /// be done elsewhere or is unneeded, DAGISel may skip over them.
782
+ bit DAGISelShouldIgnore = false;
783
+
780
784
/// HasPositionOrder: Indicate tablegen to sort the instructions by record
781
785
/// ID, so that instruction that is defined earlier can be sorted earlier
782
786
/// in the assembly matching table.
Original file line number Diff line number Diff line change @@ -465,6 +465,7 @@ CodeGenInstruction::CodeGenInstruction(Record *R)
465
465
isConvergent = R->getValueAsBit (" isConvergent" );
466
466
hasNoSchedulingInfo = R->getValueAsBit (" hasNoSchedulingInfo" );
467
467
FastISelShouldIgnore = R->getValueAsBit (" FastISelShouldIgnore" );
468
+ DAGISelShouldIgnore = R->getValueAsBit (" DAGISelShouldIgnore" );
468
469
variadicOpsAreDefs = R->getValueAsBit (" variadicOpsAreDefs" );
469
470
isAuthenticated = R->getValueAsBit (" isAuthenticated" );
470
471
Original file line number Diff line number Diff line change @@ -282,6 +282,7 @@ class CodeGenInstruction {
282
282
bool isConvergent : 1 ;
283
283
bool hasNoSchedulingInfo : 1 ;
284
284
bool FastISelShouldIgnore : 1 ;
285
+ bool DAGISelShouldIgnore : 1 ;
285
286
bool hasChain : 1 ;
286
287
bool hasChain_Inferred : 1 ;
287
288
bool variadicOpsAreDefs : 1 ;
Original file line number Diff line number Diff line change @@ -165,8 +165,21 @@ void DAGISelEmitter::run(raw_ostream &OS) {
165
165
// Add all the patterns to a temporary list so we can sort them.
166
166
Records.startTimer (" Sort patterns" );
167
167
std::vector<const PatternToMatch *> Patterns;
168
- for (const PatternToMatch &PTM : CGP.ptms ())
168
+ for (const PatternToMatch &PTM : CGP.ptms ()) {
169
+
170
+ // Disable import of patterns marked as ignore.
171
+ const TreePatternNode &Dst = PTM.getDstPattern ();
172
+ if (!Dst.isLeaf ()) {
173
+ const Record *Op = Dst.getOperator ();
174
+ const bool shouldIgnore =
175
+ Op->isSubClassOf (" Instruction" ) &&
176
+ CGP.getTargetInfo ().getInstruction (Op).DAGISelShouldIgnore ;
177
+ if (shouldIgnore)
178
+ continue ;
179
+ }
180
+
169
181
Patterns.push_back (&PTM);
182
+ }
170
183
171
184
// We want to process the matches in order of minimal cost. Sort the patterns
172
185
// so the least cost one is at the start.
You can’t perform that action at this time.
0 commit comments