1 //===- llvm/Transforms/Utils.h - Utility Transformations --------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This header file defines prototypes for accessor functions that expose passes
11 // in the Utils transformations library.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_TRANSFORMS_UTILS_H
16 #define LLVM_TRANSFORMS_UTILS_H
24 //===----------------------------------------------------------------------===//
25 // createMetaRenamerPass - Rename everything with metasyntatic names.
27 ModulePass *createMetaRenamerPass();
29 //===----------------------------------------------------------------------===//
31 // LowerInvoke - This pass removes invoke instructions, converting them to call
34 FunctionPass *createLowerInvokePass();
35 extern char &LowerInvokePassID;
37 //===----------------------------------------------------------------------===//
39 // InstructionNamer - Give any unnamed non-void instructions "tmp" names.
41 FunctionPass *createInstructionNamerPass();
42 extern char &InstructionNamerID;
44 //===----------------------------------------------------------------------===//
46 // LowerSwitch - This pass converts SwitchInst instructions into a sequence of
47 // chained binary branch instructions.
49 FunctionPass *createLowerSwitchPass();
50 extern char &LowerSwitchID;
52 //===----------------------------------------------------------------------===//
54 // EntryExitInstrumenter pass - Instrument function entry/exit with calls to
55 // mcount(), @__cyg_profile_func_{enter,exit} and the like. There are two
56 // variants, intended to run pre- and post-inlining, respectively.
58 FunctionPass *createEntryExitInstrumenterPass();
59 FunctionPass *createPostInlineEntryExitInstrumenterPass();
61 //===----------------------------------------------------------------------===//
63 // BreakCriticalEdges - Break all of the critical edges in the CFG by inserting
64 // a dummy basic block. This pass may be "required" by passes that cannot deal
65 // with critical edges. For this usage, a pass must call:
67 // AU.addRequiredID(BreakCriticalEdgesID);
69 // This pass obviously invalidates the CFG, but can update forward dominator
70 // (set, immediate dominators, tree, and frontier) information.
72 FunctionPass *createBreakCriticalEdgesPass();
73 extern char &BreakCriticalEdgesID;
75 //===----------------------------------------------------------------------===//
77 // LCSSA - This pass inserts phi nodes at loop boundaries to simplify other loop
80 Pass *createLCSSAPass();
83 //===----------------------------------------------------------------------===//
85 // AddDiscriminators - Add DWARF path discriminators to the IR.
86 FunctionPass *createAddDiscriminatorsPass();
88 //===----------------------------------------------------------------------===//
90 // PromoteMemoryToRegister - This pass is used to promote memory references to
91 // be register references. A simple example of the transformation performed by
95 // %X = alloca i32, i32 1 ret i32 42
96 // store i32 42, i32 *%X
100 FunctionPass *createPromoteMemoryToRegisterPass();
102 //===----------------------------------------------------------------------===//
104 // LoopSimplify - Insert Pre-header blocks into the CFG for every function in
105 // the module. This pass updates dominator information, loop information, and
106 // does not add critical edges to the CFG.
108 // AU.addRequiredID(LoopSimplifyID);
110 Pass *createLoopSimplifyPass();
111 extern char &LoopSimplifyID;
113 /// This function returns a new pass that downgrades the debug info in the
114 /// module to line tables only.
115 ModulePass *createStripNonLineTableDebugInfoPass();