From 93f70fc291c56287bff7aefd924d171f005fdcc7 Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Mon, 13 Apr 2009 04:26:06 +0000 Subject: Link against libffi if available, fall back to "no external calls from interpreter mode" when it's not. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68937 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp') diff --git a/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp b/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp index 36de08358a..160f1ba9f6 100644 --- a/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp +++ b/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp @@ -33,13 +33,13 @@ #include #include -#ifdef HAVE_FFI +#ifdef HAVE_FFI_CALL #ifdef HAVE_FFI_H #include +#define USE_LIBFFI #elif HAVE_FFI_FFI_H #include -#else -#error "Not sure where configure found ffi.h!" +#define USE_LIBFFI #endif #endif @@ -50,7 +50,7 @@ typedef GenericValue (*ExFunc)(const FunctionType *, static ManagedStatic > ExportedFunctions; static std::map FuncNames; -#ifdef HAVE_FFI +#ifdef USE_LIBFFI typedef void (*RawFunc)(void); static ManagedStatic > RawFunctions; #endif @@ -105,7 +105,7 @@ static ExFunc lookupFunction(const Function *F) { return FnPtr; } -#ifdef HAVE_FFI +#ifdef USE_LIBFFI static ffi_type *ffiTypeFor(const Type *Ty) { switch (Ty->getTypeID()) { case Type::VoidTyID: return &ffi_type_void; @@ -240,7 +240,7 @@ static bool ffiInvoke(RawFunc Fn, Function *F, return false; } -#endif // HAVE_FFI +#endif // USE_LIBFFI GenericValue Interpreter::callExternalFunction(Function *F, const std::vector &ArgVals) { @@ -253,7 +253,7 @@ GenericValue Interpreter::callExternalFunction(Function *F, : FI->second) return Fn(F->getFunctionType(), ArgVals); -#ifdef HAVE_FFI +#ifdef USE_LIBFFI std::map::iterator RF = RawFunctions->find(F); RawFunc RawFn; if (RF == RawFunctions->end()) { @@ -268,7 +268,7 @@ GenericValue Interpreter::callExternalFunction(Function *F, GenericValue Result; if (RawFn != 0 && ffiInvoke(RawFn, F, ArgVals, getTargetData(), Result)) return Result; -#endif // HAVE_FFI +#endif // USE_LIBFFI cerr << "Tried to execute an unknown external function: " << F->getType()->getDescription() << " " << F->getName() << "\n"; -- cgit v1.2.3-18-g5258