summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2010-01-05 13:12:22 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2010-01-05 13:12:22 +0000
commitccce8bae14a8539e7c9e8d694e2126dd30dc774f (patch)
tree56fd200381c4089dabdb97ce70eb595db1ae7bd4 /llvm/lib/ExecutionEngine
parentf22afe32f905c0b229d6e55e913e8584249747f3 (diff)
downloadbcm5719-llvm-ccce8bae14a8539e7c9e8d694e2126dd30dc774f.tar.gz
bcm5719-llvm-ccce8bae14a8539e7c9e8d694e2126dd30dc774f.zip
Avoid going through the LLVMContext for type equality where it's safe to dereference the type pointer.
llvm-svn: 92726
Diffstat (limited to 'llvm/lib/ExecutionEngine')
-rw-r--r--llvm/lib/ExecutionEngine/ExecutionEngine.cpp6
-rw-r--r--llvm/lib/ExecutionEngine/Interpreter/Execution.cpp2
-rw-r--r--llvm/lib/ExecutionEngine/JIT/JIT.cpp5
3 files changed, 5 insertions, 8 deletions
diff --git a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
index 6a154cc3783..35e69229e74 100644
--- a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
+++ b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
@@ -343,9 +343,7 @@ int ExecutionEngine::runFunctionAsMain(Function *Fn,
// Check main() type
unsigned NumArgs = Fn->getFunctionType()->getNumParams();
const FunctionType *FTy = Fn->getFunctionType();
- const Type* PPInt8Ty =
- PointerType::getUnqual(PointerType::getUnqual(
- Type::getInt8Ty(Fn->getContext())));
+ const Type* PPInt8Ty = Type::getInt8PtrTy(Fn->getContext())->getPointerTo();
switch (NumArgs) {
case 3:
if (FTy->getParamType(2) != PPInt8Ty) {
@@ -364,7 +362,7 @@ int ExecutionEngine::runFunctionAsMain(Function *Fn,
// FALLS THROUGH
case 0:
if (!isa<IntegerType>(FTy->getReturnType()) &&
- FTy->getReturnType() != Type::getVoidTy(FTy->getContext())) {
+ !FTy->getReturnType()->isVoidTy()) {
llvm_report_error("Invalid return type of main() supplied");
}
break;
diff --git a/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp b/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
index a26fc36c09c..73f55588862 100644
--- a/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
+++ b/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
@@ -602,7 +602,7 @@ void Interpreter::popStackAndReturnValueToCaller(const Type *RetTy,
ExecutionContext &CallingSF = ECStack.back();
if (Instruction *I = CallingSF.Caller.getInstruction()) {
// Save result...
- if (CallingSF.Caller.getType() != Type::getVoidTy(RetTy->getContext()))
+ if (!CallingSF.Caller.getType()->isVoidTy())
SetValue(I, Result, CallingSF);
if (InvokeInst *II = dyn_cast<InvokeInst> (I))
SwitchToNewBasicBlock (II->getNormalDest (), CallingSF);
diff --git a/llvm/lib/ExecutionEngine/JIT/JIT.cpp b/llvm/lib/ExecutionEngine/JIT/JIT.cpp
index ebc25677438..3eafe5f0f29 100644
--- a/llvm/lib/ExecutionEngine/JIT/JIT.cpp
+++ b/llvm/lib/ExecutionEngine/JIT/JIT.cpp
@@ -411,8 +411,7 @@ GenericValue JIT::runFunction(Function *F,
// Handle some common cases first. These cases correspond to common `main'
// prototypes.
- if (RetTy == Type::getInt32Ty(F->getContext()) ||
- RetTy == Type::getVoidTy(F->getContext())) {
+ if (RetTy == Type::getInt32Ty(F->getContext()) || RetTy->isVoidTy()) {
switch (ArgValues.size()) {
case 3:
if (FTy->getParamType(0) == Type::getInt32Ty(F->getContext()) &&
@@ -548,7 +547,7 @@ GenericValue JIT::runFunction(Function *F,
"", StubBB);
TheCall->setCallingConv(F->getCallingConv());
TheCall->setTailCall();
- if (TheCall->getType() != Type::getVoidTy(F->getContext()))
+ if (!TheCall->getType()->isVoidTy())
// Return result of the call.
ReturnInst::Create(F->getContext(), TheCall, StubBB);
else
OpenPOWER on IntegriCloud