From 60174f118de85cbcad51deb11c650f22c9be2235 Mon Sep 17 00:00:00 2001 From: dim Date: Sun, 21 Jun 2015 13:59:01 +0000 Subject: Vendor import of llvm trunk r240225: https://llvm.org/svn/llvm-project/llvm/trunk@240225 --- .../Interpreter/ExternalFunctions.cpp | 49 ++++++++-------------- 1 file changed, 18 insertions(+), 31 deletions(-) (limited to 'lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp') diff --git a/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp b/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp index e2fe065..9b44042 100644 --- a/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp +++ b/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp @@ -49,8 +49,7 @@ using namespace llvm; static ManagedStatic FunctionsLock; -typedef GenericValue (*ExFunc)(FunctionType *, - const std::vector &); +typedef GenericValue (*ExFunc)(FunctionType *, ArrayRef); static ManagedStatic > ExportedFunctions; static ManagedStatic > FuncNames; @@ -178,8 +177,7 @@ static void *ffiValueFor(Type *Ty, const GenericValue &AV, return NULL; } -static bool ffiInvoke(RawFunc Fn, Function *F, - const std::vector &ArgVals, +static bool ffiInvoke(RawFunc Fn, Function *F, ArrayRef ArgVals, const DataLayout *TD, GenericValue &Result) { ffi_cif cif; FunctionType *FTy = F->getFunctionType(); @@ -245,7 +243,7 @@ static bool ffiInvoke(RawFunc Fn, Function *F, #endif // USE_LIBFFI GenericValue Interpreter::callExternalFunction(Function *F, - const std::vector &ArgVals) { + ArrayRef ArgVals) { TheInterpreter = this; unique_lock Guard(*FunctionsLock); @@ -298,9 +296,8 @@ GenericValue Interpreter::callExternalFunction(Function *F, // // void atexit(Function*) -static -GenericValue lle_X_atexit(FunctionType *FT, - const std::vector &Args) { +static GenericValue lle_X_atexit(FunctionType *FT, + ArrayRef Args) { assert(Args.size() == 1); TheInterpreter->addAtExitHandler((Function*)GVTOP(Args[0])); GenericValue GV; @@ -309,17 +306,13 @@ GenericValue lle_X_atexit(FunctionType *FT, } // void exit(int) -static -GenericValue lle_X_exit(FunctionType *FT, - const std::vector &Args) { +static GenericValue lle_X_exit(FunctionType *FT, ArrayRef Args) { TheInterpreter->exitCalled(Args[0]); return GenericValue(); } // void abort(void) -static -GenericValue lle_X_abort(FunctionType *FT, - const std::vector &Args) { +static GenericValue lle_X_abort(FunctionType *FT, ArrayRef Args) { //FIXME: should we report or raise here? //report_fatal_error("Interpreted program raised SIGABRT"); raise (SIGABRT); @@ -328,9 +321,8 @@ GenericValue lle_X_abort(FunctionType *FT, // int sprintf(char *, const char *, ...) - a very rough implementation to make // output useful. -static -GenericValue lle_X_sprintf(FunctionType *FT, - const std::vector &Args) { +static GenericValue lle_X_sprintf(FunctionType *FT, + ArrayRef Args) { char *OutputBuffer = (char *)GVTOP(Args[0]); const char *FmtStr = (const char *)GVTOP(Args[1]); unsigned ArgNo = 2; @@ -411,9 +403,8 @@ GenericValue lle_X_sprintf(FunctionType *FT, // int printf(const char *, ...) - a very rough implementation to make output // useful. -static -GenericValue lle_X_printf(FunctionType *FT, - const std::vector &Args) { +static GenericValue lle_X_printf(FunctionType *FT, + ArrayRef Args) { char Buffer[10000]; std::vector NewArgs; NewArgs.push_back(PTOGV((void*)&Buffer[0])); @@ -424,9 +415,8 @@ GenericValue lle_X_printf(FunctionType *FT, } // int sscanf(const char *format, ...); -static -GenericValue lle_X_sscanf(FunctionType *FT, - const std::vector &args) { +static GenericValue lle_X_sscanf(FunctionType *FT, + ArrayRef args) { assert(args.size() < 10 && "Only handle up to 10 args to sscanf right now!"); char *Args[10]; @@ -440,9 +430,7 @@ GenericValue lle_X_sscanf(FunctionType *FT, } // int scanf(const char *format, ...); -static -GenericValue lle_X_scanf(FunctionType *FT, - const std::vector &args) { +static GenericValue lle_X_scanf(FunctionType *FT, ArrayRef args) { assert(args.size() < 10 && "Only handle up to 10 args to scanf right now!"); char *Args[10]; @@ -457,9 +445,8 @@ GenericValue lle_X_scanf(FunctionType *FT, // int fprintf(FILE *, const char *, ...) - a very rough implementation to make // output useful. -static -GenericValue lle_X_fprintf(FunctionType *FT, - const std::vector &Args) { +static GenericValue lle_X_fprintf(FunctionType *FT, + ArrayRef Args) { assert(Args.size() >= 2); char Buffer[10000]; std::vector NewArgs; @@ -472,7 +459,7 @@ GenericValue lle_X_fprintf(FunctionType *FT, } static GenericValue lle_X_memset(FunctionType *FT, - const std::vector &Args) { + ArrayRef Args) { int val = (int)Args[1].IntVal.getSExtValue(); size_t len = (size_t)Args[2].IntVal.getZExtValue(); memset((void *)GVTOP(Args[0]), val, len); @@ -484,7 +471,7 @@ static GenericValue lle_X_memset(FunctionType *FT, } static GenericValue lle_X_memcpy(FunctionType *FT, - const std::vector &Args) { + ArrayRef Args) { memcpy(GVTOP(Args[0]), GVTOP(Args[1]), (size_t)(Args[2].IntVal.getLimitedValue())); -- cgit v1.1