5d1224a720e9b042d8787b318f35e38310a456e0
[oota-llvm.git] / include / llvm / CodeGen / Passes.h
1 //===-- Passes.h - Target independent code generation passes ----*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines interfaces to access the target independent code generation
11 // passes provided by the LLVM backend.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_CODEGEN_PASSES_H
16 #define LLVM_CODEGEN_PASSES_H
17
18 #include "llvm/Pass.h"
19 #include "llvm/Target/TargetMachine.h"
20 #include <functional>
21 #include <string>
22
23 namespace llvm {
24
25 class MachineFunctionPass;
26 class PassConfigImpl;
27 class PassInfo;
28 class ScheduleDAGInstrs;
29 class TargetLowering;
30 class TargetLoweringBase;
31 class TargetRegisterClass;
32 class raw_ostream;
33 struct MachineSchedContext;
34
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
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 {
56   union {
57     AnalysisID ID;
58     Pass *P;
59   };
60   bool IsInstance;
61 public:
62   IdentifyingPassPtr() : P(nullptr), IsInstance(false) {}
63   IdentifyingPassPtr(AnalysisID IDPtr) : ID(IDPtr), IsInstance(false) {}
64   IdentifyingPassPtr(Pass *InstancePtr) : P(InstancePtr), IsInstance(true) {}
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");
71     return ID;
72   }
73   Pass *getInstance() const {
74     assert(IsInstance && "Not a Pass Instance");
75     return P;
76   }
77 };
78
79 template <> struct isPodLike<IdentifyingPassPtr> {
80   static const bool value = true;
81 };
82
83 /// Target-Independent Code Generator Pass Configuration Options.
84 ///
85 /// This is an ImmutablePass solely for the purpose of exposing CodeGen options
86 /// to the internals of other CodeGen passes.
87 class TargetPassConfig : public ImmutablePass {
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
102 private:
103   PassManagerBase *PM;
104   AnalysisID StartAfter;
105   AnalysisID StopAfter;
106   bool Started;
107   bool Stopped;
108   bool AddingMachinePasses;
109
110 protected:
111   TargetMachine *TM;
112   PassConfigImpl *Impl; // Internal data structures
113   bool Initialized;     // Flagged after all passes are configured.
114
115   // Target Pass Options
116   // Targets provide a default setting, user flags override.
117   //
118   bool DisableVerify;
119
120   /// Default setting for -enable-tail-merge on this target.
121   bool EnableTailMerge;
122
123   /// Default setting for -enable-shrink-wrap on this target.
124   bool EnableShrinkWrap;
125
126 public:
127   TargetPassConfig(TargetMachine *tm, PassManagerBase &pm);
128   // Dummy constructor.
129   TargetPassConfig();
130
131   ~TargetPassConfig() override;
132
133   static char ID;
134
135   /// Get the right type of TargetMachine for this target.
136   template<typename TMC> TMC &getTM() const {
137     return *static_cast<TMC*>(TM);
138   }
139
140   //
141   void setInitialized() { Initialized = true; }
142
143   CodeGenOpt::Level getOptLevel() const { return TM->getOptLevel(); }
144
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 == nullptr);
155   }
156
157   void setDisableVerify(bool Disable) { setOpt(DisableVerify, Disable); }
158
159   bool getEnableTailMerge() const { return EnableTailMerge; }
160   void setEnableTailMerge(bool Enable) { setOpt(EnableTailMerge, Enable); }
161
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
164   /// point where StandardID is expected, add TargetID in its place.
165   void substitutePass(AnalysisID StandardID, IdentifyingPassPtr TargetID);
166
167   /// Insert InsertedPassID pass after TargetPassID pass.
168   void insertPass(AnalysisID TargetPassID, IdentifyingPassPtr InsertedPassID);
169
170   /// Allow the target to enable a specific standard pass by default.
171   void enablePass(AnalysisID PassID) { substitutePass(PassID, PassID); }
172
173   /// Allow the target to disable a specific standard pass by default.
174   void disablePass(AnalysisID PassID) {
175     substitutePass(PassID, IdentifyingPassPtr());
176   }
177
178   /// Return the pass substituted for StandardID by the target.
179   /// If no substitution exists, return StandardID.
180   IdentifyingPassPtr getPassSubstitution(AnalysisID StandardID) const;
181
182   /// Return true if the optimized regalloc pipeline is enabled.
183   bool getOptimizeRegAlloc() const;
184
185   /// Return true if shrink wrapping is enabled.
186   bool getEnableShrinkWrap() const;
187
188   /// Return true if the default global register allocator is in use and
189   /// has not be overriden on the command line with '-regalloc=...'
190   bool usingDefaultRegAlloc() const;
191
192   /// Add common target configurable passes that perform LLVM IR to IR
193   /// transforms following machine independent optimization.
194   virtual void addIRPasses();
195
196   /// Add passes to lower exception handling for the code generator.
197   void addPassesToHandleExceptions();
198
199   /// Add pass to prepare the LLVM IR for code generation. This should be done
200   /// before exception handling preparation passes.
201   virtual void addCodeGenPrepare();
202
203   /// Add common passes that perform LLVM IR to IR transforms in preparation for
204   /// instruction selection.
205   virtual void addISelPrepare();
206
207   /// addInstSelector - This method should install an instruction selector pass,
208   /// which converts from LLVM code to machine instructions.
209   virtual bool addInstSelector() {
210     return true;
211   }
212
213   /// Add the complete, standard set of LLVM CodeGen passes.
214   /// Fully developed targets will not generally override this.
215   virtual void addMachinePasses();
216
217   /// Create an instance of ScheduleDAGInstrs to be run within the standard
218   /// MachineScheduler pass for this function and target at the current
219   /// optimization level.
220   ///
221   /// This can also be used to plug a new MachineSchedStrategy into an instance
222   /// of the standard ScheduleDAGMI:
223   ///   return new ScheduleDAGMI(C, make_unique<MyStrategy>(C), /* IsPostRA= */false)
224   ///
225   /// Return NULL to select the default (generic) machine scheduler.
226   virtual ScheduleDAGInstrs *
227   createMachineScheduler(MachineSchedContext *C) const {
228     return nullptr;
229   }
230
231   /// Similar to createMachineScheduler but used when postRA machine scheduling
232   /// is enabled.
233   virtual ScheduleDAGInstrs *
234   createPostMachineScheduler(MachineSchedContext *C) const {
235     return nullptr;
236   }
237
238 protected:
239   // Helper to verify the analysis is really immutable.
240   void setOpt(bool &Opt, bool Val);
241
242   /// Methods with trivial inline returns are convenient points in the common
243   /// codegen pass pipeline where targets may insert passes. Methods with
244   /// out-of-line standard implementations are major CodeGen stages called by
245   /// addMachinePasses. Some targets may override major stages when inserting
246   /// passes is insufficient, but maintaining overriden stages is more work.
247   ///
248
249   /// addPreISelPasses - This method should add any "last minute" LLVM->LLVM
250   /// passes (which are run just before instruction selector).
251   virtual bool addPreISel() {
252     return true;
253   }
254
255   /// addMachineSSAOptimization - Add standard passes that optimize machine
256   /// instructions in SSA form.
257   virtual void addMachineSSAOptimization();
258
259   /// Add passes that optimize instruction level parallelism for out-of-order
260   /// targets. These passes are run while the machine code is still in SSA
261   /// form, so they can use MachineTraceMetrics to control their heuristics.
262   ///
263   /// All passes added here should preserve the MachineDominatorTree,
264   /// MachineLoopInfo, and MachineTraceMetrics analyses.
265   virtual bool addILPOpts() {
266     return false;
267   }
268
269   /// This method may be implemented by targets that want to run passes
270   /// immediately before register allocation.
271   virtual void addPreRegAlloc() { }
272
273   /// createTargetRegisterAllocator - Create the register allocator pass for
274   /// this target at the current optimization level.
275   virtual FunctionPass *createTargetRegisterAllocator(bool Optimized);
276
277   /// addFastRegAlloc - Add the minimum set of target-independent passes that
278   /// are required for fast register allocation.
279   virtual void addFastRegAlloc(FunctionPass *RegAllocPass);
280
281   /// addOptimizedRegAlloc - Add passes related to register allocation.
282   /// LLVMTargetMachine provides standard regalloc passes for most targets.
283   virtual void addOptimizedRegAlloc(FunctionPass *RegAllocPass);
284
285   /// addPreRewrite - Add passes to the optimized register allocation pipeline
286   /// after register allocation is complete, but before virtual registers are
287   /// rewritten to physical registers.
288   ///
289   /// These passes must preserve VirtRegMap and LiveIntervals, and when running
290   /// after RABasic or RAGreedy, they should take advantage of LiveRegMatrix.
291   /// When these passes run, VirtRegMap contains legal physreg assignments for
292   /// all virtual registers.
293   virtual bool addPreRewrite() {
294     return false;
295   }
296
297   /// This method may be implemented by targets that want to run passes after
298   /// register allocation pass pipeline but before prolog-epilog insertion.
299   virtual void addPostRegAlloc() { }
300
301   /// Add passes that optimize machine instructions after register allocation.
302   virtual void addMachineLateOptimization();
303
304   /// This method may be implemented by targets that want to run passes after
305   /// prolog-epilog insertion and before the second instruction scheduling pass.
306   virtual void addPreSched2() { }
307
308   /// addGCPasses - Add late codegen passes that analyze code for garbage
309   /// collection. This should return true if GC info should be printed after
310   /// these passes.
311   virtual bool addGCPasses();
312
313   /// Add standard basic block placement passes.
314   virtual void addBlockPlacement();
315
316   /// This pass may be implemented by targets that want to run passes
317   /// immediately before machine code is emitted.
318   virtual void addPreEmitPass() { }
319
320   /// Utilities for targets to add passes to the pass manager.
321   ///
322
323   /// Add a CodeGen pass at this point in the pipeline after checking overrides.
324   /// Return the pass that was added, or zero if no pass was added.
325   /// @p printAfter    if true and adding a machine function pass add an extra
326   ///                  machine printer pass afterwards
327   /// @p verifyAfter   if true and adding a machine function pass add an extra
328   ///                  machine verification pass afterwards.
329   AnalysisID addPass(AnalysisID PassID, bool verifyAfter = true,
330                      bool printAfter = true);
331
332   /// Add a pass to the PassManager if that pass is supposed to be run, as
333   /// determined by the StartAfter and StopAfter options. Takes ownership of the
334   /// pass.
335   /// @p printAfter    if true and adding a machine function pass add an extra
336   ///                  machine printer pass afterwards
337   /// @p verifyAfter   if true and adding a machine function pass add an extra
338   ///                  machine verification pass afterwards.
339   void addPass(Pass *P, bool verifyAfter = true, bool printAfter = true);
340
341   /// addMachinePasses helper to create the target-selected or overriden
342   /// regalloc pass.
343   FunctionPass *createRegAllocPass(bool Optimized);
344
345   /// printAndVerify - Add a pass to dump then verify the machine function, if
346   /// those steps are enabled.
347   ///
348   void printAndVerify(const std::string &Banner);
349
350   /// Add a pass to print the machine function if printing is enabled.
351   void addPrintPass(const std::string &Banner);
352
353   /// Add a pass to perform basic verification of the machine function if
354   /// verification is enabled.
355   void addVerifyPass(const std::string &Banner);
356 };
357 } // namespace llvm
358
359 /// List of target independent CodeGen pass IDs.
360 namespace llvm {
361   FunctionPass *createAtomicExpandPass(const TargetMachine *TM);
362
363   /// createUnreachableBlockEliminationPass - The LLVM code generator does not
364   /// work well with unreachable basic blocks (what live ranges make sense for a
365   /// block that cannot be reached?).  As such, a code generator should either
366   /// not instruction select unreachable blocks, or run this pass as its
367   /// last LLVM modifying pass to clean up blocks that are not reachable from
368   /// the entry block.
369   FunctionPass *createUnreachableBlockEliminationPass();
370
371   /// MachineFunctionPrinter pass - This pass prints out the machine function to
372   /// the given stream as a debugging tool.
373   MachineFunctionPass *
374   createMachineFunctionPrinterPass(raw_ostream &OS,
375                                    const std::string &Banner ="");
376
377   /// MIRPrinting pass - this pass prints out the LLVM IR into the given stream
378   /// using the MIR serialization format.
379   MachineFunctionPass *createPrintMIRPass(raw_ostream &OS);
380
381   /// createCodeGenPreparePass - Transform the code to expose more pattern
382   /// matching during instruction selection.
383   FunctionPass *createCodeGenPreparePass(const TargetMachine *TM = nullptr);
384
385   /// AtomicExpandID -- Lowers atomic operations in terms of either cmpxchg
386   /// load-linked/store-conditional loops.
387   extern char &AtomicExpandID;
388
389   /// MachineLoopInfo - This pass is a loop analysis pass.
390   extern char &MachineLoopInfoID;
391
392   /// MachineDominators - This pass is a machine dominators analysis pass.
393   extern char &MachineDominatorsID;
394
395 /// MachineDominanaceFrontier - This pass is a machine dominators analysis pass.
396   extern char &MachineDominanceFrontierID;
397
398   /// EdgeBundles analysis - Bundle machine CFG edges.
399   extern char &EdgeBundlesID;
400
401   /// LiveVariables pass - This pass computes the set of blocks in which each
402   /// variable is life and sets machine operand kill flags.
403   extern char &LiveVariablesID;
404
405   /// PHIElimination - This pass eliminates machine instruction PHI nodes
406   /// by inserting copy instructions.  This destroys SSA information, but is the
407   /// desired input for some register allocators.  This pass is "required" by
408   /// these register allocator like this: AU.addRequiredID(PHIEliminationID);
409   extern char &PHIEliminationID;
410
411   /// LiveIntervals - This analysis keeps track of the live ranges of virtual
412   /// and physical registers.
413   extern char &LiveIntervalsID;
414
415   /// LiveStacks pass. An analysis keeping track of the liveness of stack slots.
416   extern char &LiveStacksID;
417
418   /// TwoAddressInstruction - This pass reduces two-address instructions to
419   /// use two operands. This destroys SSA information but it is desired by
420   /// register allocators.
421   extern char &TwoAddressInstructionPassID;
422
423   /// ProcessImpicitDefs pass - This pass removes IMPLICIT_DEFs.
424   extern char &ProcessImplicitDefsID;
425
426   /// RegisterCoalescer - This pass merges live ranges to eliminate copies.
427   extern char &RegisterCoalescerID;
428
429   /// MachineScheduler - This pass schedules machine instructions.
430   extern char &MachineSchedulerID;
431
432   /// PostMachineScheduler - This pass schedules machine instructions postRA.
433   extern char &PostMachineSchedulerID;
434
435   /// SpillPlacement analysis. Suggest optimal placement of spill code between
436   /// basic blocks.
437   extern char &SpillPlacementID;
438
439   /// ShrinkWrap pass. Look for the best place to insert save and restore
440   // instruction and update the MachineFunctionInfo with that information.
441   extern char &ShrinkWrapID;
442
443   /// VirtRegRewriter pass. Rewrite virtual registers to physical registers as
444   /// assigned in VirtRegMap.
445   extern char &VirtRegRewriterID;
446
447   /// UnreachableMachineBlockElimination - This pass removes unreachable
448   /// machine basic blocks.
449   extern char &UnreachableMachineBlockElimID;
450
451   /// DeadMachineInstructionElim - This pass removes dead machine instructions.
452   extern char &DeadMachineInstructionElimID;
453
454   /// FastRegisterAllocation Pass - This pass register allocates as fast as
455   /// possible. It is best suited for debug code where live ranges are short.
456   ///
457   FunctionPass *createFastRegisterAllocator();
458
459   /// BasicRegisterAllocation Pass - This pass implements a degenerate global
460   /// register allocator using the basic regalloc framework.
461   ///
462   FunctionPass *createBasicRegisterAllocator();
463
464   /// Greedy register allocation pass - This pass implements a global register
465   /// allocator for optimized builds.
466   ///
467   FunctionPass *createGreedyRegisterAllocator();
468
469   /// PBQPRegisterAllocation Pass - This pass implements the Partitioned Boolean
470   /// Quadratic Prograaming (PBQP) based register allocator.
471   ///
472   FunctionPass *createDefaultPBQPRegisterAllocator();
473
474   /// PrologEpilogCodeInserter - This pass inserts prolog and epilog code,
475   /// and eliminates abstract frame references.
476   extern char &PrologEpilogCodeInserterID;
477
478   /// ExpandPostRAPseudos - This pass expands pseudo instructions after
479   /// register allocation.
480   extern char &ExpandPostRAPseudosID;
481
482   /// createPostRAScheduler - This pass performs post register allocation
483   /// scheduling.
484   extern char &PostRASchedulerID;
485
486   /// BranchFolding - This pass performs machine code CFG based
487   /// optimizations to delete branches to branches, eliminate branches to
488   /// successor blocks (creating fall throughs), and eliminating branches over
489   /// branches.
490   extern char &BranchFolderPassID;
491
492   /// MachineFunctionPrinterPass - This pass prints out MachineInstr's.
493   extern char &MachineFunctionPrinterPassID;
494
495   /// MIRPrintingPass - this pass prints out the LLVM IR using the MIR
496   /// serialization format.
497   extern char &MIRPrintingPassID;
498
499   /// TailDuplicate - Duplicate blocks with unconditional branches
500   /// into tails of their predecessors.
501   extern char &TailDuplicateID;
502
503   /// MachineTraceMetrics - This pass computes critical path and CPU resource
504   /// usage in an ensemble of traces.
505   extern char &MachineTraceMetricsID;
506
507   /// EarlyIfConverter - This pass performs if-conversion on SSA form by
508   /// inserting cmov instructions.
509   extern char &EarlyIfConverterID;
510
511   /// This pass performs instruction combining using trace metrics to estimate
512   /// critical-path and resource depth.
513   extern char &MachineCombinerID;
514
515   /// StackSlotColoring - This pass performs stack coloring and merging.
516   /// It merges disjoint allocas to reduce the stack size.
517   extern char &StackColoringID;
518
519   /// IfConverter - This pass performs machine code if conversion.
520   extern char &IfConverterID;
521
522   FunctionPass *createIfConverter(std::function<bool(const Function &)> Ftor);
523
524   /// MachineBlockPlacement - This pass places basic blocks based on branch
525   /// probabilities.
526   extern char &MachineBlockPlacementID;
527
528   /// MachineBlockPlacementStats - This pass collects statistics about the
529   /// basic block placement using branch probabilities and block frequency
530   /// information.
531   extern char &MachineBlockPlacementStatsID;
532
533   /// GCLowering Pass - Used by gc.root to perform its default lowering
534   /// operations.
535   FunctionPass *createGCLoweringPass();
536
537   /// ShadowStackGCLowering - Implements the custom lowering mechanism
538   /// used by the shadow stack GC.  Only runs on functions which opt in to
539   /// the shadow stack collector.
540   FunctionPass *createShadowStackGCLoweringPass();
541
542   /// GCMachineCodeAnalysis - Target-independent pass to mark safe points
543   /// in machine code. Must be added very late during code generation, just
544   /// prior to output, and importantly after all CFG transformations (such as
545   /// branch folding).
546   extern char &GCMachineCodeAnalysisID;
547
548   /// Creates a pass to print GC metadata.
549   ///
550   FunctionPass *createGCInfoPrinter(raw_ostream &OS);
551
552   /// MachineCSE - This pass performs global CSE on machine instructions.
553   extern char &MachineCSEID;
554
555   /// ImplicitNullChecks - This pass folds null pointer checks into nearby
556   /// memory operations.
557   extern char &ImplicitNullChecksID;
558
559   /// MachineLICM - This pass performs LICM on machine instructions.
560   extern char &MachineLICMID;
561
562   /// MachineSinking - This pass performs sinking on machine instructions.
563   extern char &MachineSinkingID;
564
565   /// MachineCopyPropagation - This pass performs copy propagation on
566   /// machine instructions.
567   extern char &MachineCopyPropagationID;
568
569   /// PeepholeOptimizer - This pass performs peephole optimizations -
570   /// like extension and comparison eliminations.
571   extern char &PeepholeOptimizerID;
572
573   /// OptimizePHIs - This pass optimizes machine instruction PHIs
574   /// to take advantage of opportunities created during DAG legalization.
575   extern char &OptimizePHIsID;
576
577   /// StackSlotColoring - This pass performs stack slot coloring.
578   extern char &StackSlotColoringID;
579
580   /// createStackProtectorPass - This pass adds stack protectors to functions.
581   ///
582   FunctionPass *createStackProtectorPass(const TargetMachine *TM);
583
584   /// createMachineVerifierPass - This pass verifies cenerated machine code
585   /// instructions for correctness.
586   ///
587   FunctionPass *createMachineVerifierPass(const std::string& Banner);
588
589   /// createDwarfEHPass - This pass mulches exception handling code into a form
590   /// adapted to code generation.  Required if using dwarf exception handling.
591   FunctionPass *createDwarfEHPass(const TargetMachine *TM);
592
593   /// createWinEHPass - Prepares personality functions used by MSVC on Windows,
594   /// in addition to the Itanium LSDA based personalities.
595   FunctionPass *createWinEHPass(const TargetMachine *TM);
596
597   /// createSjLjEHPreparePass - This pass adapts exception handling code to use
598   /// the GCC-style builtin setjmp/longjmp (sjlj) to handling EH control flow.
599   ///
600   FunctionPass *createSjLjEHPreparePass(const TargetMachine *TM);
601
602   /// LocalStackSlotAllocation - This pass assigns local frame indices to stack
603   /// slots relative to one another and allocates base registers to access them
604   /// when it is estimated by the target to be out of range of normal frame
605   /// pointer or stack pointer index addressing.
606   extern char &LocalStackSlotAllocationID;
607
608   /// ExpandISelPseudos - This pass expands pseudo-instructions.
609   extern char &ExpandISelPseudosID;
610
611   /// createExecutionDependencyFixPass - This pass fixes execution time
612   /// problems with dependent instructions, such as switching execution
613   /// domains to match.
614   ///
615   /// The pass will examine instructions using and defining registers in RC.
616   ///
617   FunctionPass *createExecutionDependencyFixPass(const TargetRegisterClass *RC);
618
619   /// UnpackMachineBundles - This pass unpack machine instruction bundles.
620   extern char &UnpackMachineBundlesID;
621
622   FunctionPass *
623   createUnpackMachineBundles(std::function<bool(const Function &)> Ftor);
624
625   /// FinalizeMachineBundles - This pass finalize machine instruction
626   /// bundles (created earlier, e.g. during pre-RA scheduling).
627   extern char &FinalizeMachineBundlesID;
628
629   /// StackMapLiveness - This pass analyses the register live-out set of
630   /// stackmap/patchpoint intrinsics and attaches the calculated information to
631   /// the intrinsic for later emission to the StackMap.
632   extern char &StackMapLivenessID;
633
634   /// createJumpInstrTables - This pass creates jump-instruction tables.
635   ModulePass *createJumpInstrTablesPass();
636
637   /// createForwardControlFlowIntegrityPass - This pass adds control-flow
638   /// integrity.
639   ModulePass *createForwardControlFlowIntegrityPass();
640 } // End llvm namespace
641
642 /// Target machine pass initializer for passes with dependencies. Use with
643 /// INITIALIZE_TM_PASS_END.
644 #define INITIALIZE_TM_PASS_BEGIN INITIALIZE_PASS_BEGIN
645
646 /// Target machine pass initializer for passes with dependencies. Use with
647 /// INITIALIZE_TM_PASS_BEGIN.
648 #define INITIALIZE_TM_PASS_END(passName, arg, name, cfg, analysis) \
649     PassInfo *PI = new PassInfo(name, arg, & passName ::ID, \
650       PassInfo::NormalCtor_t(callDefaultCtor< passName >), cfg, analysis, \
651       PassInfo::TargetMachineCtor_t(callTargetMachineCtor< passName >)); \
652     Registry.registerPass(*PI, true); \
653     return PI; \
654   } \
655   void llvm::initialize##passName##Pass(PassRegistry &Registry) { \
656     CALL_ONCE_INITIALIZATION(initialize##passName##PassOnce) \
657   }
658
659 /// This initializer registers TargetMachine constructor, so the pass being
660 /// initialized can use target dependent interfaces. Please do not move this
661 /// macro to be together with INITIALIZE_PASS, which is a complete target
662 /// independent initializer, and we don't want to make libScalarOpts depend
663 /// on libCodeGen.
664 #define INITIALIZE_TM_PASS(passName, arg, name, cfg, analysis) \
665     INITIALIZE_TM_PASS_BEGIN(passName, arg, name, cfg, analysis) \
666     INITIALIZE_TM_PASS_END(passName, arg, name, cfg, analysis)
667
668 #endif