LLVM 22.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 const 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 StructType; // For LLVMCtx.
75 friend class Region; // For LLVMCtx.
76 friend class IRSnapshotChecker; // To snapshot LLVMModuleToModuleMap.
77
79
80 /// Maps LLVM Value to the corresponding sandboxir::Value. Owns all
81 /// SandboxIR objects.
83
84 /// Maps an LLVM Module to the corresponding sandboxir::Module.
86
87 /// Type has a protected destructor to prohibit the user from managing the
88 /// lifetime of the Type objects. Context is friend of Type, and this custom
89 /// deleter can destroy Type.
90 struct TypeDeleter {
91 void operator()(Type *Ty) { delete Ty; }
92 };
93 /// Maps LLVM Type to the corresonding sandboxir::Type. Owns all Sandbox IR
94 /// Type objects.
96
97 /// Callbacks called when an IR instruction is about to get erased. Keys are
98 /// used as IDs for deregistration.
100 /// Callbacks called when an IR instruction is about to get created. Keys are
101 /// used as IDs for deregistration.
103 /// Callbacks called when an IR instruction is about to get moved. Keys are
104 /// used as IDs for deregistration.
106 /// Callbacks called when a Use gets its source set. Keys are used as IDs for
107 /// deregistration.
109
110 /// A counter used for assigning callback IDs during registration. The same
111 /// counter is used for all kinds of callbacks so we can detect mismatched
112 /// registration/deregistration.
114
115 /// Remove \p V from the maps and returns the unique_ptr.
116 LLVM_ABI std::unique_ptr<Value> detachLLVMValue(llvm::Value *V);
117 /// Remove \p SBV from all SandboxIR maps and stop owning it. This effectively
118 /// detaches \p V from the underlying IR.
119 LLVM_ABI std::unique_ptr<Value> detach(Value *V);
120 friend class Instruction; // For detach().
121 /// Take ownership of VPtr and store it in `LLVMValueToValueMap`.
122 LLVM_ABI Value *registerValue(std::unique_ptr<Value> &&VPtr);
123 friend class EraseFromParent; // For registerValue().
124 /// This is the actual function that creates sandboxir values for \p V,
125 /// and among others handles all instruction types.
127 llvm::User *U = nullptr);
128 /// Get or create a sandboxir::Argument for an existing LLVM IR \p LLVMArg.
130 /// Get or create a sandboxir::Value for an existing LLVM IR \p LLVMV.
132 return getOrCreateValueInternal(LLVMV, 0);
133 }
134 /// Get or create a sandboxir::Constant from an existing LLVM IR \p LLVMC.
136 friend class ConstantDataSequential; // For getOrCreateConstant().
137 friend class Utils; // For getMemoryBase
138
142 LLVM_ABI void runSetUseCallbacks(const Use &U, Value *NewSrc);
143
144 friend class User; // For runSetUseCallbacks().
145 friend class Value; // For runSetUseCallbacks().
146
147 // Friends for getOrCreateConstant().
148#define DEF_CONST(ID, CLASS) friend class CLASS;
149#include "llvm/SandboxIR/Values.def"
150
151 /// Create a sandboxir::BasicBlock for an existing LLVM IR \p BB. This will
152 /// also create all contents of the block.
154 friend class BasicBlock; // For getOrCreateValue().
155
157 auto &getLLVMIRBuilder() { return LLVMIRBuilder; }
158
160 friend VAArgInst; // For createVAArgInst()
162 friend FreezeInst; // For createFreezeInst()
164 friend FenceInst; // For createFenceInst()
166 friend SelectInst; // For createSelectInst()
169 friend InsertElementInst; // For createInsertElementInst()
172 friend ExtractElementInst; // For createExtractElementInst()
175 friend ShuffleVectorInst; // For createShuffleVectorInst()
178 friend ExtractValueInst; // For createExtractValueInst()
180 friend InsertValueInst; // For createInsertValueInst()
182 friend BranchInst; // For createBranchInst()
184 friend LoadInst; // For createLoadInst()
186 friend StoreInst; // For createStoreInst()
188 friend ReturnInst; // For createReturnInst()
190 friend CallInst; // For createCallInst()
192 friend InvokeInst; // For createInvokeInst()
194 friend CallBrInst; // For createCallBrInst()
196 friend LandingPadInst; // For createLandingPadInst()
198 friend CatchPadInst; // For createCatchPadInst()
200 friend CleanupPadInst; // For createCleanupPadInst()
202 friend CatchReturnInst; // For createCatchReturnInst()
205 friend CleanupReturnInst; // For createCleanupReturnInst()
208 friend GetElementPtrInst; // For createGetElementPtrInst()
210 friend CatchSwitchInst; // For createCatchSwitchInst()
212 friend ResumeInst; // For createResumeInst()
214 friend SwitchInst; // For createSwitchInst()
216 friend UnaryOperator; // For createUnaryOperator()
218 friend BinaryOperator; // For createBinaryOperator()
220 friend AtomicRMWInst; // For createAtomicRMWInst()
223 friend AtomicCmpXchgInst; // For createAtomicCmpXchgInst()
225 friend AllocaInst; // For createAllocaInst()
227 friend CastInst; // For createCastInst()
229 friend PHINode; // For createPHINode()
231 friend UnreachableInst; // For createUnreachableInst()
233 friend CmpInst; // For createCmpInst()
235 friend ICmpInst; // For createICmpInst()
237 friend FCmpInst; // For createFCmpInst()
238
239public:
242 /// Clears function-level state.
243 LLVM_ABI void clear();
244
246 /// Convenience function for `getTracker().save()`
247 void save() { IRTracker.save(); }
248 /// Convenience function for `getTracker().revert()`
249 void revert() { IRTracker.revert(); }
250 /// Convenience function for `getTracker().accept()`
251 void accept() { IRTracker.accept(); }
252
254 const sandboxir::Value *getValue(const llvm::Value *V) const {
255 return getValue(const_cast<llvm::Value *>(V));
256 }
257
258 LLVM_ABI Module *getModule(llvm::Module *LLVMM) const;
259
261
263 if (LLVMTy == nullptr)
264 return nullptr;
265 auto Pair = LLVMTypeToTypeMap.try_emplace(LLVMTy);
266 auto It = Pair.first;
267 if (Pair.second)
268 It->second = std::unique_ptr<Type, TypeDeleter>(new Type(LLVMTy, *this));
269 return It->second.get();
270 }
271
272 /// Create a sandboxir::Function for an existing LLVM IR \p F, including all
273 /// blocks and instructions.
274 /// This is the main API function for creating Sandbox IR.
275 /// Note: this will not fully populate its parent module. The only globals
276 /// that will be available are those used within the function.
278
279 /// Create a sandboxir::Module corresponding to \p LLVMM.
281
282 /// \Returns the number of values registered with Context.
283 size_t getNumValues() const { return LLVMValueToValueMap.size(); }
284
285 /// Register a callback that gets called when a SandboxIR instruction is about
286 /// to be removed from its parent. Note that this will also be called when
287 /// reverting the creation of an instruction.
288 /// \Returns a callback ID for later deregistration.
291
292 /// Register a callback that gets called right after a SandboxIR instruction
293 /// is created. Note that this will also be called when reverting the removal
294 /// of an instruction.
295 /// \Returns a callback ID for later deregistration.
298
299 /// Register a callback that gets called when a SandboxIR instruction is about
300 /// to be moved. Note that this will also be called when reverting a move.
301 /// \Returns a callback ID for later deregistration.
303 LLVM_ABI void unregisterMoveInstrCallback(CallbackID ID);
304
305 /// Register a callback that gets called when a Use gets set.
306 /// \Returns a callback ID for later deregistration.
308 LLVM_ABI void unregisterSetUseCallback(CallbackID ID);
309};
310
311} // namespace sandboxir
312
313// DenseMap info for CallbackIDs
314template <> struct DenseMapInfo<sandboxir::Context::CallbackID> {
317
319 return CallbackID{ReprInfo::getEmptyKey()};
320 }
322 return CallbackID{ReprInfo::getTombstoneKey()};
323 }
324 static unsigned getHashValue(const CallbackID &ID) {
325 return ReprInfo::getHashValue(ID.Val);
326 }
327 static bool isEqual(const CallbackID &LHS, const CallbackID &RHS) {
328 return ReprInfo::isEqual(LHS.Val, RHS.Val);
329 }
330};
331
332} // namespace llvm
333
334#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:55
#define I(x, y, z)
Definition: MD5.cpp:58
Machine Check Debug Module
This file implements a map that provides insertion order iteration.
StandardInstrumentations SI(Mod->getContext(), Debug, VerifyEach)
This file defines the SmallVector class.
Value * RHS
Value * LHS
an instruction to allocate memory on the stack
Definition: Instructions.h:64
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,...
Definition: Instructions.h:506
an instruction that atomically reads a memory location, combines it with another value,...
Definition: Instructions.h:709
LLVM Basic Block Representation.
Definition: BasicBlock.h:62
Conditional or Unconditional Branch instruction.
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:448
This class is the base class for the comparison instructions.
Definition: InstrTypes.h:666
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.
Definition: Instructions.h:429
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
Definition: Instructions.h:949
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:2780
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.
Definition: Instructions.h:180
This class implements a map that also provides access to all stored values in a deterministic order.
Definition: MapVector.h:36
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.
Definition: Instructions.h:296
Multiway switch.
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
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
Iterator for Instructions in a `BasicBlock.
Definition: BasicBlock.h:24
Contains a list of sandboxir::Instruction's.
Definition: BasicBlock.h:68
ConstantDataSequential - A vector or array constant whose element type is a simple 1/2/4/8-byte integ...
Definition: Constant.h:498
An ID for a registered callback.
Definition: Context.h:49
static constexpr const 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:449
std::function< void(Instruction *)> CreateInstrCallback
Definition: Context.h:38
LLVM_ABI GetElementPtrInst * createGetElementPtrInst(llvm::GetElementPtrInst *I)
Definition: Context.cpp:574
MapVector< CallbackID, CreateInstrCallback > CreateInstrCallbacks
Callbacks called when an IR instruction is about to get created.
Definition: Context.h:102
friend class Type
MessagePack types as defined in the standard, with the exception of Integer being divided into a sign...
Definition: Context.h:71
LLVM_ABI CallBrInst * createCallBrInst(llvm::CallBrInst *I)
Definition: Context.cpp:541
LLVM_ABI Module * createModule(llvm::Module *LLVMM)
Create a sandboxir::Module corresponding to LLVMM.
Definition: Context.cpp:685
IRBuilder< ConstantFolder > LLVMIRBuilder
Definition: Context.h:156
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:99
LLVM_ABI sandboxir::Value * getValue(llvm::Value *V) const
Definition: Context.cpp:629
LLVM_ABI Argument * getOrCreateArgument(llvm::Argument *LLVMArg)
Get or create a sandboxir::Argument for an existing LLVM IR LLVMArg.
Definition: Context.cpp:435
LLVM_ABI void unregisterSetUseCallback(CallbackID ID)
Definition: Context.cpp:775
LLVM_ABI ReturnInst * createReturnInst(llvm::ReturnInst *I)
Definition: Context.cpp:526
LLVM_ABI void runEraseInstrCallbacks(Instruction *I)
Definition: Context.cpp:703
LLVM_ABI Module * getModule(llvm::Module *LLVMM) const
Definition: Context.cpp:648
LLVM_ABI VAArgInst * createVAArgInst(llvm::VAArgInst *SI)
Definition: Context.cpp:458
auto & getLLVMIRBuilder()
Definition: Context.h:157
LLVM_ABI CleanupReturnInst * createCleanupReturnInst(llvm::CleanupReturnInst *I)
Definition: Context.cpp:568
LLVM_ABI AllocaInst * createAllocaInst(llvm::AllocaInst *I)
Definition: Context.cpp:609
Type * getType(llvm::Type *LLVMTy)
Definition: Context.h:262
LLVM_ABI void runCreateInstrCallbacks(Instruction *I)
Definition: Context.cpp:708
LLVM_ABI AtomicRMWInst * createAtomicRMWInst(llvm::AtomicRMWInst *I)
Definition: Context.cpp:599
LLVM_ABI InsertValueInst * createInsertValueInst(llvm::InsertValueInst *IVI)
Definition: Context.cpp:505
const sandboxir::Value * getValue(const llvm::Value *V) const
Definition: Context.h:254
DenseMap< llvm::Type *, std::unique_ptr< Type, TypeDeleter > > LLVMTypeToTypeMap
Maps LLVM Type to the corresonding sandboxir::Type.
Definition: Context.h:95
void accept()
Convenience function for getTracker().accept()
Definition: Context.h:251
LLVM_ABI FCmpInst * createFCmpInst(llvm::FCmpInst *I)
Definition: Context.cpp:625
std::function< void(Instruction *)> EraseInstrCallback
Definition: Context.h:36
CallbackID::ValTy NextCallbackID
A counter used for assigning callback IDs during registration.
Definition: Context.h:113
std::function< void(Instruction *, const BBIterator &)> MoveInstrCallback
Definition: Context.h:42
LLVM_ABI ExtractElementInst * createExtractElementInst(llvm::ExtractElementInst *EEI)
Definition: Context.cpp:479
LLVM_ABI Constant * getOrCreateConstant(llvm::Constant *LLVMC)
Get or create a sandboxir::Constant from an existing LLVM IR LLVMC.
Definition: Context.cpp:445
LLVM_ABI CallbackID registerSetUseCallback(SetUseCallback CB)
Register a callback that gets called when a Use gets set.
Definition: Context.cpp:768
LLVM_ABI BranchInst * createBranchInst(llvm::BranchInst *I)
Definition: Context.cpp:511
LLVM_ABI ShuffleVectorInst * createShuffleVectorInst(llvm::ShuffleVectorInst *SVI)
Definition: Context.cpp:493
LLVM_ABI BinaryOperator * createBinaryOperator(llvm::BinaryOperator *I)
Definition: Context.cpp:595
LLVM_ABI Module * getOrCreateModule(llvm::Module *LLVMM)
Definition: Context.cpp:655
LLVM_ABI LoadInst * createLoadInst(llvm::LoadInst *LI)
Definition: Context.cpp:516
DenseMap< llvm::Value *, std::unique_ptr< Value > > LLVMValueToValueMap
Maps LLVM Value to the corresponding sandboxir::Value.
Definition: Context.h:82
LLVM_ABI FreezeInst * createFreezeInst(llvm::FreezeInst *SI)
Definition: Context.cpp:463
LLVM_ABI PHINode * createPHINode(llvm::PHINode *I)
Definition: Context.cpp:617
LLVM_ABI CallbackID registerCreateInstrCallback(CreateInstrCallback CB)
Register a callback that gets called right after a SandboxIR instruction is created.
Definition: Context.cpp:742
LLVM_ABI CatchPadInst * createCatchPadInst(llvm::CatchPadInst *I)
Definition: Context.cpp:555
LLVM_ABI void clear()
Clears function-level state.
Definition: Context.cpp:642
LLVM_ABI ICmpInst * createICmpInst(llvm::ICmpInst *I)
Definition: Context.cpp:621
MapVector< CallbackID, MoveInstrCallback > MoveInstrCallbacks
Callbacks called when an IR instruction is about to get moved.
Definition: Context.h:105
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:749
LLVM_ABI ExtractValueInst * createExtractValueInst(llvm::ExtractValueInst *IVI)
Definition: Context.cpp:499
void revert()
Convenience function for getTracker().revert()
Definition: Context.h:249
LLVM_ABI CastInst * createCastInst(llvm::CastInst *I)
Definition: Context.cpp:613
DenseMap< llvm::Module *, std::unique_ptr< Module > > LLVMModuleToModuleMap
Maps an LLVM Module to the corresponding sandboxir::Module.
Definition: Context.h:85
LLVM_ABI StoreInst * createStoreInst(llvm::StoreInst *SI)
Definition: Context.cpp:521
LLVM_ABI CatchReturnInst * createCatchReturnInst(llvm::CatchReturnInst *I)
Definition: Context.cpp:563
LLVM_ABI CatchSwitchInst * createCatchSwitchInst(llvm::CatchSwitchInst *I)
Definition: Context.cpp:579
LLVM_ABI void unregisterMoveInstrCallback(CallbackID ID)
Definition: Context.cpp:762
void save()
Convenience function for getTracker().save()
Definition: Context.h:247
LLVM_ABI CleanupPadInst * createCleanupPadInst(llvm::CleanupPadInst *I)
Definition: Context.cpp:559
Value * getOrCreateValue(llvm::Value *LLVMV)
Get or create a sandboxir::Value for an existing LLVM IR LLVMV.
Definition: Context.h:131
LLVM_ABI FenceInst * createFenceInst(llvm::FenceInst *SI)
Definition: Context.cpp:468
LLVM_ABI CallInst * createCallInst(llvm::CallInst *I)
Definition: Context.cpp:531
LLVM_ABI SwitchInst * createSwitchInst(llvm::SwitchInst *I)
Definition: Context.cpp:587
LLVM_ABI void runMoveInstrCallbacks(Instruction *I, const BBIterator &Where)
Definition: Context.cpp:713
LLVM_ABI UnaryOperator * createUnaryOperator(llvm::UnaryOperator *I)
Definition: Context.cpp:591
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:536
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:551
LLVM_ABI InsertElementInst * createInsertElementInst(llvm::InsertElementInst *IEI)
Definition: Context.cpp:486
LLVM_ABI CmpInst * createCmpInst(llvm::CmpInst *I)
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:664
LLVM_ABI SelectInst * createSelectInst(llvm::SelectInst *SI)
Definition: Context.cpp:473
LLVM_ABI ResumeInst * createResumeInst(llvm::ResumeInst *I)
Definition: Context.cpp:583
LLVM_ABI void unregisterEraseInstrCallback(CallbackID ID)
Definition: Context.cpp:735
LLVMContext & LLVMCtx
Definition: Context.h:70
MapVector< CallbackID, SetUseCallback > SetUseCallbacks
Callbacks called when a Use gets its source set.
Definition: Context.h:108
Tracker & getTracker()
Definition: Context.h:245
friend class BasicBlock
Various leaf nodes.
Definition: Context.h:154
LLVM_ABI CallbackID registerMoveInstrCallback(MoveInstrCallback CB)
Register a callback that gets called when a SandboxIR instruction is about to be moved.
Definition: Context.cpp:755
LLVM_ABI UnreachableInst * createUnreachableInst(llvm::UnreachableInst *UI)
Definition: Context.cpp:546
LLVM_ABI AtomicCmpXchgInst * createAtomicCmpXchgInst(llvm::AtomicCmpXchgInst *I)
Definition: Context.cpp:604
LLVM_ABI void runSetUseCallbacks(const Use &U, Value *NewSrc)
Definition: Context.cpp:718
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:728
size_t getNumValues() const
\Returns the number of values registered with Context.
Definition: Context.h:283
LLVM_ABI std::unique_ptr< Value > detachLLVMValue(llvm::Value *V)
Remove V from the maps and returns the unique_ptr.
Definition: Context.cpp:17
A class that saves hashes and textual IR snapshots of functions in a SandboxIR Context,...
Definition: Tracker.h:79
A sandboxir::User with operands, opcode and linked with previous/next instructions in an instruction ...
Definition: Instruction.h:43
Class to represent integer types.
Definition: Type.h:466
In SandboxIR the Module is mainly used to access the list of global objects.
Definition: Module.h:32
The main job of the Region is to point to new instructions generated by vectorization passes.
Definition: Region.h:96
The tracker collects all the change objects and implements the main API for saving / reverting / acce...
Definition: Tracker.h:442
LLVM_ABI void revert()
Stops tracking and reverts to saved state.
Definition: Tracker.cpp:346
LLVM_ABI void save()
Turns on IR tracking.
Definition: Tracker.cpp:339
LLVM_ABI void accept()
Stops tracking and accept changes.
Definition: Tracker.cpp:358
Just like llvm::Type these are immutable, unique, never get freed and can only be created via static ...
Definition: Type.h:47
Represents a Def-use/Use-def edge in SandboxIR.
Definition: Use.h:33
A sandboxir::User has operands.
Definition: User.h:59
A SandboxIR Value has users. This is the base class.
Definition: Value.h:66
NodeAddr< UseNode * > Use
Definition: RDFGraph.h:385
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
static unsigned getHashValue(const CallbackID &ID)
Definition: Context.h:324
static bool isEqual(const CallbackID &LHS, const CallbackID &RHS)
Definition: Context.h:327
An information struct used to provide DenseMap with the various necessary components for a given valu...
Definition: DenseMapInfo.h:54
Type has a protected destructor to prohibit the user from managing the lifetime of the Type objects.
Definition: Context.h:90