[llvm] [LLVM][TableGen] Change FastISelEmitter to use const RecordKeeper (PR #109060)
Rahul Joshi via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 17 16:11:21 PDT 2024
https://github.com/jurahul created https://github.com/llvm/llvm-project/pull/109060
Change FastISelEmitter to use const RecordKeeper.
>From 015d4c926a8aed75a60293603207f9033ca828b7 Mon Sep 17 00:00:00 2001
From: Rahul Joshi <rjoshi at nvidia.com>
Date: Tue, 17 Sep 2024 16:09:24 -0700
Subject: [PATCH] [LLVM][TableGen] Change FastISelEmitter to use const
RecordKeeper
---
llvm/utils/TableGen/FastISelEmitter.cpp | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/llvm/utils/TableGen/FastISelEmitter.cpp b/llvm/utils/TableGen/FastISelEmitter.cpp
index 01df873ece1fcf..af05496a7b6ab9 100644
--- a/llvm/utils/TableGen/FastISelEmitter.cpp
+++ b/llvm/utils/TableGen/FastISelEmitter.cpp
@@ -272,7 +272,7 @@ struct OperandsSignature {
DefInit *OpDI = dyn_cast<DefInit>(Op.getLeafValue());
if (!OpDI)
return false;
- Record *OpLeafRec = OpDI->getDef();
+ const Record *OpLeafRec = OpDI->getDef();
// For now, the only other thing we accept is register operands.
const CodeGenRegisterClass *RC = nullptr;
@@ -407,7 +407,7 @@ class FastISelMap {
public:
explicit FastISelMap(StringRef InstNS);
- void collectPatterns(CodeGenDAGPatterns &CGP);
+ void collectPatterns(const CodeGenDAGPatterns &CGP);
void printImmediatePredicates(raw_ostream &OS);
void printFunctionDefinitions(raw_ostream &OS);
@@ -417,7 +417,8 @@ class FastISelMap {
};
} // End anonymous namespace
-static std::string getOpcodeName(const Record *Op, CodeGenDAGPatterns &CGP) {
+static std::string getOpcodeName(const Record *Op,
+ const CodeGenDAGPatterns &CGP) {
return std::string(CGP.getSDNodeInfo(Op).getEnumName());
}
@@ -437,7 +438,7 @@ static std::string PhyRegForNode(TreePatternNode &Op,
if (!Op.isLeaf())
return PhysReg;
- Record *OpLeafRec = cast<DefInit>(Op.getLeafValue())->getDef();
+ const Record *OpLeafRec = cast<DefInit>(Op.getLeafValue())->getDef();
if (!OpLeafRec->isSubClassOf("Register"))
return PhysReg;
@@ -448,7 +449,7 @@ static std::string PhyRegForNode(TreePatternNode &Op,
return PhysReg;
}
-void FastISelMap::collectPatterns(CodeGenDAGPatterns &CGP) {
+void FastISelMap::collectPatterns(const CodeGenDAGPatterns &CGP) {
const CodeGenTarget &Target = CGP.getTargetInfo();
// Scan through all the patterns and record the simple ones.
@@ -864,8 +865,8 @@ void FastISelMap::printFunctionDefinitions(raw_ostream &OS) {
// TODO: SignaturesWithConstantForms should be empty here.
}
-static void EmitFastISel(RecordKeeper &RK, raw_ostream &OS) {
- CodeGenDAGPatterns CGP(RK);
+static void EmitFastISel(const RecordKeeper &RK, raw_ostream &OS) {
+ const CodeGenDAGPatterns CGP(RK);
const CodeGenTarget &Target = CGP.getTargetInfo();
emitSourceFileHeader("\"Fast\" Instruction Selector for the " +
Target.getName().str() + " target",
More information about the llvm-commits
mailing list