Deleted Added
full compact
Interpreter.cpp (198090) Interpreter.cpp (203954)
1//===- Interpreter.cpp - Top-Level LLVM Interpreter Implementation --------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file implements the top-level functionality for the LLVM interpreter.
11// This interpreter is designed to be a very simple, portable, inefficient
12// interpreter.
13//
14//===----------------------------------------------------------------------===//
15
16#include "Interpreter.h"
17#include "llvm/CodeGen/IntrinsicLowering.h"
18#include "llvm/DerivedTypes.h"
19#include "llvm/Module.h"
1//===- Interpreter.cpp - Top-Level LLVM Interpreter Implementation --------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file implements the top-level functionality for the LLVM interpreter.
11// This interpreter is designed to be a very simple, portable, inefficient
12// interpreter.
13//
14//===----------------------------------------------------------------------===//
15
16#include "Interpreter.h"
17#include "llvm/CodeGen/IntrinsicLowering.h"
18#include "llvm/DerivedTypes.h"
19#include "llvm/Module.h"
20#include "llvm/ModuleProvider.h"
21#include <cstring>
22using namespace llvm;
23
24namespace {
25
26static struct RegisterInterp {
27 RegisterInterp() { Interpreter::Register(); }
28} InterpRegistrator;
29
30}
31
32extern "C" void LLVMLinkInInterpreter() { }
33
34/// create - Create a new interpreter object. This can never fail.
35///
20#include <cstring>
21using namespace llvm;
22
23namespace {
24
25static struct RegisterInterp {
26 RegisterInterp() { Interpreter::Register(); }
27} InterpRegistrator;
28
29}
30
31extern "C" void LLVMLinkInInterpreter() { }
32
33/// create - Create a new interpreter object. This can never fail.
34///
36ExecutionEngine *Interpreter::create(ModuleProvider *MP, std::string* ErrStr) {
37 // Tell this ModuleProvide to materialize and release the module
38 if (!MP->materializeModule(ErrStr))
35ExecutionEngine *Interpreter::create(Module *M, std::string* ErrStr) {
36 // Tell this Module to materialize everything and release the GVMaterializer.
37 if (M->MaterializeAllPermanently(ErrStr))
39 // We got an error, just return 0
40 return 0;
41
38 // We got an error, just return 0
39 return 0;
40
42 return new Interpreter(MP);
41 return new Interpreter(M);
43}
44
45//===----------------------------------------------------------------------===//
46// Interpreter ctor - Initialize stuff
47//
42}
43
44//===----------------------------------------------------------------------===//
45// Interpreter ctor - Initialize stuff
46//
48Interpreter::Interpreter(ModuleProvider *M)
49 : ExecutionEngine(M), TD(M->getModule()) {
47Interpreter::Interpreter(Module *M)
48 : ExecutionEngine(M), TD(M) {
50
51 memset(&ExitValue.Untyped, 0, sizeof(ExitValue.Untyped));
52 setTargetData(&TD);
53 // Initialize the "backend"
54 initializeExecutionEngine();
55 initializeExternalFunctions();
56 emitGlobals();
57

--- 42 unchanged lines hidden ---
49
50 memset(&ExitValue.Untyped, 0, sizeof(ExitValue.Untyped));
51 setTargetData(&TD);
52 // Initialize the "backend"
53 initializeExecutionEngine();
54 initializeExternalFunctions();
55 emitGlobals();
56

--- 42 unchanged lines hidden ---