diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2004-10-27 23:03:44 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2004-10-27 23:03:44 +0000 |
commit | abec8f96e3e35fbb306c957674809c4ace04a620 (patch) | |
tree | 73a294a25458cd5c975ea83c7ab1fe5cf8dea050 /lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp | |
parent | 0b8d2f9706743418cf97ff3837465de77fa8d781 (diff) |
Changes to support rand48 tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17284 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp')
-rw-r--r-- | lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp b/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp index def406a4b7..2f3469ca85 100644 --- a/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp +++ b/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp @@ -213,6 +213,8 @@ GenericValue lle_X_floor(FunctionType *M, const vector<GenericValue> &Args) { return GV; } +#ifdef HAVE_RAND48 + // double drand48() GenericValue lle_X_drand48(FunctionType *M, const vector<GenericValue> &Args) { assert(Args.size() == 0); @@ -236,6 +238,16 @@ GenericValue lle_X_srand48(FunctionType *M, const vector<GenericValue> &Args) { return GenericValue(); } +#endif + +// int rand() +GenericValue lle_X_rand(FunctionType *M, const vector<GenericValue> &Args) { + assert(Args.size() == 0); + GenericValue GV; + GV.IntVal = rand(); + return GV; +} + // void srand(uint) GenericValue lle_X_srand(FunctionType *M, const vector<GenericValue> &Args) { assert(Args.size() == 1); @@ -676,9 +688,12 @@ void Interpreter::initializeExternalFunctions() { FuncNames["lle_X_log"] = lle_X_log; FuncNames["lle_X_floor"] = lle_X_floor; FuncNames["lle_X_srand"] = lle_X_srand; + FuncNames["lle_X_rand"] = lle_X_rand; +#ifdef HAVE_RAND48 FuncNames["lle_X_drand48"] = lle_X_drand48; FuncNames["lle_X_srand48"] = lle_X_srand48; FuncNames["lle_X_lrand48"] = lle_X_lrand48; +#endif FuncNames["lle_X_sqrt"] = lle_X_sqrt; FuncNames["lle_X_puts"] = lle_X_puts; FuncNames["lle_X_printf"] = lle_X_printf; |