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.
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);
namespace llvm {
class MCAsmInfoCOFF : public MCAsmInfo {
protected:
- explicit MCAsmInfoCOFF();
+ explicit MCAsmInfoCOFF(bool isLittleEndian);
};
}
class Mangler;
struct MCAsmInfoDarwin : public MCAsmInfo {
- explicit MCAsmInfoDarwin();
+ explicit MCAsmInfoDarwin(bool isLittleEndian);
};
}
#include <cstring>
using namespace llvm;
-MCAsmInfo::MCAsmInfo() {
+MCAsmInfo::MCAsmInfo(bool isLittleEndian) {
+ IsLittleEndian = isLittleEndian;
HasMachoZeroFillDirective = false;
HasStaticCtorDtorReferenceInStaticMode = false;
NonexecutableStackDirective = 0;
#include "llvm/ADT/SmallVector.h"
using namespace llvm;
-MCAsmInfoCOFF::MCAsmInfoCOFF() {
+MCAsmInfoCOFF::MCAsmInfoCOFF(bool isLittleEndian) : MCAsmInfo(isLittleEndian) {
GlobalPrefix = "_";
LCOMMDirective = "\t.lcomm\t";
COMMDirectiveTakesAlignment = false;
#include "llvm/MC/MCAsmInfoDarwin.h"
using namespace llvm;
-MCAsmInfoDarwin::MCAsmInfoDarwin() {
+MCAsmInfoDarwin::MCAsmInfoDarwin(bool isLittleEndian)
+ : MCAsmInfo(isLittleEndian) {
// Common settings for all Darwin targets.
// Syntax:
GlobalPrefix = "_";
0,0
};
-ARMMCAsmInfoDarwin::ARMMCAsmInfoDarwin() {
+ARMMCAsmInfoDarwin::ARMMCAsmInfoDarwin() : MCAsmInfoDarwin(true) {
AsmTransCBE = arm_asm_table;
Data64bitsDirective = 0;
CommentString = "@";
AbsoluteEHSectionOffsets = false;
}
-ARMELFMCAsmInfo::ARMELFMCAsmInfo() {
+ARMELFMCAsmInfo::ARMELFMCAsmInfo() : MCAsmInfo(true) {
AlignmentIsInBytes = false;
Data64bitsDirective = 0;
CommentString = "@";
#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";
using namespace llvm;
-BlackfinMCAsmInfo::BlackfinMCAsmInfo(const Target &T, const StringRef &TT) {
+BlackfinMCAsmInfo::BlackfinMCAsmInfo(const Target &T, const StringRef &TT)
+: MCAsmInfo(true) {
GlobalPrefix = "_";
CommentString = "//";
}
namespace {
class CBEMCAsmInfo : public MCAsmInfo {
public:
- CBEMCAsmInfo() {
+ CBEMCAsmInfo(bool isLE) : MCAsmInfo(isLE) {
GlobalPrefix = "";
PrivateGlobalPrefix = "";
}
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
#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";
#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";
#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";
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
// 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
// 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;
}
#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";
#include "PPCMCAsmInfo.h"
using namespace llvm;
-PPCMCAsmInfoDarwin::PPCMCAsmInfoDarwin(bool is64Bit) {
+PPCMCAsmInfoDarwin::PPCMCAsmInfoDarwin(bool is64Bit) : MCAsmInfoDarwin(false) {
PCSymbol = ".";
CommentString = ";";
ExceptionsType = ExceptionHandling::Dwarf;
SupportsDebugInformation= true; // Debug information.
}
-PPCLinuxMCAsmInfo::PPCLinuxMCAsmInfo(bool is64Bit) {
+PPCLinuxMCAsmInfo::PPCLinuxMCAsmInfo(bool is64Bit) : MCAsmInfo(false) {
CommentString = "#";
GlobalPrefix = "";
PrivateGlobalPrefix = ".L";
#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.
#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";
"{cc}", "cc",
0,0};
-X86MCAsmInfoDarwin::X86MCAsmInfoDarwin(const Triple &Triple) {
+X86MCAsmInfoDarwin::X86MCAsmInfoDarwin(const Triple &Triple)
+ : MCAsmInfoDarwin(true /*islittleendian*/) {
AsmTransCBE = x86_asm_table;
AssemblerDialect = AsmWriterFlavor;
AbsoluteEHSectionOffsets = false;
}
-X86ELFMCAsmInfo::X86ELFMCAsmInfo(const Triple &Triple) {
+X86ELFMCAsmInfo::X86ELFMCAsmInfo(const Triple &Triple)
+ : MCAsmInfo(true /*islittleendian*/) {
AsmTransCBE = x86_asm_table;
AssemblerDialect = AsmWriterFlavor;
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;
#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";