LLVM
8.0.1
include
llvm
Transforms
InstCombine
InstCombine.h
Go to the documentation of this file.
1
//===- InstCombine.h - InstCombine pass -------------------------*- 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
/// \file
10
///
11
/// This file provides the primary interface to the instcombine pass. This pass
12
/// is suitable for use in the new pass manager. For a pass that works with the
13
/// legacy pass manager, use \c createInstructionCombiningPass().
14
///
15
//===----------------------------------------------------------------------===//
16
17
#ifndef LLVM_TRANSFORMS_INSTCOMBINE_INSTCOMBINE_H
18
#define LLVM_TRANSFORMS_INSTCOMBINE_INSTCOMBINE_H
19
20
#include "
llvm/IR/Function.h
"
21
#include "
llvm/IR/PassManager.h
"
22
#include "
llvm/Transforms/InstCombine/InstCombineWorklist.h
"
23
24
namespace
llvm
{
25
26
class
InstCombinePass
:
public
PassInfoMixin
<InstCombinePass> {
27
InstCombineWorklist
Worklist;
28
bool
ExpensiveCombines;
29
30
public
:
31
static
StringRef
name
() {
return
"InstCombinePass"
; }
32
33
explicit
InstCombinePass
(
bool
ExpensiveCombines =
true
)
34
: ExpensiveCombines(ExpensiveCombines) {}
35
36
PreservedAnalyses
run
(
Function
&
F
,
FunctionAnalysisManager
&AM);
37
};
38
39
/// The legacy pass manager's instcombine pass.
40
///
41
/// This is a basic whole-function wrapper around the instcombine utility. It
42
/// will try to combine all instructions in the function.
43
class
InstructionCombiningPass
:
public
FunctionPass
{
44
InstCombineWorklist
Worklist;
45
const
bool
ExpensiveCombines;
46
47
public
:
48
static
char
ID
;
// Pass identification, replacement for typeid
49
50
InstructionCombiningPass
(
bool
ExpensiveCombines =
true
)
51
:
FunctionPass
(ID), ExpensiveCombines(ExpensiveCombines) {
52
initializeInstructionCombiningPassPass
(*
PassRegistry::getPassRegistry
());
53
}
54
55
void
getAnalysisUsage(
AnalysisUsage
&AU)
const override
;
56
bool
runOnFunction
(
Function
&
F
)
override
;
57
};
58
59
//===----------------------------------------------------------------------===//
60
//
61
// InstructionCombining - Combine instructions to form fewer, simple
62
// instructions. This pass does not modify the CFG, and has a tendency to make
63
// instructions dead, so a subsequent DCE pass is useful.
64
//
65
// This pass combines things like:
66
// %Y = add int 1, %X
67
// %Z = add int 1, %Y
68
// into:
69
// %Z = add int 2, %X
70
//
71
FunctionPass
*
createInstructionCombiningPass
(
bool
ExpensiveCombines =
true
);
72
}
73
74
#endif
llvm::PassRegistry::getPassRegistry
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
Definition:
PassRegistry.cpp:32
llvm
This class represents lattice values for constants.
Definition:
AllocatorList.h:24
F
F(f)
llvm::Function
Definition:
Function.h:60
llvm::InstructionCombiningPass::ID
static char ID
Definition:
InstCombine.h:48
llvm::PassInfoMixin
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition:
PassManager.h:366
llvm::createInstructionCombiningPass
FunctionPass * createInstructionCombiningPass(bool ExpensiveCombines=true)
Definition:
InstructionCombining.cpp:3532
llvm::InstCombinePass::run
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Definition:
InstructionCombining.cpp:3454
runOnFunction
static bool runOnFunction(Function &F, bool PostInlining)
Definition:
EntryExitInstrumenter.cpp:66
llvm::PreservedAnalyses
A set of analyses that are preserved following a run of a transformation pass.
Definition:
PassManager.h:154
llvm::AnalysisUsage
Represent the analysis usage information of a pass.
Definition:
PassAnalysisSupport.h:43
llvm::FunctionPass
FunctionPass class - This class is used to implement most global optimizations.
Definition:
Pass.h:285
llvm::InstCombinePass
Definition:
InstCombine.h:26
llvm::InstructionCombiningPass
The legacy pass manager's instcombine pass.
Definition:
InstCombine.h:43
llvm::InstructionCombiningPass::InstructionCombiningPass
InstructionCombiningPass(bool ExpensiveCombines=true)
Definition:
InstCombine.h:50
llvm::InstCombineWorklist
InstCombineWorklist - This is the worklist management logic for InstCombine.
Definition:
InstCombineWorklist.h:27
llvm::InstCombinePass::InstCombinePass
InstCombinePass(bool ExpensiveCombines=true)
Definition:
InstCombine.h:33
llvm::InstCombinePass::name
static StringRef name()
Definition:
InstCombine.h:31
Function.h
llvm::initializeInstructionCombiningPassPass
void initializeInstructionCombiningPassPass(PassRegistry &)
InstCombineWorklist.h
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition:
StringRef.h:49
llvm::AnalysisManager
A container for analyses that lazily runs them and caches their results.
Definition:
InstructionSimplify.h:41
PassManager.h
This header defines various interfaces for pass management in LLVM.
Generated on Sun Dec 20 2020 13:53:38 for LLVM by
1.8.13