-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[TableGen] Use llvm::append_range (NFC) #133649
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
Merged
kazutakahirata
merged 1 commit into
llvm:main
from
kazutakahirata:cleanup_001_append_range_llvm_TableGen
Mar 30, 2025
Merged
[TableGen] Use llvm::append_range (NFC) #133649
kazutakahirata
merged 1 commit into
llvm:main
from
kazutakahirata:cleanup_001_append_range_llvm_TableGen
Mar 30, 2025
Conversation
This file contains hidden or 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
Member
|
@llvm/pr-subscribers-tablegen @llvm/pr-subscribers-backend-directx Author: Kazu Hirata (kazutakahirata) ChangesFull diff: https://github.com/llvm/llvm-project/pull/133649.diff 3 Files Affected:
diff --git a/llvm/utils/TableGen/DXILEmitter.cpp b/llvm/utils/TableGen/DXILEmitter.cpp
index 0b553c3a3d456..0364b02c2483d 100644
--- a/llvm/utils/TableGen/DXILEmitter.cpp
+++ b/llvm/utils/TableGen/DXILEmitter.cpp
@@ -113,9 +113,7 @@ DXILOperationDesc::DXILOperationDesc(const Record *R) {
ParamTypeRecs.push_back(R->getValueAsDef("result"));
- for (const Record *ArgTy : R->getValueAsListOfDefs("arguments")) {
- ParamTypeRecs.push_back(ArgTy);
- }
+ llvm::append_range(ParamTypeRecs, R->getValueAsListOfDefs("arguments"));
size_t ParamTypeRecsSize = ParamTypeRecs.size();
// Populate OpTypes with return type and parameter types
@@ -148,9 +146,7 @@ DXILOperationDesc::DXILOperationDesc(const Record *R) {
// Sort records in ascending order of DXIL version
ascendingSortByVersion(Recs);
- for (const Record *CR : Recs) {
- OverloadRecs.push_back(CR);
- }
+ llvm::append_range(OverloadRecs, Recs);
// Get stage records
Recs = R->getValueAsListOfDefs("stages");
@@ -163,9 +159,7 @@ DXILOperationDesc::DXILOperationDesc(const Record *R) {
// Sort records in ascending order of DXIL version
ascendingSortByVersion(Recs);
- for (const Record *CR : Recs) {
- StageRecs.push_back(CR);
- }
+ llvm::append_range(StageRecs, Recs);
// Get attribute records
Recs = R->getValueAsListOfDefs("attributes");
@@ -173,9 +167,7 @@ DXILOperationDesc::DXILOperationDesc(const Record *R) {
// Sort records in ascending order of DXIL version
ascendingSortByVersion(Recs);
- for (const Record *CR : Recs) {
- AttrRecs.push_back(CR);
- }
+ llvm::append_range(AttrRecs, Recs);
// Get the operation class
OpClass = R->getValueAsDef("OpClass")->getName();
diff --git a/llvm/utils/TableGen/DecoderEmitter.cpp b/llvm/utils/TableGen/DecoderEmitter.cpp
index e1344ae54b20e..cf7c02db8842e 100644
--- a/llvm/utils/TableGen/DecoderEmitter.cpp
+++ b/llvm/utils/TableGen/DecoderEmitter.cpp
@@ -1342,8 +1342,7 @@ void FilterChooser::emitPredicateTableEntry(DecoderTableInfo &TableInfo,
TableInfo.Table.push_back(MCD::OPC_CheckPredicate);
// Predicate index.
- for (const auto PB : PBytes)
- TableInfo.Table.push_back(PB);
+ llvm::append_range(TableInfo.Table, PBytes);
// Push location for NumToSkip backpatching.
TableInfo.FixupStack.back().push_back(TableInfo.Table.size());
TableInfo.Table.push_back(0);
@@ -1402,15 +1401,13 @@ void FilterChooser::emitSoftFailTableEntry(DecoderTableInfo &TableInfo,
raw_svector_ostream S(MaskBytes);
if (NeedPositiveMask) {
encodeULEB128(PositiveMask.getZExtValue(), S);
- for (unsigned i = 0, e = MaskBytes.size(); i != e; ++i)
- TableInfo.Table.push_back(MaskBytes[i]);
+ llvm::append_range(TableInfo.Table, MaskBytes);
} else
TableInfo.Table.push_back(0);
if (NeedNegativeMask) {
MaskBytes.clear();
encodeULEB128(NegativeMask.getZExtValue(), S);
- for (unsigned i = 0, e = MaskBytes.size(); i != e; ++i)
- TableInfo.Table.push_back(MaskBytes[i]);
+ llvm::append_range(TableInfo.Table, MaskBytes);
} else
TableInfo.Table.push_back(0);
}
@@ -1483,8 +1480,7 @@ void FilterChooser::emitSingletonTableEntry(DecoderTableInfo &TableInfo,
encodeULEB128(DIdx, S);
// Decoder index.
- for (const auto B : Bytes)
- TableInfo.Table.push_back(B);
+ llvm::append_range(TableInfo.Table, Bytes);
if (!HasCompleteDecoder) {
// Push location for NumToSkip backpatching.
diff --git a/llvm/utils/TableGen/X86DisassemblerTables.cpp b/llvm/utils/TableGen/X86DisassemblerTables.cpp
index 5e7983a101e0b..36f752a1ebe63 100644
--- a/llvm/utils/TableGen/X86DisassemblerTables.cpp
+++ b/llvm/utils/TableGen/X86DisassemblerTables.cpp
@@ -746,8 +746,7 @@ void DisassemblerTables::emitModRMDecision(raw_ostream &o1, raw_ostream &o2,
ModRMDecision.push_back(decision.instructionIDs[index]);
break;
case MODRM_FULL:
- for (unsigned short InstructionID : decision.instructionIDs)
- ModRMDecision.push_back(InstructionID);
+ llvm::append_range(ModRMDecision, decision.instructionIDs);
break;
}
|
kuhar
approved these changes
Mar 30, 2025
SchrodingerZhu
pushed a commit
to SchrodingerZhu/llvm-project
that referenced
this pull request
Mar 31, 2025
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.
No description provided.