[llvm-commits] [llvm] r84273 - in /llvm/trunk: include/llvm/CodeGen/Passes.h include/llvm/Target/TargetSubtarget.h lib/CodeGen/LLVMTargetMachine.cpp lib/CodeGen/PostRASchedulerList.cpp lib/Target/ARM/ARMSubtarget.h lib/Target/X86/X86Subtarget.h
Evan Cheng
evan.cheng at apple.com
Fri Oct 16 14:06:16 PDT 2009
Author: evancheng
Date: Fri Oct 16 16:06:15 2009
New Revision: 84273
URL: http://llvm.org/viewvc/llvm-project?rev=84273&view=rev
Log:
Change createPostRAScheduler so it can be turned off at llc -O1.
Modified:
llvm/trunk/include/llvm/CodeGen/Passes.h
llvm/trunk/include/llvm/Target/TargetSubtarget.h
llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp
llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp
llvm/trunk/lib/Target/ARM/ARMSubtarget.h
llvm/trunk/lib/Target/X86/X86Subtarget.h
Modified: llvm/trunk/include/llvm/CodeGen/Passes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/Passes.h?rev=84273&r1=84272&r2=84273&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/Passes.h (original)
+++ llvm/trunk/include/llvm/CodeGen/Passes.h Fri Oct 16 16:06:15 2009
@@ -15,13 +15,13 @@
#ifndef LLVM_CODEGEN_PASSES_H
#define LLVM_CODEGEN_PASSES_H
+#include "llvm/Target/TargetMachine.h"
#include <string>
namespace llvm {
class FunctionPass;
class PassInfo;
- class TargetMachine;
class TargetLowering;
class RegisterCoalescer;
class raw_ostream;
@@ -119,8 +119,9 @@
///
FunctionPass *createLowerSubregsPass();
- /// createPostRAScheduler - under development.
- FunctionPass *createPostRAScheduler();
+ /// createPostRAScheduler - This pass performs post register allocation
+ /// scheduling.
+ FunctionPass *createPostRAScheduler(CodeGenOpt::Level OptLevel);
/// BranchFolding Pass - This pass performs machine code CFG based
/// optimizations to delete branches to branches, eliminate branches to
Modified: llvm/trunk/include/llvm/Target/TargetSubtarget.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetSubtarget.h?rev=84273&r1=84272&r2=84273&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetSubtarget.h (original)
+++ llvm/trunk/include/llvm/Target/TargetSubtarget.h Fri Oct 16 16:06:15 2009
@@ -14,6 +14,8 @@
#ifndef LLVM_TARGET_TARGETSUBTARGET_H
#define LLVM_TARGET_TARGETSUBTARGET_H
+#include "llvm/Target/TargetMachine.h"
+
namespace llvm {
class SDep;
@@ -39,9 +41,12 @@
/// should be attempted.
virtual unsigned getSpecialAddressLatency() const { return 0; }
- // enablePostRAScheduler - Return true to enable
- // post-register-allocation scheduling.
- virtual bool enablePostRAScheduler() const { return false; }
+ // enablePostRAScheduler - If the target can benefit from post-regalloc
+ // scheduling and the specified optimization level meets the requirement
+ // return true to enable post-register-allocation scheduling.
+ virtual bool enablePostRAScheduler(CodeGenOpt::Level OptLevel) const {
+ return false;
+ }
// adjustSchedDependency - Perform target specific adjustments to
// the latency of a schedule dependency.
Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp?rev=84273&r1=84272&r2=84273&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp (original)
+++ llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Fri Oct 16 16:06:15 2009
@@ -323,7 +323,7 @@
// Second pass scheduler.
if (OptLevel != CodeGenOpt::None) {
- PM.add(createPostRAScheduler());
+ PM.add(createPostRAScheduler(OptLevel));
printAndVerify(PM);
}
Modified: llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp?rev=84273&r1=84272&r2=84273&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp (original)
+++ llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp Fri Oct 16 16:06:15 2009
@@ -78,10 +78,12 @@
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();
@@ -238,7 +240,7 @@
} else {
// Check that post-RA scheduling is enabled for this target.
const TargetSubtarget &ST = Fn.getTarget().getSubtarget<TargetSubtarget>();
- if (!ST.enablePostRAScheduler())
+ if (!ST.enablePostRAScheduler(OptLevel))
return false;
}
@@ -1195,6 +1197,6 @@
// Public Constructor Functions
//===----------------------------------------------------------------------===//
-FunctionPass *llvm::createPostRAScheduler() {
- return new PostRAScheduler();
+FunctionPass *llvm::createPostRAScheduler(CodeGenOpt::Level OptLevel) {
+ return new PostRAScheduler(OptLevel);
}
Modified: llvm/trunk/lib/Target/ARM/ARMSubtarget.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMSubtarget.h?rev=84273&r1=84272&r2=84273&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMSubtarget.h (original)
+++ llvm/trunk/lib/Target/ARM/ARMSubtarget.h Fri Oct 16 16:06:15 2009
@@ -126,9 +126,11 @@
const std::string & getCPUString() const { return CPUString; }
- /// enablePostRAScheduler - From TargetSubtarget, return true to
- /// enable post-RA scheduler.
- bool enablePostRAScheduler() const { return PostRAScheduler; }
+ /// enablePostRAScheduler - True at 'More' optimization except
+ /// for Thumb1.
+ bool enablePostRAScheduler(CodeGenOpt::Level OptLevel) const {
+ return PostRAScheduler && OptLevel >= CodeGenOpt::Default;
+ }
/// getInstrItins - Return the instruction itineraies based on subtarget
/// selection.
Modified: llvm/trunk/lib/Target/X86/X86Subtarget.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.h?rev=84273&r1=84272&r2=84273&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86Subtarget.h (original)
+++ llvm/trunk/lib/Target/X86/X86Subtarget.h Fri Oct 16 16:06:15 2009
@@ -215,6 +215,13 @@
/// indicating the number of scheduling cycles of backscheduling that
/// should be attempted.
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
More information about the llvm-commits
mailing list