revert 93934, removing the MCAsmInfo endianness bit. I can't

stomache MCAsmInfo having this, and I found a better solution to
this layering issue.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93985 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2010-01-20 06:34:14 +00:00
parent 6f8694b272
commit 8eeba35bab
21 changed files with 31 additions and 63 deletions

View File

@ -24,7 +24,6 @@ namespace llvm {
namespace ExceptionHandling { enum ExceptionsType { None, Dwarf, SjLj }; } namespace ExceptionHandling { enum ExceptionsType { None, Dwarf, SjLj }; }
class MCAsmInfo { class MCAsmInfo {
bool IsLittleEndian;
protected: protected:
//===------------------------------------------------------------------===// //===------------------------------------------------------------------===//
// Properties to be set by the target writer, used to configure asm printer. // Properties to be set by the target writer, used to configure asm printer.
@ -286,12 +285,9 @@ namespace llvm {
const char *const *AsmTransCBE; // Defaults to empty const char *const *AsmTransCBE; // Defaults to empty
public: public:
explicit MCAsmInfo(bool isLittleEndian); explicit MCAsmInfo();
virtual ~MCAsmInfo(); virtual ~MCAsmInfo();
bool isLittleEndian() const { return IsLittleEndian; }
bool isBigEndian() const { return !IsLittleEndian; }
/// getSLEB128Size - Compute the number of bytes required for a signed /// getSLEB128Size - Compute the number of bytes required for a signed
/// leb128 value. /// leb128 value.
static unsigned getSLEB128Size(int Value); static unsigned getSLEB128Size(int Value);

View File

@ -15,7 +15,7 @@
namespace llvm { namespace llvm {
class MCAsmInfoCOFF : public MCAsmInfo { class MCAsmInfoCOFF : public MCAsmInfo {
protected: protected:
explicit MCAsmInfoCOFF(bool isLittleEndian); explicit MCAsmInfoCOFF();
}; };
} }

View File

@ -24,7 +24,7 @@ namespace llvm {
class Mangler; class Mangler;
struct MCAsmInfoDarwin : public MCAsmInfo { struct MCAsmInfoDarwin : public MCAsmInfo {
explicit MCAsmInfoDarwin(bool isLittleEndian); explicit MCAsmInfoDarwin();
}; };
} }

View File

@ -18,8 +18,7 @@
#include <cstring> #include <cstring>
using namespace llvm; using namespace llvm;
MCAsmInfo::MCAsmInfo(bool isLittleEndian) { MCAsmInfo::MCAsmInfo() {
IsLittleEndian = isLittleEndian;
HasMachoZeroFillDirective = false; HasMachoZeroFillDirective = false;
HasStaticCtorDtorReferenceInStaticMode = false; HasStaticCtorDtorReferenceInStaticMode = false;
NonexecutableStackDirective = 0; NonexecutableStackDirective = 0;

View File

@ -16,7 +16,7 @@
#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/SmallVector.h"
using namespace llvm; using namespace llvm;
MCAsmInfoCOFF::MCAsmInfoCOFF(bool isLittleEndian) : MCAsmInfo(isLittleEndian) { MCAsmInfoCOFF::MCAsmInfoCOFF() {
GlobalPrefix = "_"; GlobalPrefix = "_";
LCOMMDirective = "\t.lcomm\t"; LCOMMDirective = "\t.lcomm\t";
COMMDirectiveTakesAlignment = false; COMMDirectiveTakesAlignment = false;

View File

@ -15,8 +15,7 @@
#include "llvm/MC/MCAsmInfoDarwin.h" #include "llvm/MC/MCAsmInfoDarwin.h"
using namespace llvm; using namespace llvm;
MCAsmInfoDarwin::MCAsmInfoDarwin(bool isLittleEndian) MCAsmInfoDarwin::MCAsmInfoDarwin() {
: MCAsmInfo(isLittleEndian) {
// Common settings for all Darwin targets. // Common settings for all Darwin targets.
// Syntax: // Syntax:
GlobalPrefix = "_"; GlobalPrefix = "_";

View File

@ -40,7 +40,7 @@ static const char *const arm_asm_table[] = {
0,0 0,0
}; };
ARMMCAsmInfoDarwin::ARMMCAsmInfoDarwin() : MCAsmInfoDarwin(true) { ARMMCAsmInfoDarwin::ARMMCAsmInfoDarwin() {
AsmTransCBE = arm_asm_table; AsmTransCBE = arm_asm_table;
Data64bitsDirective = 0; Data64bitsDirective = 0;
CommentString = "@"; CommentString = "@";
@ -52,7 +52,7 @@ ARMMCAsmInfoDarwin::ARMMCAsmInfoDarwin() : MCAsmInfoDarwin(true) {
AbsoluteEHSectionOffsets = false; AbsoluteEHSectionOffsets = false;
} }
ARMELFMCAsmInfo::ARMELFMCAsmInfo() : MCAsmInfo(true) { ARMELFMCAsmInfo::ARMELFMCAsmInfo() {
AlignmentIsInBytes = false; AlignmentIsInBytes = false;
Data64bitsDirective = 0; Data64bitsDirective = 0;
CommentString = "@"; CommentString = "@";

View File

@ -14,8 +14,7 @@
#include "AlphaMCAsmInfo.h" #include "AlphaMCAsmInfo.h"
using namespace llvm; using namespace llvm;
AlphaMCAsmInfo::AlphaMCAsmInfo(const Target &T, const StringRef &TT) AlphaMCAsmInfo::AlphaMCAsmInfo(const Target &T, const StringRef &TT) {
: MCAsmInfo(true) {
AlignmentIsInBytes = false; AlignmentIsInBytes = false;
PrivateGlobalPrefix = "$"; PrivateGlobalPrefix = "$";
PICJumpTableDirective = ".gprel32"; PICJumpTableDirective = ".gprel32";

View File

@ -15,8 +15,7 @@
using namespace llvm; using namespace llvm;
BlackfinMCAsmInfo::BlackfinMCAsmInfo(const Target &T, const StringRef &TT) BlackfinMCAsmInfo::BlackfinMCAsmInfo(const Target &T, const StringRef &TT) {
: MCAsmInfo(true) {
GlobalPrefix = "_"; GlobalPrefix = "_";
CommentString = "//"; CommentString = "//";
} }

View File

@ -60,7 +60,7 @@ extern "C" void LLVMInitializeCBackendTarget() {
namespace { namespace {
class CBEMCAsmInfo : public MCAsmInfo { class CBEMCAsmInfo : public MCAsmInfo {
public: public:
CBEMCAsmInfo(bool isLE) : MCAsmInfo(isLE) { CBEMCAsmInfo() {
GlobalPrefix = ""; GlobalPrefix = "";
PrivateGlobalPrefix = ""; PrivateGlobalPrefix = "";
} }
@ -1893,7 +1893,7 @@ bool CWriter::doInitialization(Module &M) {
if (const Target *Match = TargetRegistry::lookupTarget(Triple, E)) if (const Target *Match = TargetRegistry::lookupTarget(Triple, E))
TAsm = Match->createAsmInfo(Triple); TAsm = Match->createAsmInfo(Triple);
#endif #endif
TAsm = new CBEMCAsmInfo(TD->isLittleEndian()); TAsm = new CBEMCAsmInfo();
Mang = new Mangler(*TAsm); Mang = new Mangler(*TAsm);
// Keep track of which functions are static ctors/dtors so they can have // Keep track of which functions are static ctors/dtors so they can have

View File

@ -14,8 +14,7 @@
#include "SPUMCAsmInfo.h" #include "SPUMCAsmInfo.h"
using namespace llvm; 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"; ZeroDirective = "\t.space\t";
SetDirective = "\t.set"; SetDirective = "\t.set";
Data64bitsDirective = "\t.quad\t"; Data64bitsDirective = "\t.quad\t";

View File

@ -14,8 +14,7 @@
#include "MSP430MCAsmInfo.h" #include "MSP430MCAsmInfo.h"
using namespace llvm; using namespace llvm;
MSP430MCAsmInfo::MSP430MCAsmInfo(const Target &T, const StringRef &TT) : MSP430MCAsmInfo::MSP430MCAsmInfo(const Target &T, const StringRef &TT) {
MCAsmInfo(true) {
PrivateGlobalPrefix = ".L"; PrivateGlobalPrefix = ".L";
WeakRefDirective ="\t.weak\t"; WeakRefDirective ="\t.weak\t";
SetDirective = "\t.set\t"; SetDirective = "\t.set\t";

View File

@ -14,8 +14,7 @@
#include "MipsMCAsmInfo.h" #include "MipsMCAsmInfo.h"
using namespace llvm; 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; AlignmentIsInBytes = false;
COMMDirectiveTakesAlignment = true; COMMDirectiveTakesAlignment = true;
Data16bitsDirective = "\t.half\t"; Data16bitsDirective = "\t.half\t";

View File

@ -22,23 +22,9 @@ namespace llvm {
class MipsMCAsmInfo : public MCAsmInfo { class MipsMCAsmInfo : public MCAsmInfo {
public: 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 } // namespace llvm
#endif #endif

View File

@ -22,8 +22,8 @@ extern "C" void LLVMInitializeMipsTarget() {
// Register the target. // Register the target.
RegisterTargetMachine<MipsTargetMachine> X(TheMipsTarget); RegisterTargetMachine<MipsTargetMachine> X(TheMipsTarget);
RegisterTargetMachine<MipselTargetMachine> Y(TheMipselTarget); RegisterTargetMachine<MipselTargetMachine> Y(TheMipselTarget);
RegisterAsmInfo<MipsBEMCAsmInfo> A(TheMipsTarget); RegisterAsmInfo<MipsMCAsmInfo> A(TheMipsTarget);
RegisterAsmInfo<MipsLEMCAsmInfo> B(TheMipselTarget); RegisterAsmInfo<MipsMCAsmInfo> B(TheMipselTarget);
} }
// DataLayout --> Big-endian, 32-bit pointer/ABI/alignment // DataLayout --> Big-endian, 32-bit pointer/ABI/alignment
@ -60,7 +60,8 @@ MipselTargetMachine(const Target &T, const std::string &TT,
// Install an instruction selector pass using // Install an instruction selector pass using
// the ISelDag to gen Mips code. // the ISelDag to gen Mips code.
bool MipsTargetMachine:: bool MipsTargetMachine::
addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel) { addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel)
{
PM.add(createMipsISelDag(*this)); PM.add(createMipsISelDag(*this));
return false; return false;
} }

View File

@ -20,8 +20,7 @@
#include "PIC16ISelLowering.h" #include "PIC16ISelLowering.h"
using namespace llvm; using namespace llvm;
PIC16MCAsmInfo::PIC16MCAsmInfo(const Target &T, const StringRef &TT) PIC16MCAsmInfo::PIC16MCAsmInfo(const Target &T, const StringRef &TT) {
: MCAsmInfo(true) {
CommentString = ";"; CommentString = ";";
GlobalPrefix = PAN::getTagName(PAN::PREFIX_SYMBOL); GlobalPrefix = PAN::getTagName(PAN::PREFIX_SYMBOL);
GlobalDirective = "\tglobal\t"; GlobalDirective = "\tglobal\t";

View File

@ -14,7 +14,7 @@
#include "PPCMCAsmInfo.h" #include "PPCMCAsmInfo.h"
using namespace llvm; using namespace llvm;
PPCMCAsmInfoDarwin::PPCMCAsmInfoDarwin(bool is64Bit) : MCAsmInfoDarwin(false) { PPCMCAsmInfoDarwin::PPCMCAsmInfoDarwin(bool is64Bit) {
PCSymbol = "."; PCSymbol = ".";
CommentString = ";"; CommentString = ";";
ExceptionsType = ExceptionHandling::Dwarf; ExceptionsType = ExceptionHandling::Dwarf;
@ -25,7 +25,7 @@ PPCMCAsmInfoDarwin::PPCMCAsmInfoDarwin(bool is64Bit) : MCAsmInfoDarwin(false) {
SupportsDebugInformation= true; // Debug information. SupportsDebugInformation= true; // Debug information.
} }
PPCLinuxMCAsmInfo::PPCLinuxMCAsmInfo(bool is64Bit) : MCAsmInfo(false) { PPCLinuxMCAsmInfo::PPCLinuxMCAsmInfo(bool is64Bit) {
CommentString = "#"; CommentString = "#";
GlobalPrefix = ""; GlobalPrefix = "";
PrivateGlobalPrefix = ".L"; PrivateGlobalPrefix = ".L";

View File

@ -15,8 +15,7 @@
#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/SmallVector.h"
using namespace llvm; 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"; Data16bitsDirective = "\t.half\t";
Data32bitsDirective = "\t.word\t"; Data32bitsDirective = "\t.word\t";
Data64bitsDirective = 0; // .xword is only supported by V9. Data64bitsDirective = 0; // .xword is only supported by V9.

View File

@ -14,8 +14,7 @@
#include "SystemZMCAsmInfo.h" #include "SystemZMCAsmInfo.h"
using namespace llvm; using namespace llvm;
SystemZMCAsmInfo::SystemZMCAsmInfo(const Target &T, const StringRef &TT) SystemZMCAsmInfo::SystemZMCAsmInfo(const Target &T, const StringRef &TT) {
: MCAsmInfo(false) {
AlignmentIsInBytes = true; AlignmentIsInBytes = true;
PrivateGlobalPrefix = ".L"; PrivateGlobalPrefix = ".L";

View File

@ -43,8 +43,7 @@ static const char *const x86_asm_table[] = {
"{cc}", "cc", "{cc}", "cc",
0,0}; 0,0};
X86MCAsmInfoDarwin::X86MCAsmInfoDarwin(const Triple &Triple) X86MCAsmInfoDarwin::X86MCAsmInfoDarwin(const Triple &Triple) {
: MCAsmInfoDarwin(true /*islittleendian*/) {
AsmTransCBE = x86_asm_table; AsmTransCBE = x86_asm_table;
AssemblerDialect = AsmWriterFlavor; AssemblerDialect = AsmWriterFlavor;
@ -69,8 +68,7 @@ X86MCAsmInfoDarwin::X86MCAsmInfoDarwin(const Triple &Triple)
AbsoluteEHSectionOffsets = false; AbsoluteEHSectionOffsets = false;
} }
X86ELFMCAsmInfo::X86ELFMCAsmInfo(const Triple &Triple) X86ELFMCAsmInfo::X86ELFMCAsmInfo(const Triple &Triple) {
: MCAsmInfo(true /*islittleendian*/) {
AsmTransCBE = x86_asm_table; AsmTransCBE = x86_asm_table;
AssemblerDialect = AsmWriterFlavor; AssemblerDialect = AsmWriterFlavor;
@ -95,15 +93,13 @@ X86ELFMCAsmInfo::X86ELFMCAsmInfo(const Triple &Triple)
NonexecutableStackDirective = "\t.section\t.note.GNU-stack,\"\",@progbits"; 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; AsmTransCBE = x86_asm_table;
AssemblerDialect = AsmWriterFlavor; AssemblerDialect = AsmWriterFlavor;
} }
X86WinMCAsmInfo::X86WinMCAsmInfo(const Triple &Triple) X86WinMCAsmInfo::X86WinMCAsmInfo(const Triple &Triple) {
: MCAsmInfo(true /*islittleendian*/) {
AsmTransCBE = x86_asm_table; AsmTransCBE = x86_asm_table;
AssemblerDialect = AsmWriterFlavor; AssemblerDialect = AsmWriterFlavor;

View File

@ -10,8 +10,7 @@
#include "XCoreMCAsmInfo.h" #include "XCoreMCAsmInfo.h"
using namespace llvm; using namespace llvm;
XCoreMCAsmInfo::XCoreMCAsmInfo(const Target &T, const StringRef &TT) XCoreMCAsmInfo::XCoreMCAsmInfo(const Target &T, const StringRef &TT) {
: MCAsmInfo(true) {
SupportsDebugInformation = true; SupportsDebugInformation = true;
Data16bitsDirective = "\t.short\t"; Data16bitsDirective = "\t.short\t";
Data32bitsDirective = "\t.long\t"; Data32bitsDirective = "\t.long\t";