|
LLVM 23.0.0git
|
An IR builder augmented with extra information for the instrumentor pass. More...
#include "llvm/Transforms/IPO/InstrumentorUtils.h"
Public Types | |
| using | AllocaListTy = SmallVector<AllocaInst *> |
| } | |
Public Member Functions | |
| InstrumentorIRBuilderTy (Module &M) | |
Construct an IR builder for the module M. | |
| ~InstrumentorIRBuilderTy () | |
| Destroy the IR builder and remove all erasable instructions cached during the process of instrumenting. | |
| AllocaInst * | getAlloca (Function *Fn, Type *Ty, bool MatchType=false) |
| Get a temporary alloca to communicate (large) values with the runtime. | |
| void | returnAllocas () |
| Return the temporary allocas. | |
| void | eraseLater (Instruction *I) |
Save instruction I to be erased later. | |
Public Attributes | |
| Module & | M |
| Commonly used values for IR inspection and creation. | |
| LLVMContext & | Ctx |
| const DataLayout & | DL = M.getDataLayout() |
| Type * | VoidTy = Type::getVoidTy(Ctx) |
| PointerType * | PtrTy = PointerType::get(Ctx, 0) |
| IntegerType * | Int8Ty = Type::getInt8Ty(Ctx) |
| IntegerType * | Int32Ty = Type::getInt32Ty(Ctx) |
| IntegerType * | Int64Ty = Type::getInt64Ty(Ctx) |
| DenseMap< std::pair< Function *, unsigned >, AllocaListTy * > | AllocaMap |
| Map that holds a list of currently available allocas for a function and alloca size. | |
| DenseMap< AllocaInst *, AllocaListTy * > | UsedAllocas |
| Map that holds the currently used allocas and the list where they belong. | |
| SmallPtrSet< Instruction *, 32 > | ErasableInstructions |
| Instructions that should be erased later. | |
| IRBuilder< ConstantFolder, IRBuilderCallbackInserter > | IRB |
| The underlying IR builder with insertion callback. | |
| unsigned | Epoch = 0 |
| The current epoch number. | |
| DenseMap< Instruction *, unsigned > | NewInsts |
| A mapping from instrumentation instructions to the epoch they have been created. | |
An IR builder augmented with extra information for the instrumentor pass.
The underlying IR builder features an insertion callback to keep track of the new instructions.
Definition at line 34 of file InstrumentorUtils.h.
}
Definition at line 102 of file InstrumentorUtils.h.
|
inline |
|
inline |
Destroy the IR builder and remove all erasable instructions cached during the process of instrumenting.
Definition at line 45 of file InstrumentorUtils.h.
References ErasableInstructions, llvm::PoisonValue::get(), and I.
|
inline |
Save instruction I to be erased later.
The instructions are erased when the IR builder is destroyed.
Definition at line 85 of file InstrumentorUtils.h.
References ErasableInstructions, and I.
|
inline |
Get a temporary alloca to communicate (large) values with the runtime.
Definition at line 54 of file InstrumentorUtils.h.
References AllocaMap, llvm::BasicBlock::begin(), DL, llvm::Function::getDataLayout(), llvm::Function::getEntryBlock(), and UsedAllocas.
Referenced by llvm::instrumentor::IRTCallDescription::createLLVMCall().
|
inline |
Return the temporary allocas.
Definition at line 77 of file InstrumentorUtils.h.
References llvm::List, and UsedAllocas.
| DenseMap<std::pair<Function *, unsigned>, AllocaListTy *> llvm::instrumentor::InstrumentorIRBuilderTy::AllocaMap |
Map that holds a list of currently available allocas for a function and alloca size.
Definition at line 106 of file InstrumentorUtils.h.
Referenced by getAlloca().
| LLVMContext& llvm::instrumentor::InstrumentorIRBuilderTy::Ctx |
Definition at line 91 of file InstrumentorUtils.h.
Referenced by llvm::instrumentor::IRTCallDescription::createLLVMCall(), llvm::instrumentor::LoadIO::init(), llvm::instrumentor::StoreIO::init(), and InstrumentorIRBuilderTy().
| const DataLayout& llvm::instrumentor::InstrumentorIRBuilderTy::DL = M.getDataLayout() |
Definition at line 93 of file InstrumentorUtils.h.
Referenced by getAlloca(), and llvm::instrumentor::InstrumentationOpportunity::replaceValue().
| unsigned llvm::instrumentor::InstrumentorIRBuilderTy::Epoch = 0 |
The current epoch number.
Each instrumentation, e.g., of an instruction, is happening in a dedicated epoch. The epoch allows to determine if instrumentation instructions were already around, due to prior instrumentations, or have been introduced to support the current instrumentation, e.g., compute information about the current instruction.
Definition at line 123 of file InstrumentorUtils.h.
Referenced by llvm::instrumentor::IRTCallDescription::createLLVMCall(), llvm::instrumentor::InstrumentationOpportunity::getIdPost(), llvm::instrumentor::InstrumentationOpportunity::getIdPre(), InstrumentorIRBuilderTy(), and llvm::instrumentor::InstrumentationOpportunity::replaceValue().
| SmallPtrSet<Instruction *, 32> llvm::instrumentor::InstrumentorIRBuilderTy::ErasableInstructions |
Instructions that should be erased later.
Definition at line 113 of file InstrumentorUtils.h.
Referenced by eraseLater(), and ~InstrumentorIRBuilderTy().
| IntegerType* llvm::instrumentor::InstrumentorIRBuilderTy::Int32Ty = Type::getInt32Ty(Ctx) |
Definition at line 98 of file InstrumentorUtils.h.
Referenced by llvm::instrumentor::IRTCallDescription::createLLVMSignature(), llvm::instrumentor::LoadIO::init(), and llvm::instrumentor::StoreIO::init().
| IntegerType* llvm::instrumentor::InstrumentorIRBuilderTy::Int64Ty = Type::getInt64Ty(Ctx) |
Definition at line 99 of file InstrumentorUtils.h.
Referenced by llvm::instrumentor::LoadIO::getValueType(), llvm::instrumentor::StoreIO::getValueType(), llvm::instrumentor::LoadIO::init(), and llvm::instrumentor::StoreIO::init().
| IntegerType* llvm::instrumentor::InstrumentorIRBuilderTy::Int8Ty = Type::getInt8Ty(Ctx) |
Definition at line 97 of file InstrumentorUtils.h.
Referenced by llvm::instrumentor::LoadIO::init(), and llvm::instrumentor::StoreIO::init().
| IRBuilder<ConstantFolder, IRBuilderCallbackInserter> llvm::instrumentor::InstrumentorIRBuilderTy::IRB |
The underlying IR builder with insertion callback.
Definition at line 116 of file InstrumentorUtils.h.
Referenced by llvm::instrumentor::IRTCallDescription::createLLVMCall(), llvm::instrumentor::InstrumentationOpportunity::forceCast(), llvm::instrumentor::InstrumentationOpportunity::instrument(), InstrumentorIRBuilderTy(), and llvm::instrumentor::InstrumentationOpportunity::replaceValue().
| Module& llvm::instrumentor::InstrumentorIRBuilderTy::M |
Commonly used values for IR inspection and creation.
{
Definition at line 89 of file InstrumentorUtils.h.
Referenced by InstrumentorIRBuilderTy().
| DenseMap<Instruction *, unsigned> llvm::instrumentor::InstrumentorIRBuilderTy::NewInsts |
A mapping from instrumentation instructions to the epoch they have been created.
Definition at line 127 of file InstrumentorUtils.h.
Referenced by InstrumentorIRBuilderTy(), and llvm::instrumentor::InstrumentationOpportunity::replaceValue().
| PointerType* llvm::instrumentor::InstrumentorIRBuilderTy::PtrTy = PointerType::get(Ctx, 0) |
Definition at line 96 of file InstrumentorUtils.h.
Referenced by llvm::instrumentor::IRTCallDescription::createLLVMSignature(), llvm::instrumentor::LoadIO::init(), and llvm::instrumentor::StoreIO::init().
| DenseMap<AllocaInst *, AllocaListTy *> llvm::instrumentor::InstrumentorIRBuilderTy::UsedAllocas |
Map that holds the currently used allocas and the list where they belong.
Once an alloca has to be returned, it is returned directly to its list.
Definition at line 110 of file InstrumentorUtils.h.
Referenced by getAlloca(), and returnAllocas().
| Type* llvm::instrumentor::InstrumentorIRBuilderTy::VoidTy = Type::getVoidTy(Ctx) |
Definition at line 95 of file InstrumentorUtils.h.
Referenced by llvm::instrumentor::IRTCallDescription::createLLVMSignature().