Interpreter cleanups:
[oota-llvm.git] / lib / ExecutionEngine / Interpreter / Interpreter.h
index 50765810abf4fedffc0e4d1a141bca569c23de92..47f5c95f152e3630aef46775cbf6155e7c95b884 100644 (file)
@@ -7,9 +7,6 @@
 #ifndef LLI_INTERPRETER_H
 #define LLI_INTERPRETER_H
 
-// Uncomment this line to enable profiling of structure field accesses.
-//#define PROFILE_STRUCTURE_FIELDS 1
-
 #include "../ExecutionEngine.h"
 #include "../GenericValue.h"
 #include "Support/DataTypes.h"
@@ -74,7 +71,6 @@ struct ExecutionContext {
 //
 class Interpreter : public ExecutionEngine, public InstVisitor<Interpreter> {
   int ExitCode;                // The exit code to be returned by the lli util
-  bool Debug;                  // Debug mode enabled?
   bool Profile;                // Profiling enabled?
   bool Trace;                  // Tracing enabled?
   int CurFrame;                // The current stack frame being inspected
@@ -87,17 +83,24 @@ class Interpreter : public ExecutionEngine, public InstVisitor<Interpreter> {
   // AtExitHandlers - List of functions to call when the program exits.
   std::vector<Function*> AtExitHandlers;
 public:
-  Interpreter(Module *M, unsigned Config, bool DebugMode, bool TraceMode);
+  Interpreter(Module *M, bool isLittleEndian, bool isLongPointer,
+              bool TraceMode);
   inline ~Interpreter() { CW.setModule(0); }
 
-  // getExitCode - return the code that should be the exit code for the lli
-  // utility.
+  /// create - Create an interpreter ExecutionEngine. This can never fail.
+  ///
+  static ExecutionEngine *create(Module *M, bool TraceMode);
+
+  /// getExitCode - return the code that should be the exit code for the lli
+  /// utility.
+  ///
   inline int getExitCode() const { return ExitCode; }
 
   /// run - Start execution with the specified function and arguments.
   ///
   virtual int run(const std::string &FnName,
-                 const std::vector<std::string> &Args);
+                 const std::vector<std::string> &Args,
+                  const char ** envp);
  
 
   // enableProfiling() - Turn profiling on, clear stats?
@@ -182,7 +185,7 @@ private:  // Helper functions
   // 
   void SwitchToNewBasicBlock(BasicBlock *Dest, ExecutionContext &SF);
 
-  void *getPointerToFunction(const Function *F) { return (void*)F; }
+  void *getPointerToFunction(Function *F) { return (void*)F; }
 
   // getCurrentExecutablePath() - Return the directory that the lli executable
   // lives in.
@@ -213,10 +216,6 @@ private:  // Helper functions
   Value *ChooseOneOption(const std::string &Name,
                          const std::vector<Value*> &Opts);
 
-  // PerformExitStuff - Print out counters and profiling information if
-  // applicable...
-  void PerformExitStuff();
-
   void initializeExecutionEngine();
   void initializeExternalFunctions();
 };