blob: f2deadb486716f0aba7685d038600f50e80e1558 [file] [log] [blame]
Misha Brukmanef6a6a62003-08-21 22:14:26 +00001//===-- Passes.h - Target independent code generation passes ----*- C++ -*-===//
Misha Brukmanea61c352005-04-21 20:39:54 +00002//
John Criswell6fbcc262003-10-20 20:19:47 +00003// The LLVM Compiler Infrastructure
4//
Chris Lattner7ed47a12007-12-29 19:59:42 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Misha Brukmanea61c352005-04-21 20:39:54 +00007//
John Criswell6fbcc262003-10-20 20:19:47 +00008//===----------------------------------------------------------------------===//
Chris Lattnerdb000652003-01-13 01:01:31 +00009//
Misha Brukmanef6a6a62003-08-21 22:14:26 +000010// This file defines interfaces to access the target independent code generation
Chris Lattnerdb000652003-01-13 01:01:31 +000011// passes provided by the LLVM backend.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_CODEGEN_PASSES_H
16#define LLVM_CODEGEN_PASSES_H
17
Andrew Trick74613342012-02-04 02:56:45 +000018#include "llvm/Pass.h"
Evan Chengfa163542009-10-16 21:06:15 +000019#include "llvm/Target/TargetMachine.h"
Brian Gaekefc1f6e82004-02-04 21:41:10 +000020#include <string>
Brian Gaeke09caa372004-01-30 21:53:46 +000021
Brian Gaeked0fde302003-11-11 22:41:34 +000022namespace llvm {
23
Chris Lattner3e200e62003-12-20 10:18:58 +000024 class FunctionPass;
David Greene5c8aa952010-04-02 23:17:14 +000025 class MachineFunctionPass;
Chris Lattner3e200e62003-12-20 10:18:58 +000026 class PassInfo;
Bill Wendling80a320d2008-11-04 21:53:09 +000027 class TargetLowering;
Jakob Stoklund Olesendf4b35e2011-09-27 23:50:46 +000028 class TargetRegisterClass;
Chris Lattnercf143a42009-08-23 03:13:20 +000029 class raw_ostream;
Andrew Trick843ee2e2012-02-03 05:12:41 +000030}
Chris Lattner8b708e42004-07-02 05:44:13 +000031
Andrew Trick843ee2e2012-02-03 05:12:41 +000032namespace llvm {
33
34/// Target-Independent Code Generator Pass Configuration Options.
35///
Andrew Trick74613342012-02-04 02:56:45 +000036/// This is an ImmutablePass solely for the purpose of exposing CodeGen options
37/// to the internals of other CodeGen passes.
Andrew Trick74613342012-02-04 02:56:45 +000038class TargetPassConfig : public ImmutablePass {
Andrew Trick843ee2e2012-02-03 05:12:41 +000039protected:
40 TargetMachine *TM;
41 PassManagerBase &PM;
Andrew Trickffea03f2012-02-08 21:22:39 +000042 bool Initialized; // Flagged after all passes are configured.
Andrew Trick061efcf2012-02-04 02:56:59 +000043
44 // Target Pass Options
Andrew Trick61f1e3d2012-02-08 21:22:48 +000045 // Targets provide a default setting, user flags override.
Andrew Trick061efcf2012-02-04 02:56:59 +000046 //
Andrew Trick843ee2e2012-02-03 05:12:41 +000047 bool DisableVerify;
48
Andrew Trick61f1e3d2012-02-08 21:22:48 +000049 /// Default setting for -enable-tail-merge on this target.
50 bool EnableTailMerge;
51
Andrew Trick843ee2e2012-02-03 05:12:41 +000052public:
Andrew Trick061efcf2012-02-04 02:56:59 +000053 TargetPassConfig(TargetMachine *tm, PassManagerBase &pm);
Andrew Trick74613342012-02-04 02:56:45 +000054 // Dummy constructor.
55 TargetPassConfig();
Andrew Trick843ee2e2012-02-03 05:12:41 +000056
Andrew Trick74613342012-02-04 02:56:45 +000057 virtual ~TargetPassConfig();
58
59 static char ID;
Andrew Trick843ee2e2012-02-03 05:12:41 +000060
61 /// Get the right type of TargetMachine for this target.
62 template<typename TMC> TMC &getTM() const {
63 return *static_cast<TMC*>(TM);
64 }
65
Andrew Trick061efcf2012-02-04 02:56:59 +000066 const TargetLowering *getTargetLowering() const {
67 return TM->getTargetLowering();
68 }
69
Andrew Trickffea03f2012-02-08 21:22:39 +000070 void setInitialized() { Initialized = true; }
71
Andrew Trick843ee2e2012-02-03 05:12:41 +000072 CodeGenOpt::Level getOptLevel() const { return TM->getOptLevel(); }
73
Andrew Trick61f1e3d2012-02-08 21:22:48 +000074 void setDisableVerify(bool Disable) { setOpt(DisableVerify, Disable); }
75
76 bool getEnableTailMerge() const { return EnableTailMerge; }
77 void setEnableTailMerge(bool Enable) { setOpt(EnableTailMerge, Enable); }
Andrew Trick061efcf2012-02-04 02:56:59 +000078
79 /// Add common target configurable passes that perform LLVM IR to IR
80 /// transforms following machine independent optimization.
81 virtual void addIRPasses();
82
83 /// Add common passes that perform LLVM IR to IR transforms in preparation for
84 /// instruction selection.
85 virtual void addISelPrepare();
86
87 /// addInstSelector - This method should install an instruction selector pass,
88 /// which converts from LLVM code to machine instructions.
89 virtual bool addInstSelector() {
90 return true;
91 }
Andrew Trick843ee2e2012-02-03 05:12:41 +000092
93 /// Add the complete, standard set of LLVM CodeGen passes.
94 /// Fully developed targets will not generally override this.
Andrew Trick061efcf2012-02-04 02:56:59 +000095 virtual void addMachinePasses();
Andrew Trick9d41bd52012-02-08 21:23:03 +000096
Andrew Trick843ee2e2012-02-03 05:12:41 +000097protected:
Andrew Trickffea03f2012-02-08 21:22:39 +000098 // Helper to verify the analysis is really immutable.
99 void setOpt(bool &Opt, bool Val);
100
Andrew Trick061efcf2012-02-04 02:56:59 +0000101 /// Methods with trivial inline returns are convenient points in the common
102 /// codegen pass pipeline where targets may insert passes. Methods with
103 /// out-of-line standard implementations are major CodeGen stages called by
104 /// addMachinePasses. Some targets may override major stages when inserting
105 /// passes is insufficient, but maintaining overriden stages is more work.
Andrew Trick843ee2e2012-02-03 05:12:41 +0000106 ///
107
108 /// addPreISelPasses - This method should add any "last minute" LLVM->LLVM
109 /// passes (which are run just before instruction selector).
110 virtual bool addPreISel() {
111 return true;
112 }
113
Andrew Trickf7b96312012-02-09 00:40:55 +0000114 /// addMachineSSAOptimization - Add standard passes that optimize machine
115 /// instructions in SSA form.
116 virtual void addMachineSSAOptimization();
117
Andrew Trick843ee2e2012-02-03 05:12:41 +0000118 /// addPreRegAlloc - This method may be implemented by targets that want to
119 /// run passes immediately before register allocation. This should return
120 /// true if -print-machineinstrs should print after these passes.
121 virtual bool addPreRegAlloc() {
122 return false;
123 }
124
Andrew Trickf7b96312012-02-09 00:40:55 +0000125 // addRegAlloc - Add standard passes related to register allocation.
126 virtual void addRegAlloc();
127
Andrew Trick843ee2e2012-02-03 05:12:41 +0000128 /// addPostRegAlloc - This method may be implemented by targets that want
129 /// to run passes after register allocation but before prolog-epilog
130 /// insertion. This should return true if -print-machineinstrs should print
131 /// after these passes.
132 virtual bool addPostRegAlloc() {
133 return false;
134 }
135
Andrew Trickf7b96312012-02-09 00:40:55 +0000136 /// Add passes that optimize machine instructions after register allocation.
137 virtual void addMachineLateOptimization();
138
Andrew Trick843ee2e2012-02-03 05:12:41 +0000139 /// addPreSched2 - This method may be implemented by targets that want to
140 /// run passes after prolog-epilog insertion and before the second instruction
141 /// scheduling pass. This should return true if -print-machineinstrs should
142 /// print after these passes.
143 virtual bool addPreSched2() {
144 return false;
145 }
146
Andrew Trickf7b96312012-02-09 00:40:55 +0000147 /// Add standard basic block placement passes.
148 virtual void addBlockPlacement();
149
Andrew Trick843ee2e2012-02-03 05:12:41 +0000150 /// addPreEmitPass - This pass may be implemented by targets that want to run
151 /// passes immediately before machine code is emitted. This should return
152 /// true if -print-machineinstrs should print out the code after the passes.
153 virtual bool addPreEmitPass() {
154 return false;
155 }
156
157 /// Utilities for targets to add passes to the pass manager.
158 ///
159
160 /// Add a target-independent CodeGen pass at this point in the pipeline.
Andrew Trickebe18ef2012-02-08 21:22:34 +0000161 void addPass(char &ID);
Andrew Trick843ee2e2012-02-03 05:12:41 +0000162
163 /// printNoVerify - Add a pass to dump the machine function, if debugging is
164 /// enabled.
165 ///
166 void printNoVerify(const char *Banner) const;
167
168 /// printAndVerify - Add a pass to dump then verify the machine function, if
169 /// those steps are enabled.
170 ///
171 void printAndVerify(const char *Banner) const;
172};
173} // namespace llvm
174
175/// List of target independent CodeGen pass IDs.
176namespace llvm {
Chris Lattner8b708e42004-07-02 05:44:13 +0000177 /// createUnreachableBlockEliminationPass - The LLVM code generator does not
178 /// work well with unreachable basic blocks (what live ranges make sense for a
179 /// block that cannot be reached?). As such, a code generator should either
Jim Grosbachf6912292010-08-06 21:31:35 +0000180 /// not instruction select unreachable blocks, or run this pass as its
Chris Lattner8b708e42004-07-02 05:44:13 +0000181 /// last LLVM modifying pass to clean up blocks that are not reachable from
182 /// the entry block.
183 FunctionPass *createUnreachableBlockEliminationPass();
Misha Brukmanea61c352005-04-21 20:39:54 +0000184
Chris Lattner3e200e62003-12-20 10:18:58 +0000185 /// MachineFunctionPrinter pass - This pass prints out the machine function to
Jim Grosbachf6912292010-08-06 21:31:35 +0000186 /// the given stream as a debugging tool.
David Greene5c8aa952010-04-02 23:17:14 +0000187 MachineFunctionPass *
188 createMachineFunctionPrinterPass(raw_ostream &OS,
189 const std::string &Banner ="");
Brian Gaeke09caa372004-01-30 21:53:46 +0000190
Andrew Trick1dd8c852012-02-08 21:23:13 +0000191 /// MachineLoopInfo - This pass is a loop analysis pass.
Owen Anderson90c579d2010-08-06 18:33:48 +0000192 extern char &MachineLoopInfoID;
Bill Wendling67d65bb2008-01-04 20:54:55 +0000193
Andrew Trick1dd8c852012-02-08 21:23:13 +0000194 /// MachineLoopRanges - This pass is an on-demand loop coverage analysis.
Jakob Stoklund Olesenceadc012010-12-15 23:41:23 +0000195 extern char &MachineLoopRangesID;
196
Andrew Trick1dd8c852012-02-08 21:23:13 +0000197 /// MachineDominators - This pass is a machine dominators analysis pass.
Owen Anderson90c579d2010-08-06 18:33:48 +0000198 extern char &MachineDominatorsID;
Bill Wendling67d65bb2008-01-04 20:54:55 +0000199
Jakob Stoklund Olesen8dd070e2011-01-04 21:10:05 +0000200 /// EdgeBundles analysis - Bundle machine CFG edges.
Jakob Stoklund Olesen8dd070e2011-01-04 21:10:05 +0000201 extern char &EdgeBundlesID;
202
Andrew Trick1dd8c852012-02-08 21:23:13 +0000203 /// PHIElimination - This pass eliminates machine instruction PHI nodes
Chris Lattner3e200e62003-12-20 10:18:58 +0000204 /// by inserting copy instructions. This destroys SSA information, but is the
205 /// desired input for some register allocators. This pass is "required" by
206 /// these register allocator like this: AU.addRequiredID(PHIEliminationID);
Owen Anderson90c579d2010-08-06 18:33:48 +0000207 extern char &PHIEliminationID;
Jim Grosbachf6912292010-08-06 21:31:35 +0000208
Andrew Trick1dd8c852012-02-08 21:23:13 +0000209 /// StrongPHIElimination - This pass eliminates machine instruction PHI
Owen Anderson0bda0e82007-10-31 03:37:57 +0000210 /// nodes by inserting copy instructions. This destroys SSA information, but
211 /// is the desired input for some register allocators. This pass is
212 /// "required" by these register allocator like this:
213 /// AU.addRequiredID(PHIEliminationID);
214 /// This pass is still in development
Owen Anderson90c579d2010-08-06 18:33:48 +0000215 extern char &StrongPHIEliminationID;
Chris Lattnerdb000652003-01-13 01:01:31 +0000216
Jakob Stoklund Olesen2d172932010-10-26 00:11:33 +0000217 /// LiveStacks pass. An analysis keeping track of the liveness of stack slots.
218 extern char &LiveStacksID;
219
Andrew Trick1dd8c852012-02-08 21:23:13 +0000220 /// TwoAddressInstruction - This pass reduces two-address instructions to
Chris Lattner3e200e62003-12-20 10:18:58 +0000221 /// use two operands. This destroys SSA information but it is desired by
222 /// register allocators.
Owen Anderson90c579d2010-08-06 18:33:48 +0000223 extern char &TwoAddressInstructionPassID;
Chris Lattnerdb000652003-01-13 01:01:31 +0000224
Andrew Trick1dd8c852012-02-08 21:23:13 +0000225 /// RegisteCoalescer - This pass merges live ranges to eliminate copies.
Jakob Stoklund Olesen27215672011-08-09 00:29:53 +0000226 extern char &RegisterCoalescerPassID;
227
Andrew Trick1dd8c852012-02-08 21:23:13 +0000228 /// MachineScheduler - This pass schedules machine instructions.
Andrew Trick42b7a712012-01-17 06:55:03 +0000229 extern char &MachineSchedulerID;
Andrew Trick96f678f2012-01-13 06:30:30 +0000230
Jakob Stoklund Olesen8bfe5082011-01-06 01:21:53 +0000231 /// SpillPlacement analysis. Suggest optimal placement of spill code between
232 /// basic blocks.
Jakob Stoklund Olesen8bfe5082011-01-06 01:21:53 +0000233 extern char &SpillPlacementID;
234
Andrew Trick1dd8c852012-02-08 21:23:13 +0000235 /// UnreachableMachineBlockElimination - This pass removes unreachable
Owen Andersonbd3ba462008-08-04 23:54:43 +0000236 /// machine basic blocks.
Owen Anderson90c579d2010-08-06 18:33:48 +0000237 extern char &UnreachableMachineBlockElimID;
Owen Andersonbd3ba462008-08-04 23:54:43 +0000238
Andrew Trick1dd8c852012-02-08 21:23:13 +0000239 /// DeadMachineInstructionElim - This pass removes dead machine instructions.
240 extern char &DeadMachineInstructionElimID;
Dan Gohmand3ead432008-09-17 00:43:24 +0000241
Jakob Stoklund Olesen700bfad2010-05-27 23:57:25 +0000242 /// Creates a register allocator as the user specified on the command line, or
243 /// picks one that matches OptLevel.
Chris Lattner3e200e62003-12-20 10:18:58 +0000244 ///
Jakob Stoklund Olesen700bfad2010-05-27 23:57:25 +0000245 FunctionPass *createRegisterAllocator(CodeGenOpt::Level OptLevel);
Alkis Evlogimenos4c080862003-12-18 22:40:24 +0000246
Jakob Stoklund Olesen00207232010-04-21 18:02:42 +0000247 /// FastRegisterAllocation Pass - This pass register allocates as fast as
248 /// possible. It is best suited for debug code where live ranges are short.
249 ///
250 FunctionPass *createFastRegisterAllocator();
251
Andrew Trick14e8d712010-10-22 23:09:15 +0000252 /// BasicRegisterAllocation Pass - This pass implements a degenerate global
253 /// register allocator using the basic regalloc framework.
254 ///
255 FunctionPass *createBasicRegisterAllocator();
256
Jakob Stoklund Olesencba2e062010-12-08 03:26:16 +0000257 /// Greedy register allocation pass - This pass implements a global register
258 /// allocator for optimized builds.
259 ///
260 FunctionPass *createGreedyRegisterAllocator();
261
Evan Chengb1290a62008-10-02 18:29:27 +0000262 /// PBQPRegisterAllocation Pass - This pass implements the Partitioned Boolean
263 /// Quadratic Prograaming (PBQP) based register allocator.
264 ///
Lang Hamesf70e7cc2010-09-23 04:28:54 +0000265 FunctionPass *createDefaultPBQPRegisterAllocator();
Evan Chengb1290a62008-10-02 18:29:27 +0000266
Andrew Trick1dd8c852012-02-08 21:23:13 +0000267 /// PrologEpilogCodeInserter - This pass inserts prolog and epilog code,
Chris Lattner3e200e62003-12-20 10:18:58 +0000268 /// and eliminates abstract frame references.
Andrew Trick1dd8c852012-02-08 21:23:13 +0000269 extern char &PrologEpilogCodeInserterID;
Jim Grosbachf6912292010-08-06 21:31:35 +0000270
Andrew Trick1dd8c852012-02-08 21:23:13 +0000271 /// ExpandPostRAPseudos - This pass expands pseudo instructions after
Jakob Stoklund Olesen74e2d6e2011-09-25 16:46:08 +0000272 /// register allocation.
Andrew Trick1dd8c852012-02-08 21:23:13 +0000273 extern char &ExpandPostRAPseudosID;
Chris Lattnerdb000652003-01-13 01:01:31 +0000274
Evan Chengfa163542009-10-16 21:06:15 +0000275 /// createPostRAScheduler - This pass performs post register allocation
276 /// scheduling.
Andrew Trick1dd8c852012-02-08 21:23:13 +0000277 extern char &PostRASchedulerID;
Dale Johannesene7e7d0d2007-07-13 17:13:54 +0000278
Andrew Trick1dd8c852012-02-08 21:23:13 +0000279 /// BranchFolding - This pass performs machine code CFG based
Chris Lattner36c29db2004-07-31 09:59:14 +0000280 /// optimizations to delete branches to branches, eliminate branches to
281 /// successor blocks (creating fall throughs), and eliminating branches over
282 /// branches.
Andrew Trick61f1e3d2012-02-08 21:22:48 +0000283 extern char &BranchFolderPassID;
Chris Lattner36c29db2004-07-31 09:59:14 +0000284
Andrew Trick1dd8c852012-02-08 21:23:13 +0000285 /// TailDuplicate - Duplicate blocks with unconditional branches
Bob Wilson15acadd2009-11-26 00:32:21 +0000286 /// into tails of their predecessors.
Andrew Trick1dd8c852012-02-08 21:23:13 +0000287 extern char &TailDuplicateID;
Bob Wilson15acadd2009-11-26 00:32:21 +0000288
Andrew Trick1dd8c852012-02-08 21:23:13 +0000289 /// IfConverter - This pass performs machine code if conversion.
290 extern char &IfConverterID;
Evan Cheng4e654852007-05-16 02:00:57 +0000291
Andrew Trick1dd8c852012-02-08 21:23:13 +0000292 /// MachineBlockPlacement - This pass places basic blocks based on branch
Chandler Carruthdb350872011-10-21 06:46:38 +0000293 /// probabilities.
Andrew Trick1dd8c852012-02-08 21:23:13 +0000294 extern char &MachineBlockPlacementID;
Chandler Carruthdb350872011-10-21 06:46:38 +0000295
Andrew Trick1dd8c852012-02-08 21:23:13 +0000296 /// MachineBlockPlacementStats - This pass collects statistics about the
Chandler Carruth37efc9f2011-11-02 07:17:12 +0000297 /// basic block placement using branch probabilities and block frequency
298 /// information.
Andrew Trick1dd8c852012-02-08 21:23:13 +0000299 extern char &MachineBlockPlacementStatsID;
Chandler Carruth37efc9f2011-11-02 07:17:12 +0000300
Andrew Trick1dd8c852012-02-08 21:23:13 +0000301 /// Code Placement - This pass optimize code placement and aligns loop
Evan Chengbbf1db72009-05-07 05:42:24 +0000302 /// headers to target specific alignment boundary.
Andrew Trick1dd8c852012-02-08 21:23:13 +0000303 extern char &CodePlacementOptID;
Evan Chengfb8075d2008-02-28 00:43:03 +0000304
Andrew Trick1dd8c852012-02-08 21:23:13 +0000305 /// GCLowering Pass - Performs target-independent LLVM IR transformations for
306 /// highly portable strategies.
307 ///
Gordon Henriksenad93c4f2007-12-11 00:30:17 +0000308 FunctionPass *createGCLoweringPass();
Jim Grosbachf6912292010-08-06 21:31:35 +0000309
Andrew Trick1dd8c852012-02-08 21:23:13 +0000310 /// GCMachineCodeAnalysis - Target-independent pass to mark safe points
311 /// in machine code. Must be added very late during code generation, just
312 /// prior to output, and importantly after all CFG transformations (such as
313 /// branch folding).
314 extern char &GCMachineCodeAnalysisID;
Jim Grosbachf6912292010-08-06 21:31:35 +0000315
Gordon Henriksen5eca0752008-08-17 18:44:35 +0000316 /// Deleter Pass - Releases GC metadata.
Jim Grosbachf6912292010-08-06 21:31:35 +0000317 ///
Gordon Henriksen5eca0752008-08-17 18:44:35 +0000318 FunctionPass *createGCInfoDeleter();
Jim Grosbachf6912292010-08-06 21:31:35 +0000319
Gordon Henriksen5eca0752008-08-17 18:44:35 +0000320 /// Creates a pass to print GC metadata.
Jim Grosbachf6912292010-08-06 21:31:35 +0000321 ///
Chris Lattnercf143a42009-08-23 03:13:20 +0000322 FunctionPass *createGCInfoPrinter(raw_ostream &OS);
Jim Grosbachf6912292010-08-06 21:31:35 +0000323
Andrew Trick1dd8c852012-02-08 21:23:13 +0000324 /// MachineCSE - This pass performs global CSE on machine instructions.
325 extern char &MachineCSEID;
Evan Chengc6fe3332010-03-02 02:38:24 +0000326
Andrew Trick1dd8c852012-02-08 21:23:13 +0000327 /// MachineLICM - This pass performs LICM on machine instructions.
328 extern char &MachineLICMID;
Bill Wendling0f940c92007-12-07 21:42:31 +0000329
Andrew Trick1dd8c852012-02-08 21:23:13 +0000330 /// MachineSinking - This pass performs sinking on machine instructions.
331 extern char &MachineSinkingID;
Evan Cheng3f32d652008-06-04 09:18:41 +0000332
Andrew Trick1dd8c852012-02-08 21:23:13 +0000333 /// MachineCopyPropagation - This pass performs copy propagation on
Evan Cheng977679d2012-01-07 03:02:36 +0000334 /// machine instructions.
Andrew Trick1dd8c852012-02-08 21:23:13 +0000335 extern char &MachineCopyPropagationID;
Evan Cheng977679d2012-01-07 03:02:36 +0000336
Andrew Trick1dd8c852012-02-08 21:23:13 +0000337 /// PeepholeOptimizer - This pass performs peephole optimizations -
Bill Wendling6cdb1ab2010-08-09 23:59:04 +0000338 /// like extension and comparison eliminations.
Andrew Trick1dd8c852012-02-08 21:23:13 +0000339 extern char &PeepholeOptimizerID;
Evan Cheng7da9ecf2010-01-13 00:30:23 +0000340
Andrew Trick1dd8c852012-02-08 21:23:13 +0000341 /// OptimizePHIs - This pass optimizes machine instruction PHIs
Bob Wilsonfe61fb12010-02-12 01:30:21 +0000342 /// to take advantage of opportunities created during DAG legalization.
Andrew Trick1dd8c852012-02-08 21:23:13 +0000343 extern char &OptimizePHIsID;
Bob Wilsonfe61fb12010-02-12 01:30:21 +0000344
Andrew Trick1dd8c852012-02-08 21:23:13 +0000345 /// StackSlotColoring - This pass performs stack slot coloring.
346 extern char &StackSlotColoringID;
Bill Wendling2b58ce52008-11-04 02:10:20 +0000347
348 /// createStackProtectorPass - This pass adds stack protectors to functions.
Andrew Trick1dd8c852012-02-08 21:23:13 +0000349 ///
Bill Wendlinge9e6bdf2008-11-13 01:02:14 +0000350 FunctionPass *createStackProtectorPass(const TargetLowering *tli);
Bill Wendling2b58ce52008-11-04 02:10:20 +0000351
Jakob Stoklund Olesen48872e02009-05-16 00:33:53 +0000352 /// createMachineVerifierPass - This pass verifies cenerated machine code
353 /// instructions for correctness.
Andrew Trick1dd8c852012-02-08 21:23:13 +0000354 ///
Jakob Stoklund Olesen89cab932010-12-18 00:06:56 +0000355 FunctionPass *createMachineVerifierPass(const char *Banner = 0);
Jakob Stoklund Olesen48872e02009-05-16 00:33:53 +0000356
Duncan Sandsb0f1e172009-05-22 20:36:31 +0000357 /// createDwarfEHPass - This pass mulches exception handling code into a form
358 /// adapted to code generation. Required if using dwarf exception handling.
Duncan Sands22efc182010-08-31 09:05:06 +0000359 FunctionPass *createDwarfEHPass(const TargetMachine *tm);
Duncan Sandsb0f1e172009-05-22 20:36:31 +0000360
Jim Grosbach8b818d72009-08-17 16:41:22 +0000361 /// createSjLjEHPass - This pass adapts exception handling code to use
362 /// the GCC-style builtin setjmp/longjmp (sjlj) to handling EH control flow.
Andrew Trick1dd8c852012-02-08 21:23:13 +0000363 ///
Jim Grosbach8b818d72009-08-17 16:41:22 +0000364 FunctionPass *createSjLjEHPass(const TargetLowering *tli);
365
Andrew Trick1dd8c852012-02-08 21:23:13 +0000366 /// LocalStackSlotAllocation - This pass assigns local frame indices to stack
367 /// slots relative to one another and allocates base registers to access them
368 /// when it is estimated by the target to be out of range of normal frame
369 /// pointer or stack pointer index addressing.
370 extern char &LocalStackSlotAllocationID;
Jim Grosbach3d723672010-08-14 00:15:52 +0000371
Andrew Trick1dd8c852012-02-08 21:23:13 +0000372 /// ExpandISelPseudos - This pass expands pseudo-instructions.
373 extern char &ExpandISelPseudosID;
Dan Gohman668ac2f2010-11-16 21:02:37 +0000374
Jakob Stoklund Olesendf4b35e2011-09-27 23:50:46 +0000375 /// createExecutionDependencyFixPass - This pass fixes execution time
376 /// problems with dependent instructions, such as switching execution
377 /// domains to match.
378 ///
379 /// The pass will examine instructions using and defining registers in RC.
380 ///
381 FunctionPass *createExecutionDependencyFixPass(const TargetRegisterClass *RC);
382
Andrew Trick1dd8c852012-02-08 21:23:13 +0000383 /// UnpackMachineBundles - This pass unpack machine instruction bundles.
384 extern char &UnpackMachineBundlesID;
Evan Chengddfd1372011-12-14 02:11:42 +0000385
Andrew Trick1dd8c852012-02-08 21:23:13 +0000386 /// FinalizeMachineBundles - This pass finalize machine instruction
Evan Chengef2887d2012-01-19 07:47:03 +0000387 /// bundles (created earlier, e.g. during pre-RA scheduling).
Andrew Trick1dd8c852012-02-08 21:23:13 +0000388 extern char &FinalizeMachineBundlesID;
Evan Chengef2887d2012-01-19 07:47:03 +0000389
Brian Gaeked0fde302003-11-11 22:41:34 +0000390} // End llvm namespace
391
Chris Lattnerdb000652003-01-13 01:01:31 +0000392#endif