[llvm] r220193 - Switch the default DataLayout to be little endian, and make the variable

Chandler Carruth chandlerc at gmail.com
Mon Oct 20 03:41:29 PDT 2014


Author: chandlerc
Date: Mon Oct 20 05:41:29 2014
New Revision: 220193

URL: http://llvm.org/viewvc/llvm-project?rev=220193&view=rev
Log:
Switch the default DataLayout to be little endian, and make the variable
be BigEndian so the default can continue to be zero-initialized.

This is one of the prerequisites to making DataLayout a constant and
always available part of every module.

Modified:
    llvm/trunk/include/llvm/IR/DataLayout.h
    llvm/trunk/lib/IR/DataLayout.cpp

Modified: llvm/trunk/include/llvm/IR/DataLayout.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DataLayout.h?rev=220193&r1=220192&r2=220193&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/DataLayout.h (original)
+++ llvm/trunk/include/llvm/IR/DataLayout.h Mon Oct 20 05:41:29 2014
@@ -99,7 +99,7 @@ struct PointerAlignElem {
 class DataLayout {
 private:
   /// Defaults to false.
-  bool LittleEndian;
+  bool BigEndian;
 
   unsigned StackNaturalAlign;
 
@@ -180,7 +180,7 @@ public:
 
   DataLayout &operator=(const DataLayout &DL) {
     clear();
-    LittleEndian = DL.isLittleEndian();
+    BigEndian = DL.isBigEndian();
     StackNaturalAlign = DL.StackNaturalAlign;
     ManglingMode = DL.ManglingMode;
     LegalIntWidths = DL.LegalIntWidths;
@@ -198,8 +198,8 @@ public:
   void reset(StringRef LayoutDescription);
 
   /// Layout endianness...
-  bool isLittleEndian() const { return LittleEndian; }
-  bool isBigEndian() const { return !LittleEndian; }
+  bool isLittleEndian() const { return !BigEndian; }
+  bool isBigEndian() const { return BigEndian; }
 
   /// \brief Returns the string representation of the DataLayout.
   ///

Modified: llvm/trunk/lib/IR/DataLayout.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DataLayout.cpp?rev=220193&r1=220192&r2=220193&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DataLayout.cpp (original)
+++ llvm/trunk/lib/IR/DataLayout.cpp Mon Oct 20 05:41:29 2014
@@ -179,7 +179,7 @@ void DataLayout::reset(StringRef Desc) {
   clear();
 
   LayoutMap = nullptr;
-  LittleEndian = false;
+  BigEndian = false;
   StackNaturalAlign = 0;
   ManglingMode = MM_None;
 
@@ -239,10 +239,10 @@ void DataLayout::parseSpecifier(StringRe
       // FIXME: remove this on LLVM 4.0.
       break;
     case 'E':
-      LittleEndian = false;
+      BigEndian = true;
       break;
     case 'e':
-      LittleEndian = true;
+      BigEndian = false;
       break;
     case 'p': {
       // Address space.
@@ -357,7 +357,7 @@ void DataLayout::init(const Module *M) {
 }
 
 bool DataLayout::operator==(const DataLayout &Other) const {
-  bool Ret = LittleEndian == Other.LittleEndian &&
+  bool Ret = BigEndian == Other.BigEndian &&
              StackNaturalAlign == Other.StackNaturalAlign &&
              ManglingMode == Other.ManglingMode &&
              LegalIntWidths == Other.LegalIntWidths &&
@@ -526,7 +526,7 @@ std::string DataLayout::getStringReprese
   std::string Result;
   raw_string_ostream OS(Result);
 
-  OS << (LittleEndian ? "e" : "E");
+  OS << (BigEndian ? "E" : "e");
 
   switch (ManglingMode) {
   case MM_None:





More information about the llvm-commits mailing list