LLVM
17.0.0git
include
llvm
IR
SSAContext.h
Go to the documentation of this file.
1
//===- SSAContext.h ---------------------------------------------*- 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
/// \file
9
///
10
/// This file declares a specialization of the GenericSSAContext<X>
11
/// class template for LLVM IR.
12
///
13
//===----------------------------------------------------------------------===//
14
15
#ifndef LLVM_IR_SSACONTEXT_H
16
#define LLVM_IR_SSACONTEXT_H
17
18
#include "
llvm/ADT/GenericSSAContext.h
"
19
#include "
llvm/IR/BasicBlock.h
"
20
#include "
llvm/IR/ModuleSlotTracker.h
"
21
#include "
llvm/Support/Printable.h
"
22
23
#include <memory>
24
25
namespace
llvm
{
26
class
BasicBlock
;
27
class
Function
;
28
class
Instruction;
29
class
Value
;
30
template
<
typename
>
class
SmallVectorImpl;
31
template
<
typename
,
bool
>
class
DominatorTreeBase;
32
33
inline
auto
instrs
(
const
BasicBlock
&BB) {
34
return
llvm::make_range
(BB.
begin
(), BB.
end
());
35
}
36
37
template
<>
class
GenericSSAContext
<
Function
> {
38
Function
*
F
;
39
40
public
:
41
using
BlockT
=
BasicBlock
;
42
using
FunctionT
=
Function
;
43
using
InstructionT
=
Instruction
;
44
using
ValueRefT
=
Value
*;
45
using
ConstValueRefT
=
const
Value
*;
46
static
Value
*
ValueRefNull
;
47
using
DominatorTreeT
=
DominatorTreeBase<BlockT, false>
;
48
49
void
setFunction(
Function
&Fn);
50
Function
*
getFunction
()
const
{
return
F
; }
51
52
static
BasicBlock
*getEntryBlock(
Function
&
F
);
53
static
const
BasicBlock
*getEntryBlock(
const
Function
&
F
);
54
55
static
void
appendBlockDefs(
SmallVectorImpl<Value *>
&defs,
56
BasicBlock
&
block
);
57
static
void
appendBlockDefs(
SmallVectorImpl<const Value *>
&defs,
58
const
BasicBlock
&
block
);
59
60
static
void
appendBlockTerms(
SmallVectorImpl<Instruction *>
&terms,
61
BasicBlock
&
block
);
62
static
void
appendBlockTerms(
SmallVectorImpl<const Instruction *>
&terms,
63
const
BasicBlock
&
block
);
64
65
static
bool
comesBefore(
const
Instruction
*lhs,
const
Instruction
*rhs);
66
static
bool
isConstantValuePhi(
const
Instruction
&Instr);
67
const
BasicBlock
*getDefBlock(
const
Value
*
value
)
const
;
68
69
Printable
print
(
const
BasicBlock
*
Block
)
const
;
70
Printable
print
(
const
Instruction
*Inst)
const
;
71
Printable
print
(
const
Value
*
Value
)
const
;
72
};
73
74
using
SSAContext
=
GenericSSAContext<Function>
;
75
76
}
// namespace llvm
77
78
#endif
// LLVM_IR_SSACONTEXT_H
BasicBlock.h
value
Given that RA is a live value
Definition:
DeadArgumentElimination.cpp:702
GenericSSAContext.h
This file defines the little GenericSSAContext<X> template class that can be used to implement IR ana...
F
#define F(x, y, z)
Definition:
MD5.cpp:55
ModuleSlotTracker.h
Printable.h
block
unify loop Fixup each natural loop to have a single exit block
Definition:
UnifyLoopExits.cpp:72
llvm::BasicBlock
LLVM Basic Block Representation.
Definition:
BasicBlock.h:56
llvm::BasicBlock::end
iterator end()
Definition:
BasicBlock.h:316
llvm::BasicBlock::begin
iterator begin()
Instruction iterator methods.
Definition:
BasicBlock.h:314
llvm::DominatorTreeBase
Core dominator tree base class.
Definition:
GenericDomTree.h:243
llvm::Function
Definition:
Function.h:60
llvm::GenericSSAContext< Function >
Definition:
SSAContext.h:37
llvm::GenericSSAContext< Function >::ValueRefNull
static Value * ValueRefNull
Definition:
SSAContext.h:46
llvm::GenericSSAContext< Function >::getFunction
Function * getFunction() const
Definition:
SSAContext.h:50
llvm::GenericSSAContext
Definition:
GenericSSAContext.h:24
llvm::Instruction
Definition:
Instruction.h:42
llvm::Printable
Simple wrapper around std::function<void(raw_ostream&)>.
Definition:
Printable.h:38
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition:
SmallVector.h:577
llvm::Value
LLVM Value Representation.
Definition:
Value.h:74
llvm::ISD::BasicBlock
@ BasicBlock
Various leaf nodes.
Definition:
ISDOpcodes.h:71
llvm::TargetStackID::Value
Value
Definition:
TargetFrameLowering.h:27
llvm::codeview::PublicSymFlags::Function
@ Function
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition:
AddressRanges.h:18
llvm::PseudoProbeType::Block
@ Block
llvm::make_range
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
Definition:
iterator_range.h:53
llvm::print
Printable print(const GCNRegPressure &RP, const GCNSubtarget *ST=nullptr)
Definition:
GCNRegPressure.cpp:138
llvm::instrs
auto instrs(const MachineBasicBlock &BB)
Definition:
MachineSSAContext.h:35
Generated on Mon Feb 6 2023 01:13:50 for LLVM by
1.9.6