Skip to content

Commit

Permalink
[Clang][TableGen] Change NeonEmitter to use const Record * (llvm#110597)
Browse files Browse the repository at this point in the history
  • Loading branch information
jurahul authored and xgupta committed Oct 4, 2024
1 parent 148f4d2 commit 435ea0f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
3 changes: 1 addition & 2 deletions clang/utils/TableGen/NeonEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,7 @@ class Intrinsic {
}

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

ArgIdx = I->getValueAsInt("ImmArgIdx");
Expand Down
12 changes: 5 additions & 7 deletions clang/utils/TableGen/SveEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1161,11 +1161,9 @@ void SVEEmitter::createIntrinsic(
uint64_t Merge = R->getValueAsInt("Merge");
StringRef MergeSuffix = R->getValueAsString("MergeSuffix");
uint64_t MemEltType = R->getValueAsInt("MemEltType");
std::vector<Record*> FlagsList = R->getValueAsListOfDefs("Flags");
std::vector<Record*> ImmCheckList = R->getValueAsListOfDefs("ImmChecks");

int64_t Flags = 0;
for (auto FlagRec : FlagsList)
for (const Record *FlagRec : R->getValueAsListOfConstDefs("Flags"))
Flags |= FlagRec->getValueAsInt("Value");

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

Expand Down

0 comments on commit 435ea0f

Please sign in to comment.