#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"
//
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
// 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?
//
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.
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();
};