15 static struct RegisterJIT {
29 assert(F &&
"Function *F was null at entry to run()");
31 void *FPtr = getPointerToFunction(F);
32 assert(FPtr &&
"Pointer to fn's code was null after getPointerToFunction");
38 "Wrong number of arguments passed into function!");
40 "This doesn't support passing arguments through varargs (yet)!");
45 switch (ArgValues.
size()) {
50 int (*PF)(int,
char **,
const char **) =
51 (
int (*)(int,
char **,
const char **))(
intptr_t)FPtr;
56 (
char **)
GVTOP(ArgValues[1]),
57 (
const char **)
GVTOP(ArgValues[2])));
64 int (*PF)(int,
char **) = (
int (*)(int,
char **))(
intptr_t)FPtr;
69 (
char **)
GVTOP(ArgValues[1])));
76 int (*PF)(int) = (
int (*)(int))(
intptr_t)FPtr;
85 if (ArgValues.
empty()) {
90 case Type::IntegerTyID: {
91 unsigned BitWidth = cast<IntegerType>(RetTy)->
getBitWidth();
94 else if (BitWidth <= 8)
96 else if (BitWidth <= 16)
98 else if (BitWidth <= 32)
100 else if (BitWidth <= 64)
115 case Type::X86_FP80TyID:
116 case Type::FP128TyID:
117 case Type::PPC_FP128TyID:
119 case Type::PointerTyID:
127 void OrcMCJITReplacement::runStaticConstructorsDestructors(
bool isDtors) {
128 auto &CtorDtorsMap = isDtors ? UnexecutedDestructors : UnexecutedConstructors;
130 for (
auto &KV : CtorDtorsMap)
134 CtorDtorsMap.clear();
static unsigned getBitWidth(Type *Ty, const DataLayout &DL)
Returns the bitwidth of the given scalar or pointer type.
void cantFail(Error Err, const char *Msg=nullptr)
Report a fatal error if Err is a failure value.
This class represents lattice values for constants.
Type * getParamType(unsigned i) const
Parameter type accessors.
Convenience class for recording constructor/destructor names for later execution. ...
TypeID getTypeID() const
Return the type id for the type.
bool isIntegerTy() const
True if this is an instance of IntegerType.
Class to represent function types.
const Type::TypeID FloatTyID
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
bool isVoidTy() const
Return true if this is 'void'.
The instances of the Type class are immutable: once they are created, they are never changed...
void LLVMLinkInOrcMCJITReplacement()
size_t size() const
size - Get the array size.
bool isPointerTy() const
True if this is an instance of PointerType.
unsigned getNumParams() const
Return the number of fixed parameters this function type requires.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
void * GVTOP(const GenericValue &GV)
Type * getReturnType() const
FunctionType * getFunctionType() const
Returns the FunctionType for me.
GenericValue PTOGV(void *P)
Class for arbitrary precision integers.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
const Type::TypeID DoubleTyID
Error runViaLayer(JITLayerT &JITLayer) const
Run the recorded constructors/destructors through the given JIT layer.
bool empty() const
empty - Check if the array is empty.