LLVM 23.0.0git
Context.h
Go to the documentation of this file.
1//===- Context.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#ifndef LLVM_SANDBOXIR_CONTEXT_H
10#define LLVM_SANDBOXIR_CONTEXT_H
11
12#include "llvm/ADT/DenseMap.h"
13#include "llvm/ADT/MapVector.h"
15#include "llvm/IR/LLVMContext.h"
17#include "llvm/SandboxIR/Type.h"
19
20#include <cstdint>
21
22namespace llvm {
23namespace sandboxir {
24
25class Argument;
26class BBIterator;
27class Constant;
28class Module;
29class Region;
30class Value;
31class Use;
32
33class Context {
34public:
35 // A EraseInstrCallback receives the instruction about to be erased.
36 using EraseInstrCallback = std::function<void(Instruction *)>;
37 // A CreateInstrCallback receives the instruction about to be created.
38 using CreateInstrCallback = std::function<void(Instruction *)>;
39 // A MoveInstrCallback receives the instruction about to be moved, the
40 // destination BB and an iterator pointing to the insertion position.
42 std::function<void(Instruction *, const BBIterator &)>;
43 // A SetUseCallback receives the Use that is about to get its source set.
44 using SetUseCallback = std::function<void(const Use &, Value *)>;
45
46 /// An ID for a registered callback. Used for deregistration. A dedicated type
47 /// is employed so as to keep IDs opaque to the end user; only Context should
48 /// deal with its underlying representation.
49 class CallbackID {
50 public:
51 // Uses a 64-bit integer so we don't have to worry about the unlikely case
52 // of overflowing a 32-bit counter.
53 using ValTy = uint64_t;
54 static constexpr ValTy InvalidVal = 0;
55
56 private:
57 // Default initialization results in an invalid ID.
58 ValTy Val = InvalidVal;
59 explicit CallbackID(ValTy Val) : Val{Val} {
60 assert(Val != InvalidVal && "newly-created ID is invalid!");
61 }
62
63 public:
64 CallbackID() = default;
65 friend class Context;
66 friend struct DenseMapInfo<CallbackID>;
67 };
68
69protected:
71 friend class Type; // For LLVMCtx.
72 friend class PointerType; // For LLVMCtx.
73 friend class IntegerType; // For LLVMCtx.
74 friend class ByteType; // For LLVMCtx.
75 friend class StructType; // For LLVMCtx.
76 friend class Region; // For LLVMCtx.
77 friend class IRSnapshotChecker; // To snapshot LLVMModuleToModuleMap.
78
80
81 /// Maps LLVM Value to the corresponding sandboxir::Value. Owns all
82 /// SandboxIR objects.
84
85 /// Maps an LLVM Module to the corresponding sandboxir::Module.
87
88 /// Type has a protected destructor to prohibit the user from managing the
89 /// lifetime of the Type objects. Context is friend of Type, and this custom
90 /// deleter can destroy Type.
91 struct TypeDeleter {
92 void operator()(Type *Ty) { delete Ty; }
93 };
94 /// Maps LLVM Type to the corresonding sandboxir::Type. Owns all Sandbox IR
95 /// Type objects.
97
98 /// Callbacks called when an IR instruction is about to get erased. Keys are
99 /// used as IDs for deregistration.
101 /// Callbacks called when an IR instruction is about to get created. Keys are
102 /// used as IDs for deregistration.
104 /// Callbacks called when an IR instruction is about to get moved. Keys are
105 /// used as IDs for deregistration.
107 /// Callbacks called when a Use gets its source set. Keys are used as IDs for
108 /// deregistration.
110
111 /// A counter used for assigning callback IDs during registration. The same
112 /// counter is used for all kinds of callbacks so we can detect mismatched
113 /// registration/deregistration.
115
116 /// Remove \p V from the maps and returns the unique_ptr.
117 LLVM_ABI std::unique_ptr<Value> detachLLVMValue(llvm::Value *V);
118 /// Remove \p SBV from all SandboxIR maps and stop owning it. This effectively
119 /// detaches \p V from the underlying IR.
120 LLVM_ABI std::unique_ptr<Value> detach(Value *V);
121 friend class Instruction; // For detach().
122 /// Take ownership of VPtr and store it in `LLVMValueToValueMap`.
123 LLVM_ABI Value *registerValue(std::unique_ptr<Value> &&VPtr);
124 friend class EraseFromParent; // For registerValue().
125 /// This is the actual function that creates sandboxir values for \p V,
126 /// and among others handles all instruction types.
128 llvm::User *U = nullptr);
129 /// Get or create a sandboxir::Argument for an existing LLVM IR \p LLVMArg.
131 /// Get or create a sandboxir::Value for an existing LLVM IR \p LLVMV.
133 return getOrCreateValueInternal(LLVMV, 0);
134 }
135 /// Get or create a sandboxir::Constant from an existing LLVM IR \p LLVMC.
137 friend class ConstantDataSequential; // For getOrCreateConstant().
138 friend class Utils; // For getMemoryBase
139
142 LLVM_ABI void runMoveInstrCallbacks(Instruction *I, const BBIterator &Where);
143 LLVM_ABI void runSetUseCallbacks(const Use &U, Value *NewSrc);
144
145 friend class User; // For runSetUseCallbacks().
146 friend class Value; // For runSetUseCallbacks().
147
148 // Friends for getOrCreateConstant().
149#define DEF_CONST(ID, CLASS) friend class CLASS;
150#include "llvm/SandboxIR/Values.def"
151
152 /// Create a sandboxir::BasicBlock for an existing LLVM IR \p BB. This will
153 /// also create all contents of the block.
155 friend class BasicBlock; // For getOrCreateValue().
156
158 auto &getLLVMIRBuilder() { return LLVMIRBuilder; }
159
161 friend VAArgInst; // For createVAArgInst()
163 friend FreezeInst; // For createFreezeInst()
165 friend FenceInst; // For createFenceInst()
167 friend SelectInst; // For createSelectInst()
170 friend InsertElementInst; // For createInsertElementInst()
173 friend ExtractElementInst; // For createExtractElementInst()
176 friend ShuffleVectorInst; // For createShuffleVectorInst()
179 friend ExtractValueInst; // For createExtractValueInst()
181 friend InsertValueInst; // For createInsertValueInst()
183 friend UncondBrInst; // For createUncondBrInst()
185 friend CondBrInst; // For createCondBrInst()
187 friend LoadInst; // For createLoadInst()
189 friend StoreInst; // For createStoreInst()
191 friend ReturnInst; // For createReturnInst()
193 friend CallInst; // For createCallInst()
195 friend InvokeInst; // For createInvokeInst()
197 friend CallBrInst; // For createCallBrInst()
199 friend LandingPadInst; // For createLandingPadInst()
201 friend CatchPadInst; // For createCatchPadInst()
203 friend CleanupPadInst; // For createCleanupPadInst()
205 friend CatchReturnInst; // For createCatchReturnInst()
208 friend CleanupReturnInst; // For createCleanupReturnInst()
211 friend GetElementPtrInst; // For createGetElementPtrInst()
213 friend CatchSwitchInst; // For createCatchSwitchInst()
215 friend ResumeInst; // For createResumeInst()
217 friend SwitchInst; // For createSwitchInst()
219 friend UnaryOperator; // For createUnaryOperator()
221 friend BinaryOperator; // For createBinaryOperator()
223 friend AtomicRMWInst; // For createAtomicRMWInst()
226 friend AtomicCmpXchgInst; // For createAtomicCmpXchgInst()
228 friend AllocaInst; // For createAllocaInst()
230 friend CastInst; // For createCastInst()
232 friend PHINode; // For createPHINode()
234 friend UnreachableInst; // For createUnreachableInst()
236 friend CmpInst; // For createCmpInst()
238 friend ICmpInst; // For createICmpInst()
240 friend FCmpInst; // For createFCmpInst()
241
242public:
245 /// Clears function-level state.
246 LLVM_ABI void clear();
247
249 /// Convenience function for `getTracker().save()`
250 void save() { IRTracker.save(); }
251 /// Convenience function for `getTracker().revert()`
252 void revert() { IRTracker.revert(); }
253 /// Convenience function for `getTracker().accept()`
254 void accept() { IRTracker.accept(); }
255
257 const sandboxir::Value *getValue(const llvm::Value *V) const {
258 return getValue(const_cast<llvm::Value *>(V));
259 }
260
261 LLVM_ABI Module *getModule(llvm::Module *LLVMM) const;
262
264
266 if (LLVMTy == nullptr)
267 return nullptr;
268 auto Pair = LLVMTypeToTypeMap.try_emplace(LLVMTy);
269 auto It = Pair.first;
270 if (Pair.second)
271 It->second = std::unique_ptr<Type, TypeDeleter>(new Type(LLVMTy, *this));
272 return It->second.get();
273 }
274
275 /// Create a sandboxir::Function for an existing LLVM IR \p F, including all
276 /// blocks and instructions.
277 /// This is the main API function for creating Sandbox IR.
278 /// Note: this will not fully populate its parent module. The only globals
279 /// that will be available are those used within the function.
281
282 /// Create a sandboxir::Module corresponding to \p LLVMM.
284
285 /// \Returns the number of values registered with Context.
286 size_t getNumValues() const { return LLVMValueToValueMap.size(); }
287
288 /// Register a callback that gets called when a SandboxIR instruction is about
289 /// to be removed from its parent. Note that this will also be called when
290 /// reverting the creation of an instruction.
291 /// \Returns a callback ID for later deregistration.
294
295 /// Register a callback that gets called right after a SandboxIR instruction
296 /// is created. Note that this will also be called when reverting the removal
297 /// of an instruction.
298 /// \Returns a callback ID for later deregistration.
301
302 /// Register a callback that gets called when a SandboxIR instruction is about
303 /// to be moved. Note that this will also be called when reverting a move.
304 /// \Returns a callback ID for later deregistration.
306 LLVM_ABI void unregisterMoveInstrCallback(CallbackID ID);
307
308 /// Register a callback that gets called when a Use gets set.
309 /// \Returns a callback ID for later deregistration.
311 LLVM_ABI void unregisterSetUseCallback(CallbackID ID);
312};
313
314} // namespace sandboxir
315
316// DenseMap info for CallbackIDs
317template <> struct DenseMapInfo<sandboxir::Context::CallbackID> {
320
322 return CallbackID{ReprInfo::getEmptyKey()};
323 }
325 return CallbackID{ReprInfo::getTombstoneKey()};
326 }
327 static unsigned getHashValue(const CallbackID &ID) {
328 return ReprInfo::getHashValue(ID.Val);
329 }
330 static bool isEqual(const CallbackID &LHS, const CallbackID &RHS) {
331 return ReprInfo::isEqual(LHS.Val, RHS.Val);
332 }
333};
334
335} // namespace llvm
336
337#endif // LLVM_SANDBOXIR_CONTEXT_H
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
#define LLVM_ABI
Definition Compiler.h:213
This file defines the DenseMap class.
#define F(x, y, z)
Definition MD5.cpp:54
#define I(x, y, z)
Definition MD5.cpp:57
This file implements a map that provides insertion order iteration.
This file defines the SmallVector class.
Value * RHS
Value * LHS
an instruction to allocate memory on the stack
This class represents an incoming formal argument to a Function.
Definition Argument.h:32
An instruction that atomically checks whether a specified value is in a memory location,...
an instruction that atomically reads a memory location, combines it with another value,...
LLVM Basic Block Representation.
Definition BasicBlock.h:62
CallBr instruction, tracking function calls that may not return control but instead transfer it to a ...
This class represents a function call, abstracting a target machine's calling convention.
This is the base class for all instructions that perform data casts.
Definition InstrTypes.h:512
This class is the base class for the comparison instructions.
Definition InstrTypes.h:728
Conditional Branch instruction.
This is an important base class in LLVM.
Definition Constant.h:43
This instruction extracts a single (scalar) element from a VectorType value.
This instruction extracts a struct member or array element value from an aggregate value.
This instruction compares its operands according to the predicate given to the constructor.
An instruction for ordering other memory operations.
This class represents a freeze function that returns random concrete value if an operand is either a ...
an instruction for type-safe pointer arithmetic to access elements of arrays and structs
This instruction compares its operands according to the predicate given to the constructor.
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
Definition IRBuilder.h:2858
This instruction inserts a single (scalar) element into a VectorType value.
This instruction inserts a struct field of array element value into an aggregate value.
Invoke instruction.
This is an important class for using LLVM in a threaded context.
Definition LLVMContext.h:68
The landingpad instruction holds all of the information necessary to generate correct exception handl...
An instruction for reading from memory.
This class implements a map that also provides access to all stored values in a deterministic order.
Definition MapVector.h:38
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:67
Resume the propagation of an exception.
Return a value (possibly void), from a function.
This class represents the LLVM 'select' instruction.
This instruction constructs a fixed permutation of two input vectors.
An instruction for storing to memory.
Multiway switch.
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:46
Unconditional Branch instruction.
This function has undefined behavior.
This class represents the va_arg llvm instruction, which returns an argument of the specified type gi...
LLVM Value Representation.
Definition Value.h:75
Argument of a sandboxir::Function.
Definition Argument.h:18
An ID for a registered callback.
Definition Context.h:49
static constexpr ValTy InvalidVal
Definition Context.h:54
LLVM_ABI BasicBlock * createBasicBlock(llvm::BasicBlock *BB)
Create a sandboxir::BasicBlock for an existing LLVM IR BB.
Definition Context.cpp:455
std::function< void(Instruction *)> CreateInstrCallback
Definition Context.h:38
LLVM_ABI GetElementPtrInst * createGetElementPtrInst(llvm::GetElementPtrInst *I)
Definition Context.cpp:585
MapVector< CallbackID, CreateInstrCallback > CreateInstrCallbacks
Callbacks called when an IR instruction is about to get created.
Definition Context.h:103
friend class Type
MessagePack types as defined in the standard, with the exception of Integer being divided into a sign...
Definition Context.h:71
friend class EraseFromParent
Definition Context.h:124
LLVM_ABI CallBrInst * createCallBrInst(llvm::CallBrInst *I)
Definition Context.cpp:552
LLVM_ABI Module * createModule(llvm::Module *LLVMM)
Create a sandboxir::Module corresponding to LLVMM.
Definition Context.cpp:696
IRBuilder< ConstantFolder > LLVMIRBuilder
Definition Context.h:157
std::function< void(const Use &, Value *)> SetUseCallback
Definition Context.h:44
MapVector< CallbackID, EraseInstrCallback > EraseInstrCallbacks
Callbacks called when an IR instruction is about to get erased.
Definition Context.h:100
LLVM_ABI sandboxir::Value * getValue(llvm::Value *V) const
Definition Context.cpp:640
LLVM_ABI Argument * getOrCreateArgument(llvm::Argument *LLVMArg)
Get or create a sandboxir::Argument for an existing LLVM IR LLVMArg.
Definition Context.cpp:441
LLVM_ABI void unregisterSetUseCallback(CallbackID ID)
Definition Context.cpp:786
friend class IRSnapshotChecker
Definition Context.h:77
LLVM_ABI ReturnInst * createReturnInst(llvm::ReturnInst *I)
Definition Context.cpp:537
LLVM_ABI UncondBrInst * createUncondBrInst(llvm::UncondBrInst *UBI)
Definition Context.cpp:517
LLVM_ABI void runEraseInstrCallbacks(Instruction *I)
Definition Context.cpp:714
LLVM_ABI Module * getModule(llvm::Module *LLVMM) const
Definition Context.cpp:659
LLVM_ABI VAArgInst * createVAArgInst(llvm::VAArgInst *SI)
Definition Context.cpp:464
LLVM_ABI CleanupReturnInst * createCleanupReturnInst(llvm::CleanupReturnInst *I)
Definition Context.cpp:579
LLVM_ABI AllocaInst * createAllocaInst(llvm::AllocaInst *I)
Definition Context.cpp:620
Type * getType(llvm::Type *LLVMTy)
Definition Context.h:265
LLVM_ABI void runCreateInstrCallbacks(Instruction *I)
Definition Context.cpp:719
LLVM_ABI AtomicRMWInst * createAtomicRMWInst(llvm::AtomicRMWInst *I)
Definition Context.cpp:610
LLVM_ABI InsertValueInst * createInsertValueInst(llvm::InsertValueInst *IVI)
Definition Context.cpp:511
const sandboxir::Value * getValue(const llvm::Value *V) const
Definition Context.h:257
DenseMap< llvm::Type *, std::unique_ptr< Type, TypeDeleter > > LLVMTypeToTypeMap
Maps LLVM Type to the corresonding sandboxir::Type.
Definition Context.h:96
void accept()
Convenience function for getTracker().accept()
Definition Context.h:254
LLVM_ABI FCmpInst * createFCmpInst(llvm::FCmpInst *I)
Definition Context.cpp:636
std::function< void(Instruction *)> EraseInstrCallback
Definition Context.h:36
friend class ConstantDataSequential
Definition Context.h:137
CallbackID::ValTy NextCallbackID
A counter used for assigning callback IDs during registration.
Definition Context.h:114
LLVM_ABI ExtractElementInst * createExtractElementInst(llvm::ExtractElementInst *EEI)
Definition Context.cpp:485
LLVM_ABI Constant * getOrCreateConstant(llvm::Constant *LLVMC)
Get or create a sandboxir::Constant from an existing LLVM IR LLVMC.
Definition Context.cpp:451
LLVM_ABI CallbackID registerSetUseCallback(SetUseCallback CB)
Register a callback that gets called when a Use gets set.
Definition Context.cpp:779
LLVM_ABI ShuffleVectorInst * createShuffleVectorInst(llvm::ShuffleVectorInst *SVI)
Definition Context.cpp:499
LLVM_ABI BinaryOperator * createBinaryOperator(llvm::BinaryOperator *I)
Definition Context.cpp:606
friend class Instruction
Iterator for Instructions in a `BasicBlock.
Definition Context.h:121
LLVM_ABI Module * getOrCreateModule(llvm::Module *LLVMM)
Definition Context.cpp:666
LLVM_ABI LoadInst * createLoadInst(llvm::LoadInst *LI)
Definition Context.cpp:527
DenseMap< llvm::Value *, std::unique_ptr< Value > > LLVMValueToValueMap
Maps LLVM Value to the corresponding sandboxir::Value.
Definition Context.h:83
LLVM_ABI FreezeInst * createFreezeInst(llvm::FreezeInst *SI)
Definition Context.cpp:469
LLVM_ABI PHINode * createPHINode(llvm::PHINode *I)
Definition Context.cpp:628
LLVM_ABI CallbackID registerCreateInstrCallback(CreateInstrCallback CB)
Register a callback that gets called right after a SandboxIR instruction is created.
Definition Context.cpp:753
LLVM_ABI Context(LLVMContext &LLVMCtx)
Definition Context.cpp:647
LLVM_ABI CatchPadInst * createCatchPadInst(llvm::CatchPadInst *I)
Definition Context.cpp:566
LLVM_ABI void clear()
Clears function-level state.
Definition Context.cpp:653
LLVM_ABI CondBrInst * createCondBrInst(llvm::CondBrInst *CBI)
Definition Context.cpp:522
friend class IntegerType
Definition Context.h:73
LLVM_ABI ICmpInst * createICmpInst(llvm::ICmpInst *I)
Definition Context.cpp:632
friend class Region
Definition Context.h:76
MapVector< CallbackID, MoveInstrCallback > MoveInstrCallbacks
Callbacks called when an IR instruction is about to get moved.
Definition Context.h:106
LLVM_ABI std::unique_ptr< Value > detach(Value *V)
Remove SBV from all SandboxIR maps and stop owning it.
Definition Context.cpp:28
LLVM_ABI void unregisterCreateInstrCallback(CallbackID ID)
Definition Context.cpp:760
LLVM_ABI ExtractValueInst * createExtractValueInst(llvm::ExtractValueInst *IVI)
Definition Context.cpp:505
void revert()
Convenience function for getTracker().revert()
Definition Context.h:252
LLVM_ABI CastInst * createCastInst(llvm::CastInst *I)
Definition Context.cpp:624
DenseMap< llvm::Module *, std::unique_ptr< Module > > LLVMModuleToModuleMap
Maps an LLVM Module to the corresponding sandboxir::Module.
Definition Context.h:86
friend class PointerType
Definition Context.h:72
LLVM_ABI StoreInst * createStoreInst(llvm::StoreInst *SI)
Definition Context.cpp:532
LLVM_ABI CatchReturnInst * createCatchReturnInst(llvm::CatchReturnInst *I)
Definition Context.cpp:574
LLVM_ABI CatchSwitchInst * createCatchSwitchInst(llvm::CatchSwitchInst *I)
Definition Context.cpp:590
std::function< void(Instruction *, const BBIterator &)> MoveInstrCallback
Definition Context.h:41
virtual LLVM_ABI ~Context()
LLVM_ABI void unregisterMoveInstrCallback(CallbackID ID)
Definition Context.cpp:773
void save()
Convenience function for getTracker().save()
Definition Context.h:250
LLVM_ABI CleanupPadInst * createCleanupPadInst(llvm::CleanupPadInst *I)
Definition Context.cpp:570
Value * getOrCreateValue(llvm::Value *LLVMV)
Get or create a sandboxir::Value for an existing LLVM IR LLVMV.
Definition Context.h:132
LLVM_ABI FenceInst * createFenceInst(llvm::FenceInst *SI)
Definition Context.cpp:474
LLVM_ABI CallInst * createCallInst(llvm::CallInst *I)
Definition Context.cpp:542
LLVM_ABI SwitchInst * createSwitchInst(llvm::SwitchInst *I)
Definition Context.cpp:598
LLVM_ABI void runMoveInstrCallbacks(Instruction *I, const BBIterator &Where)
Definition Context.cpp:724
LLVM_ABI UnaryOperator * createUnaryOperator(llvm::UnaryOperator *I)
Definition Context.cpp:602
LLVM_ABI Value * getOrCreateValueInternal(llvm::Value *V, llvm::User *U=nullptr)
This is the actual function that creates sandboxir values for V, and among others handles all instruc...
Definition Context.cpp:56
LLVM_ABI InvokeInst * createInvokeInst(llvm::InvokeInst *I)
Definition Context.cpp:547
LLVM_ABI Value * registerValue(std::unique_ptr< Value > &&VPtr)
Take ownership of VPtr and store it in LLVMValueToValueMap.
Definition Context.cpp:35
LLVM_ABI LandingPadInst * createLandingPadInst(llvm::LandingPadInst *I)
Definition Context.cpp:562
LLVM_ABI InsertElementInst * createInsertElementInst(llvm::InsertElementInst *IEI)
Definition Context.cpp:492
LLVM_ABI CmpInst * createCmpInst(llvm::CmpInst *I)
friend class StructType
Definition Context.h:75
LLVM_ABI Function * createFunction(llvm::Function *F)
Create a sandboxir::Function for an existing LLVM IR F, including all blocks and instructions.
Definition Context.cpp:675
LLVM_ABI SelectInst * createSelectInst(llvm::SelectInst *SI)
Definition Context.cpp:479
friend class ByteType
Definition Context.h:74
LLVM_ABI ResumeInst * createResumeInst(llvm::ResumeInst *I)
Definition Context.cpp:594
LLVM_ABI void unregisterEraseInstrCallback(CallbackID ID)
Definition Context.cpp:746
LLVMContext & LLVMCtx
Definition Context.h:70
MapVector< CallbackID, SetUseCallback > SetUseCallbacks
Callbacks called when a Use gets its source set.
Definition Context.h:109
Tracker & getTracker()
Definition Context.h:248
friend class BasicBlock
Various leaf nodes.
Definition Context.h:155
LLVM_ABI CallbackID registerMoveInstrCallback(MoveInstrCallback CB)
Register a callback that gets called when a SandboxIR instruction is about to be moved.
Definition Context.cpp:766
LLVM_ABI UnreachableInst * createUnreachableInst(llvm::UnreachableInst *UI)
Definition Context.cpp:557
LLVM_ABI AtomicCmpXchgInst * createAtomicCmpXchgInst(llvm::AtomicCmpXchgInst *I)
Definition Context.cpp:615
LLVM_ABI void runSetUseCallbacks(const Use &U, Value *NewSrc)
Definition Context.cpp:729
LLVM_ABI CallbackID registerEraseInstrCallback(EraseInstrCallback CB)
Register a callback that gets called when a SandboxIR instruction is about to be removed from its par...
Definition Context.cpp:739
size_t getNumValues() const
\Returns the number of values registered with Context.
Definition Context.h:286
LLVM_ABI std::unique_ptr< Value > detachLLVMValue(llvm::Value *V)
Remove V from the maps and returns the unique_ptr.
Definition Context.cpp:17
In SandboxIR the Module is mainly used to access the list of global objects.
Definition Module.h:32
The tracker collects all the change objects and implements the main API for saving / reverting / acce...
Definition Tracker.h:442
Represents a Def-use/Use-def edge in SandboxIR.
Definition Use.h:33
A SandboxIR Value has users. This is the base class.
Definition Value.h:72
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition CallingConv.h:24
This is an optimization pass for GlobalISel generic memory operations.
static unsigned getHashValue(const CallbackID &ID)
Definition Context.h:327
DenseMapInfo< CallbackID::ValTy > ReprInfo
Definition Context.h:319
sandboxir::Context::CallbackID CallbackID
Definition Context.h:318
static bool isEqual(const CallbackID &LHS, const CallbackID &RHS)
Definition Context.h:330
An information struct used to provide DenseMap with the various necessary components for a given valu...
Type has a protected destructor to prohibit the user from managing the lifetime of the Type objects.
Definition Context.h:91