[llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h

Chris Lattner lattner at cs.uiuc.edu
Mon Oct 14 17:42:01 PDT 2002


Changes in directory llvm/include/llvm/Target:

TargetData.h updated: 1.10 -> 1.11

---
Log message:

  - Add an endianness field to the TargetData datastructure


---
Diffs of the changes:

Index: llvm/include/llvm/Target/TargetData.h
diff -u llvm/include/llvm/Target/TargetData.h:1.10 llvm/include/llvm/Target/TargetData.h:1.11
--- llvm/include/llvm/Target/TargetData.h:1.10	Wed Sep 25 18:46:56 2002
+++ llvm/include/llvm/Target/TargetData.h	Mon Oct 14 17:41:09 2002
@@ -23,6 +23,7 @@
 class StructLayout;
 
 class TargetData : public ImmutablePass {
+  bool          LittleEndian;          // Defaults to false
   unsigned char ByteAlignment;         // Defaults to 1 bytes
   unsigned char ShortAlignment;        // Defaults to 2 bytes
   unsigned char IntAlignment;          // Defaults to 4 bytes
@@ -37,6 +38,7 @@
   static Annotation *TypeAnFactory(AnnotationID, const Annotable *, void *);
 public:
   TargetData(const std::string &TargetName = "SparcV9",
+             bool LittleEndian = false,
              unsigned char IntRegSize = 8,
              unsigned char PtrSize = 8,
 	     unsigned char PtrAl = 8, unsigned char DoubleAl = 8,
@@ -45,6 +47,11 @@
 	     unsigned char ByteAl = 1);
   ~TargetData();  // Not virtual, do not subclass this class
 
+  /// Target endianness...
+  bool          isLittleEndian()      const { return     LittleEndian; }
+  bool          isBigEndian()         const { return    !LittleEndian; }
+
+  /// Target alignment constraints
   unsigned char getByteAlignment()    const { return    ByteAlignment; }
   unsigned char getShortAlignment()   const { return   ShortAlignment; }
   unsigned char getIntAlignment()     const { return     IntAlignment; }
@@ -52,8 +59,8 @@
   unsigned char getFloatAlignment()   const { return   FloatAlignment; }
   unsigned char getDoubleAlignment()  const { return  DoubleAlignment; }
   unsigned char getPointerAlignment() const { return PointerAlignment; }
-  unsigned char getPointerSize()      const { return PointerSize; }
-  unsigned char getIntegerRegize()    const { return IntegerRegSize; }
+  unsigned char getPointerSize()      const { return      PointerSize; }
+  unsigned char getIntegerRegize()    const { return   IntegerRegSize; }
   AnnotationID  getStructLayoutAID()  const { return AID; }
 
   // getTypeSize - Return the number of bytes neccesary to hold the specified





More information about the llvm-commits mailing list