File tree Expand file tree Collapse file tree 10 files changed +18
-4
lines changed Expand file tree Collapse file tree 10 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -123,6 +123,10 @@ class MCAsmInfo {
123123 // / file. Defaults to "L"
124124 const char *PrivateGlobalPrefix;
125125
126+ // / This prefix is used for labels for basic blocks. Defaults to the same as
127+ // / PrivateGlobalPrefix.
128+ const char *PrivateLabelPrefix;
129+
126130 // / This prefix is used for symbols that should be passed through the
127131 // / assembler but be removed by the linker. This is 'l' on Darwin, currently
128132 // / used for some ObjC metadata. The default of "" meast that for this system
@@ -418,6 +422,7 @@ class MCAsmInfo {
418422
419423 bool useAssignmentForEHBegin () const { return UseAssignmentForEHBegin; }
420424 const char *getPrivateGlobalPrefix () const { return PrivateGlobalPrefix; }
425+ const char *getPrivateLabelPrefix () const { return PrivateLabelPrefix; }
421426 bool hasLinkerPrivateGlobalPrefix () const {
422427 return LinkerPrivateGlobalPrefix[0 ] != ' \0 ' ;
423428 }
Original file line number Diff line number Diff line change @@ -54,9 +54,7 @@ MCSymbol *MachineBasicBlock::getSymbol() const {
5454 if (!CachedMCSymbol) {
5555 const MachineFunction *MF = getParent ();
5656 MCContext &Ctx = MF->getContext ();
57- const TargetMachine &TM = MF->getTarget ();
58- const char *Prefix =
59- TM.getSubtargetImpl ()->getDataLayout ()->getPrivateGlobalPrefix ();
57+ const char *Prefix = Ctx.getAsmInfo ()->getPrivateLabelPrefix ();
6058 CachedMCSymbol = Ctx.GetOrCreateSymbol (Twine (Prefix) + " BB" +
6159 Twine (MF->getFunctionNumber ()) +
6260 " _" + Twine (getNumber ()));
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ MCAsmInfo::MCAsmInfo() {
4040 LabelSuffix = " :" ;
4141 UseAssignmentForEHBegin = false ;
4242 PrivateGlobalPrefix = " L" ;
43+ PrivateLabelPrefix = PrivateGlobalPrefix;
4344 LinkerPrivateGlobalPrefix = " " ;
4445 InlineAsmStart = " APP" ;
4546 InlineAsmEnd = " NO_APP" ;
Original file line number Diff line number Diff line change @@ -30,4 +30,5 @@ MCAsmInfoELF::MCAsmInfoELF() {
3030 HasIdentDirective = true ;
3131 WeakRefDirective = " \t .weak\t " ;
3232 PrivateGlobalPrefix = " .L" ;
33+ PrivateLabelPrefix = " .L" ;
3334}
Original file line number Diff line number Diff line change @@ -4662,7 +4662,7 @@ bool AsmParser::parseMSInlineAsm(
46624662 OS << " $$" ;
46634663 break ;
46644664 case AOK_Label:
4665- OS << Ctx.getAsmInfo ()->getPrivateGlobalPrefix () << AR.Label ;
4665+ OS << Ctx.getAsmInfo ()->getPrivateLabelPrefix () << AR.Label ;
46664666 break ;
46674667 case AOK_Input:
46684668 OS << ' $' << InputIdx++;
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ AArch64MCAsmInfoDarwin::AArch64MCAsmInfoDarwin() {
3737 AssemblerDialect = AsmWriterVariant == Default ? 1 : AsmWriterVariant;
3838
3939 PrivateGlobalPrefix = " L" ;
40+ PrivateLabelPrefix = " L" ;
4041 SeparatorString = " %%" ;
4142 CommentString = " ;" ;
4243 PointerSize = CalleeSaveStackSlotSize = 8 ;
@@ -79,6 +80,7 @@ AArch64MCAsmInfoELF::AArch64MCAsmInfoELF(StringRef TT) {
7980
8081 CommentString = " //" ;
8182 PrivateGlobalPrefix = " .L" ;
83+ PrivateLabelPrefix = " .L" ;
8284 Code32Directive = " .code\t 32" ;
8385
8486 Data16bitsDirective = " \t .hword\t " ;
Original file line number Diff line number Diff line change @@ -89,6 +89,7 @@ ARMCOFFMCAsmInfoMicrosoft::ARMCOFFMCAsmInfoMicrosoft() {
8989 AlignmentIsInBytes = false ;
9090
9191 PrivateGlobalPrefix = " $M" ;
92+ PrivateLabelPrefix = " $M" ;
9293}
9394
9495void ARMCOFFMCAsmInfoGNU::anchor () { }
@@ -101,6 +102,7 @@ ARMCOFFMCAsmInfoGNU::ARMCOFFMCAsmInfoGNU() {
101102 Code16Directive = " .code\t 16" ;
102103 Code32Directive = " .code\t 32" ;
103104 PrivateGlobalPrefix = " .L" ;
105+ PrivateLabelPrefix = " .L" ;
104106
105107 SupportsDebugInformation = true ;
106108 ExceptionsType = ExceptionHandling::None;
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ MipsMCAsmInfo::MipsMCAsmInfo(StringRef TT) {
3434 Data32bitsDirective = " \t .4byte\t " ;
3535 Data64bitsDirective = " \t .8byte\t " ;
3636 PrivateGlobalPrefix = " $" ;
37+ PrivateLabelPrefix = " $" ;
3738 CommentString = " #" ;
3839 ZeroDirective = " \t .space\t " ;
3940 GPRel32Directive = " \t .gpword\t " ;
Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ AMDGPUMCAsmInfo::AMDGPUMCAsmInfo(StringRef &TT) : MCAsmInfoELF() {
1717 MaxInstLength = 16 ;
1818 SeparatorString = " \n " ;
1919 CommentString = " ;" ;
20+ PrivateGlobalPrefix = " " ;
21+ PrivateLabelPrefix = " " ;
2022 InlineAsmStart = " ;#ASMSTART" ;
2123 InlineAsmEnd = " ;#ASMEND" ;
2224
Original file line number Diff line number Diff line change @@ -134,6 +134,7 @@ void X86MCAsmInfoMicrosoft::anchor() { }
134134X86MCAsmInfoMicrosoft::X86MCAsmInfoMicrosoft (const Triple &Triple) {
135135 if (Triple.getArch () == Triple::x86_64) {
136136 PrivateGlobalPrefix = " .L" ;
137+ PrivateLabelPrefix = " .L" ;
137138 PointerSize = 8 ;
138139 WinEHEncodingType = WinEH::EncodingType::Itanium;
139140 ExceptionsType = ExceptionHandling::ItaniumWinEH;
@@ -154,6 +155,7 @@ X86MCAsmInfoGNUCOFF::X86MCAsmInfoGNUCOFF(const Triple &Triple) {
154155 assert (Triple.isOSWindows () && " Windows is the only supported COFF target" );
155156 if (Triple.getArch () == Triple::x86_64) {
156157 PrivateGlobalPrefix = " .L" ;
158+ PrivateLabelPrefix = " .L" ;
157159 PointerSize = 8 ;
158160 WinEHEncodingType = WinEH::EncodingType::Itanium;
159161 ExceptionsType = ExceptionHandling::ItaniumWinEH;
You can’t perform that action at this time.
0 commit comments