mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-16 16:16:45 +00:00
Change createPostRAScheduler so it can be turned off at llc -O1.
llvm-svn: 84273
This commit is contained in:
parent
96e3c797d1
commit
e1fbdc5244
@ -15,13 +15,13 @@
|
|||||||
#ifndef LLVM_CODEGEN_PASSES_H
|
#ifndef LLVM_CODEGEN_PASSES_H
|
||||||
#define LLVM_CODEGEN_PASSES_H
|
#define LLVM_CODEGEN_PASSES_H
|
||||||
|
|
||||||
|
#include "llvm/Target/TargetMachine.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
||||||
class FunctionPass;
|
class FunctionPass;
|
||||||
class PassInfo;
|
class PassInfo;
|
||||||
class TargetMachine;
|
|
||||||
class TargetLowering;
|
class TargetLowering;
|
||||||
class RegisterCoalescer;
|
class RegisterCoalescer;
|
||||||
class raw_ostream;
|
class raw_ostream;
|
||||||
@ -119,8 +119,9 @@ namespace llvm {
|
|||||||
///
|
///
|
||||||
FunctionPass *createLowerSubregsPass();
|
FunctionPass *createLowerSubregsPass();
|
||||||
|
|
||||||
/// createPostRAScheduler - under development.
|
/// createPostRAScheduler - This pass performs post register allocation
|
||||||
FunctionPass *createPostRAScheduler();
|
/// scheduling.
|
||||||
|
FunctionPass *createPostRAScheduler(CodeGenOpt::Level OptLevel);
|
||||||
|
|
||||||
/// BranchFolding Pass - This pass performs machine code CFG based
|
/// BranchFolding Pass - This pass performs machine code CFG based
|
||||||
/// optimizations to delete branches to branches, eliminate branches to
|
/// optimizations to delete branches to branches, eliminate branches to
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
#ifndef LLVM_TARGET_TARGETSUBTARGET_H
|
#ifndef LLVM_TARGET_TARGETSUBTARGET_H
|
||||||
#define LLVM_TARGET_TARGETSUBTARGET_H
|
#define LLVM_TARGET_TARGETSUBTARGET_H
|
||||||
|
|
||||||
|
#include "llvm/Target/TargetMachine.h"
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
||||||
class SDep;
|
class SDep;
|
||||||
@ -39,9 +41,12 @@ public:
|
|||||||
/// should be attempted.
|
/// should be attempted.
|
||||||
virtual unsigned getSpecialAddressLatency() const { return 0; }
|
virtual unsigned getSpecialAddressLatency() const { return 0; }
|
||||||
|
|
||||||
// enablePostRAScheduler - Return true to enable
|
// enablePostRAScheduler - If the target can benefit from post-regalloc
|
||||||
// post-register-allocation scheduling.
|
// scheduling and the specified optimization level meets the requirement
|
||||||
virtual bool enablePostRAScheduler() const { return false; }
|
// return true to enable post-register-allocation scheduling.
|
||||||
|
virtual bool enablePostRAScheduler(CodeGenOpt::Level OptLevel) const {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// adjustSchedDependency - Perform target specific adjustments to
|
// adjustSchedDependency - Perform target specific adjustments to
|
||||||
// the latency of a schedule dependency.
|
// the latency of a schedule dependency.
|
||||||
|
@ -323,7 +323,7 @@ bool LLVMTargetMachine::addCommonCodeGenPasses(PassManagerBase &PM,
|
|||||||
|
|
||||||
// Second pass scheduler.
|
// Second pass scheduler.
|
||||||
if (OptLevel != CodeGenOpt::None) {
|
if (OptLevel != CodeGenOpt::None) {
|
||||||
PM.add(createPostRAScheduler());
|
PM.add(createPostRAScheduler(OptLevel));
|
||||||
printAndVerify(PM);
|
printAndVerify(PM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,10 +78,12 @@ DebugMod("postra-sched-debugmod",
|
|||||||
namespace {
|
namespace {
|
||||||
class VISIBILITY_HIDDEN PostRAScheduler : public MachineFunctionPass {
|
class VISIBILITY_HIDDEN PostRAScheduler : public MachineFunctionPass {
|
||||||
AliasAnalysis *AA;
|
AliasAnalysis *AA;
|
||||||
|
CodeGenOpt::Level OptLevel;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static char ID;
|
static char ID;
|
||||||
PostRAScheduler() : MachineFunctionPass(&ID) {}
|
PostRAScheduler(CodeGenOpt::Level ol) :
|
||||||
|
MachineFunctionPass(&ID), OptLevel(ol) {}
|
||||||
|
|
||||||
void getAnalysisUsage(AnalysisUsage &AU) const {
|
void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||||
AU.setPreservesCFG();
|
AU.setPreservesCFG();
|
||||||
@ -238,7 +240,7 @@ bool PostRAScheduler::runOnMachineFunction(MachineFunction &Fn) {
|
|||||||
} else {
|
} else {
|
||||||
// Check that post-RA scheduling is enabled for this target.
|
// Check that post-RA scheduling is enabled for this target.
|
||||||
const TargetSubtarget &ST = Fn.getTarget().getSubtarget<TargetSubtarget>();
|
const TargetSubtarget &ST = Fn.getTarget().getSubtarget<TargetSubtarget>();
|
||||||
if (!ST.enablePostRAScheduler())
|
if (!ST.enablePostRAScheduler(OptLevel))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1195,6 +1197,6 @@ void SchedulePostRATDList::ListScheduleTopDown() {
|
|||||||
// Public Constructor Functions
|
// Public Constructor Functions
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
FunctionPass *llvm::createPostRAScheduler() {
|
FunctionPass *llvm::createPostRAScheduler(CodeGenOpt::Level OptLevel) {
|
||||||
return new PostRAScheduler();
|
return new PostRAScheduler(OptLevel);
|
||||||
}
|
}
|
||||||
|
@ -126,9 +126,11 @@ protected:
|
|||||||
|
|
||||||
const std::string & getCPUString() const { return CPUString; }
|
const std::string & getCPUString() const { return CPUString; }
|
||||||
|
|
||||||
/// enablePostRAScheduler - From TargetSubtarget, return true to
|
/// enablePostRAScheduler - True at 'More' optimization except
|
||||||
/// enable post-RA scheduler.
|
/// for Thumb1.
|
||||||
bool enablePostRAScheduler() const { return PostRAScheduler; }
|
bool enablePostRAScheduler(CodeGenOpt::Level OptLevel) const {
|
||||||
|
return PostRAScheduler && OptLevel >= CodeGenOpt::Default;
|
||||||
|
}
|
||||||
|
|
||||||
/// getInstrItins - Return the instruction itineraies based on subtarget
|
/// getInstrItins - Return the instruction itineraies based on subtarget
|
||||||
/// selection.
|
/// selection.
|
||||||
|
@ -215,6 +215,13 @@ public:
|
|||||||
/// indicating the number of scheduling cycles of backscheduling that
|
/// indicating the number of scheduling cycles of backscheduling that
|
||||||
/// should be attempted.
|
/// should be attempted.
|
||||||
unsigned getSpecialAddressLatency() const;
|
unsigned getSpecialAddressLatency() const;
|
||||||
|
|
||||||
|
/// enablePostRAScheduler - X86 target is enabling post-alloc scheduling
|
||||||
|
/// at 'More' optimization level.
|
||||||
|
bool enablePostRAScheduler(CodeGenOpt::Level OptLevel) const {
|
||||||
|
// FIXME: This causes llvm to miscompile itself on i386. :-(
|
||||||
|
return false/*OptLevel >= CodeGenOpt::Default*/;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End llvm namespace
|
} // End llvm namespace
|
||||||
|
Loading…
Reference in New Issue
Block a user