LLVM 20.0.0git
Utils.h
Go to the documentation of this file.
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// EntryExitInstrumenter pass - Instrument function entry/exit with calls to
42// mcount(), @__cyg_profile_func_{enter,exit} and the like. There are two
43// variants, intended to run pre- and post-inlining, respectively. Only the
44// post-inlining variant is used with the legacy pass manager.
45//
47
48//===----------------------------------------------------------------------===//
49//
50// BreakCriticalEdges - Break all of the critical edges in the CFG by inserting
51// a dummy basic block. This pass may be "required" by passes that cannot deal
52// with critical edges. For this usage, a pass must call:
53//
54// AU.addRequiredID(BreakCriticalEdgesID);
55//
56// This pass obviously invalidates the CFG, but can update forward dominator
57// (set, immediate dominators, tree, and frontier) information.
58//
60extern char &BreakCriticalEdgesID;
61
62//===----------------------------------------------------------------------===//
63//
64// LCSSA - This pass inserts phi nodes at loop boundaries to simplify other loop
65// optimizations.
66//
68extern char &LCSSAID;
69
70//===----------------------------------------------------------------------===//
71//
72// PromoteMemoryToRegister - This pass is used to promote memory references to
73// be register references. A simple example of the transformation performed by
74// this pass is:
75//
76// FROM CODE TO CODE
77// %X = alloca i32, i32 1 ret i32 42
78// store i32 42, i32 *%X
79// %Y = load i32* %X
80// ret i32 %Y
81//
83
84//===----------------------------------------------------------------------===//
85//
86// RegToMemWrapperPass - This pass is used to demote registers to memory
87// references. In basically undoes the PromoteMemoryToRegister pass to make cfg
88// hacking easier.
89//
91
92//===----------------------------------------------------------------------===//
93//
94// LoopSimplify - Insert Pre-header blocks into the CFG for every function in
95// the module. This pass updates dominator information, loop information, and
96// does not add critical edges to the CFG.
97//
98// AU.addRequiredID(LoopSimplifyID);
99//
101extern char &LoopSimplifyID;
102
103//===----------------------------------------------------------------------===//
104//
105// UnifyLoopExits - For each loop, creates a new block N such that all exiting
106// blocks branch to N, and then N distributes control flow to all the original
107// exit blocks.
108//
110
111//===----------------------------------------------------------------------===//
112//
113// FixIrreducible - Convert each SCC with irreducible control-flow
114// into a natural loop.
115//
117
118//===----------------------------------------------------------------------===//
119//
120// CanonicalizeFreezeInLoops - Canonicalize freeze instructions in loops so they
121// don't block SCEV.
122//
124
125//===----------------------------------------------------------------------===//
126// LowerGlobalDtorsLegacy - Lower @llvm.global_dtors by creating wrapper
127// functions that are registered in @llvm.global_ctors and which contain a call
128// to `__cxa_atexit` to register their destructor functions.
130} // namespace llvm
131
132#endif
aarch64 AArch64 CCMP Pass
FunctionPass class - This class is used to implement most global optimizations.
Definition: Pass.h:310
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
Definition: Pass.h:251
Pass interface - Implemented by all 'passes'.
Definition: Pass.h:94
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
Pass * createLCSSAPass()
Definition: LCSSA.cpp:541
FunctionPass * createPromoteMemoryToRegisterPass()
Definition: Mem2Reg.cpp:114
char & LoopSimplifyID
FunctionPass * createRegToMemWrapperPass()
Definition: Reg2Mem.cpp:148
FunctionPass * createPostInlineEntryExitInstrumenterPass()
char & LCSSAID
Definition: LCSSA.cpp:542
char & LowerSwitchID
ModulePass * createLowerGlobalDtorsLegacyPass()
FunctionPass * createLowerInvokePass()
Definition: LowerInvoke.cpp:85
FunctionPass * createUnifyLoopExitsPass()
FunctionPass * createFixIrreduciblePass()
char & BreakCriticalEdgesID
FunctionPass * createLowerSwitchPass()
FunctionPass * createBreakCriticalEdgesPass()
Pass * createCanonicalizeFreezeInLoopsPass()
char & LowerInvokePassID
Definition: LowerInvoke.cpp:82
Pass * createLoopSimplifyPass()