mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
Allow target to specify prefix for labels
Use the MCAsmInfo instead of the DataLayout, and allow specifying a custom prefix for labels specifically. HSAIL requires that labels begin with @, but global symbols with &. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223323 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5862c2af3e
commit
459e595697
@ -123,6 +123,10 @@ protected:
|
||||
/// file. Defaults to "L"
|
||||
const char *PrivateGlobalPrefix;
|
||||
|
||||
/// This prefix is used for labels for basic blocks. Defaults to the same as
|
||||
/// PrivateGlobalPrefix.
|
||||
const char *PrivateLabelPrefix;
|
||||
|
||||
/// This prefix is used for symbols that should be passed through the
|
||||
/// assembler but be removed by the linker. This is 'l' on Darwin, currently
|
||||
/// used for some ObjC metadata. The default of "" meast that for this system
|
||||
@ -418,6 +422,7 @@ public:
|
||||
|
||||
bool useAssignmentForEHBegin() const { return UseAssignmentForEHBegin; }
|
||||
const char *getPrivateGlobalPrefix() const { return PrivateGlobalPrefix; }
|
||||
const char *getPrivateLabelPrefix() const { return PrivateLabelPrefix; }
|
||||
bool hasLinkerPrivateGlobalPrefix() const {
|
||||
return LinkerPrivateGlobalPrefix[0] != '\0';
|
||||
}
|
||||
|
@ -54,9 +54,7 @@ MCSymbol *MachineBasicBlock::getSymbol() const {
|
||||
if (!CachedMCSymbol) {
|
||||
const MachineFunction *MF = getParent();
|
||||
MCContext &Ctx = MF->getContext();
|
||||
const TargetMachine &TM = MF->getTarget();
|
||||
const char *Prefix =
|
||||
TM.getSubtargetImpl()->getDataLayout()->getPrivateGlobalPrefix();
|
||||
const char *Prefix = Ctx.getAsmInfo()->getPrivateLabelPrefix();
|
||||
CachedMCSymbol = Ctx.GetOrCreateSymbol(Twine(Prefix) + "BB" +
|
||||
Twine(MF->getFunctionNumber()) +
|
||||
"_" + Twine(getNumber()));
|
||||
|
@ -40,6 +40,7 @@ MCAsmInfo::MCAsmInfo() {
|
||||
LabelSuffix = ":";
|
||||
UseAssignmentForEHBegin = false;
|
||||
PrivateGlobalPrefix = "L";
|
||||
PrivateLabelPrefix = PrivateGlobalPrefix;
|
||||
LinkerPrivateGlobalPrefix = "";
|
||||
InlineAsmStart = "APP";
|
||||
InlineAsmEnd = "NO_APP";
|
||||
|
@ -30,4 +30,5 @@ MCAsmInfoELF::MCAsmInfoELF() {
|
||||
HasIdentDirective = true;
|
||||
WeakRefDirective = "\t.weak\t";
|
||||
PrivateGlobalPrefix = ".L";
|
||||
PrivateLabelPrefix = ".L";
|
||||
}
|
||||
|
@ -4662,7 +4662,7 @@ bool AsmParser::parseMSInlineAsm(
|
||||
OS << "$$";
|
||||
break;
|
||||
case AOK_Label:
|
||||
OS << Ctx.getAsmInfo()->getPrivateGlobalPrefix() << AR.Label;
|
||||
OS << Ctx.getAsmInfo()->getPrivateLabelPrefix() << AR.Label;
|
||||
break;
|
||||
case AOK_Input:
|
||||
OS << '$' << InputIdx++;
|
||||
|
@ -37,6 +37,7 @@ AArch64MCAsmInfoDarwin::AArch64MCAsmInfoDarwin() {
|
||||
AssemblerDialect = AsmWriterVariant == Default ? 1 : AsmWriterVariant;
|
||||
|
||||
PrivateGlobalPrefix = "L";
|
||||
PrivateLabelPrefix = "L";
|
||||
SeparatorString = "%%";
|
||||
CommentString = ";";
|
||||
PointerSize = CalleeSaveStackSlotSize = 8;
|
||||
@ -79,6 +80,7 @@ AArch64MCAsmInfoELF::AArch64MCAsmInfoELF(StringRef TT) {
|
||||
|
||||
CommentString = "//";
|
||||
PrivateGlobalPrefix = ".L";
|
||||
PrivateLabelPrefix = ".L";
|
||||
Code32Directive = ".code\t32";
|
||||
|
||||
Data16bitsDirective = "\t.hword\t";
|
||||
|
@ -89,6 +89,7 @@ ARMCOFFMCAsmInfoMicrosoft::ARMCOFFMCAsmInfoMicrosoft() {
|
||||
AlignmentIsInBytes = false;
|
||||
|
||||
PrivateGlobalPrefix = "$M";
|
||||
PrivateLabelPrefix = "$M";
|
||||
}
|
||||
|
||||
void ARMCOFFMCAsmInfoGNU::anchor() { }
|
||||
@ -101,6 +102,7 @@ ARMCOFFMCAsmInfoGNU::ARMCOFFMCAsmInfoGNU() {
|
||||
Code16Directive = ".code\t16";
|
||||
Code32Directive = ".code\t32";
|
||||
PrivateGlobalPrefix = ".L";
|
||||
PrivateLabelPrefix = ".L";
|
||||
|
||||
SupportsDebugInformation = true;
|
||||
ExceptionsType = ExceptionHandling::None;
|
||||
|
@ -34,6 +34,7 @@ MipsMCAsmInfo::MipsMCAsmInfo(StringRef TT) {
|
||||
Data32bitsDirective = "\t.4byte\t";
|
||||
Data64bitsDirective = "\t.8byte\t";
|
||||
PrivateGlobalPrefix = "$";
|
||||
PrivateLabelPrefix = "$";
|
||||
CommentString = "#";
|
||||
ZeroDirective = "\t.space\t";
|
||||
GPRel32Directive = "\t.gpword\t";
|
||||
|
@ -17,6 +17,8 @@ AMDGPUMCAsmInfo::AMDGPUMCAsmInfo(StringRef &TT) : MCAsmInfoELF() {
|
||||
MaxInstLength = 16;
|
||||
SeparatorString = "\n";
|
||||
CommentString = ";";
|
||||
PrivateGlobalPrefix = "";
|
||||
PrivateLabelPrefix = "";
|
||||
InlineAsmStart = ";#ASMSTART";
|
||||
InlineAsmEnd = ";#ASMEND";
|
||||
|
||||
|
@ -134,6 +134,7 @@ void X86MCAsmInfoMicrosoft::anchor() { }
|
||||
X86MCAsmInfoMicrosoft::X86MCAsmInfoMicrosoft(const Triple &Triple) {
|
||||
if (Triple.getArch() == Triple::x86_64) {
|
||||
PrivateGlobalPrefix = ".L";
|
||||
PrivateLabelPrefix = ".L";
|
||||
PointerSize = 8;
|
||||
WinEHEncodingType = WinEH::EncodingType::Itanium;
|
||||
ExceptionsType = ExceptionHandling::ItaniumWinEH;
|
||||
@ -154,6 +155,7 @@ X86MCAsmInfoGNUCOFF::X86MCAsmInfoGNUCOFF(const Triple &Triple) {
|
||||
assert(Triple.isOSWindows() && "Windows is the only supported COFF target");
|
||||
if (Triple.getArch() == Triple::x86_64) {
|
||||
PrivateGlobalPrefix = ".L";
|
||||
PrivateLabelPrefix = ".L";
|
||||
PointerSize = 8;
|
||||
WinEHEncodingType = WinEH::EncodingType::Itanium;
|
||||
ExceptionsType = ExceptionHandling::ItaniumWinEH;
|
||||
|
Loading…
Reference in New Issue
Block a user