blob: cfb89d1bb755456c95850df47b60c6f8c0931c06 [file] [log] [blame]
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001//===- 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
18namespace llvm {
19
20class ModulePass;
21class FunctionPass;
22class Pass;
23
24//===----------------------------------------------------------------------===//
25// createMetaRenamerPass - Rename everything with metasyntatic names.
26//
27ModulePass *createMetaRenamerPass();
28
29//===----------------------------------------------------------------------===//
30//
31// LowerInvoke - This pass removes invoke instructions, converting them to call
32// instructions.
33//
34FunctionPass *createLowerInvokePass();
35extern char &LowerInvokePassID;
36
37//===----------------------------------------------------------------------===//
38//
39// InstructionNamer - Give any unnamed non-void instructions "tmp" names.
40//
41FunctionPass *createInstructionNamerPass();
42extern char &InstructionNamerID;
43
44//===----------------------------------------------------------------------===//
45//
46// LowerSwitch - This pass converts SwitchInst instructions into a sequence of
47// chained binary branch instructions.
48//
49FunctionPass *createLowerSwitchPass();
50extern 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//
58FunctionPass *createEntryExitInstrumenterPass();
59FunctionPass *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//
72FunctionPass *createBreakCriticalEdgesPass();
73extern char &BreakCriticalEdgesID;
74
75//===----------------------------------------------------------------------===//
76//
77// LCSSA - This pass inserts phi nodes at loop boundaries to simplify other loop
78// optimizations.
79//
80Pass *createLCSSAPass();
81extern char &LCSSAID;
82
83//===----------------------------------------------------------------------===//
84//
85// AddDiscriminators - Add DWARF path discriminators to the IR.
86FunctionPass *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//
100FunctionPass *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//
110Pass *createLoopSimplifyPass();
111extern char &LoopSimplifyID;
112
113//===----------------------------------------------------------------------===//
114//
115// InstructionSimplifier - Remove redundant instructions.
116//
117FunctionPass *createInstructionSimplifierPass();
118extern char &InstructionSimplifierID;
119
120/// This function returns a new pass that downgrades the debug info in the
121/// module to line tables only.
122ModulePass *createStripNonLineTableDebugInfoPass();
123}
124
125#endif