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 | AtomicCmpXchgInst |
friend | AllocaInst |
friend | CastInst |
friend | PHINode |
friend | UnreachableInst |
Friends | |
class | EraseFromParent |
class | Constant |
class | BasicBlock |
Various leaf nodes. | |
void | Instruction::eraseFromParent () |
Definition at line 1715 of file SandboxIR.h.
|
inline |
Definition at line 1799 of file SandboxIR.h.
|
inline |
Convenience function for getTracker().accept()
Definition at line 1809 of file SandboxIR.h.
References llvm::sandboxir::Tracker::accept(), and IRTracker.
|
protected |
Definition at line 1663 of file SandboxIR.cpp.
References AllocaInst, I, and registerValue().
Referenced by llvm::sandboxir::AllocaInst::create().
|
protected |
Definition at line 1658 of file SandboxIR.cpp.
References AtomicCmpXchgInst, I, and registerValue().
Referenced by llvm::sandboxir::AtomicCmpXchgInst::create().
|
protected |
Create a sandboxir::BasicBlock for an existing LLVM IR BB
.
This will also create all contents of the block.
Definition at line 1582 of file SandboxIR.cpp.
References assert(), BasicBlock, getValue(), and registerValue().
Referenced by createFunction().
|
protected |
Definition at line 1610 of file SandboxIR.cpp.
References BranchInst, and registerValue().
Referenced by llvm::sandboxir::BranchInst::create().
|
protected |
Definition at line 1640 of file SandboxIR.cpp.
References CallBrInst, I, and registerValue().
Referenced by llvm::sandboxir::CallBrInst::create().
|
protected |
Definition at line 1630 of file SandboxIR.cpp.
References CallInst, I, and registerValue().
|
protected |
Definition at line 1667 of file SandboxIR.cpp.
References CastInst, I, and registerValue().
Referenced by llvm::sandboxir::CastInst::create().
|
protected |
Definition at line 1597 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 1683 of file SandboxIR.cpp.
References assert(), createBasicBlock(), F, getOrCreateArgument(), getValue(), and registerValue().
|
protected |
Definition at line 1652 of file SandboxIR.cpp.
References GetElementPtrInst, I, and registerValue().
|
protected |
Definition at line 1604 of file SandboxIR.cpp.
References InsertElementInst, and registerValue().
Referenced by llvm::sandboxir::InsertElementInst::create().
|
protected |
Definition at line 1635 of file SandboxIR.cpp.
References I, InvokeInst, and registerValue().
Referenced by llvm::sandboxir::InvokeInst::create().
|
protected |
Definition at line 1615 of file SandboxIR.cpp.
References LoadInst, and registerValue().
Referenced by llvm::sandboxir::LoadInst::create().
|
protected |
Definition at line 1671 of file SandboxIR.cpp.
References I, PHINode, and registerValue().
Referenced by llvm::sandboxir::PHINode::create().
|
protected |
Definition at line 1625 of file SandboxIR.cpp.
References I, registerValue(), and ReturnInst.
|
protected |
Definition at line 1591 of file SandboxIR.cpp.
References registerValue(), and SelectInst.
|
protected |
Definition at line 1620 of file SandboxIR.cpp.
References registerValue(), and StoreInst.
Referenced by llvm::sandboxir::StoreInst::create().
|
protected |
Definition at line 1645 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 1421 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 1410 of file SandboxIR.cpp.
References LLVMValueToValueMap.
Referenced by detach().
|
inlineprotected |
Definition at line 1763 of file SandboxIR.h.
References LLVMIRBuilder.
Referenced by llvm::sandboxir::BranchInst::create(), llvm::sandboxir::CallBrInst::create(), llvm::sandboxir::InvokeInst::create(), llvm::sandboxir::UnreachableInst::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::StoreInst::create(), llvm::sandboxir::ExtractElementInst::create(), and llvm::sandboxir::InsertElementInst::create().
|
inline |
\Returns the number of values registered with Context.
Definition at line 1821 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 1738 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 1752 of file SandboxIR.h.
References getOrCreateValueInternal().
Referenced by llvm::sandboxir::CastInst::create(), llvm::sandboxir::ExtractElementInst::create(), llvm::sandboxir::InsertElementInst::create(), and llvm::sandboxir::Constant::createInt().
|
inlineprotected |
Get or create a sandboxir::Value for an existing LLVM IR LLVMV
.
Definition at line 1748 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 1446 of file SandboxIR.cpp.
References AllocaInst, assert(), AtomicCmpXchgInst, BranchInst, llvm::CallingConv::C, CallBrInst, CallInst, CastInst, Constant, ExtractElementInst, F, GetElementPtrInst, getOpcode(), getOrCreateValueInternal(), getValue(), InsertElementInst, InvokeInst, LLVMAlloca, LLVMAtomicCmpXchg, LLVMBr, LLVMCall, LLVMCallBr, LLVMInvoke, LLVMRet, LLVMUnreachable, LLVMValueToValueMap, LoadInst, PHINode, ReturnInst, SelectInst, StoreInst, and UnreachableInst.
Referenced by getOrCreateConstant(), getOrCreateValue(), and getOrCreateValueInternal().
|
inline |
Definition at line 1803 of file SandboxIR.h.
References IRTracker.
Referenced by llvm::sandboxir::PHINode::addIncoming(), llvm::sandboxir::Instruction::eraseFromParent(), llvm::sandboxir::Instruction::insertBefore(), llvm::sandboxir::Instruction::insertInto(), llvm::sandboxir::Instruction::moveBefore(), registerValue(), 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::AtomicCmpXchgInst::setAlignment(), llvm::sandboxir::AllocaInst::setAlignment(), llvm::sandboxir::AllocaInst::setAllocatedType(), llvm::sandboxir::CallBrInst::setDefaultDest(), llvm::sandboxir::AtomicCmpXchgInst::setFailureOrdering(), llvm::sandboxir::PHINode::setIncomingBlock(), llvm::sandboxir::PHINode::setIncomingValue(), llvm::sandboxir::CallBrInst::setIndirectDest(), llvm::sandboxir::User::setOperand(), llvm::sandboxir::AtomicCmpXchgInst::setSuccessOrdering(), llvm::sandboxir::AtomicCmpXchgInst::setSyncScopeID(), llvm::sandboxir::AllocaInst::setUsedWithInAlloca(), llvm::sandboxir::LoadInst::setVolatile(), llvm::sandboxir::StoreInst::setVolatile(), llvm::sandboxir::AtomicCmpXchgInst::setVolatile(), llvm::sandboxir::AtomicCmpXchgInst::setWeak(), and llvm::sandboxir::Use::swap().
|
inline |
Definition at line 1812 of file SandboxIR.h.
References getValue().
Value * Context::getValue | ( | llvm::Value * | V | ) | const |
Definition at line 1676 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::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::CallBrInst::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::AtomicCmpXchgInst::getPointerOperand(), llvm::sandboxir::LoadInst::getPointerOperand(), llvm::sandboxir::StoreInst::getPointerOperand(), llvm::sandboxir::GetElementPtrInst::getPointerOperand(), llvm::sandboxir::ReturnInst::getReturnValue(), llvm::sandboxir::CallBrInst::getSuccessor(), llvm::sandboxir::BranchInst::getSuccessor(), llvm::sandboxir::InvokeInst::getSuccessor(), llvm::sandboxir::BasicBlock::getTerminator(), llvm::sandboxir::InvokeInst::getUnwindDest(), 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 1428 of file SandboxIR.cpp.
References assert(), llvm::sandboxir::Tracker::emplaceIfTracking(), getTracker(), I, and LLVMValueToValueMap.
Referenced by createAllocaInst(), createAtomicCmpXchgInst(), createBasicBlock(), createBranchInst(), createCallBrInst(), createCallInst(), createCastInst(), createExtractElementInst(), createFunction(), createGetElementPtrInst(), createInsertElementInst(), createInvokeInst(), createLoadInst(), createPHINode(), createReturnInst(), createSelectInst(), createStoreInst(), createUnreachableInst(), and llvm::sandboxir::EraseFromParent::revert().
|
inline |
Convenience function for getTracker().revert()
Definition at line 1807 of file SandboxIR.h.
References IRTracker, and llvm::sandboxir::Tracker::revert().
|
inline |
Convenience function for getTracker().save()
Definition at line 1805 of file SandboxIR.h.
References IRTracker, and llvm::sandboxir::Tracker::save().
|
friend |
|
friend |
Definition at line 1755 of file SandboxIR.h.
Referenced by getOrCreateValueInternal().
|
friend |
Definition at line 1733 of file SandboxIR.h.
|
friend |
|
protected |
Definition at line 1790 of file SandboxIR.h.
Referenced by createAllocaInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 1788 of file SandboxIR.h.
Referenced by createAtomicCmpXchgInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 1772 of file SandboxIR.h.
Referenced by createBranchInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 1784 of file SandboxIR.h.
Referenced by createCallBrInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 1780 of file SandboxIR.h.
Referenced by createCallInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 1792 of file SandboxIR.h.
Referenced by createCastInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 1770 of file SandboxIR.h.
Referenced by createExtractElementInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 1786 of file SandboxIR.h.
Referenced by createGetElementPtrInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 1768 of file SandboxIR.h.
Referenced by createInsertElementInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 1782 of file SandboxIR.h.
Referenced by createInvokeInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 1718 of file SandboxIR.h.
Referenced by accept(), getTracker(), revert(), and save().
|
protected |
Definition at line 1717 of file SandboxIR.h.
|
protected |
Definition at line 1762 of file SandboxIR.h.
Referenced by getLLVMIRBuilder().
|
protected |
Maps LLVM Value to the corresponding sandboxir::Value.
Owns all SandboxIR objects.
Definition at line 1723 of file SandboxIR.h.
Referenced by detachLLVMValue(), getNumValues(), getOrCreateArgument(), getOrCreateValueInternal(), getValue(), and registerValue().
|
protected |
Definition at line 1774 of file SandboxIR.h.
Referenced by createLoadInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 1794 of file SandboxIR.h.
Referenced by createPHINode(), and getOrCreateValueInternal().
|
protected |
Definition at line 1778 of file SandboxIR.h.
Referenced by createReturnInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 1766 of file SandboxIR.h.
Referenced by createSelectInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 1776 of file SandboxIR.h.
Referenced by createStoreInst(), and getOrCreateValueInternal().
|
protected |
Definition at line 1796 of file SandboxIR.h.
Referenced by createUnreachableInst(), and getOrCreateValueInternal().