9#ifndef LLVM_TOOLS_LLUBI_CONTEXT_H
10#define LLVM_TOOLS_LLUBI_CONTEXT_H
114 bool IsConstant =
false;
115 bool IsIRGlobalValue =
false;
116 bool IsInaccessible =
false;
148 return NewAddr.
uge(Address) && NewAddr.
ule(Address + Size);
199 : Bytes(
Ref), IsLittleEndian(IsLittleEndian) {}
204 return Bytes[IsLittleEndian ? Index : Bytes.size() - 1 - Index];
207 size_t size()
const {
return Bytes.size(); }
240 bool Deterministic =
false;
243 bool FusedMultiplyAdd =
false;
277 struct ExposedProvenance {
282 return Generation <
RHS.Generation;
285 struct ExposedProvenanceSet {
292 std::map<uint64_t, ExposedProvenanceSet> ExposedProvenances;
294 uint64_t ExposedProvenanceSetGeneration = 0;
299 bool CheckPaddingBits,
bool *ContainsUndefinedBits);
308 std::map<Constant *, MaterializedConstant> ConstCache;
312 size_t NoncacheableConstCount = 0;
355 NaNBehavior = NaNBehav;
368 return VScale * EC.getKnownMinValue();
369 return EC.getFixedValue();
373 if (
Size.isScalable())
374 return VScale *
Size.getKnownMinValue();
375 return Size.getFixedValue();
393 return !
isUIntN(DL.getIndexSizeInBits(AS) - 1,
Size);
398 bool IsIRGlobalValue =
false);
417 bool HasSideEffect =
true);
426 bool *ContainsUndefinedBits =
nullptr);
441 bool *ContainsUndefinedBits =
nullptr);
464 unsigned IndexBitWidth,
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
AMDGPU Mark last scratch load
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
This file defines the DenseMap class.
This file contains the declarations of entities that describe floating point environment and related ...
Module.h This file contains the declarations for the Module class.
static ManagedStatic< cl::opt< uint64_t >, CreateSeed > Seed
Class for arbitrary precision integers.
bool ule(const APInt &RHS) const
Unsigned less or equal comparison.
bool uge(const APInt &RHS) const
Unsigned greater or equal comparison.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Registry of file location information for LLVM IR constructs.
LLVM Basic Block Representation.
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
A constant value that is initialized with an expression using other constant values.
This is an important base class in LLVM.
A parsed version of the target data layout string in and methods for querying it.
Represents flags for the getelementptr instruction/expression.
A smart pointer to a reference-counted object that inherits from RefCountedBase or ThreadSafeRefCount...
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.
Represent a mutable reference to an array (0 or more elements consecutively in memory),...
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.
A BumpPtrAllocator that allows only elements of a specific type to be allocated.
Represent a constant reference to a string, i.e.
Implementation of the target library information.
Triple - Helper class for working with autoconf configuration names.
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
An efficient, type-erasing, non-owning reference to a callable.
Represents a scalar byte value.
Endianness aware accessor for bytes.
BytesView(ArrayRefT Ref, bool IsLittleEndian)
BytesView(ArrayRefT Ref, const DataLayout &DL)
auto & operator[](uint32_t Index)
Context & operator=(const Context &)=delete
LLVM_ABI ProgramExitInfo runFunction(Function &F, ArrayRef< AnyValue > Args, AnyValue &RetVal, EventHandler &Handler)
Execute the function F with arguments Args, and store the return value in RetVal if the function is n...
LLVM_ABI bool isDefaultFPEnv() const
uint64_t getMemoryLimit() const
uint32_t getEVL(ElementCount EC) const
Get the effective vector length for a vector type.
LLVM_ABI Pointer deriveFromMemoryObject(IntrusiveRefCntPtr< MemoryObject > Obj)
Derive a pointer from a memory object with offset 0.
uint32_t getMaxStackDepth() const
LLVM_ABI UndefValueBehavior getEffectiveUndefValueBehavior() const
void setUndefValueBehavior(UndefValueBehavior UB)
Context(const Context &)=delete
bool exceedsMaxObjectSize(uint64_t Size, unsigned AS) const
Returns true if an object of Size bytes in address space AS is larger than the largest signed integer...
LLVM_ABI void resetNoncacheableConstantBuffer()
LLVM_ABI void setCurrentRoundingMode(RoundingMode RM)
LLVM_ABI void setCurrentExceptionBehavior(fp::ExceptionBehavior EB)
const AsmParserContext * getParserContext() const
Context(Context &&)=delete
bool fuseMultiplyAdd() const
LLVM_ABI bool initGlobalValues()
Initialize global variables and function/block objects.
void setMaxStackDepth(uint32_t Depth)
void setNaNPropagationBehavior(NaNPropagationBehavior NaNBehav)
LLVM_ABI IntrusiveRefCntPtr< MemoryObject > allocate(uint64_t Size, uint64_t Align, StringRef Name, unsigned AS, MemInitKind InitKind, MemAllocKind AllocKind, bool IsIRGlobalValue=false)
uint64_t getEffectiveTypeSize(TypeSize Size) const
The result is multiplied by VScale for scalable type sizes.
LLVM_ABI IntrusiveRefCntPtr< Provenance > getWildcardProvenance()
Returns the snapshot of currently exposed provenances.
LLVM_ABI Function * getTargetFunction(const Pointer &Ptr)
LLVM_ABI uint64_t getEffectiveTypeAllocSize(Type *Ty)
Returns DL.getTypeAllocSize/getTypeStoreSize for the given type.
void setFusedMultiplyAdd(bool F)
LLVM_ABI uint64_t getEffectiveTypeStoreSize(Type *Ty)
LLVM_ABI AnyValue extractBits(const ByteValue &Src, uint32_t OffsetInBits, Type *Ty)
Read the bits [OffsetInBits, OffsetInBits + bitwidth(Ty)) of Src as a value of type Ty.
LLVM_ABI AnyValue computeGEP(GEPOperator &GEP, function_ref< const AnyValue &(Value *V)> GetValue)
const DataLayout & getDataLayout() const
const Triple & getTargetTriple() const
LLVM_ABI bool getRandomBool()
LLVM_ABI NaNPropagationBehavior getEffectiveNaNPropagationBehavior() const
LLVM_ABI fp::ExceptionBehavior getCurrentExceptionBehavior() const
bool mayUseNonDeterminism() const
static LLVM_ABI AnyValue canonicalizeIndex(const AnyValue &Idx, unsigned IndexBitWidth, GEPNoWrapFlags Flags)
Sign extends or truncates the GEP index Idx to IndexBitWidth bits.
void reseed(uint32_t Seed)
LLVMContext & getContext() const
LLVM_ABI Context(Module &M, const AsmParserContext *ParserContext)
LLVM_ABI const MaterializedConstant * getConstantValue(Constant *C)
Returns a pointer to an evaluated constant C.
LLVM_ABI bool free(const MemoryObject &Obj)
LLVM_ABI void insertBits(ByteValue &Base, uint32_t OffsetInBits, const AnyValue &Val, Type *Ty)
Overwrite the bits [OffsetInBits, OffsetInBits + bitwidth(Ty)) of Base with Val.
LLVM_ABI void store(MemoryObject &MO, uint64_t Offset, const AnyValue &Val, Type *ValTy)
Direct memory store without checks.
LLVM_ABI BasicBlock * getTargetBlock(const Pointer &Ptr)
void setMaxSteps(uint32_t MS)
uint32_t getMaxSteps() const
void setDeterministic(bool D)
LLVM_ABI void storeRawBytes(MemoryObject &MO, uint64_t Offset, const void *Data, uint64_t Size)
LLVM_ABI AnyValue computeScaledPtrAdd(const AnyValue &Ptr, const AnyValue &Index, const APInt &Scale, GEPNoWrapFlags Flags, AnyValue &AccumulatedOffset)
void setMemoryLimit(uint64_t Max)
LLVM_ABI void exposeProvenance(Provenance &Prov)
Mark this provenance as exposed.
const TargetLibraryInfoImpl & getTLIImpl() const
LLVM_ABI RoundingMode getCurrentRoundingMode() const
bool isDeterministic() const
LLVM_ABI MemoryObject * checkProvenance(const Pointer &Ptr, function_ref< bool(const Provenance &)> Check, bool HasSideEffect=true)
A helper to check both concrete and wildcard provenance.
Context & operator=(Context &&)=delete
LLVM_ABI uint64_t getRandomUInt64()
void setVScale(uint32_t VS)
uint32_t getVScale() const
Module & getModule() const
An interface for handling events and managing outputs during interpretation.
virtual bool onFunctionEntry(Function &F, ArrayRef< AnyValue > Args, CallBase *CallSite)
virtual bool onFunctionExit(Function &F, const AnyValue &RetVal)
virtual void onProgramExit(const ProgramExitInfo &ExitInfo)
virtual bool onBBJump(Instruction &I, BasicBlock &To)
virtual void onError(StringRef Msg)
virtual ~EventHandler()=default
virtual bool onInstructionExecuted(Instruction &I, const AnyValue &Result)
virtual bool onPrint(StringRef Msg)
virtual void onImmediateUB(StringRef Msg)
virtual void onUnrecognizedInstruction(Instruction &I)
MaterializedConstant(AnyValue V, bool Cacheable)
MaterializedConstant(std::nullopt_t)
MemoryObject & operator=(MemoryObject &&)=delete
LLVM_ABI MemoryObject(uint64_t Addr, uint64_t Size, StringRef Name, unsigned AS, MemInitKind InitKind, MemAllocKind AllocKind, bool IsIRGlobalValue=false)
bool isInaccessible() const
void setIsInaccessible(bool V)
unsigned getAddressSpace() const
ArrayRef< Byte > getBytes() const
MemoryObject(const MemoryObject &)=delete
MemoryObjectState getState() const
LLVM_ABI bool isHeapAllocated() const
Byte & operator[](uint64_t Offset)
void setState(MemoryObjectState S)
MemoryObject(MemoryObject &&)=delete
MutableArrayRef< Byte > getBytes()
LLVM_ABI bool isGlobal() const
bool inBounds(const APInt &NewAddr) const
void setIsConstant(bool C)
MemoryObject & operator=(const MemoryObject &)=delete
uint64_t getAddress() const
MemAllocKind getAllocKind() const
StringRef getName() const
bool isIRGlobalValue() const
LLVM_ABI bool isStackAllocated() const
Components of a pointer excluding address.
ExceptionBehavior
Exception behavior used for floating point operations.
@ ebIgnore
This corresponds to "fpexcept.ignore".
BytesView< ArrayRef< Byte > > ConstBytesView
BytesView< MutableArrayRef< Byte > > MutableBytesView
bool operator<(int64_t V1, const APSInt &V2)
LLVM_ABI raw_fd_ostream & outs()
This returns a reference to a raw_fd_ostream for standard output.
constexpr bool isUIntN(unsigned N, uint64_t x)
Checks if an unsigned integer fits into the given (dynamic) bit width.
@ Ref
The access may reference the value stored in memory.
RoundingMode
Rounding mode.
@ NearestTiesToEven
roundTiesToEven.
constexpr unsigned BitWidth
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Implement std::hash so that hash_code can be used in STL containers.
This struct is a compact representation of a valid (non-zero power of two) alignment.
Representation of a byte in memory.
bool isExitedByLibcall() const
ProgramExitInfo(ProgramExitKind Kind, uint64_t ExitCode)