diff options
| author | Craig Topper <craig.topper@sifive.com> | 2024-11-17 19:11:28 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-17 19:11:28 -0800 |
| commit | 92ffefe3510e0cbf5b9ded0f2e2caff4e6803f17 (patch) | |
| tree | 4dec2b100a9052dba6946c39d685b4a20cdf6b2b /llvm/utils/TableGen/DAGISelMatcherGen.cpp | |
| parent | 61d1b7c5eded9b0e6e8adcd74cf181b3458656ed (diff) | |
[Tablegen] Add more comments for result numbers to DAGISelEmitter.cpp (#116533)
Print what result number the Emit* nodes are storing their results in.
This makes it easy to track the inputs of later opcodes that consume
these results.
Diffstat (limited to 'llvm/utils/TableGen/DAGISelMatcherGen.cpp')
| -rw-r--r-- | llvm/utils/TableGen/DAGISelMatcherGen.cpp | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/llvm/utils/TableGen/DAGISelMatcherGen.cpp b/llvm/utils/TableGen/DAGISelMatcherGen.cpp index 6a793c09394d..a3569bc1770b 100644 --- a/llvm/utils/TableGen/DAGISelMatcherGen.cpp +++ b/llvm/utils/TableGen/DAGISelMatcherGen.cpp @@ -651,7 +651,7 @@ void MatcherGen::EmitResultOfNamedOperand( if (!N.isLeaf()) { StringRef OperatorName = N.getOperator()->getName(); if (OperatorName == "imm" || OperatorName == "fpimm") { - AddMatcher(new EmitConvertToTargetMatcher(SlotNo)); + AddMatcher(new EmitConvertToTargetMatcher(SlotNo, NextRecordedOperandNo)); ResultOps.push_back(NextRecordedOperandNo++); return; } @@ -666,7 +666,8 @@ void MatcherGen::EmitResultLeafAsOperand(const TreePatternNode &N, assert(N.isLeaf() && "Must be a leaf"); if (const IntInit *II = dyn_cast<IntInit>(N.getLeafValue())) { - AddMatcher(new EmitIntegerMatcher(II->getValue(), N.getSimpleType(0))); + AddMatcher(new EmitIntegerMatcher(II->getValue(), N.getSimpleType(0), + NextRecordedOperandNo)); ResultOps.push_back(NextRecordedOperandNo++); return; } @@ -676,13 +677,15 @@ void MatcherGen::EmitResultLeafAsOperand(const TreePatternNode &N, const Record *Def = DI->getDef(); if (Def->isSubClassOf("Register")) { const CodeGenRegister *Reg = CGP.getTargetInfo().getRegBank().getReg(Def); - AddMatcher(new EmitRegisterMatcher(Reg, N.getSimpleType(0))); + AddMatcher(new EmitRegisterMatcher(Reg, N.getSimpleType(0), + NextRecordedOperandNo)); ResultOps.push_back(NextRecordedOperandNo++); return; } if (Def->getName() == "zero_reg") { - AddMatcher(new EmitRegisterMatcher(nullptr, N.getSimpleType(0))); + AddMatcher(new EmitRegisterMatcher(nullptr, N.getSimpleType(0), + NextRecordedOperandNo)); ResultOps.push_back(NextRecordedOperandNo++); return; } @@ -710,12 +713,13 @@ void MatcherGen::EmitResultLeafAsOperand(const TreePatternNode &N, CGP.getTargetInfo().getRegisterClass(Def); if (RC.EnumValue <= 127) { std::string Value = RC.getQualifiedIdName(); - AddMatcher(new EmitStringIntegerMatcher(Value, MVT::i32)); - ResultOps.push_back(NextRecordedOperandNo++); + AddMatcher(new EmitStringIntegerMatcher(Value, MVT::i32, + NextRecordedOperandNo)); } else { - AddMatcher(new EmitIntegerMatcher(RC.EnumValue, MVT::i32)); - ResultOps.push_back(NextRecordedOperandNo++); + AddMatcher(new EmitIntegerMatcher(RC.EnumValue, MVT::i32, + NextRecordedOperandNo)); } + ResultOps.push_back(NextRecordedOperandNo++); return; } @@ -728,13 +732,15 @@ void MatcherGen::EmitResultLeafAsOperand(const TreePatternNode &N, const CodeGenSubRegIndex *I = RB.findSubRegIdx(Def); assert(I && "Cannot find subreg index by name!"); if (I->EnumValue > 127) { - AddMatcher(new EmitIntegerMatcher(I->EnumValue, MVT::i32)); + AddMatcher(new EmitIntegerMatcher(I->EnumValue, MVT::i32, + NextRecordedOperandNo)); ResultOps.push_back(NextRecordedOperandNo++); return; } } std::string Value = getQualifiedName(Def); - AddMatcher(new EmitStringIntegerMatcher(Value, MVT::i32)); + AddMatcher( + new EmitStringIntegerMatcher(Value, MVT::i32, NextRecordedOperandNo)); ResultOps.push_back(NextRecordedOperandNo++); return; } @@ -995,7 +1001,8 @@ void MatcherGen::EmitResultSDNodeXFormAsOperand( // The input currently must have produced exactly one result. assert(InputOps.size() == 1 && "Unexpected input to SDNodeXForm"); - AddMatcher(new EmitNodeXFormMatcher(InputOps[0], N.getOperator())); + AddMatcher(new EmitNodeXFormMatcher(InputOps[0], N.getOperator(), + NextRecordedOperandNo)); ResultOps.push_back(NextRecordedOperandNo++); } |
