aboutsummaryrefslogtreecommitdiff
path: root/lib/ExecutionEngine/JIT/JIT.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-08-16 01:07:04 +0000
committerChris Lattner <sabre@nondot.org>2004-08-16 01:07:04 +0000
commit174f2264649d9ae062bdb0a038131c2836596be5 (patch)
treebafcaee2e75d14ed8659faaa3530cc282d28ed45 /lib/ExecutionEngine/JIT/JIT.cpp
parentf24d09933c0fa2dae141426f2c38c8925693c73f (diff)
Add a special case for argc,argv
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15802 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/JIT/JIT.cpp')
-rw-r--r--lib/ExecutionEngine/JIT/JIT.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/ExecutionEngine/JIT/JIT.cpp b/lib/ExecutionEngine/JIT/JIT.cpp
index d185e00d87..675ef479d1 100644
--- a/lib/ExecutionEngine/JIT/JIT.cpp
+++ b/lib/ExecutionEngine/JIT/JIT.cpp
@@ -77,8 +77,7 @@ GenericValue JIT::runFunction(Function *F,
if (RetTy == Type::IntTy || RetTy == Type::UIntTy || RetTy == Type::VoidTy) {
switch (ArgValues.size()) {
case 3:
- if (FTy->getNumParams() == 3 &&
- (FTy->getParamType(0) == Type::IntTy ||
+ if ((FTy->getParamType(0) == Type::IntTy ||
FTy->getParamType(0) == Type::UIntTy) &&
isa<PointerType>(FTy->getParamType(1)) &&
isa<PointerType>(FTy->getParamType(2))) {
@@ -92,6 +91,18 @@ GenericValue JIT::runFunction(Function *F,
return rv;
}
break;
+ case 2:
+ if ((FTy->getParamType(0) == Type::IntTy ||
+ FTy->getParamType(0) == Type::UIntTy) &&
+ isa<PointerType>(FTy->getParamType(1))) {
+ int (*PF)(int, char **) = (int(*)(int, char **))FPtr;
+
+ // Call the function.
+ GenericValue rv;
+ rv.IntVal = PF(ArgValues[0].IntVal, (char **)GVTOP(ArgValues[1]));
+ return rv;
+ }
+ break;
case 1:
if (FTy->getNumParams() == 1 &&
(FTy->getParamType(0) == Type::IntTy ||