summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-06-16 18:08:38 +0000
committerChris Lattner <sabre@nondot.org>2006-06-16 18:08:38 +0000
commit91f228b2913c91ae83e1dcf052d784adc2c29546 (patch)
tree522a7c8705c079c6ee66ce2e291772efe3da50b5 /llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp
parent16682fff2b7d8c5b12499dbbe7f1d617fb62fdbe (diff)
downloadbcm5719-llvm-91f228b2913c91ae83e1dcf052d784adc2c29546.tar.gz
bcm5719-llvm-91f228b2913c91ae83e1dcf052d784adc2c29546.zip
Simplify interpreter construction.
llvm-svn: 28826
Diffstat (limited to 'llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp')
-rw-r--r--llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp30
1 files changed, 10 insertions, 20 deletions
diff --git a/llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp b/llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp
index 63d88254484..35f7c86a8d9 100644
--- a/llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp
+++ b/llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp
@@ -39,37 +39,27 @@ ExecutionEngine *Interpreter::create(ModuleProvider *MP) {
return 0; // error materializing the module.
}
- bool isLittleEndian = false;
- switch (M->getEndianness()) {
- case Module::LittleEndian: isLittleEndian = true; break;
- case Module::BigEndian: isLittleEndian = false; break;
- case Module::AnyPointerSize:
+ if (M->getEndianness() == Module::AnyEndianness) {
int Test = 0;
*(char*)&Test = 1; // Return true if the host is little endian
- isLittleEndian = (Test == 1);
- break;
+ bool isLittleEndian = (Test == 1);
+ M->setEndianness(isLittleEndian ? Module::LittleEndian : Module::BigEndian);
}
- bool isLongPointer = false;
- 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;
+ if (M->getPointerSize() == Module::AnyPointerSize) {
+ // Follow host.
+ bool Ptr64 = sizeof(void*) == 8;
+ M->setPointerSize(Ptr64 ? Module::Pointer64 : Module::Pointer32);
}
- return new Interpreter(M, isLittleEndian, isLongPointer);
+ return new Interpreter(M);
}
//===----------------------------------------------------------------------===//
// Interpreter ctor - Initialize stuff
//
-Interpreter::Interpreter(Module *M, bool isLittleEndian, bool isLongPointer)
- : ExecutionEngine(M),
- TD("lli", isLittleEndian, isLongPointer ? 8 : 4, isLongPointer ? 8 : 4,
- isLongPointer ? 8 : 4) {
-
+Interpreter::Interpreter(Module *M) : ExecutionEngine(M), TD("lli", M) {
+
memset(&ExitValue, 0, sizeof(ExitValue));
setTargetData(&TD);
// Initialize the "backend"
OpenPOWER on IntegriCloud