summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNuno Lopes <nunoplopes@sapo.pt>2012-08-02 12:09:32 +0000
committerNuno Lopes <nunoplopes@sapo.pt>2012-08-02 12:09:32 +0000
commit79a4424f8e6ad609f27c1c39eeab67de57f34ef5 (patch)
treea61bcd2ae7b782ed1755cb268730c4d9e88ccc28
parent2e62a9a76506a89162614db786c15507f033d2c0 (diff)
downloadbcm5719-llvm-79a4424f8e6ad609f27c1c39eeab67de57f34ef5.tar.gz
bcm5719-llvm-79a4424f8e6ad609f27c1c39eeab67de57f34ef5.zip
JIT::runFunction(): add a fast path for functions with a single argument that is a pointer.
llvm-svn: 161171
-rw-r--r--llvm/lib/ExecutionEngine/JIT/JIT.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/ExecutionEngine/JIT/JIT.cpp b/llvm/lib/ExecutionEngine/JIT/JIT.cpp
index a54ee3b87bc..97995ad95c8 100644
--- a/llvm/lib/ExecutionEngine/JIT/JIT.cpp
+++ b/llvm/lib/ExecutionEngine/JIT/JIT.cpp
@@ -433,13 +433,18 @@ GenericValue JIT::runFunction(Function *F,
}
break;
case 1:
- if (FTy->getNumParams() == 1 &&
- FTy->getParamType(0)->isIntegerTy(32)) {
+ if (FTy->getParamType(0)->isIntegerTy(32)) {
GenericValue rv;
int (*PF)(int) = (int(*)(int))(intptr_t)FPtr;
rv.IntVal = APInt(32, PF(ArgValues[0].IntVal.getZExtValue()));
return rv;
}
+ if (FTy->getParamType(0)->isPointerTy()) {
+ GenericValue rv;
+ int (*PF)(char *) = (int(*)(char *))(intptr_t)FPtr;
+ rv.IntVal = APInt(32, PF((char*)GVTOP(ArgValues[0])));
+ return rv;
+ }
break;
}
}
OpenPOWER on IntegriCloud