LLVM
22.0.0git
include
llvm
CodeGen
PseudoSourceValue.h
Go to the documentation of this file.
1
//===-- llvm/CodeGen/PseudoSourceValue.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
//
9
// This file contains the declaration of the PseudoSourceValue class.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#ifndef LLVM_CODEGEN_PSEUDOSOURCEVALUE_H
14
#define LLVM_CODEGEN_PSEUDOSOURCEVALUE_H
15
16
#include "
llvm/Support/Compiler.h
"
17
18
namespace
llvm
{
19
20
class
GlobalValue
;
21
class
MachineFrameInfo
;
22
class
MachineMemOperand
;
23
class
MIRFormatter
;
24
class
PseudoSourceValue
;
25
class
raw_ostream
;
26
class
TargetMachine
;
27
28
LLVM_ABI
raw_ostream
&
operator<<
(
raw_ostream
&OS,
const
PseudoSourceValue
*PSV);
29
30
/// Special value supplied for machine level alias analysis. It indicates that
31
/// a memory access references the functions stack frame (e.g., a spill slot),
32
/// below the stack frame (e.g., argument space), or constant pool.
33
class
LLVM_ABI
PseudoSourceValue
{
34
public
:
35
enum
PSVKind
:
unsigned
{
36
Stack
,
37
GOT
,
38
JumpTable
,
39
ConstantPool
,
40
FixedStack
,
41
GlobalValueCallEntry
,
42
ExternalSymbolCallEntry
,
43
TargetCustom
44
};
45
46
private
:
47
unsigned
Kind;
48
unsigned
AddressSpace
;
49
LLVM_ABI
friend
raw_ostream
&
llvm::operator<<
(
raw_ostream
&OS,
50
const
PseudoSourceValue
*PSV);
51
52
friend
class
MachineMemOperand
;
// For printCustom().
53
friend
class
MIRFormatter
;
// For printCustom().
54
55
/// Implement printing for PseudoSourceValue. This is called from
56
/// Value::print or Value's operator<<.
57
virtual
void
printCustom(
raw_ostream
&O)
const
;
58
59
public
:
60
explicit
PseudoSourceValue
(
unsigned
Kind,
const
TargetMachine
&TM);
61
62
virtual
~PseudoSourceValue
();
63
64
unsigned
kind
()
const
{
return
Kind; }
65
66
bool
isStack
()
const
{
return
Kind ==
Stack
; }
67
bool
isGOT
()
const
{
return
Kind ==
GOT
; }
68
bool
isConstantPool
()
const
{
return
Kind ==
ConstantPool
; }
69
bool
isJumpTable
()
const
{
return
Kind ==
JumpTable
; }
70
71
unsigned
getAddressSpace
()
const
{
return
AddressSpace; }
72
73
unsigned
getTargetCustom
()
const
{
74
return
(Kind >=
TargetCustom
) ? ((Kind+1) -
TargetCustom
) : 0;
75
}
76
77
/// Test whether the memory pointed to by this PseudoSourceValue has a
78
/// constant value.
79
virtual
bool
isConstant
(
const
MachineFrameInfo
*)
const
;
80
81
/// Test whether the memory pointed to by this PseudoSourceValue may also be
82
/// pointed to by an LLVM IR Value.
83
virtual
bool
isAliased(
const
MachineFrameInfo
*)
const
;
84
85
/// Return true if the memory pointed to by this PseudoSourceValue can ever
86
/// alias an LLVM IR Value.
87
virtual
bool
mayAlias
(
const
MachineFrameInfo
*)
const
;
88
};
89
90
/// A specialized PseudoSourceValue for holding FixedStack values, which must
91
/// include a frame index.
92
class
LLVM_ABI
FixedStackPseudoSourceValue
:
public
PseudoSourceValue
{
93
const
int
FI;
94
95
public
:
96
explicit
FixedStackPseudoSourceValue
(
int
FI,
const
TargetMachine
&TM)
97
:
PseudoSourceValue
(
FixedStack
, TM), FI(FI) {}
98
99
static
bool
classof
(
const
PseudoSourceValue
*V) {
100
return
V->kind() ==
FixedStack
;
101
}
102
103
bool
isConstant
(
const
MachineFrameInfo
*MFI)
const override
;
104
105
bool
isAliased(
const
MachineFrameInfo
*MFI)
const override
;
106
107
bool
mayAlias
(
const
MachineFrameInfo
*)
const override
;
108
109
void
printCustom(
raw_ostream
&OS)
const override
;
110
111
int
getFrameIndex
()
const
{
return
FI; }
112
};
113
114
class
LLVM_ABI
CallEntryPseudoSourceValue
:
public
PseudoSourceValue
{
115
protected
:
116
CallEntryPseudoSourceValue
(
unsigned
Kind,
const
TargetMachine
&TM);
117
118
public
:
119
bool
isConstant
(
const
MachineFrameInfo
*)
const override
;
120
bool
isAliased
(
const
MachineFrameInfo
*)
const override
;
121
bool
mayAlias
(
const
MachineFrameInfo
*)
const override
;
122
};
123
124
/// A specialized pseudo source value for holding GlobalValue values.
125
class
GlobalValuePseudoSourceValue
:
public
CallEntryPseudoSourceValue
{
126
const
GlobalValue
*GV;
127
128
public
:
129
LLVM_ABI
GlobalValuePseudoSourceValue
(
const
GlobalValue
*GV,
130
const
TargetMachine
&TM);
131
132
static
bool
classof
(
const
PseudoSourceValue
*V) {
133
return
V->kind() ==
GlobalValueCallEntry
;
134
}
135
136
const
GlobalValue
*
getValue
()
const
{
return
GV; }
137
};
138
139
/// A specialized pseudo source value for holding external symbol values.
140
class
ExternalSymbolPseudoSourceValue
:
public
CallEntryPseudoSourceValue
{
141
const
char
*ES;
142
143
public
:
144
LLVM_ABI
ExternalSymbolPseudoSourceValue
(
const
char
*ES,
145
const
TargetMachine
&TM);
146
147
static
bool
classof
(
const
PseudoSourceValue
*V) {
148
return
V->kind() ==
ExternalSymbolCallEntry
;
149
}
150
151
const
char
*
getSymbol
()
const
{
return
ES; }
152
};
153
154
}
// end namespace llvm
155
156
#endif
mayAlias
static bool mayAlias(MachineInstr &MIa, SmallVectorImpl< MachineInstr * > &MemInsns, AliasAnalysis *AA)
Definition
AArch64LoadStoreOptimizer.cpp:1548
isConstant
static bool isConstant(const MachineInstr &MI)
Definition
AMDGPUInstructionSelector.cpp:2877
Compiler.h
LLVM_ABI
#define LLVM_ABI
Definition
Compiler.h:213
llvm::CallEntryPseudoSourceValue::CallEntryPseudoSourceValue
CallEntryPseudoSourceValue(unsigned Kind, const TargetMachine &TM)
Definition
PseudoSourceValue.cpp:81
llvm::CallEntryPseudoSourceValue::isAliased
bool isAliased(const MachineFrameInfo *) const override
Test whether the memory pointed to by this PseudoSourceValue may also be pointed to by an LLVM IR Val...
Definition
PseudoSourceValue.cpp:89
llvm::ExternalSymbolPseudoSourceValue::ExternalSymbolPseudoSourceValue
LLVM_ABI ExternalSymbolPseudoSourceValue(const char *ES, const TargetMachine &TM)
Definition
PseudoSourceValue.cpp:100
llvm::ExternalSymbolPseudoSourceValue::getSymbol
const char * getSymbol() const
Definition
PseudoSourceValue.h:151
llvm::ExternalSymbolPseudoSourceValue::classof
static bool classof(const PseudoSourceValue *V)
Definition
PseudoSourceValue.h:147
llvm::FixedStackPseudoSourceValue::FixedStackPseudoSourceValue
FixedStackPseudoSourceValue(int FI, const TargetMachine &TM)
Definition
PseudoSourceValue.h:96
llvm::FixedStackPseudoSourceValue::classof
static bool classof(const PseudoSourceValue *V)
Definition
PseudoSourceValue.h:99
llvm::FixedStackPseudoSourceValue::getFrameIndex
int getFrameIndex() const
Definition
PseudoSourceValue.h:111
llvm::GlobalValuePseudoSourceValue::GlobalValuePseudoSourceValue
LLVM_ABI GlobalValuePseudoSourceValue(const GlobalValue *GV, const TargetMachine &TM)
Definition
PseudoSourceValue.cpp:97
llvm::GlobalValuePseudoSourceValue::getValue
const GlobalValue * getValue() const
Definition
PseudoSourceValue.h:136
llvm::GlobalValuePseudoSourceValue::classof
static bool classof(const PseudoSourceValue *V)
Definition
PseudoSourceValue.h:132
llvm::GlobalValue
Definition
GlobalValue.h:49
llvm::MIRFormatter
MIRFormater - Interface to format MIR operand based on target.
Definition
MIRFormatter.h:33
llvm::MachineFrameInfo
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
Definition
MachineFrameInfo.h:108
llvm::MachineMemOperand
A description of a memory reference used in the backend.
Definition
MachineMemOperand.h:130
llvm::PseudoSourceValue
Special value supplied for machine level alias analysis.
Definition
PseudoSourceValue.h:33
llvm::PseudoSourceValue::isGOT
bool isGOT() const
Definition
PseudoSourceValue.h:67
llvm::PseudoSourceValue::MachineMemOperand
friend class MachineMemOperand
Definition
PseudoSourceValue.h:52
llvm::PseudoSourceValue::~PseudoSourceValue
virtual ~PseudoSourceValue()
llvm::PseudoSourceValue::getAddressSpace
unsigned getAddressSpace() const
Definition
PseudoSourceValue.h:71
llvm::PseudoSourceValue::PseudoSourceValue
PseudoSourceValue(unsigned Kind, const TargetMachine &TM)
Definition
PseudoSourceValue.cpp:27
llvm::PseudoSourceValue::MIRFormatter
friend class MIRFormatter
Definition
PseudoSourceValue.h:53
llvm::PseudoSourceValue::getTargetCustom
unsigned getTargetCustom() const
Definition
PseudoSourceValue.h:73
llvm::PseudoSourceValue::PSVKind
PSVKind
Definition
PseudoSourceValue.h:35
llvm::PseudoSourceValue::GOT
@ GOT
Definition
PseudoSourceValue.h:37
llvm::PseudoSourceValue::Stack
@ Stack
Definition
PseudoSourceValue.h:36
llvm::PseudoSourceValue::GlobalValueCallEntry
@ GlobalValueCallEntry
Definition
PseudoSourceValue.h:41
llvm::PseudoSourceValue::JumpTable
@ JumpTable
Definition
PseudoSourceValue.h:38
llvm::PseudoSourceValue::ExternalSymbolCallEntry
@ ExternalSymbolCallEntry
Definition
PseudoSourceValue.h:42
llvm::PseudoSourceValue::ConstantPool
@ ConstantPool
Definition
PseudoSourceValue.h:39
llvm::PseudoSourceValue::TargetCustom
@ TargetCustom
Definition
PseudoSourceValue.h:43
llvm::PseudoSourceValue::FixedStack
@ FixedStack
Definition
PseudoSourceValue.h:40
llvm::PseudoSourceValue::isStack
bool isStack() const
Definition
PseudoSourceValue.h:66
llvm::PseudoSourceValue::isConstantPool
bool isConstantPool() const
Definition
PseudoSourceValue.h:68
llvm::PseudoSourceValue::isJumpTable
bool isJumpTable() const
Definition
PseudoSourceValue.h:69
llvm::PseudoSourceValue::kind
unsigned kind() const
Definition
PseudoSourceValue.h:64
llvm::TargetMachine
Primary interface to the complete machine description for the target machine.
Definition
TargetMachine.h:83
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition
raw_ostream.h:53
llvm::NVPTXAS::AddressSpace
AddressSpace
Definition
NVPTXAddrSpace.h:21
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition
AddressRanges.h:18
llvm::operator<<
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
Definition
APFixedPoint.h:312
Generated on
for LLVM by
1.14.0