]> granicus.if.org Git - llvm/commitdiff
TableGen/CodeGenSchedule: Move some getAllDerivedDefinitions() calls out of inner...
authorMatthias Braun <matze@braunis.de>
Tue, 21 Jun 2016 03:24:03 +0000 (03:24 +0000)
committerMatthias Braun <matze@braunis.de>
Tue, 21 Jun 2016 03:24:03 +0000 (03:24 +0000)
This cuts the runtime of the two slowest tblgen invocations in aarch64
in half for me...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273235 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/CodeGenSchedule.cpp
utils/TableGen/CodeGenSchedule.h

index c52d3b0e9fc92ef9735f5b72d6ed349facf0f990..57a426bffb3699051bd1ab93b84eb9c354c7365b 100644 (file)
@@ -1429,6 +1429,9 @@ void CodeGenSchedModels::verifyProcResourceGroups(CodeGenProcModel &PM) {
 
 // Collect and sort WriteRes, ReadAdvance, and ProcResources.
 void CodeGenSchedModels::collectProcResources() {
+  ProcResourceDefs = Records.getAllDerivedDefinitions("ProcResourceUnits");
+  ProcResGroups = Records.getAllDerivedDefinitions("ProcResGroup");
+
   // Add any subtarget-specific SchedReadWrites that are directly associated
   // with processor resources. Refer to the parent SchedClass's ProcIndices to
   // determine which processors they apply to.
@@ -1523,6 +1526,9 @@ void CodeGenSchedModels::collectProcResources() {
       dbgs() << '\n');
     verifyProcResourceGroups(PM);
   }
+
+  ProcResourceDefs.clear();
+  ProcResGroups.clear();
 }
 
 void CodeGenSchedModels::checkCompleteness() {
@@ -1652,8 +1658,8 @@ Record *CodeGenSchedModels::findProcResUnits(Record *ProcResKind,
     return ProcResKind;
 
   Record *ProcUnitDef = nullptr;
-  RecVec ProcResourceDefs =
-    Records.getAllDerivedDefinitions("ProcResourceUnits");
+  assert(!ProcResourceDefs.empty());
+  assert(!ProcResGroups.empty());
 
   for (RecIter RI = ProcResourceDefs.begin(), RE = ProcResourceDefs.end();
        RI != RE; ++RI) {
@@ -1668,7 +1674,6 @@ Record *CodeGenSchedModels::findProcResUnits(Record *ProcResKind,
       ProcUnitDef = *RI;
     }
   }
-  RecVec ProcResGroups = Records.getAllDerivedDefinitions("ProcResGroup");
   for (RecIter RI = ProcResGroups.begin(), RE = ProcResGroups.end();
        RI != RE; ++RI) {
 
index 62601d941bcd453f1437e54ce4e838274ab5f9ed..7a236ad0dd816520d6c7689e6726d5f5492358a1 100644 (file)
@@ -241,6 +241,9 @@ class CodeGenSchedModels {
   // Any inferred SchedClass has an index greater than NumInstrSchedClassses.
   unsigned NumInstrSchedClasses;
 
+  RecVec ProcResourceDefs;
+  RecVec ProcResGroups;
+
   // Map each instruction to its unique SchedClass index considering the
   // combination of it's itinerary class, SchedRW list, and InstRW records.
   typedef DenseMap<Record*, unsigned> InstClassMapTy;