| Misha Brukman | ef6a6a6 | 2003-08-21 22:14:26 +0000 | [diff] [blame] | 1 | //===-- Passes.h - Target independent code generation passes ----*- C++ -*-===// |
| Misha Brukman | ea61c35 | 2005-04-21 20:39:54 +0000 | [diff] [blame] | 2 | // |
| John Criswell | 6fbcc26 | 2003-10-20 20:19:47 +0000 | [diff] [blame] | 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| Chris Lattner | 7ed47a1 | 2007-12-29 19:59:42 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| Misha Brukman | ea61c35 | 2005-04-21 20:39:54 +0000 | [diff] [blame] | 7 | // |
| John Criswell | 6fbcc26 | 2003-10-20 20:19:47 +0000 | [diff] [blame] | 8 | //===----------------------------------------------------------------------===// |
| Chris Lattner | db00065 | 2003-01-13 01:01:31 +0000 | [diff] [blame] | 9 | // |
| Misha Brukman | ef6a6a6 | 2003-08-21 22:14:26 +0000 | [diff] [blame] | 10 | // This file defines interfaces to access the target independent code generation |
| Chris Lattner | db00065 | 2003-01-13 01:01:31 +0000 | [diff] [blame] | 11 | // passes provided by the LLVM backend. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | #ifndef LLVM_CODEGEN_PASSES_H |
| 16 | #define LLVM_CODEGEN_PASSES_H |
| 17 | |
| Andrew Trick | 7461334 | 2012-02-04 02:56:45 +0000 | [diff] [blame] | 18 | #include "llvm/Pass.h" |
| Evan Cheng | fa16354 | 2009-10-16 21:06:15 +0000 | [diff] [blame] | 19 | #include "llvm/Target/TargetMachine.h" |
| Brian Gaeke | fc1f6e8 | 2004-02-04 21:41:10 +0000 | [diff] [blame] | 20 | #include <string> |
| Brian Gaeke | 09caa37 | 2004-01-30 21:53:46 +0000 | [diff] [blame] | 21 | |
| Brian Gaeke | d0fde30 | 2003-11-11 22:41:34 +0000 | [diff] [blame] | 22 | namespace llvm { |
| 23 | |
| Chandler Carruth | cc3d76d | 2013-10-15 02:03:44 +0000 | [diff] [blame] | 24 | class FunctionPass; |
| 25 | class MachineFunctionPass; |
| Andrew Trick | 5e108ee | 2012-02-15 03:21:47 +0000 | [diff] [blame] | 26 | class PassConfigImpl; |
| Chandler Carruth | cc3d76d | 2013-10-15 02:03:44 +0000 | [diff] [blame] | 27 | class PassInfo; |
| Chandler Carruth | cc3d76d | 2013-10-15 02:03:44 +0000 | [diff] [blame] | 28 | class ScheduleDAGInstrs; |
| 29 | class TargetLowering; |
| 30 | class TargetLoweringBase; |
| 31 | class TargetRegisterClass; |
| 32 | class raw_ostream; |
| 33 | struct MachineSchedContext; |
| Andrew Trick | 5e108ee | 2012-02-15 03:21:47 +0000 | [diff] [blame] | 34 | |
| Chandler Carruth | 49837ef | 2013-11-09 12:26:54 +0000 | [diff] [blame] | 35 | // The old pass manager infrastructure is hidden in a legacy namespace now. |
| 36 | namespace legacy { |
| 37 | class PassManagerBase; |
| 38 | } |
| 39 | using legacy::PassManagerBase; |
| 40 | |
| Andrew Trick | 5ed0283 | 2013-04-10 01:06:56 +0000 | [diff] [blame] | 41 | /// Discriminated union of Pass ID types. |
| 42 | /// |
| 43 | /// The PassConfig API prefers dealing with IDs because they are safer and more |
| 44 | /// efficient. IDs decouple configuration from instantiation. This way, when a |
| 45 | /// pass is overriden, it isn't unnecessarily instantiated. It is also unsafe to |
| 46 | /// refer to a Pass pointer after adding it to a pass manager, which deletes |
| 47 | /// redundant pass instances. |
| 48 | /// |
| 49 | /// However, it is convient to directly instantiate target passes with |
| 50 | /// non-default ctors. These often don't have a registered PassInfo. Rather than |
| 51 | /// force all target passes to implement the pass registry boilerplate, allow |
| 52 | /// the PassConfig API to handle either type. |
| 53 | /// |
| 54 | /// AnalysisID is sadly char*, so PointerIntPair won't work. |
| 55 | class IdentifyingPassPtr { |
| Benjamin Kramer | 8f58365 | 2013-04-10 20:50:44 +0000 | [diff] [blame] | 56 | union { |
| 57 | AnalysisID ID; |
| 58 | Pass *P; |
| 59 | }; |
| Andrew Trick | 5ed0283 | 2013-04-10 01:06:56 +0000 | [diff] [blame] | 60 | bool IsInstance; |
| 61 | public: |
| Benjamin Kramer | 8f58365 | 2013-04-10 20:50:44 +0000 | [diff] [blame] | 62 | IdentifyingPassPtr() : P(0), IsInstance(false) {} |
| 63 | IdentifyingPassPtr(AnalysisID IDPtr) : ID(IDPtr), IsInstance(false) {} |
| 64 | IdentifyingPassPtr(Pass *InstancePtr) : P(InstancePtr), IsInstance(true) {} |
| Andrew Trick | 5ed0283 | 2013-04-10 01:06:56 +0000 | [diff] [blame] | 65 | |
| 66 | bool isValid() const { return P; } |
| 67 | bool isInstance() const { return IsInstance; } |
| 68 | |
| 69 | AnalysisID getID() const { |
| 70 | assert(!IsInstance && "Not a Pass ID"); |
| Benjamin Kramer | 8f58365 | 2013-04-10 20:50:44 +0000 | [diff] [blame] | 71 | return ID; |
| Andrew Trick | 5ed0283 | 2013-04-10 01:06:56 +0000 | [diff] [blame] | 72 | } |
| 73 | Pass *getInstance() const { |
| 74 | assert(IsInstance && "Not a Pass Instance"); |
| Benjamin Kramer | 8f58365 | 2013-04-10 20:50:44 +0000 | [diff] [blame] | 75 | return P; |
| Andrew Trick | 5ed0283 | 2013-04-10 01:06:56 +0000 | [diff] [blame] | 76 | } |
| 77 | }; |
| 78 | |
| 79 | template <> struct isPodLike<IdentifyingPassPtr> { |
| 80 | static const bool value = true; |
| 81 | }; |
| 82 | |
| Andrew Trick | 843ee2e | 2012-02-03 05:12:41 +0000 | [diff] [blame] | 83 | /// Target-Independent Code Generator Pass Configuration Options. |
| 84 | /// |
| Andrew Trick | 7461334 | 2012-02-04 02:56:45 +0000 | [diff] [blame] | 85 | /// This is an ImmutablePass solely for the purpose of exposing CodeGen options |
| 86 | /// to the internals of other CodeGen passes. |
| Andrew Trick | 7461334 | 2012-02-04 02:56:45 +0000 | [diff] [blame] | 87 | class TargetPassConfig : public ImmutablePass { |
| Andrew Trick | 79bf288 | 2012-02-15 03:21:51 +0000 | [diff] [blame] | 88 | public: |
| 89 | /// Pseudo Pass IDs. These are defined within TargetPassConfig because they |
| 90 | /// are unregistered pass IDs. They are only useful for use with |
| 91 | /// TargetPassConfig APIs to identify multiple occurrences of the same pass. |
| 92 | /// |
| 93 | |
| 94 | /// EarlyTailDuplicate - A clone of the TailDuplicate pass that runs early |
| 95 | /// during codegen, on SSA form. |
| 96 | static char EarlyTailDuplicateID; |
| 97 | |
| 98 | /// PostRAMachineLICM - A clone of the LICM pass that runs during late machine |
| 99 | /// optimization after regalloc. |
| 100 | static char PostRAMachineLICMID; |
| 101 | |
| Bob Wilson | 564fbf6 | 2012-07-02 19:48:31 +0000 | [diff] [blame] | 102 | private: |
| 103 | PassManagerBase *PM; |
| Bob Wilson | 30a507a | 2012-07-02 19:48:45 +0000 | [diff] [blame] | 104 | AnalysisID StartAfter; |
| 105 | AnalysisID StopAfter; |
| 106 | bool Started; |
| 107 | bool Stopped; |
| Bob Wilson | 564fbf6 | 2012-07-02 19:48:31 +0000 | [diff] [blame] | 108 | |
| Andrew Trick | 843ee2e | 2012-02-03 05:12:41 +0000 | [diff] [blame] | 109 | protected: |
| 110 | TargetMachine *TM; |
| Andrew Trick | 5e108ee | 2012-02-15 03:21:47 +0000 | [diff] [blame] | 111 | PassConfigImpl *Impl; // Internal data structures |
| 112 | bool Initialized; // Flagged after all passes are configured. |
| Andrew Trick | 061efcf | 2012-02-04 02:56:59 +0000 | [diff] [blame] | 113 | |
| 114 | // Target Pass Options |
| Andrew Trick | 61f1e3d | 2012-02-08 21:22:48 +0000 | [diff] [blame] | 115 | // Targets provide a default setting, user flags override. |
| Andrew Trick | 061efcf | 2012-02-04 02:56:59 +0000 | [diff] [blame] | 116 | // |
| Andrew Trick | 843ee2e | 2012-02-03 05:12:41 +0000 | [diff] [blame] | 117 | bool DisableVerify; |
| 118 | |
| Andrew Trick | 61f1e3d | 2012-02-08 21:22:48 +0000 | [diff] [blame] | 119 | /// Default setting for -enable-tail-merge on this target. |
| 120 | bool EnableTailMerge; |
| 121 | |
| Andrew Trick | 843ee2e | 2012-02-03 05:12:41 +0000 | [diff] [blame] | 122 | public: |
| Andrew Trick | 061efcf | 2012-02-04 02:56:59 +0000 | [diff] [blame] | 123 | TargetPassConfig(TargetMachine *tm, PassManagerBase &pm); |
| Andrew Trick | 7461334 | 2012-02-04 02:56:45 +0000 | [diff] [blame] | 124 | // Dummy constructor. |
| 125 | TargetPassConfig(); |
| Andrew Trick | 843ee2e | 2012-02-03 05:12:41 +0000 | [diff] [blame] | 126 | |
| Andrew Trick | 7461334 | 2012-02-04 02:56:45 +0000 | [diff] [blame] | 127 | virtual ~TargetPassConfig(); |
| 128 | |
| 129 | static char ID; |
| Andrew Trick | 843ee2e | 2012-02-03 05:12:41 +0000 | [diff] [blame] | 130 | |
| 131 | /// Get the right type of TargetMachine for this target. |
| 132 | template<typename TMC> TMC &getTM() const { |
| 133 | return *static_cast<TMC*>(TM); |
| 134 | } |
| 135 | |
| Andrew Trick | 061efcf | 2012-02-04 02:56:59 +0000 | [diff] [blame] | 136 | const TargetLowering *getTargetLowering() const { |
| 137 | return TM->getTargetLowering(); |
| 138 | } |
| 139 | |
| Andrew Trick | 5e108ee | 2012-02-15 03:21:47 +0000 | [diff] [blame] | 140 | // |
| Andrew Trick | ffea03f | 2012-02-08 21:22:39 +0000 | [diff] [blame] | 141 | void setInitialized() { Initialized = true; } |
| 142 | |
| Andrew Trick | 843ee2e | 2012-02-03 05:12:41 +0000 | [diff] [blame] | 143 | CodeGenOpt::Level getOptLevel() const { return TM->getOptLevel(); } |
| 144 | |
| Bob Wilson | 30a507a | 2012-07-02 19:48:45 +0000 | [diff] [blame] | 145 | /// setStartStopPasses - Set the StartAfter and StopAfter passes to allow |
| 146 | /// running only a portion of the normal code-gen pass sequence. If the |
| 147 | /// Start pass ID is zero, then compilation will begin at the normal point; |
| 148 | /// otherwise, clear the Started flag to indicate that passes should not be |
| 149 | /// added until the starting pass is seen. If the Stop pass ID is zero, |
| 150 | /// then compilation will continue to the end. |
| 151 | void setStartStopPasses(AnalysisID Start, AnalysisID Stop) { |
| 152 | StartAfter = Start; |
| 153 | StopAfter = Stop; |
| 154 | Started = (StartAfter == 0); |
| 155 | } |
| 156 | |
| Andrew Trick | 61f1e3d | 2012-02-08 21:22:48 +0000 | [diff] [blame] | 157 | void setDisableVerify(bool Disable) { setOpt(DisableVerify, Disable); } |
| 158 | |
| 159 | bool getEnableTailMerge() const { return EnableTailMerge; } |
| 160 | void setEnableTailMerge(bool Enable) { setOpt(EnableTailMerge, Enable); } |
| Andrew Trick | 061efcf | 2012-02-04 02:56:59 +0000 | [diff] [blame] | 161 | |
| Andrew Trick | 5e108ee | 2012-02-15 03:21:47 +0000 | [diff] [blame] | 162 | /// Allow the target to override a specific pass without overriding the pass |
| 163 | /// pipeline. When passes are added to the standard pipeline at the |
| Bob Wilson | 3fb99a7 | 2012-07-02 19:48:37 +0000 | [diff] [blame] | 164 | /// point where StandardID is expected, add TargetID in its place. |
| Andrew Trick | 5ed0283 | 2013-04-10 01:06:56 +0000 | [diff] [blame] | 165 | void substitutePass(AnalysisID StandardID, IdentifyingPassPtr TargetID); |
| Andrew Trick | 5e108ee | 2012-02-15 03:21:47 +0000 | [diff] [blame] | 166 | |
| Bob Wilson | 6e1b812 | 2012-05-30 00:17:12 +0000 | [diff] [blame] | 167 | /// Insert InsertedPassID pass after TargetPassID pass. |
| Andrew Trick | 5ed0283 | 2013-04-10 01:06:56 +0000 | [diff] [blame] | 168 | void insertPass(AnalysisID TargetPassID, IdentifyingPassPtr InsertedPassID); |
| Bob Wilson | 6e1b812 | 2012-05-30 00:17:12 +0000 | [diff] [blame] | 169 | |
| Andrew Trick | f91a330 | 2012-03-09 00:52:17 +0000 | [diff] [blame] | 170 | /// Allow the target to enable a specific standard pass by default. |
| Bob Wilson | 3fb99a7 | 2012-07-02 19:48:37 +0000 | [diff] [blame] | 171 | void enablePass(AnalysisID PassID) { substitutePass(PassID, PassID); } |
| Andrew Trick | f91a330 | 2012-03-09 00:52:17 +0000 | [diff] [blame] | 172 | |
| 173 | /// Allow the target to disable a specific standard pass by default. |
| Andrew Trick | 5ed0283 | 2013-04-10 01:06:56 +0000 | [diff] [blame] | 174 | void disablePass(AnalysisID PassID) { |
| 175 | substitutePass(PassID, IdentifyingPassPtr()); |
| 176 | } |
| Andrew Trick | 5e108ee | 2012-02-15 03:21:47 +0000 | [diff] [blame] | 177 | |
| Bob Wilson | 3fb99a7 | 2012-07-02 19:48:37 +0000 | [diff] [blame] | 178 | /// Return the pass substituted for StandardID by the target. |
| Andrew Trick | 5e108ee | 2012-02-15 03:21:47 +0000 | [diff] [blame] | 179 | /// If no substitution exists, return StandardID. |
| Andrew Trick | 5ed0283 | 2013-04-10 01:06:56 +0000 | [diff] [blame] | 180 | IdentifyingPassPtr getPassSubstitution(AnalysisID StandardID) const; |
| Andrew Trick | 5e108ee | 2012-02-15 03:21:47 +0000 | [diff] [blame] | 181 | |
| Andrew Trick | 5fd84a2 | 2012-02-15 03:21:43 +0000 | [diff] [blame] | 182 | /// Return true if the optimized regalloc pipeline is enabled. |
| Andrew Trick | 8dd2625 | 2012-02-10 04:10:36 +0000 | [diff] [blame] | 183 | bool getOptimizeRegAlloc() const; |
| 184 | |
| Andrew Trick | 061efcf | 2012-02-04 02:56:59 +0000 | [diff] [blame] | 185 | /// Add common target configurable passes that perform LLVM IR to IR |
| 186 | /// transforms following machine independent optimization. |
| 187 | virtual void addIRPasses(); |
| 188 | |
| Bob Wilson | 564fbf6 | 2012-07-02 19:48:31 +0000 | [diff] [blame] | 189 | /// Add passes to lower exception handling for the code generator. |
| 190 | void addPassesToHandleExceptions(); |
| 191 | |
| Bill Wendling | 08510b1 | 2012-11-30 22:08:55 +0000 | [diff] [blame] | 192 | /// Add pass to prepare the LLVM IR for code generation. This should be done |
| 193 | /// before exception handling preparation passes. |
| 194 | virtual void addCodeGenPrepare(); |
| 195 | |
| Andrew Trick | 061efcf | 2012-02-04 02:56:59 +0000 | [diff] [blame] | 196 | /// Add common passes that perform LLVM IR to IR transforms in preparation for |
| 197 | /// instruction selection. |
| 198 | virtual void addISelPrepare(); |
| 199 | |
| 200 | /// addInstSelector - This method should install an instruction selector pass, |
| 201 | /// which converts from LLVM code to machine instructions. |
| 202 | virtual bool addInstSelector() { |
| 203 | return true; |
| 204 | } |
| Andrew Trick | 843ee2e | 2012-02-03 05:12:41 +0000 | [diff] [blame] | 205 | |
| 206 | /// Add the complete, standard set of LLVM CodeGen passes. |
| 207 | /// Fully developed targets will not generally override this. |
| Andrew Trick | 061efcf | 2012-02-04 02:56:59 +0000 | [diff] [blame] | 208 | virtual void addMachinePasses(); |
| Andrew Trick | 9d41bd5 | 2012-02-08 21:23:03 +0000 | [diff] [blame] | 209 | |
| Andrew Trick | f45edcc | 2013-09-20 05:14:41 +0000 | [diff] [blame] | 210 | /// createTargetScheduler - Create an instance of ScheduleDAGInstrs to be run |
| 211 | /// within the standard MachineScheduler pass for this function and target at |
| 212 | /// the current optimization level. |
| 213 | /// |
| 214 | /// This can also be used to plug a new MachineSchedStrategy into an instance |
| 215 | /// of the standard ScheduleDAGMI: |
| 216 | /// return new ScheduleDAGMI(C, new MyStrategy(C)) |
| 217 | /// |
| 218 | /// Return NULL to select the default (generic) machine scheduler. |
| 219 | virtual ScheduleDAGInstrs * |
| 220 | createMachineScheduler(MachineSchedContext *C) const { |
| 221 | return 0; |
| 222 | } |
| 223 | |
| Andrew Trick | 843ee2e | 2012-02-03 05:12:41 +0000 | [diff] [blame] | 224 | protected: |
| Andrew Trick | ffea03f | 2012-02-08 21:22:39 +0000 | [diff] [blame] | 225 | // Helper to verify the analysis is really immutable. |
| 226 | void setOpt(bool &Opt, bool Val); |
| 227 | |
| Andrew Trick | 061efcf | 2012-02-04 02:56:59 +0000 | [diff] [blame] | 228 | /// Methods with trivial inline returns are convenient points in the common |
| 229 | /// codegen pass pipeline where targets may insert passes. Methods with |
| 230 | /// out-of-line standard implementations are major CodeGen stages called by |
| 231 | /// addMachinePasses. Some targets may override major stages when inserting |
| 232 | /// passes is insufficient, but maintaining overriden stages is more work. |
| Andrew Trick | 843ee2e | 2012-02-03 05:12:41 +0000 | [diff] [blame] | 233 | /// |
| 234 | |
| 235 | /// addPreISelPasses - This method should add any "last minute" LLVM->LLVM |
| 236 | /// passes (which are run just before instruction selector). |
| 237 | virtual bool addPreISel() { |
| 238 | return true; |
| 239 | } |
| 240 | |
| Andrew Trick | f7b9631 | 2012-02-09 00:40:55 +0000 | [diff] [blame] | 241 | /// addMachineSSAOptimization - Add standard passes that optimize machine |
| 242 | /// instructions in SSA form. |
| 243 | virtual void addMachineSSAOptimization(); |
| 244 | |
| Jakob Stoklund Olesen | 02c6325 | 2013-01-17 00:58:38 +0000 | [diff] [blame] | 245 | /// Add passes that optimize instruction level parallelism for out-of-order |
| 246 | /// targets. These passes are run while the machine code is still in SSA |
| 247 | /// form, so they can use MachineTraceMetrics to control their heuristics. |
| 248 | /// |
| 249 | /// All passes added here should preserve the MachineDominatorTree, |
| 250 | /// MachineLoopInfo, and MachineTraceMetrics analyses. |
| 251 | virtual bool addILPOpts() { |
| 252 | return false; |
| 253 | } |
| 254 | |
| Andrew Trick | 843ee2e | 2012-02-03 05:12:41 +0000 | [diff] [blame] | 255 | /// addPreRegAlloc - This method may be implemented by targets that want to |
| 256 | /// run passes immediately before register allocation. This should return |
| 257 | /// true if -print-machineinstrs should print after these passes. |
| 258 | virtual bool addPreRegAlloc() { |
| 259 | return false; |
| 260 | } |
| 261 | |
| Andrew Trick | 8dd2625 | 2012-02-10 04:10:36 +0000 | [diff] [blame] | 262 | /// createTargetRegisterAllocator - Create the register allocator pass for |
| 263 | /// this target at the current optimization level. |
| 264 | virtual FunctionPass *createTargetRegisterAllocator(bool Optimized); |
| 265 | |
| 266 | /// addFastRegAlloc - Add the minimum set of target-independent passes that |
| 267 | /// are required for fast register allocation. |
| 268 | virtual void addFastRegAlloc(FunctionPass *RegAllocPass); |
| 269 | |
| Andrew Trick | fda655e | 2012-02-11 07:11:29 +0000 | [diff] [blame] | 270 | /// addOptimizedRegAlloc - Add passes related to register allocation. |
| 271 | /// LLVMTargetMachine provides standard regalloc passes for most targets. |
| Andrew Trick | 8dd2625 | 2012-02-10 04:10:36 +0000 | [diff] [blame] | 272 | virtual void addOptimizedRegAlloc(FunctionPass *RegAllocPass); |
| Andrew Trick | f7b9631 | 2012-02-09 00:40:55 +0000 | [diff] [blame] | 273 | |
| Jakob Stoklund Olesen | 34f5a2b | 2012-06-26 17:09:29 +0000 | [diff] [blame] | 274 | /// addPreRewrite - Add passes to the optimized register allocation pipeline |
| 275 | /// after register allocation is complete, but before virtual registers are |
| 276 | /// rewritten to physical registers. |
| 277 | /// |
| 278 | /// These passes must preserve VirtRegMap and LiveIntervals, and when running |
| 279 | /// after RABasic or RAGreedy, they should take advantage of LiveRegMatrix. |
| 280 | /// When these passes run, VirtRegMap contains legal physreg assignments for |
| 281 | /// all virtual registers. |
| 282 | virtual bool addPreRewrite() { |
| 283 | return false; |
| 284 | } |
| 285 | |
| Andrew Trick | 746f24b | 2012-02-11 07:11:32 +0000 | [diff] [blame] | 286 | /// addPostRegAlloc - This method may be implemented by targets that want to |
| 287 | /// run passes after register allocation pass pipeline but before |
| 288 | /// prolog-epilog insertion. This should return true if -print-machineinstrs |
| 289 | /// should print after these passes. |
| Andrew Trick | 843ee2e | 2012-02-03 05:12:41 +0000 | [diff] [blame] | 290 | virtual bool addPostRegAlloc() { |
| 291 | return false; |
| 292 | } |
| 293 | |
| Andrew Trick | f7b9631 | 2012-02-09 00:40:55 +0000 | [diff] [blame] | 294 | /// Add passes that optimize machine instructions after register allocation. |
| 295 | virtual void addMachineLateOptimization(); |
| 296 | |
| Andrew Trick | 843ee2e | 2012-02-03 05:12:41 +0000 | [diff] [blame] | 297 | /// addPreSched2 - This method may be implemented by targets that want to |
| 298 | /// run passes after prolog-epilog insertion and before the second instruction |
| 299 | /// scheduling pass. This should return true if -print-machineinstrs should |
| 300 | /// print after these passes. |
| 301 | virtual bool addPreSched2() { |
| 302 | return false; |
| 303 | } |
| 304 | |
| Evan Cheng | ab37b2c | 2012-12-21 02:57:04 +0000 | [diff] [blame] | 305 | /// addGCPasses - Add late codegen passes that analyze code for garbage |
| 306 | /// collection. This should return true if GC info should be printed after |
| 307 | /// these passes. |
| 308 | virtual bool addGCPasses(); |
| 309 | |
| Andrew Trick | f7b9631 | 2012-02-09 00:40:55 +0000 | [diff] [blame] | 310 | /// Add standard basic block placement passes. |
| 311 | virtual void addBlockPlacement(); |
| 312 | |
| Andrew Trick | 843ee2e | 2012-02-03 05:12:41 +0000 | [diff] [blame] | 313 | /// addPreEmitPass - This pass may be implemented by targets that want to run |
| 314 | /// passes immediately before machine code is emitted. This should return |
| 315 | /// true if -print-machineinstrs should print out the code after the passes. |
| 316 | virtual bool addPreEmitPass() { |
| 317 | return false; |
| 318 | } |
| 319 | |
| 320 | /// Utilities for targets to add passes to the pass manager. |
| 321 | /// |
| 322 | |
| Andrew Trick | 5e108ee | 2012-02-15 03:21:47 +0000 | [diff] [blame] | 323 | /// Add a CodeGen pass at this point in the pipeline after checking overrides. |
| Bob Wilson | 3fb99a7 | 2012-07-02 19:48:37 +0000 | [diff] [blame] | 324 | /// Return the pass that was added, or zero if no pass was added. |
| 325 | AnalysisID addPass(AnalysisID PassID); |
| Andrew Trick | 843ee2e | 2012-02-03 05:12:41 +0000 | [diff] [blame] | 326 | |
| Bob Wilson | 30a507a | 2012-07-02 19:48:45 +0000 | [diff] [blame] | 327 | /// Add a pass to the PassManager if that pass is supposed to be run, as |
| Benjamin Kramer | f8e16c6 | 2013-08-05 11:11:11 +0000 | [diff] [blame] | 328 | /// determined by the StartAfter and StopAfter options. Takes ownership of the |
| 329 | /// pass. |
| Bob Wilson | 564fbf6 | 2012-07-02 19:48:31 +0000 | [diff] [blame] | 330 | void addPass(Pass *P); |
| 331 | |
| Andrew Trick | 8dd2625 | 2012-02-10 04:10:36 +0000 | [diff] [blame] | 332 | /// addMachinePasses helper to create the target-selected or overriden |
| 333 | /// regalloc pass. |
| 334 | FunctionPass *createRegAllocPass(bool Optimized); |
| 335 | |
| Andrew Trick | 843ee2e | 2012-02-03 05:12:41 +0000 | [diff] [blame] | 336 | /// printAndVerify - Add a pass to dump then verify the machine function, if |
| 337 | /// those steps are enabled. |
| 338 | /// |
| Bob Wilson | 564fbf6 | 2012-07-02 19:48:31 +0000 | [diff] [blame] | 339 | void printAndVerify(const char *Banner); |
| Andrew Trick | 843ee2e | 2012-02-03 05:12:41 +0000 | [diff] [blame] | 340 | }; |
| 341 | } // namespace llvm |
| 342 | |
| 343 | /// List of target independent CodeGen pass IDs. |
| 344 | namespace llvm { |
| Chandler Carruth | aeef83c | 2013-01-07 01:37:14 +0000 | [diff] [blame] | 345 | /// \brief Create a basic TargetTransformInfo analysis pass. |
| 346 | /// |
| 347 | /// This pass implements the target transform info analysis using the target |
| 348 | /// independent information available to the LLVM code generator. |
| Benjamin Kramer | 69e42db | 2013-01-11 20:05:37 +0000 | [diff] [blame] | 349 | ImmutablePass * |
| Bill Wendling | f9fd58a | 2013-06-19 21:07:11 +0000 | [diff] [blame] | 350 | createBasicTargetTransformInfoPass(const TargetMachine *TM); |
| Chandler Carruth | aeef83c | 2013-01-07 01:37:14 +0000 | [diff] [blame] | 351 | |
| Chris Lattner | 8b708e4 | 2004-07-02 05:44:13 +0000 | [diff] [blame] | 352 | /// createUnreachableBlockEliminationPass - The LLVM code generator does not |
| 353 | /// work well with unreachable basic blocks (what live ranges make sense for a |
| 354 | /// block that cannot be reached?). As such, a code generator should either |
| Jim Grosbach | f691229 | 2010-08-06 21:31:35 +0000 | [diff] [blame] | 355 | /// not instruction select unreachable blocks, or run this pass as its |
| Chris Lattner | 8b708e4 | 2004-07-02 05:44:13 +0000 | [diff] [blame] | 356 | /// last LLVM modifying pass to clean up blocks that are not reachable from |
| 357 | /// the entry block. |
| 358 | FunctionPass *createUnreachableBlockEliminationPass(); |
| Misha Brukman | ea61c35 | 2005-04-21 20:39:54 +0000 | [diff] [blame] | 359 | |
| Chris Lattner | 3e200e6 | 2003-12-20 10:18:58 +0000 | [diff] [blame] | 360 | /// MachineFunctionPrinter pass - This pass prints out the machine function to |
| Jim Grosbach | f691229 | 2010-08-06 21:31:35 +0000 | [diff] [blame] | 361 | /// the given stream as a debugging tool. |
| David Greene | 5c8aa95 | 2010-04-02 23:17:14 +0000 | [diff] [blame] | 362 | MachineFunctionPass * |
| 363 | createMachineFunctionPrinterPass(raw_ostream &OS, |
| 364 | const std::string &Banner =""); |
| Brian Gaeke | 09caa37 | 2004-01-30 21:53:46 +0000 | [diff] [blame] | 365 | |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 366 | /// MachineLoopInfo - This pass is a loop analysis pass. |
| Owen Anderson | 90c579d | 2010-08-06 18:33:48 +0000 | [diff] [blame] | 367 | extern char &MachineLoopInfoID; |
| Bill Wendling | 67d65bb | 2008-01-04 20:54:55 +0000 | [diff] [blame] | 368 | |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 369 | /// MachineDominators - This pass is a machine dominators analysis pass. |
| Owen Anderson | 90c579d | 2010-08-06 18:33:48 +0000 | [diff] [blame] | 370 | extern char &MachineDominatorsID; |
| Bill Wendling | 67d65bb | 2008-01-04 20:54:55 +0000 | [diff] [blame] | 371 | |
| Jakob Stoklund Olesen | 8dd070e | 2011-01-04 21:10:05 +0000 | [diff] [blame] | 372 | /// EdgeBundles analysis - Bundle machine CFG edges. |
| Jakob Stoklund Olesen | 8dd070e | 2011-01-04 21:10:05 +0000 | [diff] [blame] | 373 | extern char &EdgeBundlesID; |
| 374 | |
| Andrew Trick | 8dd2625 | 2012-02-10 04:10:36 +0000 | [diff] [blame] | 375 | /// LiveVariables pass - This pass computes the set of blocks in which each |
| 376 | /// variable is life and sets machine operand kill flags. |
| 377 | extern char &LiveVariablesID; |
| 378 | |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 379 | /// PHIElimination - This pass eliminates machine instruction PHI nodes |
| Chris Lattner | 3e200e6 | 2003-12-20 10:18:58 +0000 | [diff] [blame] | 380 | /// by inserting copy instructions. This destroys SSA information, but is the |
| 381 | /// desired input for some register allocators. This pass is "required" by |
| 382 | /// these register allocator like this: AU.addRequiredID(PHIEliminationID); |
| Owen Anderson | 90c579d | 2010-08-06 18:33:48 +0000 | [diff] [blame] | 383 | extern char &PHIEliminationID; |
| Jim Grosbach | f691229 | 2010-08-06 21:31:35 +0000 | [diff] [blame] | 384 | |
| Jakob Stoklund Olesen | dcc4436 | 2012-08-03 22:12:54 +0000 | [diff] [blame] | 385 | /// LiveIntervals - This analysis keeps track of the live ranges of virtual |
| 386 | /// and physical registers. |
| 387 | extern char &LiveIntervalsID; |
| 388 | |
| Jakob Stoklund Olesen | 2d17293 | 2010-10-26 00:11:33 +0000 | [diff] [blame] | 389 | /// LiveStacks pass. An analysis keeping track of the liveness of stack slots. |
| 390 | extern char &LiveStacksID; |
| 391 | |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 392 | /// TwoAddressInstruction - This pass reduces two-address instructions to |
| Chris Lattner | 3e200e6 | 2003-12-20 10:18:58 +0000 | [diff] [blame] | 393 | /// use two operands. This destroys SSA information but it is desired by |
| 394 | /// register allocators. |
| Owen Anderson | 90c579d | 2010-08-06 18:33:48 +0000 | [diff] [blame] | 395 | extern char &TwoAddressInstructionPassID; |
| Chris Lattner | db00065 | 2003-01-13 01:01:31 +0000 | [diff] [blame] | 396 | |
| Andrew Trick | 8dd2625 | 2012-02-10 04:10:36 +0000 | [diff] [blame] | 397 | /// ProcessImpicitDefs pass - This pass removes IMPLICIT_DEFs. |
| 398 | extern char &ProcessImplicitDefsID; |
| 399 | |
| 400 | /// RegisterCoalescer - This pass merges live ranges to eliminate copies. |
| 401 | extern char &RegisterCoalescerID; |
| Jakob Stoklund Olesen | 2721567 | 2011-08-09 00:29:53 +0000 | [diff] [blame] | 402 | |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 403 | /// MachineScheduler - This pass schedules machine instructions. |
| Andrew Trick | 42b7a71 | 2012-01-17 06:55:03 +0000 | [diff] [blame] | 404 | extern char &MachineSchedulerID; |
| Andrew Trick | 96f678f | 2012-01-13 06:30:30 +0000 | [diff] [blame] | 405 | |
| Jakob Stoklund Olesen | 8bfe508 | 2011-01-06 01:21:53 +0000 | [diff] [blame] | 406 | /// SpillPlacement analysis. Suggest optimal placement of spill code between |
| 407 | /// basic blocks. |
| Jakob Stoklund Olesen | 8bfe508 | 2011-01-06 01:21:53 +0000 | [diff] [blame] | 408 | extern char &SpillPlacementID; |
| 409 | |
| Jakob Stoklund Olesen | 05ec712 | 2012-06-08 23:44:45 +0000 | [diff] [blame] | 410 | /// VirtRegRewriter pass. Rewrite virtual registers to physical registers as |
| 411 | /// assigned in VirtRegMap. |
| 412 | extern char &VirtRegRewriterID; |
| 413 | |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 414 | /// UnreachableMachineBlockElimination - This pass removes unreachable |
| Owen Anderson | bd3ba46 | 2008-08-04 23:54:43 +0000 | [diff] [blame] | 415 | /// machine basic blocks. |
| Owen Anderson | 90c579d | 2010-08-06 18:33:48 +0000 | [diff] [blame] | 416 | extern char &UnreachableMachineBlockElimID; |
| Owen Anderson | bd3ba46 | 2008-08-04 23:54:43 +0000 | [diff] [blame] | 417 | |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 418 | /// DeadMachineInstructionElim - This pass removes dead machine instructions. |
| 419 | extern char &DeadMachineInstructionElimID; |
| Dan Gohman | d3ead43 | 2008-09-17 00:43:24 +0000 | [diff] [blame] | 420 | |
| Jakob Stoklund Olesen | 0020723 | 2010-04-21 18:02:42 +0000 | [diff] [blame] | 421 | /// FastRegisterAllocation Pass - This pass register allocates as fast as |
| 422 | /// possible. It is best suited for debug code where live ranges are short. |
| 423 | /// |
| 424 | FunctionPass *createFastRegisterAllocator(); |
| 425 | |
| Andrew Trick | 14e8d71 | 2010-10-22 23:09:15 +0000 | [diff] [blame] | 426 | /// BasicRegisterAllocation Pass - This pass implements a degenerate global |
| 427 | /// register allocator using the basic regalloc framework. |
| 428 | /// |
| 429 | FunctionPass *createBasicRegisterAllocator(); |
| 430 | |
| Jakob Stoklund Olesen | cba2e06 | 2010-12-08 03:26:16 +0000 | [diff] [blame] | 431 | /// Greedy register allocation pass - This pass implements a global register |
| 432 | /// allocator for optimized builds. |
| 433 | /// |
| 434 | FunctionPass *createGreedyRegisterAllocator(); |
| 435 | |
| Evan Cheng | b1290a6 | 2008-10-02 18:29:27 +0000 | [diff] [blame] | 436 | /// PBQPRegisterAllocation Pass - This pass implements the Partitioned Boolean |
| 437 | /// Quadratic Prograaming (PBQP) based register allocator. |
| 438 | /// |
| Lang Hames | f70e7cc | 2010-09-23 04:28:54 +0000 | [diff] [blame] | 439 | FunctionPass *createDefaultPBQPRegisterAllocator(); |
| Evan Cheng | b1290a6 | 2008-10-02 18:29:27 +0000 | [diff] [blame] | 440 | |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 441 | /// PrologEpilogCodeInserter - This pass inserts prolog and epilog code, |
| Chris Lattner | 3e200e6 | 2003-12-20 10:18:58 +0000 | [diff] [blame] | 442 | /// and eliminates abstract frame references. |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 443 | extern char &PrologEpilogCodeInserterID; |
| Jim Grosbach | f691229 | 2010-08-06 21:31:35 +0000 | [diff] [blame] | 444 | |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 445 | /// ExpandPostRAPseudos - This pass expands pseudo instructions after |
| Jakob Stoklund Olesen | 74e2d6e | 2011-09-25 16:46:08 +0000 | [diff] [blame] | 446 | /// register allocation. |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 447 | extern char &ExpandPostRAPseudosID; |
| Chris Lattner | db00065 | 2003-01-13 01:01:31 +0000 | [diff] [blame] | 448 | |
| Evan Cheng | fa16354 | 2009-10-16 21:06:15 +0000 | [diff] [blame] | 449 | /// createPostRAScheduler - This pass performs post register allocation |
| 450 | /// scheduling. |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 451 | extern char &PostRASchedulerID; |
| Dale Johannesen | e7e7d0d | 2007-07-13 17:13:54 +0000 | [diff] [blame] | 452 | |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 453 | /// BranchFolding - This pass performs machine code CFG based |
| Chris Lattner | 36c29db | 2004-07-31 09:59:14 +0000 | [diff] [blame] | 454 | /// optimizations to delete branches to branches, eliminate branches to |
| 455 | /// successor blocks (creating fall throughs), and eliminating branches over |
| 456 | /// branches. |
| Andrew Trick | 61f1e3d | 2012-02-08 21:22:48 +0000 | [diff] [blame] | 457 | extern char &BranchFolderPassID; |
| Chris Lattner | 36c29db | 2004-07-31 09:59:14 +0000 | [diff] [blame] | 458 | |
| Bob Wilson | 6e1b812 | 2012-05-30 00:17:12 +0000 | [diff] [blame] | 459 | /// MachineFunctionPrinterPass - This pass prints out MachineInstr's. |
| 460 | extern char &MachineFunctionPrinterPassID; |
| 461 | |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 462 | /// TailDuplicate - Duplicate blocks with unconditional branches |
| Bob Wilson | 15acadd | 2009-11-26 00:32:21 +0000 | [diff] [blame] | 463 | /// into tails of their predecessors. |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 464 | extern char &TailDuplicateID; |
| Bob Wilson | 15acadd | 2009-11-26 00:32:21 +0000 | [diff] [blame] | 465 | |
| Jakob Stoklund Olesen | 9f63e10 | 2012-07-26 18:38:11 +0000 | [diff] [blame] | 466 | /// MachineTraceMetrics - This pass computes critical path and CPU resource |
| 467 | /// usage in an ensemble of traces. |
| 468 | extern char &MachineTraceMetricsID; |
| 469 | |
| Jakob Stoklund Olesen | 33242fd | 2012-07-04 00:09:54 +0000 | [diff] [blame] | 470 | /// EarlyIfConverter - This pass performs if-conversion on SSA form by |
| 471 | /// inserting cmov instructions. |
| 472 | extern char &EarlyIfConverterID; |
| 473 | |
| Nadav Rotem | c05d306 | 2012-09-06 09:17:37 +0000 | [diff] [blame] | 474 | /// StackSlotColoring - This pass performs stack coloring and merging. |
| 475 | /// It merges disjoint allocas to reduce the stack size. |
| 476 | extern char &StackColoringID; |
| 477 | |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 478 | /// IfConverter - This pass performs machine code if conversion. |
| 479 | extern char &IfConverterID; |
| Evan Cheng | 4e65485 | 2007-05-16 02:00:57 +0000 | [diff] [blame] | 480 | |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 481 | /// MachineBlockPlacement - This pass places basic blocks based on branch |
| Chandler Carruth | db35087 | 2011-10-21 06:46:38 +0000 | [diff] [blame] | 482 | /// probabilities. |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 483 | extern char &MachineBlockPlacementID; |
| Chandler Carruth | db35087 | 2011-10-21 06:46:38 +0000 | [diff] [blame] | 484 | |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 485 | /// MachineBlockPlacementStats - This pass collects statistics about the |
| Chandler Carruth | 37efc9f | 2011-11-02 07:17:12 +0000 | [diff] [blame] | 486 | /// basic block placement using branch probabilities and block frequency |
| 487 | /// information. |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 488 | extern char &MachineBlockPlacementStatsID; |
| Chandler Carruth | 37efc9f | 2011-11-02 07:17:12 +0000 | [diff] [blame] | 489 | |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 490 | /// GCLowering Pass - Performs target-independent LLVM IR transformations for |
| 491 | /// highly portable strategies. |
| 492 | /// |
| Gordon Henriksen | ad93c4f | 2007-12-11 00:30:17 +0000 | [diff] [blame] | 493 | FunctionPass *createGCLoweringPass(); |
| Jim Grosbach | f691229 | 2010-08-06 21:31:35 +0000 | [diff] [blame] | 494 | |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 495 | /// GCMachineCodeAnalysis - Target-independent pass to mark safe points |
| 496 | /// in machine code. Must be added very late during code generation, just |
| 497 | /// prior to output, and importantly after all CFG transformations (such as |
| 498 | /// branch folding). |
| 499 | extern char &GCMachineCodeAnalysisID; |
| Jim Grosbach | f691229 | 2010-08-06 21:31:35 +0000 | [diff] [blame] | 500 | |
| Gordon Henriksen | 5eca075 | 2008-08-17 18:44:35 +0000 | [diff] [blame] | 501 | /// Creates a pass to print GC metadata. |
| Jim Grosbach | f691229 | 2010-08-06 21:31:35 +0000 | [diff] [blame] | 502 | /// |
| Chris Lattner | cf143a4 | 2009-08-23 03:13:20 +0000 | [diff] [blame] | 503 | FunctionPass *createGCInfoPrinter(raw_ostream &OS); |
| Jim Grosbach | f691229 | 2010-08-06 21:31:35 +0000 | [diff] [blame] | 504 | |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 505 | /// MachineCSE - This pass performs global CSE on machine instructions. |
| 506 | extern char &MachineCSEID; |
| Evan Cheng | c6fe333 | 2010-03-02 02:38:24 +0000 | [diff] [blame] | 507 | |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 508 | /// MachineLICM - This pass performs LICM on machine instructions. |
| 509 | extern char &MachineLICMID; |
| Bill Wendling | 0f940c9 | 2007-12-07 21:42:31 +0000 | [diff] [blame] | 510 | |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 511 | /// MachineSinking - This pass performs sinking on machine instructions. |
| 512 | extern char &MachineSinkingID; |
| Evan Cheng | 3f32d65 | 2008-06-04 09:18:41 +0000 | [diff] [blame] | 513 | |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 514 | /// MachineCopyPropagation - This pass performs copy propagation on |
| Evan Cheng | 977679d | 2012-01-07 03:02:36 +0000 | [diff] [blame] | 515 | /// machine instructions. |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 516 | extern char &MachineCopyPropagationID; |
| Evan Cheng | 977679d | 2012-01-07 03:02:36 +0000 | [diff] [blame] | 517 | |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 518 | /// PeepholeOptimizer - This pass performs peephole optimizations - |
| Bill Wendling | 6cdb1ab | 2010-08-09 23:59:04 +0000 | [diff] [blame] | 519 | /// like extension and comparison eliminations. |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 520 | extern char &PeepholeOptimizerID; |
| Evan Cheng | 7da9ecf | 2010-01-13 00:30:23 +0000 | [diff] [blame] | 521 | |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 522 | /// OptimizePHIs - This pass optimizes machine instruction PHIs |
| Bob Wilson | fe61fb1 | 2010-02-12 01:30:21 +0000 | [diff] [blame] | 523 | /// to take advantage of opportunities created during DAG legalization. |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 524 | extern char &OptimizePHIsID; |
| Bob Wilson | fe61fb1 | 2010-02-12 01:30:21 +0000 | [diff] [blame] | 525 | |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 526 | /// StackSlotColoring - This pass performs stack slot coloring. |
| 527 | extern char &StackSlotColoringID; |
| Bill Wendling | 2b58ce5 | 2008-11-04 02:10:20 +0000 | [diff] [blame] | 528 | |
| 529 | /// createStackProtectorPass - This pass adds stack protectors to functions. |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 530 | /// |
| Bill Wendling | ea44281 | 2013-06-19 20:51:24 +0000 | [diff] [blame] | 531 | FunctionPass *createStackProtectorPass(const TargetMachine *TM); |
| Bill Wendling | 2b58ce5 | 2008-11-04 02:10:20 +0000 | [diff] [blame] | 532 | |
| Jakob Stoklund Olesen | 48872e0 | 2009-05-16 00:33:53 +0000 | [diff] [blame] | 533 | /// createMachineVerifierPass - This pass verifies cenerated machine code |
| 534 | /// instructions for correctness. |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 535 | /// |
| Jakob Stoklund Olesen | 89cab93 | 2010-12-18 00:06:56 +0000 | [diff] [blame] | 536 | FunctionPass *createMachineVerifierPass(const char *Banner = 0); |
| Jakob Stoklund Olesen | 48872e0 | 2009-05-16 00:33:53 +0000 | [diff] [blame] | 537 | |
| Duncan Sands | b0f1e17 | 2009-05-22 20:36:31 +0000 | [diff] [blame] | 538 | /// createDwarfEHPass - This pass mulches exception handling code into a form |
| 539 | /// adapted to code generation. Required if using dwarf exception handling. |
| Bill Wendling | ea44281 | 2013-06-19 20:51:24 +0000 | [diff] [blame] | 540 | FunctionPass *createDwarfEHPass(const TargetMachine *TM); |
| Duncan Sands | b0f1e17 | 2009-05-22 20:36:31 +0000 | [diff] [blame] | 541 | |
| Bill Wendling | eabae1d | 2012-03-13 20:04:21 +0000 | [diff] [blame] | 542 | /// createSjLjEHPreparePass - This pass adapts exception handling code to use |
| Jim Grosbach | 8b818d7 | 2009-08-17 16:41:22 +0000 | [diff] [blame] | 543 | /// the GCC-style builtin setjmp/longjmp (sjlj) to handling EH control flow. |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 544 | /// |
| Bill Wendling | ea44281 | 2013-06-19 20:51:24 +0000 | [diff] [blame] | 545 | FunctionPass *createSjLjEHPreparePass(const TargetMachine *TM); |
| Jim Grosbach | 8b818d7 | 2009-08-17 16:41:22 +0000 | [diff] [blame] | 546 | |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 547 | /// LocalStackSlotAllocation - This pass assigns local frame indices to stack |
| 548 | /// slots relative to one another and allocates base registers to access them |
| 549 | /// when it is estimated by the target to be out of range of normal frame |
| 550 | /// pointer or stack pointer index addressing. |
| 551 | extern char &LocalStackSlotAllocationID; |
| Jim Grosbach | 3d72367 | 2010-08-14 00:15:52 +0000 | [diff] [blame] | 552 | |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 553 | /// ExpandISelPseudos - This pass expands pseudo-instructions. |
| 554 | extern char &ExpandISelPseudosID; |
| Dan Gohman | 668ac2f | 2010-11-16 21:02:37 +0000 | [diff] [blame] | 555 | |
| Jakob Stoklund Olesen | df4b35e | 2011-09-27 23:50:46 +0000 | [diff] [blame] | 556 | /// createExecutionDependencyFixPass - This pass fixes execution time |
| 557 | /// problems with dependent instructions, such as switching execution |
| 558 | /// domains to match. |
| 559 | /// |
| 560 | /// The pass will examine instructions using and defining registers in RC. |
| 561 | /// |
| 562 | FunctionPass *createExecutionDependencyFixPass(const TargetRegisterClass *RC); |
| 563 | |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 564 | /// UnpackMachineBundles - This pass unpack machine instruction bundles. |
| 565 | extern char &UnpackMachineBundlesID; |
| Evan Cheng | ddfd137 | 2011-12-14 02:11:42 +0000 | [diff] [blame] | 566 | |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 567 | /// FinalizeMachineBundles - This pass finalize machine instruction |
| Evan Cheng | ef2887d | 2012-01-19 07:47:03 +0000 | [diff] [blame] | 568 | /// bundles (created earlier, e.g. during pre-RA scheduling). |
| Andrew Trick | 1dd8c85 | 2012-02-08 21:23:13 +0000 | [diff] [blame] | 569 | extern char &FinalizeMachineBundlesID; |
| Evan Cheng | ef2887d | 2012-01-19 07:47:03 +0000 | [diff] [blame] | 570 | |
| Brian Gaeke | d0fde30 | 2003-11-11 22:41:34 +0000 | [diff] [blame] | 571 | } // End llvm namespace |
| 572 | |
| Chris Lattner | db00065 | 2003-01-13 01:01:31 +0000 | [diff] [blame] | 573 | #endif |