[llvm-commits] CVS: llvm/tools/lli/Interpreter/Interpreter.cpp Interpreter.h
Chris Lattner
lattner at cs.uiuc.edu
Sun Aug 24 14:52:16 PDT 2003
Changes in directory llvm/tools/lli/Interpreter:
Interpreter.cpp updated: 1.7 -> 1.8
Interpreter.h updated: 1.32 -> 1.33
---
Log message:
Targets now configure themselves based on the source module, not on the
ad-hoc "Config" flags
---
Diffs of the changes:
Index: llvm/tools/lli/Interpreter/Interpreter.cpp
diff -u llvm/tools/lli/Interpreter/Interpreter.cpp:1.7 llvm/tools/lli/Interpreter/Interpreter.cpp:1.8
--- llvm/tools/lli/Interpreter/Interpreter.cpp:1.7 Thu Aug 21 16:12:29 2003
+++ llvm/tools/lli/Interpreter/Interpreter.cpp Sun Aug 24 14:50:52 2003
@@ -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"
Index: llvm/tools/lli/Interpreter/Interpreter.h
diff -u llvm/tools/lli/Interpreter/Interpreter.h:1.32 llvm/tools/lli/Interpreter/Interpreter.h:1.33
--- llvm/tools/lli/Interpreter/Interpreter.h:1.32 Thu Aug 21 16:12:29 2003
+++ llvm/tools/lli/Interpreter/Interpreter.h Sun Aug 24 14:50:52 2003
@@ -87,7 +87,8 @@
// 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 DebugMode, bool TraceMode);
inline ~Interpreter() { CW.setModule(0); }
// getExitCode - return the code that should be the exit code for the lli
More information about the llvm-commits
mailing list