LLVM: include/llvm/Transforms/Utils/ValueMapper.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef LLVM_TRANSFORMS_UTILS_VALUEMAPPER_H
15#define LLVM_TRANSFORMS_UTILS_VALUEMAPPER_H
16
23
24namespace llvm {
25
37
42
43
44
46 virtual void anchor();
47
48public:
50
51
52
54};
55
56
57
59 virtual void anchor();
60
61protected:
66
67public:
68
69
71};
72
73
76
77
78
79
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
99
100
101
102
103
105
106
107
109
110
111
112
113
114
116};
117
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
164 void *pImpl;
165
166public:
176
177
178
179
180
184
185
186
187
188
190
193
196
203
205 unsigned MappingContextID = 0);
208 bool IsOldCtorDtor,
210 unsigned MappingContextID = 0);
212 unsigned MappingContextID = 0);
214 unsigned MappingContextID = 0);
216 unsigned MappingContextID = 0);
217};
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
241 return ValueMapper(VM, Flags, TypeMapper, Materializer, IdentityMD)
243}
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
267 return ValueMapper(VM, Flags, TypeMapper, Materializer, IdentityMD)
269}
270
271
277 return ValueMapper(VM, Flags, TypeMapper, Materializer, IdentityMD)
279}
280
281
282
283
284
285
286
287
288
294 ValueMapper(VM, Flags, TypeMapper, Materializer, IdentityMD)
296}
297
298
299
300
301
303
304
305
311 ValueMapper(VM, Flags, TypeMapper, Materializer, IdentityMD)
313}
314
315
316
324 ValueMapper(VM, Flags, TypeMapper, Materializer, IdentityMD)
326}
327
328
329
330
331
332
333
341
342
348 return ValueMapper(VM, Flags, TypeMapper, Materializer, IdentityMD)
350}
351
352}
353
354#endif
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
This file defines the SmallPtrSet class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
This is an important base class in LLVM.
Base class for non-instruction debug metadata records that have positions within IR.
A Module instance is used to store all the information related to an LLVM module.
Interface for looking up the initializer for a variable name, used by Init::resolveReferences.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
The instances of the Type class are immutable: once they are created, they are never changed.
This is a class that can be implemented by clients to remap types when cloning constants and instruct...
Definition ValueMapper.h:45
virtual ~ValueMapTypeRemapper()=default
virtual Type * remapType(Type *SrcTy)=0
The client should implement this method if they want to remap types while mapping values.
Context for (re-)mapping values (and metadata).
Definition ValueMapper.h:163
LLVM_ABI void remapDbgRecord(Module *M, DbgRecord &V)
LLVM_ABI void remapDbgRecordRange(Module *M, iterator_range< DbgRecordIterator > Range)
LLVM_ABI MDNode * mapMDNode(const MDNode &N)
LLVM_ABI Metadata * mapMetadata(const Metadata &MD)
ValueMapper & operator=(const ValueMapper &)=delete
LLVM_ABI void remapInstruction(Instruction &I)
ValueMapper(ValueMapper &&)=delete
LLVM_ABI void scheduleMapGlobalInitializer(GlobalVariable &GV, Constant &Init, unsigned MappingContextID=0)
LLVM_ABI void scheduleRemapFunction(Function &F, unsigned MappingContextID=0)
LLVM_ABI ValueMapper(ValueToValueMapTy &VM, RemapFlags Flags=RF_None, ValueMapTypeRemapper *TypeMapper=nullptr, ValueMaterializer *Materializer=nullptr, const MetadataPredicate *IdentityMD=nullptr)
LLVM_ABI void scheduleMapGlobalIFunc(GlobalIFunc &GI, Constant &Resolver, unsigned MappingContextID=0)
LLVM_ABI unsigned registerAlternateMappingContext(ValueToValueMapTy &VM, ValueMaterializer *Materializer=nullptr)
Register an alternate mapping context.
ValueMapper(const ValueMapper &)=delete
LLVM_ABI void remapFunction(Function &F)
LLVM_ABI Constant * mapConstant(const Constant &C)
ValueMapper & operator=(ValueMapper &&)=delete
LLVM_ABI void scheduleMapGlobalAlias(GlobalAlias &GA, Constant &Aliasee, unsigned MappingContextID=0)
LLVM_ABI void remapGlobalObjectMetadata(GlobalObject &GO)
LLVM_ABI Value * mapValue(const Value &V)
LLVM_ABI void scheduleMapAppendingVariable(GlobalVariable &GV, GlobalVariable *OldGV, bool IsOldCtorDtor, ArrayRef< Constant * > NewMembers, unsigned MappingContextID=0)
LLVM_ABI void addFlags(RemapFlags Flags)
Add to the current RemapFlags.
This is a class that can be implemented by clients to materialize Values on demand.
Definition ValueMapper.h:58
ValueMaterializer()=default
ValueMaterializer & operator=(const ValueMaterializer &)=default
virtual Value * materialize(Value *V)=0
This method can be implemented to generate a mapped Value on demand.
~ValueMaterializer()=default
ValueMaterializer(const ValueMaterializer &)=default
LLVM Value Representation.
A range adaptor for a pair of iterators.
ilist_select_iterator_type< OptionsT, false, false > iterator
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
std::function< bool(const Metadata *)> MetadataPredicate
Definition ValueMapper.h:41
void RemapDbgRecordRange(Module *M, iterator_range< DbgRecordIterator > Range, ValueToValueMapTy &VM, RemapFlags Flags=RF_None, ValueMapTypeRemapper *TypeMapper=nullptr, ValueMaterializer *Materializer=nullptr, const MetadataPredicate *IdentityMD=nullptr)
Remap the Values used in the DbgRecords Range using the value map VM.
Definition ValueMapper.h:317
RemapFlags
These are flags that the value mapping APIs allow.
Definition ValueMapper.h:74
@ RF_IgnoreMissingLocals
If this flag is set, the remapper ignores missing function-local entries (Argument,...
Definition ValueMapper.h:98
@ RF_NullMapMissingGlobalValues
Any global values not in value map are mapped to null instead of mapping to self.
Definition ValueMapper.h:108
@ RF_None
Definition ValueMapper.h:75
@ RF_NoModuleLevelChanges
If this flag is set, the remapper knows that only local values within a function (such as an instruct...
Definition ValueMapper.h:80
@ RF_DoNotRemapAtoms
Do not remap source location atoms.
Definition ValueMapper.h:115
@ RF_ReuseAndMutateDistinctMDs
Instruct the remapper to reuse and mutate distinct metadata (remapping them in place) instead of clon...
Definition ValueMapper.h:104
SmallPtrSet< const Metadata *, 16 > MetadataSetTy
Definition ValueMapper.h:40
void RemapInstruction(Instruction *I, ValueToValueMapTy &VM, RemapFlags Flags=RF_None, ValueMapTypeRemapper *TypeMapper=nullptr, ValueMaterializer *Materializer=nullptr, const MetadataPredicate *IdentityMD=nullptr)
Convert the instruction operands from referencing the current values into those specified by VM.
Definition ValueMapper.h:289
void RemapDbgRecord(Module *M, DbgRecord *DR, ValueToValueMapTy &VM, RemapFlags Flags=RF_None, ValueMapTypeRemapper *TypeMapper=nullptr, ValueMaterializer *Materializer=nullptr, const MetadataPredicate *IdentityMD=nullptr)
Remap the Values used in the DbgRecord DR using the value map VM.
Definition ValueMapper.h:306
ValueMap< const Value *, WeakTrackingVH > ValueToValueMapTy
Value * MapValue(const Value *V, ValueToValueMapTy &VM, RemapFlags Flags=RF_None, ValueMapTypeRemapper *TypeMapper=nullptr, ValueMaterializer *Materializer=nullptr, const MetadataPredicate *IdentityMD=nullptr)
Look up or compute a value in the value map.
Definition ValueMapper.h:236
void RemapFunction(Function &F, ValueToValueMapTy &VM, RemapFlags Flags=RF_None, ValueMapTypeRemapper *TypeMapper=nullptr, ValueMaterializer *Materializer=nullptr, const MetadataPredicate *IdentityMD=nullptr)
Remap the operands, metadata, arguments, and instructions of a function.
Definition ValueMapper.h:334
simple_ilist< DbgRecord >::iterator DbgRecordIterator
Definition ValueMapper.h:39
APInt operator|(APInt a, const APInt &b)
LLVM_ABI void RemapSourceAtom(Instruction *I, ValueToValueMapTy &VM)
Remap source location atom.
Metadata * MapMetadata(const Metadata *MD, ValueToValueMapTy &VM, RemapFlags Flags=RF_None, ValueMapTypeRemapper *TypeMapper=nullptr, ValueMaterializer *Materializer=nullptr, const MetadataPredicate *IdentityMD=nullptr)
Lookup or compute a mapping for a piece of metadata.
Definition ValueMapper.h:262