[PATCH] D24525: [Power9] Processor Model for Scheduling

Ehsan Amiri via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 22 12:48:27 PDT 2016


amehsan added inline comments.

================
Comment at: lib/Target/PowerPC/PPCTargetMachine.cpp:302
@@ +301,3 @@
+    : TargetPassConfig(TM, PM) {
+    if (TM->isPWR9() && TM->getOptLevel() != CodeGenOpt::None)
+      substitutePass(&PostRASchedulerID, &PostMachineSchedulerID);
----------------
kbarton wrote:
> amehsan wrote:
> > echristo wrote:
> > > No, this won't work. The subtarget can change on a function by function basis so you'll need to come up with an alternate way to do this.
> > > 
> > > Let's see what we can come up with...
> > I did not know that subtarget object owned by PPCTargetMachine will be removed. Anyway, I am thinking of a solution along this lines (not entirely verified it though):
> > 
> > First we create a hook for adding PostRA sched pass. Then for PPC we add both PostRA schedulers to the pipeline. In the beginning of the run method for each pass, we add a target specific hook. For PPC we check target-cpu of the machine function.  Does this sounds reasonable? (I still need to verify that P8Model will be available for functions with target-cpu=pwr8 when a module is compile with -mcpu=pwr9).
> This sounds reasonable to me, but I'm not overly familiar with how the functionality is tied together at the moment.
> 
> Is there not already a hook for adding a PostRA sched pass?
PostRA sched is added in TargetPassConfig::addMachinePasses(). There is a comment where it is declared:

```
  /// Fully developed targets will not generally override this.
  virtual void addMachinePasses();
```
and we do not override it. It makes sense given the structure of the code. All we need to do is to add a new function to the class, specifically for adding PostRA sched and override it. It is straightforward.




https://reviews.llvm.org/D24525





More information about the llvm-commits mailing list