44#define DEBUG_TYPE "jit"
46STATISTIC(NumInitBytes,
"Number of bytes of global vars initialized");
47STATISTIC(NumGlobals ,
"Number of global vars initialized");
50 std::unique_ptr<Module> M, std::string *ErrorStr,
51 std::shared_ptr<MCJITMemoryManager> MemMgr,
52 std::shared_ptr<LegacyJITSymbolResolver>
Resolver,
53 std::unique_ptr<TargetMachine> TM) =
nullptr;
55ExecutionEngine *(*ExecutionEngine::InterpCtor)(std::unique_ptr<Module> M,
56 std::string *ErrorStr) =
nullptr;
58void JITEventListener::anchor() {}
60void ObjectCache::anchor() {}
62void ExecutionEngine::Init(std::unique_ptr<Module> M) {
63 CompilingLazily =
false;
64 GVCompilationDisabled =
false;
65 SymbolSearchingDisabled =
false;
72 VerifyModules =
false;
75 assert(M &&
"Module is null?");
76 Modules.push_back(std::move(M));
106 void *RawMemory = ::operator
new(
108 new(RawMemory) GVMemoryBlock(GV);
109 return static_cast<char*
>(RawMemory) +
sizeof(GVMemoryBlock);
112 void deleted()
override {
116 this->~GVMemoryBlock();
117 ::operator
delete(
this);
127 llvm_unreachable(
"ExecutionEngine subclass doesn't implement addObjectFile.");
132 llvm_unreachable(
"ExecutionEngine subclass doesn't implement addObjectFile.");
153 for (
const auto &M :
Modules) {
155 if (
F && !
F->isDeclaration())
162 for (
const auto &M :
Modules) {
176 if (
I == GlobalAddressMap.end())
179 GlobalAddressReverseMap.erase(
I->second);
181 GlobalAddressMap.erase(
I);
190 std::lock_guard<sys::Mutex> locked(
lock);
199 return std::string(FullName);
203 std::lock_guard<sys::Mutex> locked(
lock);
208 std::lock_guard<sys::Mutex> locked(
lock);
210 assert(!Name.empty() &&
"Empty GlobalMapping symbol name!");
212 LLVM_DEBUG(
dbgs() <<
"JIT: Map \'" << Name <<
"\' to [" << Addr <<
"]\n";);
213 uint64_t &CurVal = EEState.getGlobalAddressMap()[Name];
214 assert((!CurVal || !Addr) &&
"GlobalMapping already established!");
218 if (!EEState.getGlobalAddressReverseMap().empty()) {
219 std::string &V = EEState.getGlobalAddressReverseMap()[CurVal];
220 assert((!V.empty() || !Name.empty()) &&
221 "GlobalMapping already established!");
222 V = std::string(Name);
227 std::lock_guard<sys::Mutex> locked(
lock);
229 EEState.getGlobalAddressMap().clear();
230 EEState.getGlobalAddressReverseMap().clear();
234 std::lock_guard<sys::Mutex> locked(
lock);
242 std::lock_guard<sys::Mutex> locked(
lock);
247 std::lock_guard<sys::Mutex> locked(
lock);
250 EEState.getGlobalAddressMap();
254 return EEState.RemoveMapping(Name);
256 uint64_t &CurVal = Map[Name];
257 uint64_t OldVal = CurVal;
259 if (CurVal && !EEState.getGlobalAddressReverseMap().empty())
260 EEState.getGlobalAddressReverseMap().erase(CurVal);
264 if (!EEState.getGlobalAddressReverseMap().empty()) {
265 std::string &V = EEState.getGlobalAddressReverseMap()[CurVal];
266 assert((!V.empty() || !Name.empty()) &&
267 "GlobalMapping already established!");
268 V = std::string(Name);
274 std::lock_guard<sys::Mutex> locked(
lock);
277 EEState.getGlobalAddressMap().find(S);
278 if (
I != EEState.getGlobalAddressMap().end())
285 std::lock_guard<sys::Mutex> locked(
lock);
292 std::lock_guard<sys::Mutex> locked(
lock);
297 std::lock_guard<sys::Mutex> locked(
lock);
300 if (EEState.getGlobalAddressReverseMap().empty()) {
302 I = EEState.getGlobalAddressMap().begin(),
303 E = EEState.getGlobalAddressMap().end();
I != E; ++
I) {
305 uint64_t Addr =
I->second;
306 EEState.getGlobalAddressReverseMap().insert(
307 std::make_pair(Addr, std::string(Name)));
311 std::map<uint64_t, std::string>::iterator
I =
312 EEState.getGlobalAddressReverseMap().find((uint64_t) Addr);
314 if (
I != EEState.getGlobalAddressReverseMap().end()) {
325 std::unique_ptr<char[]> Array;
326 std::vector<std::unique_ptr<char[]>>
Values;
331 const std::vector<std::string> &InputArgv);
335 const std::vector<std::string> &InputArgv) {
337 Values.reserve(InputArgv.size());
339 Array = std::make_unique<char[]>((InputArgv.size()+1)*PtrSize);
344 for (
unsigned i = 0; i != InputArgv.size(); ++i) {
345 unsigned Size = InputArgv[i].size()+1;
346 auto Dest = std::make_unique<char[]>(
Size);
347 LLVM_DEBUG(
dbgs() <<
"JIT: ARGV[" << i <<
"] = " << (
void *)Dest.get()
356 Values.push_back(std::move(Dest));
368 StringRef Name(isDtors ?
"llvm.global_dtors" :
"llvm.global_ctors");
382 for (
unsigned i = 0, e = InitList->
getNumOperands(); i != e; ++i) {
387 if (
FP->isNullValue())
393 FP = CE->getOperand(0);
407 for (std::unique_ptr<Module> &M :
Modules)
415 for (
unsigned i = 0; i < PtrSize; ++i)
423 const std::vector<std::string> &argv,
424 const char *
const * envp) {
425 std::vector<GenericValue> GVArgs;
450 GVArgs.push_back(GVArgc);
455 "argv[0] was null after CreateArgv");
457 std::vector<std::string> EnvVars;
458 for (
unsigned i = 0; envp[i]; ++i)
459 EnvVars.emplace_back(envp[i]);
477 VerifyModules =
true;
479 VerifyModules =
false;
486 std::unique_ptr<RTDyldMemoryManager> mcjmm) {
487 auto SharedMM = std::shared_ptr<RTDyldMemoryManager>(std::move(mcjmm));
489 Resolver = std::move(SharedMM);
495 MemMgr = std::shared_ptr<MCJITMemoryManager>(std::move(MM));
501 Resolver = std::shared_ptr<LegacyJITSymbolResolver>(std::move(SR));
506 std::unique_ptr<TargetMachine> TheTM(TM);
521 *ErrorStr =
"Cannot create an interpreter with a memory manager.";
530 errs() <<
"WARNING: This target JIT is not designed for the host"
531 <<
" you are running. If bad things happen, please choose"
532 <<
" a different -march switch.\n";
538 std::move(Resolver), std::move(TheTM));
552 *ErrorStr =
"Interpreter has not been linked in.";
558 *ErrorStr =
"JIT has not been linked in.";
568 std::lock_guard<sys::Mutex> locked(
lock);
588 switch (
C->getType()->getTypeID()) {
597 Result.IntVal =
APInt(
C->getType()->getPrimitiveSizeInBits(), 0);
602 unsigned int elemNum = STy->getNumElements();
603 Result.AggregateVal.resize(elemNum);
604 for (
unsigned int i = 0; i < elemNum; ++i) {
606 if (
ElemTy->isIntegerTy())
607 Result.AggregateVal[i].IntVal =
609 else if (
ElemTy->isAggregateType()) {
619 "Scalable vector support not yet implemented in ExecutionEngine");
623 unsigned int elemNum = ArrTy->getNumElements();
624 Result.AggregateVal.resize(elemNum);
625 if (
ElemTy->isIntegerTy())
626 for (
unsigned int i = 0; i < elemNum; ++i)
627 Result.AggregateVal[i].IntVal =
635 unsigned int elemNum = VTy->getNumElements();
636 Result.AggregateVal.resize(elemNum);
637 if (
ElemTy->isIntegerTy())
638 for (
unsigned int i = 0; i < elemNum; ++i)
639 Result.AggregateVal[i].IntVal =
650 switch (CE->getOpcode()) {
651 case Instruction::GetElementPtr: {
657 char* tmp = (
char*) Result.PointerVal;
661 case Instruction::Trunc: {
667 case Instruction::PtrToInt: {
670 assert(PtrWidth <= 64 &&
"Bad pointer width");
672 uint32_t IntWidth = DL.getTypeSizeInBits(CE->getType());
676 case Instruction::IntToPtr: {
678 uint32_t PtrWidth = DL.getTypeSizeInBits(CE->getType());
684 case Instruction::BitCast: {
686 Type* DestTy = CE->getType();
710 case Instruction::Add:
711 case Instruction::Sub:
712 case Instruction::Xor: {
717 switch (CE->getOpcode()) {
719 case Instruction::Add: GV.
IntVal = LHS.IntVal + RHS.IntVal;
break;
720 case Instruction::Sub: GV.
IntVal = LHS.IntVal - RHS.IntVal;
break;
721 case Instruction::Xor: GV.
IntVal = LHS.IntVal ^ RHS.IntVal;
break;
731 OS <<
"ConstantExpr not handled: " << *CE;
737 "TargetExtType only supports null constant value");
743 switch (
C->getType()->getTypeID()) {
763 Result.PointerVal =
nullptr;
773 "Scalable vector support not yet implemented in ExecutionEngine");
780 Result.AggregateVal.resize(ElemNum);
781 for (
unsigned I = 0;
I < ElemNum; ++
I) {
787 Result.AggregateVal[
I].IntVal = CI->getValue();
789 APFloat Val = CFP->getValueAPF();
795 if (
ElemTy->isIntegerTy())
796 Result.AggregateVal[
I].IntVal =
806 OS <<
"ERROR: Constant unimplemented for type: " << *
C->getType();
818 Ty = TETy->getLayoutType();
822 switch (Ty->getTypeID()) {
824 dbgs() <<
"Cannot store value of type " << *Ty <<
"!\n";
841 memset(&(Ptr->PointerVal), 0, StoreBytes);
847 for (
unsigned i = 0; i < Val.
AggregateVal.size(); ++i) {
853 unsigned numOfBytes =(Val.
AggregateVal[i].IntVal.getBitWidth()+7)/8;
855 (
uint8_t*)Ptr + numOfBytes*i, numOfBytes);
872 Ty = TETy->getLayoutType();
876 switch (Ty->getTypeID()) {
883 Result.FloatVal = *((
float*)Ptr);
886 Result.DoubleVal = *((
double*)Ptr);
896 Result.IntVal =
APInt(80, y);
901 "Scalable vector support not yet implemented in ExecutionEngine");
904 Type *ElemT = VT->getElementType();
905 const unsigned numElems = VT->getNumElements();
907 Result.AggregateVal.resize(numElems);
908 for (
unsigned i = 0; i < numElems; ++i)
909 Result.AggregateVal[i].FloatVal = *((
float*)Ptr+i);
912 Result.AggregateVal.resize(numElems);
913 for (
unsigned i = 0; i < numElems; ++i)
914 Result.AggregateVal[i].DoubleVal = *((
double*)Ptr+i);
920 Result.AggregateVal.resize(numElems, intZero);
921 for (
unsigned i = 0; i < numElems; ++i)
923 (
uint8_t*)Ptr+((elemBitWidth+7)/8)*i, (elemBitWidth+7)/8);
930 OS <<
"Cannot load value of type " << *Ty <<
"!";
942 unsigned ElementSize =
944 for (
unsigned i = 0, e = CP->getNumOperands(); i != e; ++i)
950 memset(Addr, 0, (
size_t)
getDataLayout().getTypeAllocSize(Init->getType()));
955 unsigned ElementSize =
957 for (
unsigned i = 0, e = CPA->getNumOperands(); i != e; ++i)
965 for (
unsigned i = 0, e = CPS->getNumOperands(); i != e; ++i)
974 memcpy(Addr,
Data.data(),
Data.size());
978 if (Init->getType()->isFirstClassType()) {
995 std::map<std::pair<std::string, Type*>,
999 for (
const auto &M :
Modules) {
1000 for (
const auto &GV : M->globals()) {
1005 const GlobalValue *&GVEntry = LinkedGlobalsMap[std::make_pair(
1027 std::vector<const GlobalValue*> NonCanonicalGlobals;
1028 for (
const auto &M :
Modules) {
1029 for (
const auto &GV : M->globals()) {
1031 if (!LinkedGlobalsMap.empty()) {
1032 if (
const GlobalValue *GVEntry = LinkedGlobalsMap[std::make_pair(
1035 if (GVEntry != &GV) {
1036 NonCanonicalGlobals.push_back(&GV);
1059 if (!NonCanonicalGlobals.empty()) {
1060 for (
const GlobalValue *GV : NonCanonicalGlobals) {
1061 const GlobalValue *CGV = LinkedGlobalsMap[std::make_pair(
1064 assert(Ptr &&
"Canonical global wasn't codegen'd!");
1071 for (
const auto &GV : M->globals()) {
1073 if (!LinkedGlobalsMap.empty()) {
1074 if (
const GlobalValue *GVEntry = LinkedGlobalsMap[std::make_pair(
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static bool isTargetNullPtr(ExecutionEngine *EE, void *Loc)
isTargetNullPtr - Return whether the target pointer stored at Loc is null.
Module.h This file contains the declarations for the Module class.
This file defines the SmallString class.
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
static unsigned getBitWidth(Type *Ty, const DataLayout &DL)
Returns the bitwidth of the given scalar or pointer type.
LLVM_ABI double convertToDouble() const
Converts this APFloat to host double value.
LLVM_ABI float convertToFloat() const
Converts this APFloat to host float value.
Class for arbitrary precision integers.
uint64_t getZExtValue() const
Get zero extended value.
LLVM_ABI APInt zextOrTrunc(unsigned width) const
Zero extend or truncate to width.
LLVM_ABI APInt trunc(unsigned width) const
Truncate to new width.
static APInt floatToBits(float V)
Converts a float to APInt bits.
unsigned getBitWidth() const
Return the number of bits in the APInt.
float bitsToFloat() const
Converts APInt bits to a float.
static APInt doubleToBits(double V)
Converts a double to APInt bits.
double bitsToDouble() const
Converts APInt bits to a double.
const uint64_t * getRawData() const
This function returns a pointer to the internal storage of the APInt.
Value handle with callbacks on RAUW and destruction.
ConstantArray - Constant Array Declarations.
ConstantDataSequential - A vector or array constant whose element type is a simple 1/2/4/8-byte integ...
A constant value that is initialized with an expression using other constant values.
Constant Vector Declarations.
This is an important base class in LLVM.
static LLVM_ABI Constant * getNullValue(Type *Ty)
Constructor to create a '0' constant of arbitrary type.
A parsed version of the target data layout string in and methods for querying it.
bool isDefault() const
Test if the DataLayout was constructed from an empty string.
LLVM_ABI const StructLayout * getStructLayout(StructType *Ty) const
Returns a StructLayout object, indicating the alignment of the struct, its size, and the offsets of i...
LLVM_ABI TypeSize getTypeAllocSize(Type *Ty) const
Returns the offset in bytes between successive objects of the specified type, including alignment pad...
LLVM_ABI Align getPreferredAlign(const GlobalVariable *GV) const
Returns the preferred alignment of the specified global.
LLVM_ABI unsigned getPointerSize(unsigned AS=0) const
The pointer representation size in bytes, rounded up to a whole number of bytes.
TypeSize getTypeStoreSize(Type *Ty) const
Returns the maximum number of bytes that may be overwritten by storing the specified type.
Builder class for ExecutionEngines.
LLVM_ABI EngineBuilder & setMCJITMemoryManager(std::unique_ptr< RTDyldMemoryManager > mcjmm)
setMCJITMemoryManager - Sets the MCJIT memory manager to use.
LLVM_ABI EngineBuilder()
Default constructor for EngineBuilder.
LLVM_ABI EngineBuilder & setSymbolResolver(std::unique_ptr< LegacyJITSymbolResolver > SR)
LLVM_ABI ~EngineBuilder()
LLVM_ABI EngineBuilder & setMemoryManager(std::unique_ptr< MCJITMemoryManager > MM)
ExecutionEngine * create()
LLVM_ABI uint64_t RemoveMapping(StringRef Name)
Erase an entry from the mapping table.
StringMap< uint64_t > GlobalAddressMapTy
Abstract interface for implementation execution of LLVM modules, designed to support both interpreter...
void setVerifyModules(bool Verify)
Enable/Disable IR module verification.
void StoreValueToMemory(const GenericValue &Val, GenericValue *Ptr, Type *Ty)
StoreValueToMemory - Stores the data in Val of type Ty at address Ptr.
GenericValue getConstantValue(const Constant *C)
Converts a Constant* into a GenericValue, including handling of ConstantExpr values.
const DataLayout & getDataLayout() const
void * getPointerToGlobalIfAvailable(StringRef S)
getPointerToGlobalIfAvailable - This returns the address of the specified global value if it is has a...
void clearAllGlobalMappings()
clearAllGlobalMappings - Clear all global mappings and start over again, for use in dynamic compilati...
virtual void addArchive(object::OwningBinary< object::Archive > A)
addArchive - Add an Archive to the execution engine.
void InitializeMemory(const Constant *Init, void *Addr)
virtual void * getPointerToFunctionOrStub(Function *F)
getPointerToFunctionOrStub - If the specified function has been code-gen'd, return a pointer to the f...
std::string getMangledName(const GlobalValue *GV)
getMangledName - Get mangled name.
virtual bool removeModule(Module *M)
removeModule - Removes a Module from the list of modules, but does not free the module's memory.
virtual void * getPointerToFunction(Function *F)=0
getPointerToFunction - The different EE's represent function bodies in different ways.
sys::Mutex lock
lock - This lock protects the ExecutionEngine and MCJIT classes.
static ExecutionEngine *(* InterpCtor)(std::unique_ptr< Module > M, std::string *ErrorStr)
virtual void runStaticConstructorsDestructors(bool isDtors)
runStaticConstructorsDestructors - This method is used to execute all of the static constructors or d...
static ExecutionEngine *(* MCJITCtor)(std::unique_ptr< Module > M, std::string *ErrorStr, std::shared_ptr< MCJITMemoryManager > MM, std::shared_ptr< LegacyJITSymbolResolver > SR, std::unique_ptr< TargetMachine > TM)
FunctionCreator LazyFunctionCreator
LazyFunctionCreator - If an unknown function is needed, this function pointer is invoked to create it...
void addGlobalMapping(const GlobalValue *GV, void *Addr)
addGlobalMapping - Tell the execution engine that the specified global is at the specified location.
SmallVector< std::unique_ptr< Module >, 1 > Modules
The list of Modules that we are JIT'ing from.
const GlobalValue * getGlobalValueAtAddress(void *Addr)
getGlobalValueAtAddress - Return the LLVM global value object that starts at the specified address.
ExecutionEngine(DataLayout DL)
void clearGlobalMappingsFromModule(Module *M)
clearGlobalMappingsFromModule - Clear all global mappings that came from a particular module,...
void * getPointerToGlobal(const GlobalValue *GV)
getPointerToGlobal - This returns the address of the specified global value.
int runFunctionAsMain(Function *Fn, const std::vector< std::string > &argv, const char *const *envp)
runFunctionAsMain - This is a helper function which wraps runFunction to handle the common task of st...
virtual void addObjectFile(std::unique_ptr< object::ObjectFile > O)
addObjectFile - Add an ObjectFile to the execution engine.
virtual void * getOrEmitGlobalVariable(const GlobalVariable *GV)
getOrEmitGlobalVariable - Return the address of the specified global variable, possibly emitting it t...
uint64_t getAddressToGlobalIfAvailable(StringRef S)
getAddressToGlobalIfAvailable - This returns the address of the specified global symbol.
void emitGlobalVariable(const GlobalVariable *GV)
virtual GlobalVariable * FindGlobalVariableNamed(StringRef Name, bool AllowInternal=false)
FindGlobalVariableNamed - Search all of the active modules to find the global variable that defines N...
virtual GenericValue runFunction(Function *F, ArrayRef< GenericValue > ArgValues)=0
runFunction - Execute the specified function with the specified arguments, and return the result.
void emitGlobals()
EmitGlobals - Emit all of the global variables to memory, storing their addresses into GlobalAddress.
void LoadValueFromMemory(GenericValue &Result, GenericValue *Ptr, Type *Ty)
FIXME: document.
uint64_t updateGlobalMapping(const GlobalValue *GV, void *Addr)
updateGlobalMapping - Replace an existing mapping for GV with a new address.
virtual char * getMemoryForGV(const GlobalVariable *GV)
getMemoryforGV - Allocate memory for a global variable.
virtual ~ExecutionEngine()
virtual Function * FindFunctionNamed(StringRef FnName)
FindFunctionNamed - Search all of the active modules to find the function that defines FnName.
Class to represent function types.
unsigned getNumParams() const
Return the number of fixed parameters this function type requires.
Type * getParamType(unsigned i) const
Parameter type accessors.
Type * getReturnType() const
FunctionType * getFunctionType() const
Returns the FunctionType for me.
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function.
bool hasExternalLinkage() const
bool isThreadLocal() const
If the value is "Thread Local", its value isn't shared by the threads.
LLVM_ABI bool isDeclaration() const
Return true if the primary definition of this global value is outside of the current translation unit...
bool hasLocalLinkage() const
bool hasExternalWeakLinkage() const
PointerType * getType() const
Global values are always pointers.
LLVM_ABI const DataLayout & getDataLayout() const
Get the data layout of the module this global belongs to.
bool hasAppendingLinkage() const
Type * getValueType() const
const Constant * getInitializer() const
getInitializer - Return the initializer for this global variable.
This is an important class for using LLVM in a threaded context.
LLVM_ABI void getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV, bool CannotUsePrivateLabel) const
Print the appropriate prefix and the specified global variable's name.
A Module instance is used to store all the information related to an LLVM module.
static PointerType * getUnqual(LLVMContext &C)
This constructs an opaque pointer to an object in the default address space (address space zero).
static LLVM_ABI PointerType * get(LLVMContext &C, unsigned AddressSpace)
This constructs an opaque pointer to an object in a numbered address space.
Interface for looking up the initializer for a variable name, used by Init::resolveReferences.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
StringMapIterBase< uint64_t, false > iterator
Represent a constant reference to a string, i.e.
Used to lazily calculate structure layout information for a target machine, based on the DataLayout s...
TypeSize getElementOffset(unsigned Idx) const
Class to represent struct types.
@ HasZeroInit
zeroinitializer is valid for this target extension type.
Primary interface to the complete machine description for the target machine.
const Target & getTarget() const
bool hasJIT() const
hasJIT - Check if this targets supports the just-in-time compilation.
The instances of the Type class are immutable: once they are created, they are never changed.
bool isPointerTy() const
True if this is an instance of PointerType.
bool isFloatTy() const
Return true if this is 'float', a 32-bit IEEE fp type.
@ ScalableVectorTyID
Scalable SIMD vector type.
@ FloatTyID
32-bit floating point type
@ IntegerTyID
Arbitrary bit width integers.
@ FixedVectorTyID
Fixed width SIMD vector type.
@ DoubleTyID
64-bit floating point type
@ X86_FP80TyID
80-bit floating point type (X87)
@ PPC_FP128TyID
128-bit floating point type (two 64-bits, PowerPC)
@ FP128TyID
128-bit floating point type (112-bit significand)
bool isDoubleTy() const
Return true if this is 'double', a 64-bit IEEE fp type.
bool isFloatingPointTy() const
Return true if this is one of the floating-point types.
bool isIntegerTy() const
True if this is an instance of IntegerType.
TypeID getTypeID() const
Return the type id for the type.
bool isVoidTy() const
Return true if this is 'void'.
static LLVM_ABI UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
Value * getOperand(unsigned i) const
unsigned getNumOperands() const
Type * getType() const
All values are typed, get the type of this value.
LLVM_ABI StringRef getName() const
Return a constant reference to the value's name.
A raw_ostream that writes to an SmallVector or SmallString.
StringRef str() const
Return a StringRef for the vector contents.
static bool LoadLibraryPermanently(const char *Filename, std::string *ErrMsg=nullptr)
This function permanently loads the dynamic library at the given path.
static LLVM_ABI void * SearchForAddressOfSymbol(const char *symbolName)
This function will search through all previously loaded dynamic libraries for the symbol symbolName.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
constexpr bool IsLittleEndianHost
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI void StoreIntToMemory(const APInt &IntVal, uint8_t *Dst, unsigned StoreBytes)
Fills the StoreBytes bytes of memory starting from Dst with the integer held in IntVal.
RelativeUniformCounterPtr Values
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
GenericValue PTOGV(void *P)
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
constexpr uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
CodeGenOptLevel
Code generation optimization level.
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
OutputIt copy(R &&Range, OutputIt Out)
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.
void * GVTOP(const GenericValue &GV)
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
LLVM_ABI void LoadIntFromMemory(APInt &IntVal, const uint8_t *Src, unsigned LoadBytes)
Loads the integer stored in the LoadBytes bytes starting from Src into IntVal, which is assumed to be...
Implement std::hash so that hash_code can be used in STL containers.
std::vector< GenericValue > AggregateVal