13#ifndef LLVM_TRANSFORMS_IPO_INSTRUMENTOR_UTILS_H
14#define LLVM_TRANSFORMS_IPO_INSTRUMENTOR_UTILS_H
37 :
M(
M),
Ctx(
M.getContext()),
47 if (!
I->getType()->isVoidTy())
56 auto *&AllocaList =
AllocaMap[{Fn,
DL.getTypeAllocSize(Ty)}];
60 for (
auto *&ListAI : *AllocaList) {
61 if (MatchType && ListAI->getAllocatedType() != Ty)
64 ListAI = *AllocaList->rbegin();
68 AllocaList->pop_back();
149 std::bitset<static_cast<int>(EnumTy::NumConfig)>
Options;
159 bool has(EnumTy Opt)
const {
return Options.test(
static_cast<int>(Opt)); }
This file contains the declarations for the subclasses of Constant, which represent the different fla...
This file defines the DenseMap class.
Module.h This file contains the declarations for the Module class.
an instruction to allocate memory on the stack
iterator begin()
Instruction iterator methods.
ConstantFolder - Create constants with minimum, target independent, folding.
A parsed version of the target data layout string in and methods for querying it.
const BasicBlock & getEntryBlock() const
const DataLayout & getDataLayout() const
Get the data layout of the module this function belongs to.
Provides an 'InsertHelper' that calls a user-provided callback after performing the default insertion...
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
Class to represent integer types.
This is an important class for using LLVM in a threaded context.
A Module instance is used to store all the information related to an LLVM module.
Class to represent pointers.
static LLVM_ABI PointerType * get(Type *ElementType, unsigned AddressSpace)
This constructs a pointer to an object of the specified type in a numbered address space.
static LLVM_ABI PoisonValue * get(Type *T)
Static factory methods - Return an 'poison' object of the specified type.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
The instances of the Type class are immutable: once they are created, they are never changed.
static LLVM_ABI IntegerType * getInt64Ty(LLVMContext &C)
static LLVM_ABI IntegerType * getInt32Ty(LLVMContext &C)
static LLVM_ABI Type * getVoidTy(LLVMContext &C)
static LLVM_ABI IntegerType * getInt8Ty(LLVMContext &C)
LLVM Value Representation.
This is an optimization pass for GlobalISel generic memory operations.
void set(EnumTy Opt, bool Value=true)
Set the boolean value of option Opt to Value.
std::bitset< static_cast< int >(ConfigKind::NumConfig)> Options
BaseConfigTy(bool Enable=true)
Construct the option bitset with all bits set to Enable.
bool has(EnumTy Opt) const
Check if the option Opt is enabled.
Helper that represent the caches for instrumentation call arguments.
DenseMap< std::tuple< unsigned, StringRef, StringRef >, Value * > DirectArgCache
A cache for direct and indirect arguments.
DenseMap< std::tuple< unsigned, StringRef, StringRef >, Value * > IndirectArgCache
IRBuilder< ConstantFolder, IRBuilderCallbackInserter > IRB
The underlying IR builder with insertion callback.
~InstrumentorIRBuilderTy()
Destroy the IR builder and remove all erasable instructions cached during the process of instrumentin...
unsigned Epoch
The current epoch number.
SmallVector< AllocaInst * > AllocaListTy
}
InstrumentorIRBuilderTy(Module &M)
Construct an IR builder for the module M.
AllocaInst * getAlloca(Function *Fn, Type *Ty, bool MatchType=false)
Get a temporary alloca to communicate (large) values with the runtime.
DenseMap< AllocaInst *, AllocaListTy * > UsedAllocas
Map that holds the currently used allocas and the list where they belong.
void returnAllocas()
Return the temporary allocas.
SmallPtrSet< Instruction *, 32 > ErasableInstructions
Instructions that should be erased later.
DenseMap< Instruction *, unsigned > NewInsts
A mapping from instrumentation instructions to the epoch they have been created.
Module & M
Commonly used values for IR inspection and creation.
DenseMap< std::pair< Function *, unsigned >, AllocaListTy * > AllocaMap
Map that holds a list of currently available allocas for a function and alloca size.
void eraseLater(Instruction *I)
Save instruction I to be erased later.