aboutsummaryrefslogtreecommitdiff
path: root/lib/ExecutionEngine/Interpreter/Interpreter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-08-24 19:50:53 +0000
committerChris Lattner <sabre@nondot.org>2003-08-24 19:50:53 +0000
commit39c07264da992fd5d37fa7eaac0b9f02f55f80d0 (patch)
tree8272f4fdfbabda52456df604bd85d18ae616fc51 /lib/ExecutionEngine/Interpreter/Interpreter.cpp
parent62c720a5bdd36b85dd497a1c3575db5731eca208 (diff)
Targets now configure themselves based on the source module, not on the
ad-hoc "Config" flags git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8134 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/Interpreter/Interpreter.cpp')
-rw-r--r--lib/ExecutionEngine/Interpreter/Interpreter.cpp35
1 files changed, 26 insertions, 9 deletions
diff --git a/lib/ExecutionEngine/Interpreter/Interpreter.cpp b/lib/ExecutionEngine/Interpreter/Interpreter.cpp
index 4fdd6a1be7..950e6a5727 100644
--- a/lib/ExecutionEngine/Interpreter/Interpreter.cpp
+++ b/lib/ExecutionEngine/Interpreter/Interpreter.cpp
@@ -7,27 +7,44 @@
//===----------------------------------------------------------------------===//
#include "Interpreter.h"
-#include "llvm/Target/TargetMachineImpls.h"
+#include "llvm/Module.h"
/// createInterpreter - Create a new interpreter object. This can never fail.
///
ExecutionEngine *ExecutionEngine::createInterpreter(Module *M,
- unsigned Config,
bool DebugMode,
bool TraceMode) {
- return new Interpreter(M, Config, DebugMode, TraceMode);
+ bool isLittleEndian;
+ switch (M->getEndianness()) {
+ case Module::LittleEndian: isLittleEndian = true; break;
+ case Module::BigEndian: isLittleEndian = false; break;
+ case Module::AnyPointerSize:
+ int Test = 0;
+ *(char*)&Test = 1; // Return true if the host is little endian
+ isLittleEndian = (Test == 1);
+ break;
+ }
+
+ bool isLongPointer;
+ switch (M->getPointerSize()) {
+ case Module::Pointer32: isLongPointer = false; break;
+ case Module::Pointer64: isLongPointer = true; break;
+ case Module::AnyPointerSize:
+ isLongPointer = (sizeof(void*) == 8); // Follow host
+ break;
+ }
+
+ return new Interpreter(M, isLittleEndian, isLongPointer, DebugMode,TraceMode);
}
//===----------------------------------------------------------------------===//
// Interpreter ctor - Initialize stuff
//
-Interpreter::Interpreter(Module *M, unsigned Config,
- bool DebugMode, bool TraceMode)
+Interpreter::Interpreter(Module *M, bool isLittleEndian, bool isLongPointer,
+ bool DebugMode, bool TraceMode)
: ExecutionEngine(M), ExitCode(0), Debug(DebugMode), Trace(TraceMode),
- CurFrame(-1), TD("lli", (Config & TM::EndianMask) == TM::LittleEndian,
- (Config & TM::PtrSizeMask) == TM::PtrSize64 ? 8 : 4,
- (Config & TM::PtrSizeMask) == TM::PtrSize64 ? 8 : 4,
- (Config & TM::PtrSizeMask) == TM::PtrSize64 ? 8 : 4) {
+ CurFrame(-1), TD("lli", isLittleEndian, isLongPointer ? 8 : 4,
+ isLongPointer ? 8 : 4, isLongPointer ? 8 : 4) {
setTargetData(TD);
// Initialize the "backend"