[llvm] 81cec39 - [RISCV] [TableGen] Modify RISCVCompressInstEmitter.cpp to use getAllDerivedDefinitions().

Paul C. Anagnostopoulos via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 15 07:11:43 PDT 2020


Author: Paul C. Anagnostopoulos
Date: 2020-10-15T10:11:12-04:00
New Revision: 81cec3943ab695c344900c1bcdeeda264ee41a30

URL: https://github.com/llvm/llvm-project/commit/81cec3943ab695c344900c1bcdeeda264ee41a30
DIFF: https://github.com/llvm/llvm-project/commit/81cec3943ab695c344900c1bcdeeda264ee41a30.diff

LOG: [RISCV] [TableGen] Modify RISCVCompressInstEmitter.cpp to use getAllDerivedDefinitions().

Added: 
    

Modified: 
    llvm/utils/TableGen/RISCVCompressInstEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/RISCVCompressInstEmitter.cpp b/llvm/utils/TableGen/RISCVCompressInstEmitter.cpp
index f298e639bf7f..b8464418320b 100644
--- a/llvm/utils/TableGen/RISCVCompressInstEmitter.cpp
+++ b/llvm/utils/TableGen/RISCVCompressInstEmitter.cpp
@@ -884,13 +884,7 @@ void RISCVCompressInstEmitter::emitCompressInstEmitter(raw_ostream &o,
 }
 
 void RISCVCompressInstEmitter::run(raw_ostream &o) {
-  Record *CompressClass = Records.getClass("CompressPat");
-  assert(CompressClass && "Compress class definition missing!");
-  std::vector<Record *> Insts;
-  for (const auto &D : Records.getDefs()) {
-    if (D.second->isSubClassOf(CompressClass))
-      Insts.push_back(D.second.get());
-  }
+  std::vector<Record *> Insts = Records.getAllDerivedDefinitions("CompressPat");
 
   // Process the CompressPat definitions, validating them as we do so.
   for (unsigned i = 0, e = Insts.size(); i != e; ++i)


        


More information about the llvm-commits mailing list