blob: 9162a86183db63e2e40736ebb52eb08a9ed2c58a [file] [log] [blame]
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001//===- llvm/Transforms/Utils.h - Utility Transformations --------*- C++ -*-===//
2//
Andrew Walbran16937d02019-10-22 13:54:20 +01003// 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
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01006//
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// createMetaRenamerPass - Rename everything with metasyntatic names.
25//
26ModulePass *createMetaRenamerPass();
27
28//===----------------------------------------------------------------------===//
Olivier Deprezf4ef2d02021-04-20 13:36:24 +020029// createUniqueInternalLinkageNamesPass - Make internal linkage symbol names
30// unique.
31//
32ModulePass *createUniqueInternalLinkageNamesPass();
33
34//===----------------------------------------------------------------------===//
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010035//
36// LowerInvoke - This pass removes invoke instructions, converting them to call
37// instructions.
38//
39FunctionPass *createLowerInvokePass();
40extern char &LowerInvokePassID;
41
42//===----------------------------------------------------------------------===//
43//
44// InstructionNamer - Give any unnamed non-void instructions "tmp" names.
45//
46FunctionPass *createInstructionNamerPass();
47extern char &InstructionNamerID;
48
49//===----------------------------------------------------------------------===//
50//
51// LowerSwitch - This pass converts SwitchInst instructions into a sequence of
52// chained binary branch instructions.
53//
54FunctionPass *createLowerSwitchPass();
55extern char &LowerSwitchID;
56
57//===----------------------------------------------------------------------===//
58//
59// EntryExitInstrumenter pass - Instrument function entry/exit with calls to
60// mcount(), @__cyg_profile_func_{enter,exit} and the like. There are two
61// variants, intended to run pre- and post-inlining, respectively.
62//
63FunctionPass *createEntryExitInstrumenterPass();
64FunctionPass *createPostInlineEntryExitInstrumenterPass();
65
66//===----------------------------------------------------------------------===//
67//
68// BreakCriticalEdges - Break all of the critical edges in the CFG by inserting
69// a dummy basic block. This pass may be "required" by passes that cannot deal
70// with critical edges. For this usage, a pass must call:
71//
72// AU.addRequiredID(BreakCriticalEdgesID);
73//
74// This pass obviously invalidates the CFG, but can update forward dominator
75// (set, immediate dominators, tree, and frontier) information.
76//
77FunctionPass *createBreakCriticalEdgesPass();
78extern char &BreakCriticalEdgesID;
79
80//===----------------------------------------------------------------------===//
81//
82// LCSSA - This pass inserts phi nodes at loop boundaries to simplify other loop
83// optimizations.
84//
85Pass *createLCSSAPass();
86extern char &LCSSAID;
87
88//===----------------------------------------------------------------------===//
89//
90// AddDiscriminators - Add DWARF path discriminators to the IR.
91FunctionPass *createAddDiscriminatorsPass();
92
93//===----------------------------------------------------------------------===//
94//
95// PromoteMemoryToRegister - This pass is used to promote memory references to
96// be register references. A simple example of the transformation performed by
97// this pass is:
98//
99// FROM CODE TO CODE
100// %X = alloca i32, i32 1 ret i32 42
101// store i32 42, i32 *%X
102// %Y = load i32* %X
103// ret i32 %Y
104//
105FunctionPass *createPromoteMemoryToRegisterPass();
106
107//===----------------------------------------------------------------------===//
108//
109// LoopSimplify - Insert Pre-header blocks into the CFG for every function in
110// the module. This pass updates dominator information, loop information, and
111// does not add critical edges to the CFG.
112//
113// AU.addRequiredID(LoopSimplifyID);
114//
115Pass *createLoopSimplifyPass();
116extern char &LoopSimplifyID;
117
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100118/// This function returns a new pass that downgrades the debug info in the
119/// module to line tables only.
Olivier Deprezf4ef2d02021-04-20 13:36:24 +0200120ModulePass *createStripNonLineTableDebugLegacyPass();
Andrew Scull0372a572018-11-16 15:47:06 +0000121
122//===----------------------------------------------------------------------===//
123//
124// ControlHeightReudction - Merges conditional blocks of code and reduces the
125// number of conditional branches in the hot paths based on profiles.
126//
127FunctionPass *createControlHeightReductionLegacyPass();
Olivier Deprezf4ef2d02021-04-20 13:36:24 +0200128
129//===----------------------------------------------------------------------===//
130//
131// InjectTLIMappingsLegacy - populates the VFABI attribute with the
132// scalar-to-vector mappings from the TargetLibraryInfo.
133//
134FunctionPass *createInjectTLIMappingsLegacyPass();
135
136//===----------------------------------------------------------------------===//
137//
138// UnifyLoopExits - For each loop, creates a new block N such that all exiting
139// blocks branch to N, and then N distributes control flow to all the original
140// exit blocks.
141//
142FunctionPass *createUnifyLoopExitsPass();
143
144//===----------------------------------------------------------------------===//
145//
146// FixIrreducible - Convert each SCC with irreducible control-flow
147// into a natural loop.
148//
149FunctionPass *createFixIrreduciblePass();
150
151//===----------------------------------------------------------------------===//
152//
153// AssumeSimplify - remove redundant assumes and merge assumes in the same
154// BasicBlock when possible.
155//
156FunctionPass *createAssumeSimplifyPass();
157
158//===----------------------------------------------------------------------===//
159//
160// CanonicalizeFreezeInLoops - Canonicalize freeze instructions in loops so they
161// don't block SCEV.
162//
163Pass *createCanonicalizeFreezeInLoopsPass();
164} // namespace llvm
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100165
166#endif