LLVM 19.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 Member Functions | |
std::unique_ptr< Value > | detachLLVMValue (llvm::Value *V) |
Remove V from the maps and returns the unique_ptr. | |
std::unique_ptr< Value > | detach (Value *V) |
Remove SBV from all SandboxIR maps and stop owning it. | |
Value * | registerValue (std::unique_ptr< Value > &&VPtr) |
Take ownership of VPtr and store it in LLVMValueToValueMap . | |
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 instruction types. | |
Argument * | getOrCreateArgument (llvm::Argument *LLVMArg) |
Get or create a sandboxir::Argument for an existing LLVM IR LLVMArg . | |
Value * | getOrCreateValue (llvm::Value *LLVMV) |
Get or create a sandboxir::Value for an existing LLVM IR LLVMV . | |
BasicBlock * | createBasicBlock (llvm::BasicBlock *BB) |
Create a sandboxir::BasicBlock for an existing LLVM IR BB . | |
auto & | getLLVMIRBuilder () |
LoadInst * | createLoadInst (llvm::LoadInst *LI) |
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 | LoadInst |
Friends | |
class | EraseFromParent |
class | BasicBlock |
Various leaf nodes. | |
void | Instruction::eraseFromParent () |
Definition at line 690 of file SandboxIR.h.
|
inline |
Definition at line 739 of file SandboxIR.h.
|
inline |
Convenience function for getTracker().accept()
Definition at line 749 of file SandboxIR.h.
References llvm::sandboxir::Tracker::accept(), and IRTracker.
|
protected |
Create a sandboxir::BasicBlock for an existing LLVM IR BB
.
This will also create all contents of the block.
Definition at line 631 of file SandboxIR.cpp.
References assert(), BasicBlock, getValue(), and registerValue().
Referenced by createFunction().
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 652 of file SandboxIR.cpp.
References assert(), createBasicBlock(), F, getOrCreateArgument(), getValue(), and registerValue().
|
protected |
Definition at line 640 of file SandboxIR.cpp.
References LoadInst, and registerValue().
Referenced by llvm::sandboxir::LoadInst::create().
Remove SBV
from all SandboxIR maps and stop owning it.
This effectively detaches V
from the underlying IR.
Definition at line 573 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 562 of file SandboxIR.cpp.
References LLVMValueToValueMap.
Referenced by detach().
|
inlineprotected |
Definition at line 733 of file SandboxIR.h.
References LLVMIRBuilder.
Referenced by llvm::sandboxir::LoadInst::create().
|
inline |
\Returns the number of values registered with Context.
Definition at line 761 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 713 of file SandboxIR.h.
References LLVMValueToValueMap.
Referenced by createFunction().
|
inlineprotected |
Get or create a sandboxir::Value for an existing LLVM IR LLVMV
.
Definition at line 723 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 590 of file SandboxIR.cpp.
References assert(), llvm::CallingConv::C, getOpcode(), getOrCreateValueInternal(), getValue(), LLVMValueToValueMap, and LoadInst.
Referenced by getOrCreateValue(), and getOrCreateValueInternal().
|
inline |
Definition at line 743 of file SandboxIR.h.
References IRTracker.
Referenced by llvm::sandboxir::Instruction::eraseFromParent(), llvm::sandboxir::Instruction::moveBefore(), llvm::sandboxir::Instruction::removeFromParent(), llvm::sandboxir::Value::replaceAllUsesWith(), llvm::sandboxir::User::replaceUsesOfWith(), llvm::sandboxir::Value::replaceUsesWithIf(), and llvm::sandboxir::User::setOperand().
|
inline |
Definition at line 752 of file SandboxIR.h.
References getValue().
Value * Context::getValue | ( | llvm::Value * | V | ) | const |
Definition at line 645 of file SandboxIR.cpp.
References LLVMValueToValueMap.
Referenced by llvm::sandboxir::BasicBlock::begin(), createBasicBlock(), createFunction(), llvm::sandboxir::Use::dump(), llvm::sandboxir::BasicBlock::dump(), llvm::sandboxir::Function::dump(), llvm::sandboxir::Use::get(), llvm::sandboxir::Function::getArg(), llvm::sandboxir::Instruction::getNextNode(), getOrCreateValueInternal(), llvm::sandboxir::Instruction::getParent(), llvm::sandboxir::BasicBlock::getParent(), llvm::sandboxir::LoadInst::getPointerOperand(), llvm::sandboxir::BasicBlock::getTerminator(), getValue(), llvm::sandboxir::BBIterator::operator++(), 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 580 of file SandboxIR.cpp.
References assert(), and LLVMValueToValueMap.
Referenced by createBasicBlock(), createFunction(), createLoadInst(), and llvm::sandboxir::EraseFromParent::revert().
|
inline |
Convenience function for getTracker().revert()
Definition at line 747 of file SandboxIR.h.
References IRTracker, and llvm::sandboxir::Tracker::revert().
|
inline |
Convenience function for getTracker().save()
Definition at line 745 of file SandboxIR.h.
References IRTracker, and llvm::sandboxir::Tracker::save().
|
friend |
|
friend |
Definition at line 708 of file SandboxIR.h.
|
friend |
|
protected |
Definition at line 693 of file SandboxIR.h.
Referenced by accept(), getTracker(), revert(), and save().
|
protected |
Definition at line 692 of file SandboxIR.h.
|
protected |
Definition at line 732 of file SandboxIR.h.
Referenced by getLLVMIRBuilder().
|
protected |
Maps LLVM Value to the corresponding sandboxir::Value.
Owns all SandboxIR objects.
Definition at line 698 of file SandboxIR.h.
Referenced by detachLLVMValue(), getNumValues(), getOrCreateArgument(), getOrCreateValueInternal(), getValue(), and registerValue().
|
protected |
Definition at line 736 of file SandboxIR.h.
Referenced by createLoadInst(), and getOrCreateValueInternal().