1//===- llvm/Transforms/Utils.h - Utility Transformations --------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This header file defines prototypes for accessor functions that expose passes
10// in the Utils transformations library.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_TRANSFORMS_UTILS_H
15#define LLVM_TRANSFORMS_UTILS_H
16
17namespace llvm {
18
19class ModulePass;
20class FunctionPass;
21class Pass;
22
23//===----------------------------------------------------------------------===//
24//
25// LowerInvoke - This pass removes invoke instructions, converting them to call
26// instructions.
27//
28FunctionPass *createLowerInvokePass();
29extern char &LowerInvokePassID;
30
31//===----------------------------------------------------------------------===//
32//
33// LowerSwitch - This pass converts SwitchInst instructions into a sequence of
34// chained binary branch instructions.
35//
36FunctionPass *createLowerSwitchPass();
37extern char &LowerSwitchID;
38
39//===----------------------------------------------------------------------===//
40//
41// BreakCriticalEdges - Break all of the critical edges in the CFG by inserting
42// a dummy basic block. This pass may be "required" by passes that cannot deal
43// with critical edges. For this usage, a pass must call:
44//
45// AU.addRequiredID(BreakCriticalEdgesID);
46//
47// This pass obviously invalidates the CFG, but can update forward dominator
48// (set, immediate dominators, tree, and frontier) information.
49//
50FunctionPass *createBreakCriticalEdgesPass();
51extern char &BreakCriticalEdgesID;
52
53//===----------------------------------------------------------------------===//
54//
55// LCSSA - This pass inserts phi nodes at loop boundaries to simplify other loop
56// optimizations.
57//
58Pass *createLCSSAPass();
59extern char &LCSSAID;
60
61//===----------------------------------------------------------------------===//
62//
63// PromoteMemoryToRegister - This pass is used to promote memory references to
64// be register references. A simple example of the transformation performed by
65// this pass is:
66//
67// FROM CODE TO CODE
68// %X = alloca i32, i32 1 ret i32 42
69// store i32 42, i32 *%X
70// %Y = load i32* %X
71// ret i32 %Y
72//
73FunctionPass *createPromoteMemoryToRegisterPass(bool IsForced = false);
74
75//===----------------------------------------------------------------------===//
76//
77// LoopSimplify - Insert Pre-header blocks into the CFG for every function in
78// the module. This pass updates dominator information, loop information, and
79// does not add critical edges to the CFG.
80//
81// AU.addRequiredID(LoopSimplifyID);
82//
83Pass *createLoopSimplifyPass();
84extern char &LoopSimplifyID;
85
86//===----------------------------------------------------------------------===//
87//
88// UnifyLoopExits - For each loop, creates a new block N such that all exiting
89// blocks branch to N, and then N distributes control flow to all the original
90// exit blocks.
91//
92FunctionPass *createUnifyLoopExitsPass();
93
94//===----------------------------------------------------------------------===//
95//
96// FixIrreducible - Convert each SCC with irreducible control-flow
97// into a natural loop.
98//
99FunctionPass *createFixIrreduciblePass();
100
101//===----------------------------------------------------------------------===//
102//
103// CanonicalizeFreezeInLoops - Canonicalize freeze instructions in loops so they
104// don't block SCEV.
105//
106Pass *createCanonicalizeFreezeInLoopsPass();
107
108//===----------------------------------------------------------------------===//
109// LowerGlobalDtorsLegacy - Lower @llvm.global_dtors by creating wrapper
110// functions that are registered in @llvm.global_ctors and which contain a call
111// to `__cxa_atexit` to register their destructor functions.
112ModulePass *createLowerGlobalDtorsLegacyPass();
113} // namespace llvm
114
115#endif
116

source code of llvm/include/llvm/Transforms/Utils.h