-
Notifications
You must be signed in to change notification settings - Fork 11.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Clang][TableGen] Change NeonEmitter to use const Record * #110597
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jurahul
force-pushed
the
const_record_clang_neon_emitter
branch
from
September 30, 2024 23:01
461d770
to
25ab164
Compare
@llvm/pr-subscribers-clang Author: Rahul Joshi (jurahul) ChangesThis is a part of effort to have better const correctness in TableGen backends: Full diff: https://github.com/llvm/llvm-project/pull/110597.diff 2 Files Affected:
diff --git a/clang/utils/TableGen/NeonEmitter.cpp b/clang/utils/TableGen/NeonEmitter.cpp
index 202573e2ac740e..d4b42360e7fd32 100644
--- a/clang/utils/TableGen/NeonEmitter.cpp
+++ b/clang/utils/TableGen/NeonEmitter.cpp
@@ -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");
diff --git a/clang/utils/TableGen/SveEmitter.cpp b/clang/utils/TableGen/SveEmitter.cpp
index 2f9747e7de3de2..405a58e49e0dc9 100644
--- a/clang/utils/TableGen/SveEmitter.cpp
+++ b/clang/utils/TableGen/SveEmitter.cpp
@@ -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 (auto FlagRec : R->getValueAsListOfConstDefs("Flags"))
Flags |= FlagRec->getValueAsInt("Value");
// Create a dummy TypeSpec for non-overloaded builtins.
@@ -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 (auto 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");
|
jurahul
force-pushed
the
const_record_clang_neon_emitter
branch
from
October 1, 2024 16:29
25ab164
to
7d9e44f
Compare
jurahul
force-pushed
the
const_record_clang_neon_emitter
branch
from
October 1, 2024 16:50
7d9e44f
to
8887de9
Compare
kazutakahirata
approved these changes
Oct 1, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks!
Thanks! |
VitaNuo
pushed a commit
to VitaNuo/llvm-project
that referenced
this pull request
Oct 2, 2024
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
VitaNuo
pushed a commit
to VitaNuo/llvm-project
that referenced
this pull request
Oct 2, 2024
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
Sterling-Augustine
pushed a commit
to Sterling-Augustine/llvm-project
that referenced
this pull request
Oct 3, 2024
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
xgupta
pushed a commit
to xgupta/llvm-project
that referenced
this pull request
Oct 4, 2024
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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