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 | 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 2132 of file SandboxIR.h.
|
inline |
Definition at line 2224 of file SandboxIR.h.
|
inline |
Convenience function for getTracker().accept()
Definition at line 2234 of file SandboxIR.h.
References llvm::sandboxir::Tracker::accept(), and IRTracker.
|
protected |
Definition at line 2142 of file SandboxIR.cpp.
References AllocaInst, I, and registerValue().
Referenced by llvm::sandboxir::AllocaInst::create().
|
protected |
Definition at line 2137 of file SandboxIR.cpp.
References AtomicCmpXchgInst, I, and registerValue().
Referenced by llvm::sandboxir::AtomicCmpXchgInst::create().
|
protected |
Definition at line 2132 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 2045 of file SandboxIR.cpp.
References assert(), BasicBlock, getValue(), and registerValue().
Referenced by createFunction().
|
protected |
Definition at line 2128 of file SandboxIR.cpp.
References BinaryOperator, I, and registerValue().
Referenced by llvm::sandboxir::BinaryOperator::create().
|
protected |
Definition at line 2073 of file SandboxIR.cpp.
References BranchInst, and registerValue().
Referenced by llvm::sandboxir::BranchInst::create().
|
protected |
Definition at line 2103 of file SandboxIR.cpp.
References CallBrInst, I, and registerValue().
Referenced by llvm::sandboxir::CallBrInst::create().
|
protected |
Definition at line 2093 of file SandboxIR.cpp.
References CallInst, I, and registerValue().
|
protected |
Definition at line 2146 of file SandboxIR.cpp.
References CastInst, I, and registerValue().
Referenced by llvm::sandboxir::CastInst::create().
|
protected |
Definition at line 2060 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 2162 of file SandboxIR.cpp.
References assert(), createBasicBlock(), F, getOrCreateArgument(), getValue(), and registerValue().
|
protected |
Definition at line 2115 of file SandboxIR.cpp.
References GetElementPtrInst, I, and registerValue().
|
protected |
Definition at line 2067 of file SandboxIR.cpp.
References InsertElementInst, and registerValue().
Referenced by llvm::sandboxir::InsertElementInst::create().
|
protected |
Definition at line 2098 of file SandboxIR.cpp.
References I, InvokeInst, and registerValue().
Referenced by llvm::sandboxir::InvokeInst::create().
|
protected |
Definition at line 2078 of file SandboxIR.cpp.
References LoadInst, and registerValue().
Referenced by llvm::sandboxir::LoadInst::create().
|
protected |
Definition at line 2150 of file SandboxIR.cpp.
References I, PHINode, and registerValue().
Referenced by llvm::sandboxir::PHINode::create().
|
protected |
Definition at line 2088 of file SandboxIR.cpp.
References I, registerValue(), and ReturnInst.
|
protected |
Definition at line 2054 of file SandboxIR.cpp.
References registerValue(), and SelectInst.
|
protected |
Definition at line 2083 of file SandboxIR.cpp.
References registerValue(), and StoreInst.
Referenced by llvm::sandboxir::StoreInst::create().
|
protected |
Definition at line 2120 of file SandboxIR.cpp.
References I, registerValue(), and SwitchInst.
Referenced by llvm::sandboxir::SwitchInst::create().
|
protected |
Definition at line 2124 of file SandboxIR.cpp.
References I, registerValue(), and UnaryOperator.
Referenced by llvm::sandboxir::UnaryOperator::create().
|
protected |
Definition at line 2108 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 1839 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 1828 of file SandboxIR.cpp.
References LLVMValueToValueMap.
Referenced by detach().
|
inlineprotected |
Definition at line 2180 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::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 2246 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 2155 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 2169 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 2165 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 1864 of file SandboxIR.cpp.
References AllocaInst, assert(), AtomicCmpXchgInst, AtomicRMWInst, BinaryOperator, BranchInst, llvm::CallingConv::C, CallBrInst, CallInst, CastInst, 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 2228 of file SandboxIR.h.
References IRTracker.
Referenced by llvm::sandboxir::SwitchInst::addCase(), 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::SwitchInst::setSuccessor(), llvm::sandboxir::AtomicCmpXchgInst::setSuccessOrdering(), llvm::sandboxir::AtomicRMWInst::setSyncScopeID(), llvm::sandboxir::AtomicCmpXchgInst::setSyncScopeID(), 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 2237 of file SandboxIR.h.
References getValue().
Value * Context::getValue | ( | llvm::Value * | V | ) | const |
Definition at line 2155 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::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::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 1846 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(), 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 2232 of file SandboxIR.h.
References IRTracker, and llvm::sandboxir::Tracker::revert().
|
inline |
Convenience function for getTracker().save()
Definition at line 2230 of file SandboxIR.h.
References IRTracker, and llvm::sandboxir::Tracker::save().
|
friend |
|
friend |
Definition at line 2172 of file SandboxIR.h.
Referenced by getOrCreateValueInternal().
|
friend |
Definition at line 2150 of file SandboxIR.h.
|
friend |
|
protected |
Definition at line 2215 of file SandboxIR.h.
Referenced by createAllocaInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 2213 of file SandboxIR.h.
Referenced by createAtomicCmpXchgInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 2211 of file SandboxIR.h.
Referenced by createAtomicRMWInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 2209 of file SandboxIR.h.
Referenced by createBinaryOperator(), and getOrCreateValueInternal().
|
protected |
Definition at line 2189 of file SandboxIR.h.
Referenced by createBranchInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 2201 of file SandboxIR.h.
Referenced by createCallBrInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 2197 of file SandboxIR.h.
Referenced by createCallInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 2217 of file SandboxIR.h.
Referenced by createCastInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 2187 of file SandboxIR.h.
Referenced by createExtractElementInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 2203 of file SandboxIR.h.
Referenced by createGetElementPtrInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 2185 of file SandboxIR.h.
Referenced by createInsertElementInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 2199 of file SandboxIR.h.
Referenced by createInvokeInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 2135 of file SandboxIR.h.
Referenced by accept(), getTracker(), revert(), and save().
|
protected |
Definition at line 2134 of file SandboxIR.h.
|
protected |
Definition at line 2179 of file SandboxIR.h.
Referenced by getLLVMIRBuilder().
|
protected |
Maps LLVM Value to the corresponding sandboxir::Value.
Owns all SandboxIR objects.
Definition at line 2140 of file SandboxIR.h.
Referenced by detachLLVMValue(), getNumValues(), getOrCreateArgument(), getOrCreateValueInternal(), getValue(), and registerValue().
|
protected |
Definition at line 2191 of file SandboxIR.h.
Referenced by createLoadInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 2219 of file SandboxIR.h.
Referenced by createPHINode(), and getOrCreateValueInternal().
|
protected |
Definition at line 2195 of file SandboxIR.h.
Referenced by createReturnInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 2183 of file SandboxIR.h.
Referenced by createSelectInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 2193 of file SandboxIR.h.
Referenced by createStoreInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 2205 of file SandboxIR.h.
Referenced by createSwitchInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 2207 of file SandboxIR.h.
Referenced by createUnaryOperator(), and getOrCreateValueInternal().
|
protected |
Definition at line 2221 of file SandboxIR.h.
Referenced by createUnreachableInst(), and getOrCreateValueInternal().