llvm-6502/lib/ExecutionEngine/JIT/JIT.h
Brian Gaeke 70975eef57 Make CreateArgv part of lli rather than part of ExecutionEngine.
Switch Interpreter and JIT's "run" methods to take a Function and a vector of
 GenericValues.
Move (almost all of) the stuff that constructs a canonical call to main()
 into lli (new methods "callAsMain", "makeStringVector").
Nuke getCurrentExecutablePath(), enableTracing(), getCurrentFunction(),
 isStopped(), and many dead decls from interpreter.
Add linux strdup() support to interpreter.
Make interpreter's atexit handler runner and JIT's runAtExitHandlers() look
 more alike, in preparation for refactoring.
atexit() is spelled "atexit", not "at_exit".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8366 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-05 18:42:01 +00:00

65 lines
1.9 KiB
C++

//===-- VM.h - Definitions for Virtual Machine ------------------*- C++ -*-===//
//
// This file defines the top-level Virtual Machine data structure.
//
//===----------------------------------------------------------------------===//
#ifndef VM_H
#define VM_H
#include "../ExecutionEngine.h"
#include "llvm/PassManager.h"
#include <map>
class Function;
class GlobalValue;
class Constant;
class TargetMachine;
class MachineCodeEmitter;
class VM : public ExecutionEngine {
TargetMachine &TM; // The current target we are compiling to
FunctionPassManager PM; // Passes to compile a function
MachineCodeEmitter *MCE; // MCE object
public:
VM(Module *M, TargetMachine *tm);
~VM();
/// create - Create an return a new JIT compiler if there is one available
/// for the current target. Otherwise, return null.
///
static ExecutionEngine *create(Module *M);
/// run - Start execution with the specified function and arguments.
///
virtual GenericValue run(Function *F,
const std::vector<GenericValue> &ArgValues);
/// getPointerToNamedFunction - This method returns the address of the
/// specified function by using the dlsym function call. As such it is only
/// useful for resolving library symbols, not code generated symbols.
///
void *getPointerToNamedFunction(const std::string &Name);
// CompilationCallback - Invoked the first time that a call site is found,
// which causes lazy compilation of the target function.
//
static void CompilationCallback();
/// runAtExitHandlers - Before exiting the program, at_exit functions must be
/// called. This method calls them.
///
static void runAtExitHandlers();
/// getPointerToFunction - This returns the address of the specified function,
/// compiling it if necessary.
void *getPointerToFunction(Function *F);
private:
static MachineCodeEmitter *createEmitter(VM &V);
void setupPassManager();
};
#endif