give MCAsmInfo a 'has little endian' bit.  This is unfortunate, but
I really want clients of the streamer to be able to say "emit this
64-bit integer" and have it get broken down right by the streamer.

I may change this in the future, we'll see how it works out.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93934 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/MC/MCAsmInfo.cpp b/lib/MC/MCAsmInfo.cpp
index cc03614..c15d614 100644
--- a/lib/MC/MCAsmInfo.cpp
+++ b/lib/MC/MCAsmInfo.cpp
@@ -18,7 +18,8 @@
 #include <cstring>
 using namespace llvm;
 
-MCAsmInfo::MCAsmInfo() {
+MCAsmInfo::MCAsmInfo(bool isLittleEndian) {
+  IsLittleEndian = isLittleEndian;
   HasMachoZeroFillDirective = false;
   HasStaticCtorDtorReferenceInStaticMode = false;
   NonexecutableStackDirective = 0;
diff --git a/lib/MC/MCAsmInfoCOFF.cpp b/lib/MC/MCAsmInfoCOFF.cpp
index 1b27bf0..d384c6c 100644
--- a/lib/MC/MCAsmInfoCOFF.cpp
+++ b/lib/MC/MCAsmInfoCOFF.cpp
@@ -16,7 +16,7 @@
 #include "llvm/ADT/SmallVector.h"
 using namespace llvm;
 
-MCAsmInfoCOFF::MCAsmInfoCOFF() {
+MCAsmInfoCOFF::MCAsmInfoCOFF(bool isLittleEndian) : MCAsmInfo(isLittleEndian) {
   GlobalPrefix = "_";
   LCOMMDirective = "\t.lcomm\t";
   COMMDirectiveTakesAlignment = false;
diff --git a/lib/MC/MCAsmInfoDarwin.cpp b/lib/MC/MCAsmInfoDarwin.cpp
index 664a55c..f024a16 100644
--- a/lib/MC/MCAsmInfoDarwin.cpp
+++ b/lib/MC/MCAsmInfoDarwin.cpp
@@ -15,7 +15,8 @@
 #include "llvm/MC/MCAsmInfoDarwin.h"
 using namespace llvm;
 
-MCAsmInfoDarwin::MCAsmInfoDarwin() {
+MCAsmInfoDarwin::MCAsmInfoDarwin(bool isLittleEndian)
+  : MCAsmInfo(isLittleEndian) {
   // Common settings for all Darwin targets.
   // Syntax:
   GlobalPrefix = "_";
diff --git a/lib/Target/ARM/ARMMCAsmInfo.cpp b/lib/Target/ARM/ARMMCAsmInfo.cpp
index 0ff65d2af..a3499fa 100644
--- a/lib/Target/ARM/ARMMCAsmInfo.cpp
+++ b/lib/Target/ARM/ARMMCAsmInfo.cpp
@@ -40,7 +40,7 @@
   0,0
 };
 
-ARMMCAsmInfoDarwin::ARMMCAsmInfoDarwin() {
+ARMMCAsmInfoDarwin::ARMMCAsmInfoDarwin() : MCAsmInfoDarwin(true) {
   AsmTransCBE = arm_asm_table;
   Data64bitsDirective = 0;
   CommentString = "@";
@@ -52,7 +52,7 @@
   AbsoluteEHSectionOffsets = false;
 }
 
-ARMELFMCAsmInfo::ARMELFMCAsmInfo() {
+ARMELFMCAsmInfo::ARMELFMCAsmInfo() : MCAsmInfo(true) {
   AlignmentIsInBytes = false;
   Data64bitsDirective = 0;
   CommentString = "@";
diff --git a/lib/Target/Alpha/AlphaMCAsmInfo.cpp b/lib/Target/Alpha/AlphaMCAsmInfo.cpp
index b652a53..25443cc 100644
--- a/lib/Target/Alpha/AlphaMCAsmInfo.cpp
+++ b/lib/Target/Alpha/AlphaMCAsmInfo.cpp
@@ -14,7 +14,8 @@
 #include "AlphaMCAsmInfo.h"
 using namespace llvm;
 
-AlphaMCAsmInfo::AlphaMCAsmInfo(const Target &T, const StringRef &TT) {
+AlphaMCAsmInfo::AlphaMCAsmInfo(const Target &T, const StringRef &TT)
+  : MCAsmInfo(true) {
   AlignmentIsInBytes = false;
   PrivateGlobalPrefix = "$";
   PICJumpTableDirective = ".gprel32";
diff --git a/lib/Target/Blackfin/BlackfinMCAsmInfo.cpp b/lib/Target/Blackfin/BlackfinMCAsmInfo.cpp
index 6d0f66c..368cd50 100644
--- a/lib/Target/Blackfin/BlackfinMCAsmInfo.cpp
+++ b/lib/Target/Blackfin/BlackfinMCAsmInfo.cpp
@@ -15,7 +15,8 @@
 
 using namespace llvm;
 
-BlackfinMCAsmInfo::BlackfinMCAsmInfo(const Target &T, const StringRef &TT) {
+BlackfinMCAsmInfo::BlackfinMCAsmInfo(const Target &T, const StringRef &TT)
+: MCAsmInfo(true) {
   GlobalPrefix = "_";
   CommentString = "//";
 }
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp
index 5015d1b..1feadd2 100644
--- a/lib/Target/CBackend/CBackend.cpp
+++ b/lib/Target/CBackend/CBackend.cpp
@@ -60,7 +60,7 @@
 namespace {
   class CBEMCAsmInfo : public MCAsmInfo {
   public:
-    CBEMCAsmInfo() {
+    CBEMCAsmInfo(bool isLE) : MCAsmInfo(isLE) {
       GlobalPrefix = "";
       PrivateGlobalPrefix = "";
     }
@@ -1893,7 +1893,7 @@
   if (const Target *Match = TargetRegistry::lookupTarget(Triple, E))
     TAsm = Match->createAsmInfo(Triple);
 #endif    
-  TAsm = new CBEMCAsmInfo();
+  TAsm = new CBEMCAsmInfo(TD->isLittleEndian());
   Mang = new Mangler(*TAsm);
 
   // Keep track of which functions are static ctors/dtors so they can have
diff --git a/lib/Target/CellSPU/SPUMCAsmInfo.cpp b/lib/Target/CellSPU/SPUMCAsmInfo.cpp
index 1c921ab..3b43a7e 100644
--- a/lib/Target/CellSPU/SPUMCAsmInfo.cpp
+++ b/lib/Target/CellSPU/SPUMCAsmInfo.cpp
@@ -14,7 +14,8 @@
 #include "SPUMCAsmInfo.h"
 using namespace llvm;
 
-SPULinuxMCAsmInfo::SPULinuxMCAsmInfo(const Target &T, const StringRef &TT) {
+SPULinuxMCAsmInfo::SPULinuxMCAsmInfo(const Target &T, const StringRef &TT)
+  : MCAsmInfo(false) {
   ZeroDirective = "\t.space\t";
   SetDirective = "\t.set";
   Data64bitsDirective = "\t.quad\t";
diff --git a/lib/Target/MSP430/MSP430MCAsmInfo.cpp b/lib/Target/MSP430/MSP430MCAsmInfo.cpp
index 516eacb..92adc38 100644
--- a/lib/Target/MSP430/MSP430MCAsmInfo.cpp
+++ b/lib/Target/MSP430/MSP430MCAsmInfo.cpp
@@ -14,7 +14,8 @@
 #include "MSP430MCAsmInfo.h"
 using namespace llvm;
 
-MSP430MCAsmInfo::MSP430MCAsmInfo(const Target &T, const StringRef &TT) {
+MSP430MCAsmInfo::MSP430MCAsmInfo(const Target &T, const StringRef &TT) :
+ MCAsmInfo(true) {
   PrivateGlobalPrefix = ".L";
   WeakRefDirective ="\t.weak\t";
   SetDirective = "\t.set\t";
diff --git a/lib/Target/Mips/MipsMCAsmInfo.cpp b/lib/Target/Mips/MipsMCAsmInfo.cpp
index 60ef1c9..9a0c0bf 100644
--- a/lib/Target/Mips/MipsMCAsmInfo.cpp
+++ b/lib/Target/Mips/MipsMCAsmInfo.cpp
@@ -14,7 +14,8 @@
 #include "MipsMCAsmInfo.h"
 using namespace llvm;
 
-MipsMCAsmInfo::MipsMCAsmInfo(const Target &T, const StringRef &TT) {
+MipsMCAsmInfo::MipsMCAsmInfo(const Target &T, const StringRef &TT,
+                             bool isLittleEndian) : MCAsmInfo(isLittleEndian) {
   AlignmentIsInBytes          = false;
   COMMDirectiveTakesAlignment = true;
   Data16bitsDirective         = "\t.half\t";
diff --git a/lib/Target/Mips/MipsMCAsmInfo.h b/lib/Target/Mips/MipsMCAsmInfo.h
index 33a4b5e..62ef463 100644
--- a/lib/Target/Mips/MipsMCAsmInfo.h
+++ b/lib/Target/Mips/MipsMCAsmInfo.h
@@ -22,9 +22,23 @@
   
   class MipsMCAsmInfo : public MCAsmInfo {
   public:
-    explicit MipsMCAsmInfo(const Target &T, const StringRef &TT);
+    explicit MipsMCAsmInfo(const Target &T, const StringRef &TT,
+                           bool isLittleEndian);
   };
-
+  
+  /// Big Endian MAI.
+  class MipsBEMCAsmInfo : public MipsMCAsmInfo {
+  public:
+    MipsBEMCAsmInfo(const Target &T, const StringRef &TT)
+      : MipsMCAsmInfo(T, TT, false) {}
+  };
+  
+  /// Little Endian MAI.
+  class MipsLEMCAsmInfo : public MipsMCAsmInfo {
+  public:
+    MipsLEMCAsmInfo(const Target &T, const StringRef &TT)
+    : MipsMCAsmInfo(T, TT, true) {}
+  };
 } // namespace llvm
 
 #endif
diff --git a/lib/Target/Mips/MipsTargetMachine.cpp b/lib/Target/Mips/MipsTargetMachine.cpp
index 4724ff7..1168fef 100644
--- a/lib/Target/Mips/MipsTargetMachine.cpp
+++ b/lib/Target/Mips/MipsTargetMachine.cpp
@@ -22,8 +22,8 @@
   // Register the target.
   RegisterTargetMachine<MipsTargetMachine> X(TheMipsTarget);
   RegisterTargetMachine<MipselTargetMachine> Y(TheMipselTarget);
-  RegisterAsmInfo<MipsMCAsmInfo> A(TheMipsTarget);
-  RegisterAsmInfo<MipsMCAsmInfo> B(TheMipselTarget);
+  RegisterAsmInfo<MipsBEMCAsmInfo> A(TheMipsTarget);
+  RegisterAsmInfo<MipsLEMCAsmInfo> B(TheMipselTarget);
 }
 
 // DataLayout --> Big-endian, 32-bit pointer/ABI/alignment
@@ -60,8 +60,7 @@
 // Install an instruction selector pass using 
 // the ISelDag to gen Mips code.
 bool MipsTargetMachine::
-addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel) 
-{
+addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel) {
   PM.add(createMipsISelDag(*this));
   return false;
 }
diff --git a/lib/Target/PIC16/PIC16MCAsmInfo.cpp b/lib/Target/PIC16/PIC16MCAsmInfo.cpp
index 827315e..a6331e6 100644
--- a/lib/Target/PIC16/PIC16MCAsmInfo.cpp
+++ b/lib/Target/PIC16/PIC16MCAsmInfo.cpp
@@ -20,7 +20,8 @@
 #include "PIC16ISelLowering.h"
 using namespace llvm;
 
-PIC16MCAsmInfo::PIC16MCAsmInfo(const Target &T, const StringRef &TT) {
+PIC16MCAsmInfo::PIC16MCAsmInfo(const Target &T, const StringRef &TT)
+: MCAsmInfo(true) {
   CommentString = ";";
   GlobalPrefix = PAN::getTagName(PAN::PREFIX_SYMBOL);
   GlobalDirective = "\tglobal\t";
diff --git a/lib/Target/PowerPC/PPCMCAsmInfo.cpp b/lib/Target/PowerPC/PPCMCAsmInfo.cpp
index ee6deb5..12de942 100644
--- a/lib/Target/PowerPC/PPCMCAsmInfo.cpp
+++ b/lib/Target/PowerPC/PPCMCAsmInfo.cpp
@@ -14,7 +14,7 @@
 #include "PPCMCAsmInfo.h"
 using namespace llvm;
 
-PPCMCAsmInfoDarwin::PPCMCAsmInfoDarwin(bool is64Bit) {
+PPCMCAsmInfoDarwin::PPCMCAsmInfoDarwin(bool is64Bit) : MCAsmInfoDarwin(false) {
   PCSymbol = ".";
   CommentString = ";";
   ExceptionsType = ExceptionHandling::Dwarf;
@@ -25,7 +25,7 @@
   SupportsDebugInformation= true; // Debug information.
 }
 
-PPCLinuxMCAsmInfo::PPCLinuxMCAsmInfo(bool is64Bit) {
+PPCLinuxMCAsmInfo::PPCLinuxMCAsmInfo(bool is64Bit) : MCAsmInfo(false)  {
   CommentString = "#";
   GlobalPrefix = "";
   PrivateGlobalPrefix = ".L";
diff --git a/lib/Target/Sparc/SparcMCAsmInfo.cpp b/lib/Target/Sparc/SparcMCAsmInfo.cpp
index b67537c..cb6da96 100644
--- a/lib/Target/Sparc/SparcMCAsmInfo.cpp
+++ b/lib/Target/Sparc/SparcMCAsmInfo.cpp
@@ -15,7 +15,8 @@
 #include "llvm/ADT/SmallVector.h"
 using namespace llvm;
 
-SparcELFMCAsmInfo::SparcELFMCAsmInfo(const Target &T, const StringRef &TT) {
+SparcELFMCAsmInfo::SparcELFMCAsmInfo(const Target &T, const StringRef &TT)
+  : MCAsmInfo(/*isLittleEndian*/ false) {
   Data16bitsDirective = "\t.half\t";
   Data32bitsDirective = "\t.word\t";
   Data64bitsDirective = 0;  // .xword is only supported by V9.
diff --git a/lib/Target/SystemZ/SystemZMCAsmInfo.cpp b/lib/Target/SystemZ/SystemZMCAsmInfo.cpp
index 8ea11c9..c17535f 100644
--- a/lib/Target/SystemZ/SystemZMCAsmInfo.cpp
+++ b/lib/Target/SystemZ/SystemZMCAsmInfo.cpp
@@ -14,7 +14,8 @@
 #include "SystemZMCAsmInfo.h"
 using namespace llvm;
 
-SystemZMCAsmInfo::SystemZMCAsmInfo(const Target &T, const StringRef &TT) {
+SystemZMCAsmInfo::SystemZMCAsmInfo(const Target &T, const StringRef &TT)
+: MCAsmInfo(false) {
   AlignmentIsInBytes = true;
 
   PrivateGlobalPrefix = ".L";
diff --git a/lib/Target/X86/X86MCAsmInfo.cpp b/lib/Target/X86/X86MCAsmInfo.cpp
index 001ce80..bba36e8 100644
--- a/lib/Target/X86/X86MCAsmInfo.cpp
+++ b/lib/Target/X86/X86MCAsmInfo.cpp
@@ -43,7 +43,8 @@
   "{cc}", "cc",
   0,0};
 
-X86MCAsmInfoDarwin::X86MCAsmInfoDarwin(const Triple &Triple) {
+X86MCAsmInfoDarwin::X86MCAsmInfoDarwin(const Triple &Triple)
+  : MCAsmInfoDarwin(true /*islittleendian*/) {
   AsmTransCBE = x86_asm_table;
   AssemblerDialect = AsmWriterFlavor;
     
@@ -68,7 +69,8 @@
   AbsoluteEHSectionOffsets = false;
 }
 
-X86ELFMCAsmInfo::X86ELFMCAsmInfo(const Triple &Triple) {
+X86ELFMCAsmInfo::X86ELFMCAsmInfo(const Triple &Triple)
+  : MCAsmInfo(true /*islittleendian*/) {
   AsmTransCBE = x86_asm_table;
   AssemblerDialect = AsmWriterFlavor;
 
@@ -93,13 +95,15 @@
     NonexecutableStackDirective = "\t.section\t.note.GNU-stack,\"\",@progbits";
 }
 
-X86MCAsmInfoCOFF::X86MCAsmInfoCOFF(const Triple &Triple) {
+X86MCAsmInfoCOFF::X86MCAsmInfoCOFF(const Triple &Triple)
+  : MCAsmInfoCOFF(true /*islittleendian*/) {
   AsmTransCBE = x86_asm_table;
   AssemblerDialect = AsmWriterFlavor;
 }
 
 
-X86WinMCAsmInfo::X86WinMCAsmInfo(const Triple &Triple) {
+X86WinMCAsmInfo::X86WinMCAsmInfo(const Triple &Triple)
+  : MCAsmInfo(true /*islittleendian*/) {
   AsmTransCBE = x86_asm_table;
   AssemblerDialect = AsmWriterFlavor;
 
diff --git a/lib/Target/XCore/XCoreMCAsmInfo.cpp b/lib/Target/XCore/XCoreMCAsmInfo.cpp
index dffdda9..b6c0cfc 100644
--- a/lib/Target/XCore/XCoreMCAsmInfo.cpp
+++ b/lib/Target/XCore/XCoreMCAsmInfo.cpp
@@ -10,7 +10,8 @@
 #include "XCoreMCAsmInfo.h"
 using namespace llvm;
 
-XCoreMCAsmInfo::XCoreMCAsmInfo(const Target &T, const StringRef &TT) {
+XCoreMCAsmInfo::XCoreMCAsmInfo(const Target &T, const StringRef &TT)
+: MCAsmInfo(true) {
   SupportsDebugInformation = true;
   Data16bitsDirective = "\t.short\t";
   Data32bitsDirective = "\t.long\t";