aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/CodeGen/Passes.h
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2012-02-10 04:10:36 +0000
committerAndrew Trick <atrick@apple.com>2012-02-10 04:10:36 +0000
commit8dd26253f54247e77e5accfdd70e7b4bf27b39c2 (patch)
treedf14b7b3cec3b603bc5feb7070a05f00eb83d4a5 /include/llvm/CodeGen/Passes.h
parent16f72dd68653bd4984363483cfc15ce91fa613d4 (diff)
downloadexternal_llvm-8dd26253f54247e77e5accfdd70e7b4bf27b39c2.zip
external_llvm-8dd26253f54247e77e5accfdd70e7b4bf27b39c2.tar.gz
external_llvm-8dd26253f54247e77e5accfdd70e7b4bf27b39c2.tar.bz2
RegAlloc superpass: includes phi elimination, coalescing, and scheduling.
Creates a configurable regalloc pipeline. Ensure specific llc options do what they say and nothing more: -reglloc=... has no effect other than selecting the allocator pass itself. This patch introduces a new umbrella flag, "-optimize-regalloc", to enable/disable the optimizing regalloc "superpass". This allows for example testing coalscing and scheduling under -O0 or vice-versa. When a CodeGen pass requires the MachineFunction to have a particular property, we need to explicitly define that property so it can be directly queried rather than naming a specific Pass. For example, to check for SSA, use MRI->isSSA, not addRequired<PHIElimination>. CodeGen transformation passes are never "required" as an analysis ProcessImplicitDefs does not require LiveVariables. We have a plan to massively simplify some of the early passes within the regalloc superpass. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150226 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/Passes.h')
-rw-r--r--include/llvm/CodeGen/Passes.h35
1 files changed, 26 insertions, 9 deletions
diff --git a/include/llvm/CodeGen/Passes.h b/include/llvm/CodeGen/Passes.h
index f2deadb..ab07aef 100644
--- a/include/llvm/CodeGen/Passes.h
+++ b/include/llvm/CodeGen/Passes.h
@@ -76,6 +76,8 @@ public:
bool getEnableTailMerge() const { return EnableTailMerge; }
void setEnableTailMerge(bool Enable) { setOpt(EnableTailMerge, Enable); }
+ bool getOptimizeRegAlloc() const;
+
/// Add common target configurable passes that perform LLVM IR to IR
/// transforms following machine independent optimization.
virtual void addIRPasses();
@@ -122,8 +124,17 @@ protected:
return false;
}
- // addRegAlloc - Add standard passes related to register allocation.
- virtual void addRegAlloc();
+ /// createTargetRegisterAllocator - Create the register allocator pass for
+ /// this target at the current optimization level.
+ virtual FunctionPass *createTargetRegisterAllocator(bool Optimized);
+
+ /// addFastRegAlloc - Add the minimum set of target-independent passes that
+ /// are required for fast register allocation.
+ virtual void addFastRegAlloc(FunctionPass *RegAllocPass);
+
+ // addOptimizedRegAlloc - Add passes related to register allocation.
+ // LLVMTargetMachine provides standard regalloc passes for most targets.
+ virtual void addOptimizedRegAlloc(FunctionPass *RegAllocPass);
/// addPostRegAlloc - This method may be implemented by targets that want
/// to run passes after register allocation but before prolog-epilog
@@ -160,6 +171,10 @@ protected:
/// Add a target-independent CodeGen pass at this point in the pipeline.
void addPass(char &ID);
+ /// addMachinePasses helper to create the target-selected or overriden
+ /// regalloc pass.
+ FunctionPass *createRegAllocPass(bool Optimized);
+
/// printNoVerify - Add a pass to dump the machine function, if debugging is
/// enabled.
///
@@ -200,6 +215,10 @@ namespace llvm {
/// EdgeBundles analysis - Bundle machine CFG edges.
extern char &EdgeBundlesID;
+ /// LiveVariables pass - This pass computes the set of blocks in which each
+ /// variable is life and sets machine operand kill flags.
+ extern char &LiveVariablesID;
+
/// PHIElimination - This pass eliminates machine instruction PHI nodes
/// by inserting copy instructions. This destroys SSA information, but is the
/// desired input for some register allocators. This pass is "required" by
@@ -222,8 +241,11 @@ namespace llvm {
/// register allocators.
extern char &TwoAddressInstructionPassID;
- /// RegisteCoalescer - This pass merges live ranges to eliminate copies.
- extern char &RegisterCoalescerPassID;
+ /// ProcessImpicitDefs pass - This pass removes IMPLICIT_DEFs.
+ extern char &ProcessImplicitDefsID;
+
+ /// RegisterCoalescer - This pass merges live ranges to eliminate copies.
+ extern char &RegisterCoalescerID;
/// MachineScheduler - This pass schedules machine instructions.
extern char &MachineSchedulerID;
@@ -239,11 +261,6 @@ namespace llvm {
/// DeadMachineInstructionElim - This pass removes dead machine instructions.
extern char &DeadMachineInstructionElimID;
- /// Creates a register allocator as the user specified on the command line, or
- /// picks one that matches OptLevel.
- ///
- FunctionPass *createRegisterAllocator(CodeGenOpt::Level OptLevel);
-
/// FastRegisterAllocation Pass - This pass register allocates as fast as
/// possible. It is best suited for debug code where live ranges are short.
///