Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:44:45

0001 //===- llvm/Transforms/Utils.h - Utility Transformations --------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // This header file defines prototypes for accessor functions that expose passes
0010 // in the Utils transformations library.
0011 //
0012 //===----------------------------------------------------------------------===//
0013 
0014 #ifndef LLVM_TRANSFORMS_UTILS_H
0015 #define LLVM_TRANSFORMS_UTILS_H
0016 
0017 namespace llvm {
0018 
0019 class ModulePass;
0020 class FunctionPass;
0021 class Pass;
0022 
0023 //===----------------------------------------------------------------------===//
0024 //
0025 // LowerInvoke - This pass removes invoke instructions, converting them to call
0026 // instructions.
0027 //
0028 FunctionPass *createLowerInvokePass();
0029 extern char &LowerInvokePassID;
0030 
0031 //===----------------------------------------------------------------------===//
0032 //
0033 // LowerSwitch - This pass converts SwitchInst instructions into a sequence of
0034 // chained binary branch instructions.
0035 //
0036 FunctionPass *createLowerSwitchPass();
0037 extern char &LowerSwitchID;
0038 
0039 //===----------------------------------------------------------------------===//
0040 //
0041 // EntryExitInstrumenter pass - Instrument function entry/exit with calls to
0042 // mcount(), @__cyg_profile_func_{enter,exit} and the like. There are two
0043 // variants, intended to run pre- and post-inlining, respectively. Only the
0044 // post-inlining variant is used with the legacy pass manager.
0045 //
0046 FunctionPass *createPostInlineEntryExitInstrumenterPass();
0047 
0048 //===----------------------------------------------------------------------===//
0049 //
0050 // BreakCriticalEdges - Break all of the critical edges in the CFG by inserting
0051 // a dummy basic block. This pass may be "required" by passes that cannot deal
0052 // with critical edges. For this usage, a pass must call:
0053 //
0054 //   AU.addRequiredID(BreakCriticalEdgesID);
0055 //
0056 // This pass obviously invalidates the CFG, but can update forward dominator
0057 // (set, immediate dominators, tree, and frontier) information.
0058 //
0059 FunctionPass *createBreakCriticalEdgesPass();
0060 extern char &BreakCriticalEdgesID;
0061 
0062 //===----------------------------------------------------------------------===//
0063 //
0064 // LCSSA - This pass inserts phi nodes at loop boundaries to simplify other loop
0065 // optimizations.
0066 //
0067 Pass *createLCSSAPass();
0068 extern char &LCSSAID;
0069 
0070 //===----------------------------------------------------------------------===//
0071 //
0072 // PromoteMemoryToRegister - This pass is used to promote memory references to
0073 // be register references. A simple example of the transformation performed by
0074 // this pass is:
0075 //
0076 //        FROM CODE                           TO CODE
0077 //   %X = alloca i32, i32 1                 ret i32 42
0078 //   store i32 42, i32 *%X
0079 //   %Y = load i32* %X
0080 //   ret i32 %Y
0081 //
0082 FunctionPass *createPromoteMemoryToRegisterPass();
0083 
0084 //===----------------------------------------------------------------------===//
0085 //
0086 // RegToMemWrapperPass - This pass is used to demote registers to memory
0087 // references. In basically undoes the PromoteMemoryToRegister pass to make cfg
0088 // hacking easier.
0089 //
0090 FunctionPass *createRegToMemWrapperPass();
0091 
0092 //===----------------------------------------------------------------------===//
0093 //
0094 // LoopSimplify - Insert Pre-header blocks into the CFG for every function in
0095 // the module.  This pass updates dominator information, loop information, and
0096 // does not add critical edges to the CFG.
0097 //
0098 //   AU.addRequiredID(LoopSimplifyID);
0099 //
0100 Pass *createLoopSimplifyPass();
0101 extern char &LoopSimplifyID;
0102 
0103 //===----------------------------------------------------------------------===//
0104 //
0105 // UnifyLoopExits - For each loop, creates a new block N such that all exiting
0106 // blocks branch to N, and then N distributes control flow to all the original
0107 // exit blocks.
0108 //
0109 FunctionPass *createUnifyLoopExitsPass();
0110 
0111 //===----------------------------------------------------------------------===//
0112 //
0113 // FixIrreducible - Convert each SCC with irreducible control-flow
0114 // into a natural loop.
0115 //
0116 FunctionPass *createFixIrreduciblePass();
0117 
0118 //===----------------------------------------------------------------------===//
0119 //
0120 // CanonicalizeFreezeInLoops - Canonicalize freeze instructions in loops so they
0121 // don't block SCEV.
0122 //
0123 Pass *createCanonicalizeFreezeInLoopsPass();
0124 
0125 //===----------------------------------------------------------------------===//
0126 // LowerGlobalDtorsLegacy - Lower @llvm.global_dtors by creating wrapper
0127 // functions that are registered in @llvm.global_ctors and which contain a call
0128 // to `__cxa_atexit` to register their destructor functions.
0129 ModulePass *createLowerGlobalDtorsLegacyPass();
0130 } // namespace llvm
0131 
0132 #endif