Skip to content

Commit e9dbdb2

Browse files
authored
[Clang][TableGen] Change NeonEmitter to use const Record * (#110597)
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 1d39b4f commit e9dbdb2

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

clang/utils/TableGen/NeonEmitter.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,7 @@ class Intrinsic {
410410
}
411411

412412
int ArgIdx, Kind, TypeArgIdx;
413-
std::vector<Record *> ImmCheckList = R->getValueAsListOfDefs("ImmChecks");
414-
for (const auto *I : ImmCheckList) {
413+
for (const Record *I : R->getValueAsListOfDefs("ImmChecks")) {
415414
unsigned EltSizeInBits = 0, VecSizeInBits = 0;
416415

417416
ArgIdx = I->getValueAsInt("ImmArgIdx");

clang/utils/TableGen/SveEmitter.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,11 +1161,9 @@ void SVEEmitter::createIntrinsic(
11611161
uint64_t Merge = R->getValueAsInt("Merge");
11621162
StringRef MergeSuffix = R->getValueAsString("MergeSuffix");
11631163
uint64_t MemEltType = R->getValueAsInt("MemEltType");
1164-
std::vector<Record*> FlagsList = R->getValueAsListOfDefs("Flags");
1165-
std::vector<Record*> ImmCheckList = R->getValueAsListOfDefs("ImmChecks");
11661164

11671165
int64_t Flags = 0;
1168-
for (auto FlagRec : FlagsList)
1166+
for (const Record *FlagRec : R->getValueAsListOfConstDefs("Flags"))
11691167
Flags |= FlagRec->getValueAsInt("Value");
11701168

11711169
// Create a dummy TypeSpec for non-overloaded builtins.
@@ -1195,10 +1193,10 @@ void SVEEmitter::createIntrinsic(
11951193
for (auto TS : TypeSpecs) {
11961194
// Collate a list of range/option checks for the immediates.
11971195
SmallVector<ImmCheck, 2> ImmChecks;
1198-
for (auto *R : ImmCheckList) {
1199-
int64_t ArgIdx = R->getValueAsInt("ImmArgIdx");
1200-
int64_t EltSizeArgIdx = R->getValueAsInt("TypeContextArgIdx");
1201-
int64_t Kind = R->getValueAsDef("Kind")->getValueAsInt("Value");
1196+
for (const Record *ImmR : R->getValueAsListOfConstDefs("ImmChecks")) {
1197+
int64_t ArgIdx = ImmR->getValueAsInt("ImmArgIdx");
1198+
int64_t EltSizeArgIdx = ImmR->getValueAsInt("TypeContextArgIdx");
1199+
int64_t Kind = ImmR->getValueAsDef("Kind")->getValueAsInt("Value");
12021200
assert(ArgIdx >= 0 && Kind >= 0 &&
12031201
"ImmArgIdx and Kind must be nonnegative");
12041202

0 commit comments

Comments
 (0)