Skip to content

Conversation

@kazutakahirata
Copy link
Contributor

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Mar 30, 2025

@llvm/pr-subscribers-tablegen
@llvm/pr-subscribers-backend-x86

@llvm/pr-subscribers-backend-directx

Author: Kazu Hirata (kazutakahirata)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/133649.diff

3 Files Affected:

  • (modified) llvm/utils/TableGen/DXILEmitter.cpp (+4-12)
  • (modified) llvm/utils/TableGen/DecoderEmitter.cpp (+4-8)
  • (modified) llvm/utils/TableGen/X86DisassemblerTables.cpp (+1-2)
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;
   }
 

@kazutakahirata kazutakahirata merged commit 2c73711 into llvm:main Mar 30, 2025
15 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_001_append_range_llvm_TableGen branch March 30, 2025 19:21
SchrodingerZhu pushed a commit to SchrodingerZhu/llvm-project that referenced this pull request Mar 31, 2025
@damyanp damyanp moved this to Closed in HLSL Support Apr 25, 2025
@damyanp damyanp removed this from HLSL Support Jun 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants