1 //===- llvm/Transforms/Utils.h - Utility Transformations --------*- 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 header file defines prototypes for accessor functions that expose passes 11 // in the Utils transformations library. 12 // 13 //===----------------------------------------------------------------------===// 14 15 #ifndef LLVM_TRANSFORMS_UTILS_H 16 #define LLVM_TRANSFORMS_UTILS_H 17 18 namespace llvm { 19 20 class ModulePass; 21 class FunctionPass; 22 class Pass; 23 24 //===----------------------------------------------------------------------===// 25 // createMetaRenamerPass - Rename everything with metasyntatic names. 26 // 27 ModulePass *createMetaRenamerPass(); 28 29 //===----------------------------------------------------------------------===// 30 // 31 // LowerInvoke - This pass removes invoke instructions, converting them to call 32 // instructions. 33 // 34 FunctionPass *createLowerInvokePass(); 35 extern char &LowerInvokePassID; 36 37 //===----------------------------------------------------------------------===// 38 // 39 // InstructionNamer - Give any unnamed non-void instructions "tmp" names. 40 // 41 FunctionPass *createInstructionNamerPass(); 42 extern char &InstructionNamerID; 43 44 //===----------------------------------------------------------------------===// 45 // 46 // LowerSwitch - This pass converts SwitchInst instructions into a sequence of 47 // chained binary branch instructions. 48 // 49 FunctionPass *createLowerSwitchPass(); 50 extern char &LowerSwitchID; 51 52 //===----------------------------------------------------------------------===// 53 // 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. 57 // 58 FunctionPass *createEntryExitInstrumenterPass(); 59 FunctionPass *createPostInlineEntryExitInstrumenterPass(); 60 61 //===----------------------------------------------------------------------===// 62 // 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: 66 // 67 // AU.addRequiredID(BreakCriticalEdgesID); 68 // 69 // This pass obviously invalidates the CFG, but can update forward dominator 70 // (set, immediate dominators, tree, and frontier) information. 71 // 72 FunctionPass *createBreakCriticalEdgesPass(); 73 extern char &BreakCriticalEdgesID; 74 75 //===----------------------------------------------------------------------===// 76 // 77 // LCSSA - This pass inserts phi nodes at loop boundaries to simplify other loop 78 // optimizations. 79 // 80 Pass *createLCSSAPass(); 81 extern char &LCSSAID; 82 83 //===----------------------------------------------------------------------===// 84 // 85 // AddDiscriminators - Add DWARF path discriminators to the IR. 86 FunctionPass *createAddDiscriminatorsPass(); 87 88 //===----------------------------------------------------------------------===// 89 // 90 // PromoteMemoryToRegister - This pass is used to promote memory references to 91 // be register references. A simple example of the transformation performed by 92 // this pass is: 93 // 94 // FROM CODE TO CODE 95 // %X = alloca i32, i32 1 ret i32 42 96 // store i32 42, i32 *%X 97 // %Y = load i32* %X 98 // ret i32 %Y 99 // 100 FunctionPass *createPromoteMemoryToRegisterPass(); 101 102 //===----------------------------------------------------------------------===// 103 // 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. 107 // 108 // AU.addRequiredID(LoopSimplifyID); 109 // 110 Pass *createLoopSimplifyPass(); 111 extern char &LoopSimplifyID; 112 113 /// This function returns a new pass that downgrades the debug info in the 114 /// module to line tables only. 115 ModulePass *createStripNonLineTableDebugInfoPass(); 116 117 //===----------------------------------------------------------------------===// 118 // 119 // ControlHeightReudction - Merges conditional blocks of code and reduces the 120 // number of conditional branches in the hot paths based on profiles. 121 // 122 FunctionPass *createControlHeightReductionLegacyPass(); 123 } 124 125 #endif 126