[llvm] r176390 - MIsched machine model: tablegen subtarget emitter improvement.

Andrew Trick atrick at apple.com
Fri Mar 1 15:31:27 PST 2013


Author: atrick
Date: Fri Mar  1 17:31:26 2013
New Revision: 176390

URL: http://llvm.org/viewvc/llvm-project?rev=176390&view=rev
Log:
MIsched machine model: tablegen subtarget emitter improvement.

Fix the way resources are counted. I'm taking some time to cleanup the
way MachineScheduler handles in-order machine resources. Eventually
we'll need more PPC/Atom test cases in tree.

Modified:
    llvm/trunk/utils/TableGen/SubtargetEmitter.cpp

Modified: llvm/trunk/utils/TableGen/SubtargetEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/SubtargetEmitter.cpp?rev=176390&r1=176389&r2=176390&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/SubtargetEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/SubtargetEmitter.cpp Fri Mar  1 17:31:26 2013
@@ -893,7 +893,20 @@ void SubtargetEmitter::GenSchedClassTabl
             WPREntry.Cycles = Cycles[PRIdx];
           else
             WPREntry.Cycles = 1;
-          WriteProcResources.push_back(WPREntry);
+          // If this resource is already used in this sequence, add the current
+          // entry's cycles so that the same resource appears to be used
+          // serially, rather than multiple parallel uses. This is important for
+          // in-order machine where the resource consumption is a hazard.
+          unsigned WPRIdx = 0, WPREnd = WriteProcResources.size();
+          for( ; WPRIdx != WPREnd; ++WPRIdx) {
+            if (WriteProcResources[WPRIdx].ProcResourceIdx
+                == WPREntry.ProcResourceIdx) {
+              WriteProcResources[WPRIdx].Cycles += WPREntry.Cycles;
+              break;
+            }
+          }
+          if (WPRIdx == WPREnd)
+            WriteProcResources.push_back(WPREntry);
         }
       }
       WriteLatencies.push_back(WLEntry);





More information about the llvm-commits mailing list