[PATCH] D25482: [PPC] Allow two post RA schedulers to be in the pipeline and select one depending on the Machine Function's subtarget

Ehsan Amiri via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 11 11:37:21 PDT 2016


amehsan created this revision.
amehsan added reviewers: kbarton, echristo, hfinkel.
amehsan added a subscriber: llvm-commits.
Herald added subscribers: nemanjai, mehdi_amini, MatzeB.

For PWR9, PPC backend migrates to the new Post RA MI scheduler. We continue to use PostRA top down list scheduler for PWR8 and older processors. Given that each function can override module's target-cpu, we need a mechanism that allows us to use proper scheduler, depending on the function's target-cpu.

The solution here has the following components:

1- We add a new method MachineFunctionPass::skipFunction (const MachineFunction &) which internally passes the pass ID to Machine Function's subtarget and ask whether this pass should run for this subtarget or not. If Subtarget is OK, we then internally call FunctionPass::skipFunction.

2- A new virtual getPassID method is added to MachineFunctionPass. Each subclass, can override this to return proper ID. This is used in the skipFunction of (1).

3- Some refactoring in TargetPassConfig and PPCTargetMachine is done to allow PPC to add both PostRA schedulers to the pipeline and disable the post RA scheduler with command line options.

4- TargetSubtargetInfo now has a virtual runPass method that is called by the new skipFunction method of (1).

I have tested this by checking which pass is run when invoking llc and pass different value for mcpu option. To commit those tests, I would need to run test that rely on checking DEBUG output of these passes. I am not clear if committing this kind of testcase is OK/necessary or not. Comments are welcome. I have checked that -print-after= option works properly with these changes. I have not checked if the subtarget constructed for a function that overrides target-cpu contains all necessary information. But I believe that is a separate problem. We have to check that at some point and fix any bug that we find.  (I suspect that the project that allowed functions to override target-cpus has done that check....)


https://reviews.llvm.org/D25482

Files:
  include/llvm/CodeGen/MachineFunctionPass.h
  include/llvm/CodeGen/Passes.h
  include/llvm/CodeGen/TargetPassConfig.h
  include/llvm/Target/TargetSubtargetInfo.h
  lib/CodeGen/MachineFunctionPass.cpp
  lib/CodeGen/MachineScheduler.cpp
  lib/CodeGen/PostRASchedulerList.cpp
  lib/CodeGen/TargetPassConfig.cpp
  lib/Target/PowerPC/PPCSubtarget.cpp
  lib/Target/PowerPC/PPCSubtarget.h
  lib/Target/PowerPC/PPCTargetMachine.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25482.74274.patch
Type: text/x-patch
Size: 15862 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161011/c9d48b71/attachment.bin>


More information about the llvm-commits mailing list