//
// The LLVM Compiler Infrastructure
//
-// This file was developed by the LLVM research group and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
#include "llvm/Function.h"
#include "llvm/ExecutionEngine/ExecutionEngine.h"
#include "llvm/ExecutionEngine/GenericValue.h"
-#include "llvm/ADT/APInt.h"
-#include "llvm/Support/InstVisitor.h"
-#include "llvm/Support/CallSite.h"
#include "llvm/Target/TargetData.h"
-#include "llvm/Support/DataTypes.h"
-
+#include "llvm/Support/CallSite.h"
+#include "llvm/System/DataTypes.h"
+#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/InstVisitor.h"
+#include "llvm/Support/raw_ostream.h"
namespace llvm {
class IntrinsicLowering;
CallSite Caller; // Holds the call that called subframes.
// NULL if main func or debugger invoked fn
AllocaHolderHandle Allocas; // Track memory allocated by alloca
- std::vector<APInt*> APInts; // Track memory allocated for APInts
- APInt* getAPInt(uint32_t BitWidth) {
- APInt* Result = new APInt(BitWidth, 0);
- APInts.push_back(Result);
- return Result;
- }
- ~ExecutionContext() {
- while (!APInts.empty()) {
- delete APInts.back();
- APInts.pop_back();
- }
- }
};
// Interpreter - This class represents the entirety of the interpreter.
std::vector<Function*> AtExitHandlers;
public:
- Interpreter(Module *M);
+ explicit Interpreter(ModuleProvider *M);
~Interpreter();
/// runAtExitHandlers - Run any functions registered by the program's calls to
void visitBinaryOperator(BinaryOperator &I);
void visitICmpInst(ICmpInst &I);
void visitFCmpInst(FCmpInst &I);
- void visitAllocationInst(AllocationInst &I);
+ void visitAllocaInst(AllocaInst &I);
void visitFreeInst(FreeInst &I);
void visitLoadInst(LoadInst &I);
void visitStoreInst(StoreInst &I);
void visitGetElementPtrInst(GetElementPtrInst &I);
- void visitPHINode(PHINode &PN) { assert(0 && "PHI nodes already handled!"); }
+ void visitPHINode(PHINode &PN) {
+ llvm_unreachable("PHI nodes already handled!");
+ }
void visitTruncInst(TruncInst &I);
void visitZExtInst(ZExtInst &I);
void visitSExtInst(SExtInst &I);
void visitVAArgInst(VAArgInst &I);
void visitInstruction(Instruction &I) {
- cerr << I;
- assert(0 && "Instruction not interpretable yet!");
+ errs() << I;
+ llvm_unreachable("Instruction not interpretable yet!");
}
GenericValue callExternalFunction(Function *F,
void *getPointerToFunction(Function *F) { return (void*)F; }
- void initializeExecutionEngine();
+ void initializeExecutionEngine() { }
void initializeExternalFunctions();
GenericValue getConstantExprValue(ConstantExpr *CE, ExecutionContext &SF);
GenericValue getOperandValue(Value *V, ExecutionContext &SF);