summaryrefslogtreecommitdiffstats
path: root/lib/ExecutionEngine/Interpreter
diff options
context:
space:
mode:
authorrdivacky <rdivacky@FreeBSD.org>2009-11-04 14:58:56 +0000
committerrdivacky <rdivacky@FreeBSD.org>2009-11-04 14:58:56 +0000
commit7ff99155c39edd73ebf1c6adfa023b1048fee9a4 (patch)
treeb4dc751bcee540346911aa4115729eff2f991657 /lib/ExecutionEngine/Interpreter
parentd1f06de484602e72707476a6152974847bac1570 (diff)
downloadFreeBSD-src-7ff99155c39edd73ebf1c6adfa023b1048fee9a4.zip
FreeBSD-src-7ff99155c39edd73ebf1c6adfa023b1048fee9a4.tar.gz
Update LLVM to r86025.
Diffstat (limited to 'lib/ExecutionEngine/Interpreter')
-rw-r--r--lib/ExecutionEngine/Interpreter/Execution.cpp41
-rw-r--r--lib/ExecutionEngine/Interpreter/Interpreter.h7
2 files changed, 24 insertions, 24 deletions
diff --git a/lib/ExecutionEngine/Interpreter/Execution.cpp b/lib/ExecutionEngine/Interpreter/Execution.cpp
index f8c775e..01bd2c7 100644
--- a/lib/ExecutionEngine/Interpreter/Execution.cpp
+++ b/lib/ExecutionEngine/Interpreter/Execution.cpp
@@ -572,9 +572,9 @@ void Interpreter::exitCalled(GenericValue GV) {
// runAtExitHandlers() assumes there are no stack frames, but
// if exit() was called, then it had a stack frame. Blow away
// the stack before interpreting atexit handlers.
- ECStack.clear ();
- runAtExitHandlers ();
- exit (GV.IntVal.zextOrTrunc(32).getZExtValue());
+ ECStack.clear();
+ runAtExitHandlers();
+ exit(GV.IntVal.zextOrTrunc(32).getZExtValue());
}
/// Pop the last stack frame off of ECStack and then copy the result
@@ -585,8 +585,8 @@ void Interpreter::exitCalled(GenericValue GV) {
/// care of switching to the normal destination BB, if we are returning
/// from an invoke.
///
-void Interpreter::popStackAndReturnValueToCaller (const Type *RetTy,
- GenericValue Result) {
+void Interpreter::popStackAndReturnValueToCaller(const Type *RetTy,
+ GenericValue Result) {
// Pop the current stack frame.
ECStack.pop_back();
@@ -629,15 +629,15 @@ void Interpreter::visitUnwindInst(UnwindInst &I) {
// Unwind stack
Instruction *Inst;
do {
- ECStack.pop_back ();
- if (ECStack.empty ())
+ ECStack.pop_back();
+ if (ECStack.empty())
llvm_report_error("Empty stack during unwind!");
- Inst = ECStack.back ().Caller.getInstruction ();
- } while (!(Inst && isa<InvokeInst> (Inst)));
+ Inst = ECStack.back().Caller.getInstruction();
+ } while (!(Inst && isa<InvokeInst>(Inst)));
// Return from invoke
- ExecutionContext &InvokingSF = ECStack.back ();
- InvokingSF.Caller = CallSite ();
+ ExecutionContext &InvokingSF = ECStack.back();
+ InvokingSF.Caller = CallSite();
// Go to exceptional destination BB of invoke instruction
SwitchToNewBasicBlock(cast<InvokeInst>(Inst)->getUnwindDest(), InvokingSF);
@@ -678,6 +678,13 @@ void Interpreter::visitSwitchInst(SwitchInst &I) {
SwitchToNewBasicBlock(Dest, SF);
}
+void Interpreter::visitIndirectBrInst(IndirectBrInst &I) {
+ ExecutionContext &SF = ECStack.back();
+ void *Dest = GVTOP(getOperandValue(I.getAddress(), SF));
+ SwitchToNewBasicBlock((BasicBlock*)Dest, SF);
+}
+
+
// SwitchToNewBasicBlock - This method is used to jump to a new basic block.
// This function handles the actual updating of block and instruction iterators
// as well as execution of all of the PHI nodes in the destination block.
@@ -720,7 +727,7 @@ void Interpreter::SwitchToNewBasicBlock(BasicBlock *Dest, ExecutionContext &SF){
// Memory Instruction Implementations
//===----------------------------------------------------------------------===//
-void Interpreter::visitAllocationInst(AllocationInst &I) {
+void Interpreter::visitAllocaInst(AllocaInst &I) {
ExecutionContext &SF = ECStack.back();
const Type *Ty = I.getType()->getElementType(); // Type to be allocated
@@ -749,14 +756,6 @@ void Interpreter::visitAllocationInst(AllocationInst &I) {
ECStack.back().Allocas.add(Memory);
}
-void Interpreter::visitFreeInst(FreeInst &I) {
- ExecutionContext &SF = ECStack.back();
- assert(isa<PointerType>(I.getOperand(0)->getType()) && "Freeing nonptr?");
- GenericValue Value = getOperandValue(I.getOperand(0), SF);
- // TODO: Check to make sure memory is allocated
- free(GVTOP(Value)); // Free memory
-}
-
// getElementOffset - The workhorse for getelementptr.
//
GenericValue Interpreter::executeGEPOperation(Value *Ptr, gep_type_iterator I,
@@ -835,7 +834,7 @@ void Interpreter::visitCallSite(CallSite CS) {
// Check to see if this is an intrinsic function call...
Function *F = CS.getCalledFunction();
- if (F && F->isDeclaration ())
+ if (F && F->isDeclaration())
switch (F->getIntrinsicID()) {
case Intrinsic::not_intrinsic:
break;
diff --git a/lib/ExecutionEngine/Interpreter/Interpreter.h b/lib/ExecutionEngine/Interpreter/Interpreter.h
index e026287..038830c 100644
--- a/lib/ExecutionEngine/Interpreter/Interpreter.h
+++ b/lib/ExecutionEngine/Interpreter/Interpreter.h
@@ -19,7 +19,7 @@
#include "llvm/ExecutionEngine/GenericValue.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Support/CallSite.h"
-#include "llvm/Support/DataTypes.h"
+#include "llvm/System/DataTypes.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/InstVisitor.h"
#include "llvm/Support/raw_ostream.h"
@@ -135,12 +135,12 @@ public:
void visitReturnInst(ReturnInst &I);
void visitBranchInst(BranchInst &I);
void visitSwitchInst(SwitchInst &I);
+ void visitIndirectBrInst(IndirectBrInst &I);
void visitBinaryOperator(BinaryOperator &I);
void visitICmpInst(ICmpInst &I);
void visitFCmpInst(FCmpInst &I);
- void visitAllocationInst(AllocationInst &I);
- void visitFreeInst(FreeInst &I);
+ void visitAllocaInst(AllocaInst &I);
void visitLoadInst(LoadInst &I);
void visitStoreInst(StoreInst &I);
void visitGetElementPtrInst(GetElementPtrInst &I);
@@ -203,6 +203,7 @@ private: // Helper functions
void SwitchToNewBasicBlock(BasicBlock *Dest, ExecutionContext &SF);
void *getPointerToFunction(Function *F) { return (void*)F; }
+ void *getPointerToBasicBlock(BasicBlock *BB) { return (void*)BB; }
void initializeExecutionEngine() { }
void initializeExternalFunctions();
OpenPOWER on IntegriCloud