summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-01-19 22:42:28 +0000
committerChris Lattner <sabre@nondot.org>2010-01-19 22:42:28 +0000
commitc7b8814bb4f2e6052060d6118d3bc3b66f5c5b0b (patch)
tree8ea6af8d6d1776b8e40c0feed7d63c85f182ae57
parent67847538148ed956aaa14a07a77902fb991445f2 (diff)
downloadexternal_llvm-c7b8814bb4f2e6052060d6118d3bc3b66f5c5b0b.zip
external_llvm-c7b8814bb4f2e6052060d6118d3bc3b66f5c5b0b.tar.gz
external_llvm-c7b8814bb4f2e6052060d6118d3bc3b66f5c5b0b.tar.bz2
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
-rw-r--r--include/llvm/MC/MCAsmInfo.h6
-rw-r--r--include/llvm/MC/MCAsmInfoCOFF.h2
-rw-r--r--include/llvm/MC/MCAsmInfoDarwin.h2
-rw-r--r--lib/MC/MCAsmInfo.cpp3
-rw-r--r--lib/MC/MCAsmInfoCOFF.cpp2
-rw-r--r--lib/MC/MCAsmInfoDarwin.cpp3
-rw-r--r--lib/Target/ARM/ARMMCAsmInfo.cpp4
-rw-r--r--lib/Target/Alpha/AlphaMCAsmInfo.cpp3
-rw-r--r--lib/Target/Blackfin/BlackfinMCAsmInfo.cpp3
-rw-r--r--lib/Target/CBackend/CBackend.cpp4
-rw-r--r--lib/Target/CellSPU/SPUMCAsmInfo.cpp3
-rw-r--r--lib/Target/MSP430/MSP430MCAsmInfo.cpp3
-rw-r--r--lib/Target/Mips/MipsMCAsmInfo.cpp3
-rw-r--r--lib/Target/Mips/MipsMCAsmInfo.h18
-rw-r--r--lib/Target/Mips/MipsTargetMachine.cpp7
-rw-r--r--lib/Target/PIC16/PIC16MCAsmInfo.cpp3
-rw-r--r--lib/Target/PowerPC/PPCMCAsmInfo.cpp4
-rw-r--r--lib/Target/Sparc/SparcMCAsmInfo.cpp3
-rw-r--r--lib/Target/SystemZ/SystemZMCAsmInfo.cpp3
-rw-r--r--lib/Target/X86/X86MCAsmInfo.cpp12
-rw-r--r--lib/Target/XCore/XCoreMCAsmInfo.cpp3
21 files changed, 63 insertions, 31 deletions
diff --git a/include/llvm/MC/MCAsmInfo.h b/include/llvm/MC/MCAsmInfo.h
index 0be2753..7ca7ecb 100644
--- a/include/llvm/MC/MCAsmInfo.h
+++ b/include/llvm/MC/MCAsmInfo.h
@@ -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);
diff --git a/include/llvm/MC/MCAsmInfoCOFF.h b/include/llvm/MC/MCAsmInfoCOFF.h
index a3ee159..97e9aee 100644
--- a/include/llvm/MC/MCAsmInfoCOFF.h
+++ b/include/llvm/MC/MCAsmInfoCOFF.h
@@ -15,7 +15,7 @@
namespace llvm {
class MCAsmInfoCOFF : public MCAsmInfo {
protected:
- explicit MCAsmInfoCOFF();
+ explicit MCAsmInfoCOFF(bool isLittleEndian);
};
}
diff --git a/include/llvm/MC/MCAsmInfoDarwin.h b/include/llvm/MC/MCAsmInfoDarwin.h
index c85aa3d..f5e897d 100644
--- a/include/llvm/MC/MCAsmInfoDarwin.h
+++ b/include/llvm/MC/MCAsmInfoDarwin.h
@@ -24,7 +24,7 @@ namespace llvm {
class Mangler;
struct MCAsmInfoDarwin : public MCAsmInfo {
- explicit MCAsmInfoDarwin();
+ explicit MCAsmInfoDarwin(bool isLittleEndian);
};
}
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 @@ 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 = "@";
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 @@ 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
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 @@ 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
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 @@ 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;
}
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 @@ PPCMCAsmInfoDarwin::PPCMCAsmInfoDarwin(bool is64Bit) {
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 @@ 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;
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";