Skip to content

Commit 80aa4da

Browse files
authored
[LLVM][TableGen] Change X86FoldTablesEmitter to use const RecordKeeper (#109070)
Change X86FoldTablesEmitter to use const RecordKeeper. This is a part of effort to have better const correctness in TableGen backends: https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
1 parent 1a793a8 commit 80aa4da

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

llvm/utils/TableGen/X86FoldTablesEmitter.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ static bool isExplicitUnalign(const CodeGenInstruction *Inst) {
6363
}
6464

6565
class X86FoldTablesEmitter {
66-
RecordKeeper &Records;
67-
CodeGenTarget Target;
66+
const RecordKeeper &Records;
67+
const CodeGenTarget Target;
6868

6969
// Represents an entry in the folding table
7070
class X86FoldTableEntry {
@@ -196,7 +196,7 @@ class X86FoldTablesEmitter {
196196
FoldTable BroadcastTable4;
197197

198198
public:
199-
X86FoldTablesEmitter(RecordKeeper &R) : Records(R), Target(R) {}
199+
X86FoldTablesEmitter(const RecordKeeper &R) : Records(R), Target(R) {}
200200

201201
// run - Generate the 6 X86 memory fold tables.
202202
void run(raw_ostream &OS);
@@ -670,7 +670,7 @@ void X86FoldTablesEmitter::run(raw_ostream &OS) {
670670
// added into memory fold tables.
671671
auto RegInstsForBroadcast = RegInsts;
672672

673-
Record *AsmWriter = Target.getAsmWriter();
673+
const Record *AsmWriter = Target.getAsmWriter();
674674
unsigned Variant = AsmWriter->getValueAsInt("Variant");
675675
auto FixUp = [&](const CodeGenInstruction *RegInst) {
676676
StringRef RegInstName = RegInst->TheDef->getName();
@@ -721,8 +721,8 @@ void X86FoldTablesEmitter::run(raw_ostream &OS) {
721721

722722
// Add the manually mapped instructions listed above.
723723
for (const ManualMapEntry &Entry : ManualMapSet) {
724-
Record *RegInstIter = Records.getDef(Entry.RegInstStr);
725-
Record *MemInstIter = Records.getDef(Entry.MemInstStr);
724+
const Record *RegInstIter = Records.getDef(Entry.RegInstStr);
725+
const Record *MemInstIter = Records.getDef(Entry.MemInstStr);
726726

727727
updateTables(&(Target.getInstruction(RegInstIter)),
728728
&(Target.getInstruction(MemInstIter)), Entry.Strategy, true);

0 commit comments

Comments
 (0)