Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
LLVMJIT Namespace Reference

Classes

struct  JITModuleBase
 

Typedefs

typedef void(* InvokeFunctionPointer) (void *, U64 *)
 

Functions

llvm::Type * asLLVMType (ValueType type)
 
llvm::Type * asLLVMType (ResultType type)
 
llvm::FunctionType * asLLVMType (const FunctionType *functionType)
 
llvm::ConstantInt * emitLiteral (U32 value)
 
llvm::ConstantInt * emitLiteral (I32 value)
 
llvm::ConstantInt * emitLiteral (U64 value)
 
llvm::ConstantInt * emitLiteral (I64 value)
 
llvm::Constant * emitLiteral (F32 value)
 
llvm::Constant * emitLiteral (F64 value)
 
llvm::Constant * emitLiteral (bool value)
 
llvm::Constant * emitLiteralPointer (const void *pointer, llvm::Type *type)
 
std::string getExternalFunctionName (ModuleInstance *moduleInstance, Uptr functionDefIndex)
 
bool getFunctionIndexFromExternalName (const char *externalName, Uptr &outFunctionDefIndex)
 
llvm::Module * emitModule (const IR::Module &module, ModuleInstance *moduleInstance)
 
void init ()
 
void instantiateModule (const IR::Module &module, Runtime::ModuleInstance *moduleInstance)
 
bool describeInstructionPointer (Uptr ip, std::string &outDescription)
 
InvokeFunctionPointer getInvokeThunk (const IR::FunctionType *functionType)
 

Variables

llvm::LLVMContext context
 
llvm::Type * llvmResultTypes [(Uptr) ResultType::num]
 
llvm::Type * llvmI8Type
 
llvm::Type * llvmI16Type
 
llvm::Type * llvmI32Type
 
llvm::Type * llvmI64Type
 
llvm::Type * llvmF32Type
 
llvm::Type * llvmF64Type
 
llvm::Type * llvmVoidType
 
llvm::Type * llvmBoolType
 
llvm::Type * llvmI8PtrType
 
llvm::Constant * typedZeroConstants [(Uptr) ValueType::num]
 

Typedef Documentation

◆ InvokeFunctionPointer

typedef void(* LLVMJIT::InvokeFunctionPointer) (void *, U64 *)

Definition at line 26 of file RuntimePrivate.h.

Function Documentation

◆ asLLVMType() [1/3]

llvm::FunctionType * LLVMJIT::asLLVMType ( const FunctionType * functionType)
inline

Definition at line 76 of file LLVMJIT.h.

77 {
78 auto llvmArgTypes = (llvm::Type**)alloca(sizeof(llvm::Type*) * functionType->parameters.size());
79 for(Uptr argIndex = 0;argIndex < functionType->parameters.size();++argIndex)
80 {
81 llvmArgTypes[argIndex] = asLLVMType(functionType->parameters[argIndex]);
82 }
83 auto llvmResultType = asLLVMType(functionType->ret);
84 return llvm::FunctionType::get(llvmResultType,llvm::ArrayRef<llvm::Type*>(llvmArgTypes,functionType->parameters.size()),false);
85 }
PointerIntHelper< sizeof(size_t)>::UnsignedIntType Uptr
Definition BasicTypes.h:22
ResultType ret
Definition Types.h:195
std::vector< ValueType > parameters
Definition Types.h:196
Here is the call graph for this function:

◆ asLLVMType() [2/3]

llvm::Type * LLVMJIT::asLLVMType ( ResultType type)
inline

Definition at line 73 of file LLVMJIT.h.

73{ return llvmResultTypes[(Uptr)type]; }

◆ asLLVMType() [3/3]

llvm::Type * LLVMJIT::asLLVMType ( ValueType type)
inline

Definition at line 72 of file LLVMJIT.h.

72{ return llvmResultTypes[(Uptr)asResultType(type)]; }
ResultType asResultType(ValueType type)
Definition Types.h:186
Here is the call graph for this function:
Here is the caller graph for this function:

◆ describeInstructionPointer()

bool LLVMJIT::describeInstructionPointer ( Uptr ip,
std::string & outDescription )

◆ emitLiteral() [1/7]

llvm::Constant * LLVMJIT::emitLiteral ( bool value)
inline

Definition at line 94 of file LLVMJIT.h.

94{ return llvm::ConstantInt::get(llvmBoolType,llvm::APInt(1,value ? 1 : 0,false)); }
#define value
Definition pkcs11.h:157

◆ emitLiteral() [2/7]

llvm::Constant * LLVMJIT::emitLiteral ( F32 value)
inline

Definition at line 92 of file LLVMJIT.h.

92{ return llvm::ConstantFP::get(context,llvm::APFloat(value)); }

◆ emitLiteral() [3/7]

llvm::Constant * LLVMJIT::emitLiteral ( F64 value)
inline

Definition at line 93 of file LLVMJIT.h.

93{ return llvm::ConstantFP::get(context,llvm::APFloat(value)); }

◆ emitLiteral() [4/7]

llvm::ConstantInt * LLVMJIT::emitLiteral ( I32 value)
inline

Definition at line 89 of file LLVMJIT.h.

89{ return (llvm::ConstantInt*)llvm::ConstantInt::get(llvmI32Type,llvm::APInt(32,(I64)value,false)); }
int64_t I64
Definition BasicTypes.h:12

◆ emitLiteral() [5/7]

llvm::ConstantInt * LLVMJIT::emitLiteral ( I64 value)
inline

Definition at line 91 of file LLVMJIT.h.

91{ return (llvm::ConstantInt*)llvm::ConstantInt::get(llvmI64Type,llvm::APInt(64,value,false)); }

◆ emitLiteral() [6/7]

llvm::ConstantInt * LLVMJIT::emitLiteral ( U32 value)
inline

Definition at line 88 of file LLVMJIT.h.

88{ return (llvm::ConstantInt*)llvm::ConstantInt::get(llvmI32Type,llvm::APInt(32,(U64)value,false)); }
uint64_t U64
Definition BasicTypes.h:11

◆ emitLiteral() [7/7]

llvm::ConstantInt * LLVMJIT::emitLiteral ( U64 value)
inline

Definition at line 90 of file LLVMJIT.h.

90{ return (llvm::ConstantInt*)llvm::ConstantInt::get(llvmI64Type,llvm::APInt(64,value,false)); }

◆ emitLiteralPointer()

llvm::Constant * LLVMJIT::emitLiteralPointer ( const void * pointer,
llvm::Type * type )
inline

Definition at line 95 of file LLVMJIT.h.

96 {
97 auto pointerInt = llvm::APInt(sizeof(Uptr) == 8 ? 64 : 32,reinterpret_cast<Uptr>(pointer));
98 return llvm::Constant::getIntegerValue(type,pointerInt);
99 }
const GenericPointer< typename T::ValueType > & pointer
Definition pointer.h:1181

◆ emitModule()

llvm::Module * LLVMJIT::emitModule ( const IR::Module & module,
ModuleInstance * moduleInstance )

◆ getExternalFunctionName()

std::string LLVMJIT::getExternalFunctionName ( ModuleInstance * moduleInstance,
Uptr functionDefIndex )

◆ getFunctionIndexFromExternalName()

bool LLVMJIT::getFunctionIndexFromExternalName ( const char * externalName,
Uptr & outFunctionDefIndex )

◆ getInvokeThunk()

InvokeFunctionPointer LLVMJIT::getInvokeThunk ( const IR::FunctionType * functionType)

◆ init()

void LLVMJIT::init ( )

◆ instantiateModule()

void LLVMJIT::instantiateModule ( const IR::Module & module,
Runtime::ModuleInstance * moduleInstance )

Variable Documentation

◆ context

llvm::LLVMContext LLVMJIT::context
extern

◆ llvmBoolType

llvm::Type* LLVMJIT::llvmBoolType
extern

◆ llvmF32Type

llvm::Type* LLVMJIT::llvmF32Type
extern

◆ llvmF64Type

llvm::Type* LLVMJIT::llvmF64Type
extern

◆ llvmI16Type

llvm::Type* LLVMJIT::llvmI16Type
extern

◆ llvmI32Type

llvm::Type* LLVMJIT::llvmI32Type
extern

◆ llvmI64Type

llvm::Type* LLVMJIT::llvmI64Type
extern

◆ llvmI8PtrType

llvm::Type* LLVMJIT::llvmI8PtrType
extern

◆ llvmI8Type

llvm::Type* LLVMJIT::llvmI8Type
extern

◆ llvmResultTypes

llvm::Type* LLVMJIT::llvmResultTypes[(Uptr) ResultType::num]
extern

◆ llvmVoidType

llvm::Type* LLVMJIT::llvmVoidType
extern

◆ typedZeroConstants

llvm::Constant* LLVMJIT::typedZeroConstants[(Uptr) ValueType::num]
extern