give MCAsmInfo a 'has little endian' bit. This is unfortunate, but
authorChris Lattner <sabre@nondot.org>
Tue, 19 Jan 2010 22:42:28 +0000 (22:42 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 19 Jan 2010 22:42:28 +0000 (22:42 +0000)
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

21 files changed:
include/llvm/MC/MCAsmInfo.h
include/llvm/MC/MCAsmInfoCOFF.h
include/llvm/MC/MCAsmInfoDarwin.h
lib/MC/MCAsmInfo.cpp
lib/MC/MCAsmInfoCOFF.cpp
lib/MC/MCAsmInfoDarwin.cpp
lib/Target/ARM/ARMMCAsmInfo.cpp
lib/Target/Alpha/AlphaMCAsmInfo.cpp
lib/Target/Blackfin/BlackfinMCAsmInfo.cpp
lib/Target/CBackend/CBackend.cpp
lib/Target/CellSPU/SPUMCAsmInfo.cpp
lib/Target/MSP430/MSP430MCAsmInfo.cpp
lib/Target/Mips/MipsMCAsmInfo.cpp
lib/Target/Mips/MipsMCAsmInfo.h
lib/Target/Mips/MipsTargetMachine.cpp
lib/Target/PIC16/PIC16MCAsmInfo.cpp
lib/Target/PowerPC/PPCMCAsmInfo.cpp
lib/Target/Sparc/SparcMCAsmInfo.cpp
lib/Target/SystemZ/SystemZMCAsmInfo.cpp
lib/Target/X86/X86MCAsmInfo.cpp
lib/Target/XCore/XCoreMCAsmInfo.cpp

index 0be27530f27149af10f1f6129599644ea23b4935..7ca7ecba6ff95c638f28cd1d970a4048247ef9cd 100644 (file)
@@ -24,6 +24,7 @@ namespace llvm {
   namespace ExceptionHandling { enum ExceptionsType { None, Dwarf, SjLj }; }
 
   class MCAsmInfo {
+    bool IsLittleEndian;
   protected:
     //===------------------------------------------------------------------===//
     // Properties to be set by the target writer, used to configure asm printer.
@@ -285,9 +286,12 @@ namespace llvm {
     const char *const *AsmTransCBE;          // Defaults to empty
 
   public:
-    explicit MCAsmInfo();
+    explicit MCAsmInfo(bool isLittleEndian);
     virtual ~MCAsmInfo();
 
+    bool isLittleEndian() const { return IsLittleEndian; }
+    bool isBigEndian() const { return !IsLittleEndian; }
+    
     /// getSLEB128Size - Compute the number of bytes required for a signed
     /// leb128 value.
     static unsigned getSLEB128Size(int Value);
index a3ee1593c3ac4c09ab630995c0066685b9737407..97e9aee060a57e8ed718cbfc06d9dcac722089b2 100644 (file)
@@ -15,7 +15,7 @@
 namespace llvm {
   class MCAsmInfoCOFF : public MCAsmInfo {
   protected:
-    explicit MCAsmInfoCOFF();
+    explicit MCAsmInfoCOFF(bool isLittleEndian);
       
   };
 }
index c85aa3da9572e672bbce19ebcd8b30e4e5a7bc6e..f5e897d203d83bb1689c2389d70726bd4eec9430 100644 (file)
@@ -24,7 +24,7 @@ namespace llvm {
   class Mangler;
 
   struct MCAsmInfoDarwin : public MCAsmInfo {
-    explicit MCAsmInfoDarwin();
+    explicit MCAsmInfoDarwin(bool isLittleEndian);
   };
 }
 
index cc03614157460d9200e423fc4ce4ef6db5fe559e..c15d61494ca9e31c2c05fd56e335df4f9bb65cc5 100644 (file)
@@ -18,7 +18,8 @@
 #include <cstring>
 using namespace llvm;
 
-MCAsmInfo::MCAsmInfo() {
+MCAsmInfo::MCAsmInfo(bool isLittleEndian) {
+  IsLittleEndian = isLittleEndian;
   HasMachoZeroFillDirective = false;
   HasStaticCtorDtorReferenceInStaticMode = false;
   NonexecutableStackDirective = 0;
index 1b27bf026ec70fbcb239d6a07d5eda7921030a78..d384c6c07638c84a520383d7f7cac51d0506996c 100644 (file)
@@ -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;
index 664a55c08884809d775b561b121954c40c918d4d..f024a1668c6a22d58d30414c243aa1c111420328 100644 (file)
@@ -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 = "_";
index 0ff65d2af88b86002430662ca01aa2ec5717348a..a3499fa3cbc3210af1021a9726136a478fdc12c7 100644 (file)
@@ -40,7 +40,7 @@ static const char *const arm_asm_table[] = {
   0,0
 };
 
-ARMMCAsmInfoDarwin::ARMMCAsmInfoDarwin() {
+ARMMCAsmInfoDarwin::ARMMCAsmInfoDarwin() : MCAsmInfoDarwin(true) {
   AsmTransCBE = arm_asm_table;
   Data64bitsDirective = 0;
   CommentString = "@";
@@ -52,7 +52,7 @@ ARMMCAsmInfoDarwin::ARMMCAsmInfoDarwin() {
   AbsoluteEHSectionOffsets = false;
 }
 
-ARMELFMCAsmInfo::ARMELFMCAsmInfo() {
+ARMELFMCAsmInfo::ARMELFMCAsmInfo() : MCAsmInfo(true) {
   AlignmentIsInBytes = false;
   Data64bitsDirective = 0;
   CommentString = "@";
index b652a5305a018118842844677bf09e7b858b6d42..25443cc0c693fd269ea6122f0fa5628e1fa95b5d 100644 (file)
@@ -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";
index 6d0f66cd7a5d127ca6c2feb1597821c1a4d0ac2d..368cd50ed96fa31cb6501f81fd1552df2e2cd6e6 100644 (file)
@@ -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 = "//";
 }
index 5015d1bcce80e3bc6398876ef49bb1e076302e0f..1feadd2a9308858b7ba61744faaa78d933b779e5 100644 (file)
@@ -60,7 +60,7 @@ extern "C" void LLVMInitializeCBackendTarget() {
 namespace {
   class CBEMCAsmInfo : public MCAsmInfo {
   public:
-    CBEMCAsmInfo() {
+    CBEMCAsmInfo(bool isLE) : MCAsmInfo(isLE) {
       GlobalPrefix = "";
       PrivateGlobalPrefix = "";
     }
@@ -1893,7 +1893,7 @@ bool CWriter::doInitialization(Module &M) {
   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
index 1c921ab87ff20306cc467d025b788667d51b4554..3b43a7e2092d92446f07995763e32bf82ae90884 100644 (file)
@@ -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";
index 516eacb535641a4e0c1b7e4d5211a3910b7b1473..92adc381699211eea8fc3a3b2c2247e384dc0e4a 100644 (file)
@@ -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";
index 60ef1c9e4fef3569b2e2310266068ed51dcf3eb6..9a0c0bfdba89b37362e41de1c3346b9f932e521e 100644 (file)
@@ -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";
index 33a4b5edb258f21197845dd30c36df5515ed59df..62ef463c0f3cdfd6fc2e9dab70317c20f5db9d42 100644 (file)
@@ -22,9 +22,23 @@ namespace llvm {
   
   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
index 4724ff7d3470fcc858f5b67d126fdca5f07278e0..1168fef66e0c972776558fdd4fb43729fbefffb0 100644 (file)
@@ -22,8 +22,8 @@ extern "C" void LLVMInitializeMipsTarget() {
   // 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 @@ MipselTargetMachine(const Target &T, const std::string &TT,
 // 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;
 }
index 827315e13b721b0526c42aeec6533ed5052650c1..a6331e64ccc268dfd45b076f80f2d6efc7acd363 100644 (file)
@@ -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";
index ee6deb5c5090e194bac2dbf77f76da6eccd16a43..12de9427f4f772ee7f44e4500914fefbf57f7b2d 100644 (file)
@@ -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 @@ PPCMCAsmInfoDarwin::PPCMCAsmInfoDarwin(bool is64Bit) {
   SupportsDebugInformation= true; // Debug information.
 }
 
-PPCLinuxMCAsmInfo::PPCLinuxMCAsmInfo(bool is64Bit) {
+PPCLinuxMCAsmInfo::PPCLinuxMCAsmInfo(bool is64Bit) : MCAsmInfo(false)  {
   CommentString = "#";
   GlobalPrefix = "";
   PrivateGlobalPrefix = ".L";
index b67537c17881c36120c91aad250adc51f83223f5..cb6da961b83e318041d591d01eb4931bd9adeb91 100644 (file)
@@ -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.
index 8ea11c95b27da54c755d17689253ff5ac72f21c7..c17535f4e2b34888581852eebcb918f427dab96a 100644 (file)
@@ -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";
index 001ce8072863010aff155e1363a7b58193f287f0..bba36e86caddccc8e2a3534ce66f64d8e89e48d4 100644 (file)
@@ -43,7 +43,8 @@ static const char *const x86_asm_table[] = {
   "{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 @@ X86MCAsmInfoDarwin::X86MCAsmInfoDarwin(const Triple &Triple) {
   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 @@ X86ELFMCAsmInfo::X86ELFMCAsmInfo(const Triple &Triple) {
     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;
 
index dffdda9a1fd09622512ede4f08157ae93c51e95c..b6c0cfccf901e4e4a13683aeac8af9e40eda69cb 100644 (file)
@@ -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";