6
6
//
7
7
// ===----------------------------------------------------------------------===//
8
8
//
9
- // Definitions of ModRefInfo and FunctionModRefBehavior , which are used to
9
+ // Definitions of ModRefInfo and MemoryEffects , which are used to
10
10
// describe the memory effects of instructions.
11
11
//
12
12
// ===----------------------------------------------------------------------===//
@@ -60,7 +60,7 @@ raw_ostream &operator<<(raw_ostream &OS, ModRefInfo MR);
60
60
// / Loads from constant globals are not considered memory accesses for this
61
61
// / interface. Also, functions may freely modify stack space local to their
62
62
// / invocation without having to report it through these interfaces.
63
- class FunctionModRefBehavior {
63
+ class MemoryEffects {
64
64
public:
65
65
// / The locations at which a function might access memory.
66
66
enum Location {
@@ -87,61 +87,60 @@ class FunctionModRefBehavior {
87
87
force_iteration_on_noniterable_enum);
88
88
}
89
89
90
- FunctionModRefBehavior (uint32_t Data) : Data(Data) {}
90
+ MemoryEffects (uint32_t Data) : Data(Data) {}
91
91
92
92
void setModRef (Location Loc, ModRefInfo MR) {
93
93
Data &= ~(LocMask << getLocationPos (Loc));
94
94
Data |= static_cast <uint32_t >(MR) << getLocationPos (Loc);
95
95
}
96
96
97
- friend raw_ostream &operator <<(raw_ostream &OS, FunctionModRefBehavior RMRB);
97
+ friend raw_ostream &operator <<(raw_ostream &OS, MemoryEffects RMRB);
98
98
99
99
public:
100
- // / Create FunctionModRefBehavior that can access only the given location
101
- // / with the given ModRefInfo.
102
- FunctionModRefBehavior (Location Loc, ModRefInfo MR) { setModRef (Loc, MR); }
103
-
104
- // / Create FunctionModRefBehavior that can access any location with the
100
+ // / Create MemoryEffects that can access only the given location with the
105
101
// / given ModRefInfo.
106
- explicit FunctionModRefBehavior (ModRefInfo MR) {
102
+ MemoryEffects (Location Loc, ModRefInfo MR) { setModRef (Loc, MR); }
103
+
104
+ // / Create MemoryEffects that can access any location with the given
105
+ // / ModRefInfo.
106
+ explicit MemoryEffects (ModRefInfo MR) {
107
107
for (Location Loc : locations ())
108
108
setModRef (Loc, MR);
109
109
}
110
110
111
- // / Create FunctionModRefBehavior that can read and write any memory.
112
- static FunctionModRefBehavior unknown () {
113
- return FunctionModRefBehavior (ModRefInfo::ModRef);
111
+ // / Create MemoryEffects that can read and write any memory.
112
+ static MemoryEffects unknown () {
113
+ return MemoryEffects (ModRefInfo::ModRef);
114
114
}
115
115
116
- // / Create FunctionModRefBehavior that cannot read or write any memory.
117
- static FunctionModRefBehavior none () {
118
- return FunctionModRefBehavior (ModRefInfo::NoModRef);
116
+ // / Create MemoryEffects that cannot read or write any memory.
117
+ static MemoryEffects none () {
118
+ return MemoryEffects (ModRefInfo::NoModRef);
119
119
}
120
120
121
- // / Create FunctionModRefBehavior that can read any memory.
122
- static FunctionModRefBehavior readOnly () {
123
- return FunctionModRefBehavior (ModRefInfo::Ref);
121
+ // / Create MemoryEffects that can read any memory.
122
+ static MemoryEffects readOnly () {
123
+ return MemoryEffects (ModRefInfo::Ref);
124
124
}
125
125
126
- // / Create FunctionModRefBehavior that can write any memory.
127
- static FunctionModRefBehavior writeOnly () {
128
- return FunctionModRefBehavior (ModRefInfo::Mod);
126
+ // / Create MemoryEffects that can write any memory.
127
+ static MemoryEffects writeOnly () {
128
+ return MemoryEffects (ModRefInfo::Mod);
129
129
}
130
130
131
- // / Create FunctionModRefBehavior that can only access argument memory.
132
- static FunctionModRefBehavior argMemOnly (ModRefInfo MR) {
133
- return FunctionModRefBehavior (ArgMem, MR);
131
+ // / Create MemoryEffects that can only access argument memory.
132
+ static MemoryEffects argMemOnly (ModRefInfo MR) {
133
+ return MemoryEffects (ArgMem, MR);
134
134
}
135
135
136
- // / Create FunctionModRefBehavior that can only access inaccessible memory.
137
- static FunctionModRefBehavior inaccessibleMemOnly (ModRefInfo MR) {
138
- return FunctionModRefBehavior (InaccessibleMem, MR);
136
+ // / Create MemoryEffects that can only access inaccessible memory.
137
+ static MemoryEffects inaccessibleMemOnly (ModRefInfo MR) {
138
+ return MemoryEffects (InaccessibleMem, MR);
139
139
}
140
140
141
- // / Create FunctionModRefBehavior that can only access inaccessible or
142
- // / argument memory.
143
- static FunctionModRefBehavior inaccessibleOrArgMemOnly (ModRefInfo MR) {
144
- FunctionModRefBehavior FRMB = none ();
141
+ // / Create MemoryEffects that can only access inaccessible or argument memory.
142
+ static MemoryEffects inaccessibleOrArgMemOnly (ModRefInfo MR) {
143
+ MemoryEffects FRMB = none ();
145
144
FRMB.setModRef (ArgMem, MR);
146
145
FRMB.setModRef (InaccessibleMem, MR);
147
146
return FRMB;
@@ -152,18 +151,18 @@ class FunctionModRefBehavior {
152
151
return ModRefInfo ((Data >> getLocationPos (Loc)) & LocMask);
153
152
}
154
153
155
- // / Get new FunctionModRefBehavior with modified ModRefInfo for Loc.
156
- FunctionModRefBehavior getWithModRef (Location Loc, ModRefInfo MR) const {
157
- FunctionModRefBehavior FMRB = *this ;
158
- FMRB .setModRef (Loc, MR);
159
- return FMRB ;
154
+ // / Get new MemoryEffects with modified ModRefInfo for Loc.
155
+ MemoryEffects getWithModRef (Location Loc, ModRefInfo MR) const {
156
+ MemoryEffects ME = *this ;
157
+ ME .setModRef (Loc, MR);
158
+ return ME ;
160
159
}
161
160
162
- // / Get new FunctionModRefBehavior with NoModRef on the given Loc.
163
- FunctionModRefBehavior getWithoutLoc (Location Loc) const {
164
- FunctionModRefBehavior FMRB = *this ;
165
- FMRB .setModRef (Loc, ModRefInfo::NoModRef);
166
- return FMRB ;
161
+ // / Get new MemoryEffects with NoModRef on the given Loc.
162
+ MemoryEffects getWithoutLoc (Location Loc) const {
163
+ MemoryEffects ME = *this ;
164
+ ME .setModRef (Loc, ModRefInfo::NoModRef);
165
+ return ME ;
167
166
}
168
167
169
168
// / Get ModRefInfo for any location.
@@ -204,41 +203,44 @@ class FunctionModRefBehavior {
204
203
return isNoModRef (getModRef (Other));
205
204
}
206
205
207
- // / Intersect with another FunctionModRefBehavior .
208
- FunctionModRefBehavior operator &(FunctionModRefBehavior Other) const {
209
- return FunctionModRefBehavior (Data & Other.Data );
206
+ // / Intersect with other MemoryEffects .
207
+ MemoryEffects operator &(MemoryEffects Other) const {
208
+ return MemoryEffects (Data & Other.Data );
210
209
}
211
210
212
- // / Intersect (in-place) with another FunctionModRefBehavior .
213
- FunctionModRefBehavior &operator &=(FunctionModRefBehavior Other) {
211
+ // / Intersect (in-place) with other MemoryEffects .
212
+ MemoryEffects &operator &=(MemoryEffects Other) {
214
213
Data &= Other.Data ;
215
214
return *this ;
216
215
}
217
216
218
- // / Union with another FunctionModRefBehavior .
219
- FunctionModRefBehavior operator |(FunctionModRefBehavior Other) const {
220
- return FunctionModRefBehavior (Data | Other.Data );
217
+ // / Union with other MemoryEffects .
218
+ MemoryEffects operator |(MemoryEffects Other) const {
219
+ return MemoryEffects (Data | Other.Data );
221
220
}
222
221
223
- // / Union (in-place) with another FunctionModRefBehavior .
224
- FunctionModRefBehavior &operator |=(FunctionModRefBehavior Other) {
222
+ // / Union (in-place) with other MemoryEffects .
223
+ MemoryEffects &operator |=(MemoryEffects Other) {
225
224
Data |= Other.Data ;
226
225
return *this ;
227
226
}
228
227
229
- // / Check whether this is the same as another FunctionModRefBehavior .
230
- bool operator ==(FunctionModRefBehavior Other) const {
228
+ // / Check whether this is the same as other MemoryEffects .
229
+ bool operator ==(MemoryEffects Other) const {
231
230
return Data == Other.Data ;
232
231
}
233
232
234
- // / Check whether this is different from another FunctionModRefBehavior .
235
- bool operator !=(FunctionModRefBehavior Other) const {
233
+ // / Check whether this is different from other MemoryEffects .
234
+ bool operator !=(MemoryEffects Other) const {
236
235
return !operator ==(Other);
237
236
}
238
237
};
239
238
240
- // / Debug print FunctionModRefBehavior.
241
- raw_ostream &operator <<(raw_ostream &OS, FunctionModRefBehavior RMRB);
239
+ // / Debug print MemoryEffects.
240
+ raw_ostream &operator <<(raw_ostream &OS, MemoryEffects RMRB);
241
+
242
+ // Legacy alias.
243
+ using FunctionModRefBehavior = MemoryEffects;
242
244
243
245
} // namespace llvm
244
246
0 commit comments