aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-12-24 00:02:17 +0000
committerChris Lattner <sabre@nondot.org>2002-12-24 00:02:17 +0000
commit434c86dd3f03dff344793e9faf1a66d164bf21b6 (patch)
tree8437e14ce214a46fe3552ceede9b5606d49e1b7d
parent836f675c49bbb482daf6e0e01a66dd0beee11a49 (diff)
Allow the target machines to specify endianness and pointer size
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5128 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Target/TargetMachine.h5
-rw-r--r--include/llvm/Target/TargetMachineImpls.h19
2 files changed, 20 insertions, 4 deletions
diff --git a/include/llvm/Target/TargetMachine.h b/include/llvm/Target/TargetMachine.h
index 02d57880b7..508ae330db 100644
--- a/include/llvm/Target/TargetMachine.h
+++ b/include/llvm/Target/TargetMachine.h
@@ -39,13 +39,14 @@ public:
protected:
TargetMachine(const std::string &name, // Can only create subclasses...
+ bool LittleEndian = false,
unsigned char SubWordSize = 1, unsigned char IntRegSize = 8,
unsigned char PtrSize = 8, unsigned char PtrAl = 8,
unsigned char DoubleAl = 8, unsigned char FloatAl = 4,
unsigned char LongAl = 8, unsigned char IntAl = 4,
unsigned char ShortAl = 2, unsigned char ByteAl = 1)
- : Name(name), DataLayout(name, SubWordSize, IntRegSize, PtrSize, PtrAl,
- DoubleAl, FloatAl, LongAl,
+ : Name(name), DataLayout(name, LittleEndian, SubWordSize, IntRegSize,
+ PtrSize, PtrAl, DoubleAl, FloatAl, LongAl,
IntAl, ShortAl, ByteAl) {}
public:
virtual ~TargetMachine() {}
diff --git a/include/llvm/Target/TargetMachineImpls.h b/include/llvm/Target/TargetMachineImpls.h
index e9156c7b2d..4b8450eb01 100644
--- a/include/llvm/Target/TargetMachineImpls.h
+++ b/include/llvm/Target/TargetMachineImpls.h
@@ -8,6 +8,18 @@
#ifndef LLVM_TARGET_TARGETMACHINEIMPLS_H
#define LLVM_TARGET_TARGETMACHINEIMPLS_H
+namespace TM {
+ enum {
+ PtrSizeMask = 1,
+ PtrSize32 = 0,
+ PtrSize64 = 1,
+
+ EndianMask = 2,
+ LittleEndian = 0,
+ BigEndian = 2,
+ };
+}
+
class TargetMachine;
// allocateSparcTargetMachine - Allocate and return a subclass of TargetMachine
@@ -16,8 +28,11 @@ class TargetMachine;
TargetMachine *allocateSparcTargetMachine();
// allocateX86TargetMachine - Allocate and return a subclass of TargetMachine
-// that implements the X86 backend.
+// that implements the X86 backend. The X86 target machine can run in
+// "emulation" mode, where it is capable of emulating machines of larger pointer
+// size and different endianness if desired.
//
-TargetMachine *allocateX86TargetMachine();
+TargetMachine *allocateX86TargetMachine(unsigned Configuration =
+ TM::PtrSize32|TM::LittleEndian);
#endif