LLVM 20.0.0git
|
#include "llvm/SandboxIR/SandboxIR.h"
Public Member Functions | |
Context (LLVMContext &LLVMCtx) | |
Tracker & | getTracker () |
void | save () |
Convenience function for getTracker().save() | |
void | revert () |
Convenience function for getTracker().revert() | |
void | accept () |
Convenience function for getTracker().accept() | |
sandboxir::Value * | getValue (llvm::Value *V) const |
const sandboxir::Value * | getValue (const llvm::Value *V) const |
Function * | createFunction (llvm::Function *F) |
Create a sandboxir::Function for an existing LLVM IR F , including all blocks and instructions. | |
size_t | getNumValues () const |
\Returns the number of values registered with Context. | |
Protected Attributes | |
LLVMContext & | LLVMCtx |
Tracker | IRTracker |
DenseMap< llvm::Value *, std::unique_ptr< sandboxir::Value > > | LLVMValueToValueMap |
Maps LLVM Value to the corresponding sandboxir::Value. | |
IRBuilder< ConstantFolder > | LLVMIRBuilder |
friend | SelectInst |
friend | InsertElementInst |
friend | ExtractElementInst |
friend | BranchInst |
friend | LoadInst |
friend | StoreInst |
friend | ReturnInst |
friend | CallInst |
friend | InvokeInst |
friend | CallBrInst |
friend | GetElementPtrInst |
friend | CatchSwitchInst |
friend | SwitchInst |
friend | UnaryOperator |
friend | BinaryOperator |
friend | AtomicRMWInst |
friend | AtomicCmpXchgInst |
friend | AllocaInst |
friend | CastInst |
friend | PHINode |
friend | UnreachableInst |
Friends | |
class | EraseFromParent |
class | ConstantInt |
class | BasicBlock |
Various leaf nodes. | |
void | Instruction::eraseFromParent () |
Definition at line 2227 of file SandboxIR.h.
|
inline |
Definition at line 2321 of file SandboxIR.h.
|
inline |
Convenience function for getTracker().accept()
Definition at line 2331 of file SandboxIR.h.
References llvm::sandboxir::Tracker::accept(), and IRTracker.
|
protected |
Definition at line 2197 of file SandboxIR.cpp.
References AllocaInst, I, and registerValue().
Referenced by llvm::sandboxir::AllocaInst::create().
|
protected |
Definition at line 2192 of file SandboxIR.cpp.
References AtomicCmpXchgInst, I, and registerValue().
Referenced by llvm::sandboxir::AtomicCmpXchgInst::create().
|
protected |
Definition at line 2187 of file SandboxIR.cpp.
References AtomicRMWInst, I, and registerValue().
Referenced by llvm::sandboxir::AtomicRMWInst::create().
|
protected |
Create a sandboxir::BasicBlock for an existing LLVM IR BB
.
This will also create all contents of the block.
Definition at line 2096 of file SandboxIR.cpp.
References assert(), BasicBlock, getValue(), and registerValue().
Referenced by createFunction().
|
protected |
Definition at line 2183 of file SandboxIR.cpp.
References BinaryOperator, I, and registerValue().
Referenced by llvm::sandboxir::BinaryOperator::create().
|
protected |
Definition at line 2124 of file SandboxIR.cpp.
References BranchInst, and registerValue().
Referenced by llvm::sandboxir::BranchInst::create().
|
protected |
Definition at line 2154 of file SandboxIR.cpp.
References CallBrInst, I, and registerValue().
Referenced by llvm::sandboxir::CallBrInst::create().
|
protected |
Definition at line 2144 of file SandboxIR.cpp.
References CallInst, I, and registerValue().
|
protected |
Definition at line 2201 of file SandboxIR.cpp.
References CastInst, I, and registerValue().
Referenced by llvm::sandboxir::CastInst::create().
|
protected |
Definition at line 2171 of file SandboxIR.cpp.
References CatchSwitchInst, I, and registerValue().
Referenced by llvm::sandboxir::CatchSwitchInst::create().
|
protected |
Definition at line 2111 of file SandboxIR.cpp.
References ExtractElementInst, and registerValue().
Referenced by llvm::sandboxir::ExtractElementInst::create().
Function * Context::createFunction | ( | llvm::Function * | F | ) |
Create a sandboxir::Function for an existing LLVM IR F
, including all blocks and instructions.
This is the main API function for creating Sandbox IR.
Definition at line 2217 of file SandboxIR.cpp.
References assert(), createBasicBlock(), F, getOrCreateArgument(), getValue(), and registerValue().
|
protected |
Definition at line 2166 of file SandboxIR.cpp.
References GetElementPtrInst, I, and registerValue().
|
protected |
Definition at line 2118 of file SandboxIR.cpp.
References InsertElementInst, and registerValue().
Referenced by llvm::sandboxir::InsertElementInst::create().
|
protected |
Definition at line 2149 of file SandboxIR.cpp.
References I, InvokeInst, and registerValue().
Referenced by llvm::sandboxir::InvokeInst::create().
|
protected |
Definition at line 2129 of file SandboxIR.cpp.
References LoadInst, and registerValue().
Referenced by llvm::sandboxir::LoadInst::create().
|
protected |
Definition at line 2205 of file SandboxIR.cpp.
References I, PHINode, and registerValue().
Referenced by llvm::sandboxir::PHINode::create().
|
protected |
Definition at line 2139 of file SandboxIR.cpp.
References I, registerValue(), and ReturnInst.
|
protected |
Definition at line 2105 of file SandboxIR.cpp.
References registerValue(), and SelectInst.
|
protected |
Definition at line 2134 of file SandboxIR.cpp.
References registerValue(), and StoreInst.
Referenced by llvm::sandboxir::StoreInst::create().
|
protected |
Definition at line 2175 of file SandboxIR.cpp.
References I, registerValue(), and SwitchInst.
Referenced by llvm::sandboxir::SwitchInst::create().
|
protected |
Definition at line 2179 of file SandboxIR.cpp.
References I, registerValue(), and UnaryOperator.
Referenced by llvm::sandboxir::UnaryOperator::create().
|
protected |
Definition at line 2159 of file SandboxIR.cpp.
References registerValue(), and UnreachableInst.
Referenced by llvm::sandboxir::UnreachableInst::create().
Remove SBV
from all SandboxIR maps and stop owning it.
This effectively detaches V
from the underlying IR.
Definition at line 1884 of file SandboxIR.cpp.
References assert(), and detachLLVMValue().
Referenced by llvm::sandboxir::Instruction::eraseFromParent().
|
protected |
Remove V
from the maps and returns the unique_ptr.
Definition at line 1873 of file SandboxIR.cpp.
References LLVMValueToValueMap.
Referenced by detach().
|
inlineprotected |
Definition at line 2275 of file SandboxIR.h.
References LLVMIRBuilder.
Referenced by llvm::sandboxir::BranchInst::create(), llvm::sandboxir::AtomicRMWInst::create(), llvm::sandboxir::CallBrInst::create(), llvm::sandboxir::InvokeInst::create(), llvm::sandboxir::UnreachableInst::create(), llvm::sandboxir::BinaryOperator::create(), llvm::sandboxir::UnaryOperator::create(), llvm::sandboxir::CastInst::create(), llvm::sandboxir::AllocaInst::create(), llvm::sandboxir::LoadInst::create(), llvm::sandboxir::SelectInst::create(), llvm::sandboxir::CatchSwitchInst::create(), llvm::sandboxir::AtomicCmpXchgInst::create(), llvm::sandboxir::ReturnInst::create(), llvm::sandboxir::SwitchInst::create(), llvm::sandboxir::StoreInst::create(), llvm::sandboxir::ExtractElementInst::create(), and llvm::sandboxir::InsertElementInst::create().
|
inline |
\Returns the number of values registered with Context.
Definition at line 2343 of file SandboxIR.h.
References LLVMValueToValueMap.
Referenced by llvm::sandboxir::Value::Value().
|
inlineprotected |
Get or create a sandboxir::Argument for an existing LLVM IR LLVMArg
.
Definition at line 2250 of file SandboxIR.h.
References LLVMValueToValueMap.
Referenced by createFunction().
|
inlineprotected |
Get or create a sandboxir::Constant from an existing LLVM IR LLVMC
.
Definition at line 2264 of file SandboxIR.h.
References getOrCreateValueInternal().
Referenced by llvm::sandboxir::BinaryOperator::create(), llvm::sandboxir::UnaryOperator::create(), llvm::sandboxir::CastInst::create(), llvm::sandboxir::ExtractElementInst::create(), llvm::sandboxir::InsertElementInst::create(), and llvm::sandboxir::ConstantInt::get().
|
inlineprotected |
Get or create a sandboxir::Value for an existing LLVM IR LLVMV
.
Definition at line 2260 of file SandboxIR.h.
References getOrCreateValueInternal().
|
protected |
This is the actual function that creates sandboxir values for V
, and among others handles all instruction types.
Definition at line 1909 of file SandboxIR.cpp.
References AllocaInst, assert(), AtomicCmpXchgInst, AtomicRMWInst, BinaryOperator, BranchInst, llvm::CallingConv::C, CallBrInst, CallInst, CastInst, CatchSwitchInst, ConstantInt, ExtractElementInst, F, GetElementPtrInst, getOpcode(), getOrCreateValueInternal(), getValue(), InsertElementInst, InvokeInst, LLVMAlloca, LLVMAtomicCmpXchg, LLVMAtomicRMW, LLVMBr, LLVMCall, LLVMCallBr, LLVMInvoke, LLVMRet, LLVMUnreachable, LLVMValueToValueMap, LoadInst, PHINode, ReturnInst, SelectInst, StoreInst, SwitchInst, UnaryOperator, and UnreachableInst.
Referenced by getOrCreateConstant(), getOrCreateValue(), and getOrCreateValueInternal().
|
inline |
Definition at line 2325 of file SandboxIR.h.
References IRTracker.
Referenced by llvm::sandboxir::SwitchInst::addCase(), llvm::sandboxir::CatchSwitchInst::addHandler(), llvm::sandboxir::PHINode::addIncoming(), llvm::sandboxir::Instruction::copyFastMathFlags(), llvm::sandboxir::Instruction::eraseFromParent(), llvm::sandboxir::Instruction::insertBefore(), llvm::sandboxir::Instruction::insertInto(), llvm::sandboxir::Instruction::moveBefore(), registerValue(), llvm::sandboxir::SwitchInst::removeCase(), llvm::sandboxir::Instruction::removeFromParent(), llvm::sandboxir::PHINode::removeIncomingValue(), llvm::sandboxir::Value::replaceAllUsesWith(), llvm::sandboxir::User::replaceUsesOfWith(), llvm::sandboxir::Value::replaceUsesWithIf(), llvm::sandboxir::Use::set(), llvm::sandboxir::AtomicRMWInst::setAlignment(), llvm::sandboxir::AtomicCmpXchgInst::setAlignment(), llvm::sandboxir::AllocaInst::setAlignment(), llvm::sandboxir::AllocaInst::setAllocatedType(), llvm::sandboxir::SwitchInst::setCondition(), llvm::sandboxir::CallBrInst::setDefaultDest(), llvm::sandboxir::SwitchInst::setDefaultDest(), llvm::sandboxir::AtomicCmpXchgInst::setFailureOrdering(), llvm::sandboxir::Instruction::setFast(), llvm::sandboxir::Instruction::setFastMathFlags(), llvm::sandboxir::Instruction::setHasAllowContract(), llvm::sandboxir::Instruction::setHasAllowReassoc(), llvm::sandboxir::Instruction::setHasAllowReciprocal(), llvm::sandboxir::Instruction::setHasApproxFunc(), llvm::sandboxir::Instruction::setHasNoInfs(), llvm::sandboxir::Instruction::setHasNoNaNs(), llvm::sandboxir::Instruction::setHasNoSignedWrap(), llvm::sandboxir::Instruction::setHasNoSignedZeros(), llvm::sandboxir::Instruction::setHasNoUnsignedWrap(), llvm::sandboxir::PHINode::setIncomingBlock(), llvm::sandboxir::PHINode::setIncomingValue(), llvm::sandboxir::CallBrInst::setIndirectDest(), llvm::sandboxir::Instruction::setIsExact(), llvm::sandboxir::User::setOperand(), llvm::sandboxir::AtomicRMWInst::setOrdering(), llvm::sandboxir::CatchSwitchInst::setParentPad(), llvm::sandboxir::SwitchInst::setSuccessor(), llvm::sandboxir::AtomicCmpXchgInst::setSuccessOrdering(), llvm::sandboxir::AtomicRMWInst::setSyncScopeID(), llvm::sandboxir::AtomicCmpXchgInst::setSyncScopeID(), llvm::sandboxir::CatchSwitchInst::setUnwindDest(), llvm::sandboxir::AllocaInst::setUsedWithInAlloca(), llvm::sandboxir::LoadInst::setVolatile(), llvm::sandboxir::StoreInst::setVolatile(), llvm::sandboxir::AtomicRMWInst::setVolatile(), llvm::sandboxir::AtomicCmpXchgInst::setVolatile(), llvm::sandboxir::AtomicCmpXchgInst::setWeak(), and llvm::sandboxir::Use::swap().
|
inline |
Definition at line 2334 of file SandboxIR.h.
References getValue().
Value * Context::getValue | ( | llvm::Value * | V | ) | const |
Definition at line 2210 of file SandboxIR.cpp.
References LLVMValueToValueMap.
Referenced by llvm::sandboxir::BasicBlock::begin(), createBasicBlock(), createFunction(), llvm::sandboxir::Use::dumpOS(), llvm::sandboxir::BasicBlock::dumpOS(), llvm::sandboxir::Function::dumpOS(), llvm::sandboxir::SwitchInst::findCaseDest(), llvm::sandboxir::Use::get(), llvm::sandboxir::Function::getArg(), llvm::sandboxir::AllocaInst::getArraySize(), llvm::sandboxir::CallBase::getCalledFunction(), llvm::sandboxir::CallBase::getCalledOperand(), llvm::sandboxir::CallBase::getCalledOperandUse(), llvm::sandboxir::CallBase::getCaller(), llvm::sandboxir::AtomicCmpXchgInst::getCompareOperand(), llvm::sandboxir::BranchInst::getCondition(), llvm::sandboxir::SwitchInst::getCondition(), llvm::sandboxir::CallBrInst::getDefaultDest(), llvm::sandboxir::SwitchInst::getDefaultDest(), llvm::sandboxir::PHINode::getIncomingBlock(), llvm::sandboxir::PHINode::getIncomingValue(), llvm::sandboxir::PHINode::getIncomingValueForBlock(), llvm::sandboxir::CallBrInst::getIndirectDest(), llvm::sandboxir::CallBrInst::getIndirectDestLabel(), llvm::sandboxir::CallBrInst::getIndirectDestLabelUse(), llvm::sandboxir::CallBrInst::getIndirectDests(), llvm::sandboxir::InvokeInst::getLandingPadInst(), llvm::sandboxir::AtomicCmpXchgInst::getNewValOperand(), llvm::sandboxir::Instruction::getNextNode(), llvm::sandboxir::InvokeInst::getNormalDest(), getOrCreateValueInternal(), llvm::sandboxir::BasicBlock::getParent(), llvm::sandboxir::Instruction::getParent(), llvm::sandboxir::CatchSwitchInst::getParentPad(), llvm::sandboxir::AtomicRMWInst::getPointerOperand(), llvm::sandboxir::AtomicCmpXchgInst::getPointerOperand(), llvm::sandboxir::LoadInst::getPointerOperand(), llvm::sandboxir::StoreInst::getPointerOperand(), llvm::sandboxir::GetElementPtrInst::getPointerOperand(), llvm::sandboxir::ReturnInst::getReturnValue(), llvm::sandboxir::CallBrInst::getSuccessor(), llvm::sandboxir::SwitchInst::getSuccessor(), llvm::sandboxir::BranchInst::getSuccessor(), llvm::sandboxir::InvokeInst::getSuccessor(), llvm::sandboxir::BasicBlock::getTerminator(), llvm::sandboxir::InvokeInst::getUnwindDest(), llvm::sandboxir::CatchSwitchInst::getUnwindDest(), llvm::sandboxir::AtomicRMWInst::getValOperand(), getValue(), llvm::sandboxir::StoreInst::getValueOperand(), llvm::sandboxir::PHINode::hasConstantValue(), llvm::sandboxir::BBIterator::operator++(), llvm::sandboxir::PHINode::removeIncomingValue(), llvm::sandboxir::Value::replaceUsesWithIf(), llvm::sandboxir::Value::use_begin(), llvm::sandboxir::Value::user_begin(), and llvm::sandboxir::User::verifyUserOfLLVMUse().
Take ownership of VPtr and store it in LLVMValueToValueMap
.
Definition at line 1891 of file SandboxIR.cpp.
References assert(), llvm::sandboxir::Tracker::emplaceIfTracking(), getTracker(), I, and LLVMValueToValueMap.
Referenced by createAllocaInst(), createAtomicCmpXchgInst(), createAtomicRMWInst(), createBasicBlock(), createBinaryOperator(), createBranchInst(), createCallBrInst(), createCallInst(), createCastInst(), createCatchSwitchInst(), createExtractElementInst(), createFunction(), createGetElementPtrInst(), createInsertElementInst(), createInvokeInst(), createLoadInst(), createPHINode(), createReturnInst(), createSelectInst(), createStoreInst(), createSwitchInst(), createUnaryOperator(), createUnreachableInst(), and llvm::sandboxir::EraseFromParent::revert().
|
inline |
Convenience function for getTracker().revert()
Definition at line 2329 of file SandboxIR.h.
References IRTracker, and llvm::sandboxir::Tracker::revert().
|
inline |
Convenience function for getTracker().save()
Definition at line 2327 of file SandboxIR.h.
References IRTracker, and llvm::sandboxir::Tracker::save().
|
friend |
|
friend |
Definition at line 2267 of file SandboxIR.h.
Referenced by getOrCreateValueInternal().
|
friend |
Definition at line 2245 of file SandboxIR.h.
|
friend |
|
protected |
Definition at line 2312 of file SandboxIR.h.
Referenced by createAllocaInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 2310 of file SandboxIR.h.
Referenced by createAtomicCmpXchgInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 2308 of file SandboxIR.h.
Referenced by createAtomicRMWInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 2306 of file SandboxIR.h.
Referenced by createBinaryOperator(), and getOrCreateValueInternal().
|
protected |
Definition at line 2284 of file SandboxIR.h.
Referenced by createBranchInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 2296 of file SandboxIR.h.
Referenced by createCallBrInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 2292 of file SandboxIR.h.
Referenced by createCallInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 2314 of file SandboxIR.h.
Referenced by createCastInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 2300 of file SandboxIR.h.
Referenced by createCatchSwitchInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 2282 of file SandboxIR.h.
Referenced by createExtractElementInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 2298 of file SandboxIR.h.
Referenced by createGetElementPtrInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 2280 of file SandboxIR.h.
Referenced by createInsertElementInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 2294 of file SandboxIR.h.
Referenced by createInvokeInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 2230 of file SandboxIR.h.
Referenced by accept(), getTracker(), revert(), and save().
|
protected |
Definition at line 2229 of file SandboxIR.h.
|
protected |
Definition at line 2274 of file SandboxIR.h.
Referenced by getLLVMIRBuilder().
|
protected |
Maps LLVM Value to the corresponding sandboxir::Value.
Owns all SandboxIR objects.
Definition at line 2235 of file SandboxIR.h.
Referenced by detachLLVMValue(), getNumValues(), getOrCreateArgument(), getOrCreateValueInternal(), getValue(), and registerValue().
|
protected |
Definition at line 2286 of file SandboxIR.h.
Referenced by createLoadInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 2316 of file SandboxIR.h.
Referenced by createPHINode(), and getOrCreateValueInternal().
|
protected |
Definition at line 2290 of file SandboxIR.h.
Referenced by createReturnInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 2278 of file SandboxIR.h.
Referenced by createSelectInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 2288 of file SandboxIR.h.
Referenced by createStoreInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 2302 of file SandboxIR.h.
Referenced by createSwitchInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 2304 of file SandboxIR.h.
Referenced by createUnaryOperator(), and getOrCreateValueInternal().
|
protected |
Definition at line 2318 of file SandboxIR.h.
Referenced by createUnreachableInst(), and getOrCreateValueInternal().