From 557b3561311fa5436f9acefd32ebb1ca4ac03df8 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 15 Aug 2004 23:31:43 +0000 Subject: [PATCH] Handle zero arg function case llvm-svn: 15794 --- lib/ExecutionEngine/JIT/JIT.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ExecutionEngine/JIT/JIT.cpp b/lib/ExecutionEngine/JIT/JIT.cpp index 87331fb3015..586936f21c7 100644 --- a/lib/ExecutionEngine/JIT/JIT.cpp +++ b/lib/ExecutionEngine/JIT/JIT.cpp @@ -62,7 +62,7 @@ GenericValue JIT::runFunction(Function *F, GenericValue rv; void *FPtr = getPointerToFunction(F); - assert(PFtr && "Pointer to fn's code was null after getPointerToFunction"); + assert(FPtr && "Pointer to fn's code was null after getPointerToFunction"); if (ArgValues.size() == 3) { int (*PF)(int, char **, const char **) = @@ -76,6 +76,10 @@ GenericValue JIT::runFunction(Function *F, int (*PF)(int) = (int(*)(int))FPtr; rv.IntVal = PF(ArgValues[0].IntVal); return rv; + } else if (ArgValues.size() == 0) { + int (*PF)() = (int(*)())FPtr; + rv.IntVal = PF(); + return rv; } // FIXME: This code should handle a couple of common cases efficiently, but