diff options
Diffstat (limited to 'lib/CodeGen/PostRASchedulerList.cpp')
| -rw-r--r-- | lib/CodeGen/PostRASchedulerList.cpp | 35 | 
1 files changed, 24 insertions, 11 deletions
diff --git a/lib/CodeGen/PostRASchedulerList.cpp b/lib/CodeGen/PostRASchedulerList.cpp index e52158cfeb4e..8fdbe9b1d74b 100644 --- a/lib/CodeGen/PostRASchedulerList.cpp +++ b/lib/CodeGen/PostRASchedulerList.cpp @@ -78,10 +78,12 @@ DebugMod("postra-sched-debugmod",  namespace {    class VISIBILITY_HIDDEN PostRAScheduler : public MachineFunctionPass {      AliasAnalysis *AA; +    CodeGenOpt::Level OptLevel;    public:      static char ID; -    PostRAScheduler() : MachineFunctionPass(&ID) {} +    PostRAScheduler(CodeGenOpt::Level ol) : +      MachineFunctionPass(&ID), OptLevel(ol) {}      void getAnalysisUsage(AnalysisUsage &AU) const {        AU.setPreservesCFG(); @@ -126,6 +128,9 @@ namespace {      /// AA - AliasAnalysis for making memory reference queries.      AliasAnalysis *AA; +    /// AntiDepMode - Anti-dependence breaking mode +    TargetSubtarget::AntiDepBreakMode AntiDepMode; +      /// Classes - For live regs that are only used in one register class in a      /// live range, the register class. If the register is not live, the      /// corresponding value is null. If the register is live but used in @@ -154,10 +159,11 @@ namespace {                           const MachineLoopInfo &MLI,                           const MachineDominatorTree &MDT,                           ScheduleHazardRecognizer *HR, -                         AliasAnalysis *aa) +                         AliasAnalysis *aa, +                         TargetSubtarget::AntiDepBreakMode adm)        : ScheduleDAGInstrs(MF, MLI, MDT), Topo(SUnits),          AllocatableSet(TRI->getAllocatableSet(MF)), -        HazardRec(HR), AA(aa) {} +      HazardRec(HR), AA(aa), AntiDepMode(adm) {}      ~SchedulePostRATDList() {        delete HazardRec; @@ -232,14 +238,21 @@ bool PostRAScheduler::runOnMachineFunction(MachineFunction &Fn) {    AA = &getAnalysis<AliasAnalysis>();    // Check for explicit enable/disable of post-ra scheduling. +  TargetSubtarget::AntiDepBreakMode AntiDepMode = TargetSubtarget::ANTIDEP_NONE;    if (EnablePostRAScheduler.getPosition() > 0) {      if (!EnablePostRAScheduler) -      return true; +      return false;    } else { -    // Check that post-RA scheduling is enabled for this function +    // Check that post-RA scheduling is enabled for this target.      const TargetSubtarget &ST = Fn.getTarget().getSubtarget<TargetSubtarget>(); -    if (!ST.enablePostRAScheduler()) -      return true; +    if (!ST.enablePostRAScheduler(OptLevel, AntiDepMode)) +      return false; +  } + +  // Check for antidep breaking override... +  if (EnableAntiDepBreaking.getPosition() > 0) { +    AntiDepMode = (EnableAntiDepBreaking) ?  +      TargetSubtarget::ANTIDEP_CRITICAL : TargetSubtarget::ANTIDEP_NONE;    }    DEBUG(errs() << "PostRAScheduler\n"); @@ -251,7 +264,7 @@ bool PostRAScheduler::runOnMachineFunction(MachineFunction &Fn) {      (ScheduleHazardRecognizer *)new ExactHazardRecognizer(InstrItins) :      (ScheduleHazardRecognizer *)new SimpleHazardRecognizer(); -  SchedulePostRATDList Scheduler(Fn, MLI, MDT, HR, AA); +  SchedulePostRATDList Scheduler(Fn, MLI, MDT, HR, AA, AntiDepMode);    // Loop over all of the basic blocks    for (MachineFunction::iterator MBB = Fn.begin(), MBBe = Fn.end(); @@ -391,7 +404,7 @@ void SchedulePostRATDList::Schedule() {    // Build the scheduling graph.    BuildSchedGraph(AA); -  if (EnableAntiDepBreaking) { +  if (AntiDepMode != TargetSubtarget::ANTIDEP_NONE) {      if (BreakAntiDependencies()) {        // We made changes. Update the dependency graph.        // Theoretically we could update the graph in place: @@ -1195,6 +1208,6 @@ void SchedulePostRATDList::ListScheduleTopDown() {  //                         Public Constructor Functions  //===----------------------------------------------------------------------===// -FunctionPass *llvm::createPostRAScheduler() { -  return new PostRAScheduler(); +FunctionPass *llvm::createPostRAScheduler(CodeGenOpt::Level OptLevel) { +  return new PostRAScheduler(OptLevel);  }  | 
