llvm.org GIT mirror llvm / 459e595
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 Matt Arsenault 5 years ago
10 changed file(s) with 18 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
122122 /// file. Defaults to "L"
123123 const char *PrivateGlobalPrefix;
124124
125 /// This prefix is used for labels for basic blocks. Defaults to the same as
126 /// PrivateGlobalPrefix.
127 const char *PrivateLabelPrefix;
128
125129 /// This prefix is used for symbols that should be passed through the
126130 /// assembler but be removed by the linker. This is 'l' on Darwin, currently
127131 /// used for some ObjC metadata. The default of "" meast that for this system
417421
418422 bool useAssignmentForEHBegin() const { return UseAssignmentForEHBegin; }
419423 const char *getPrivateGlobalPrefix() const { return PrivateGlobalPrefix; }
424 const char *getPrivateLabelPrefix() const { return PrivateLabelPrefix; }
420425 bool hasLinkerPrivateGlobalPrefix() const {
421426 return LinkerPrivateGlobalPrefix[0] != '\0';
422427 }
5353 if (!CachedMCSymbol) {
5454 const MachineFunction *MF = getParent();
5555 MCContext &Ctx = MF->getContext();
56 const TargetMachine &TM = MF->getTarget();
57 const char *Prefix =
58 TM.getSubtargetImpl()->getDataLayout()->getPrivateGlobalPrefix();
56 const char *Prefix = Ctx.getAsmInfo()->getPrivateLabelPrefix();
5957 CachedMCSymbol = Ctx.GetOrCreateSymbol(Twine(Prefix) + "BB" +
6058 Twine(MF->getFunctionNumber()) +
6159 "_" + Twine(getNumber()));
3939 LabelSuffix = ":";
4040 UseAssignmentForEHBegin = false;
4141 PrivateGlobalPrefix = "L";
42 PrivateLabelPrefix = PrivateGlobalPrefix;
4243 LinkerPrivateGlobalPrefix = "";
4344 InlineAsmStart = "APP";
4445 InlineAsmEnd = "NO_APP";
2929 HasIdentDirective = true;
3030 WeakRefDirective = "\t.weak\t";
3131 PrivateGlobalPrefix = ".L";
32 PrivateLabelPrefix = ".L";
3233 }
46614661 OS << "$$";
46624662 break;
46634663 case AOK_Label:
4664 OS << Ctx.getAsmInfo()->getPrivateGlobalPrefix() << AR.Label;
4664 OS << Ctx.getAsmInfo()->getPrivateLabelPrefix() << AR.Label;
46654665 break;
46664666 case AOK_Input:
46674667 OS << '$' << InputIdx++;
3636 AssemblerDialect = AsmWriterVariant == Default ? 1 : AsmWriterVariant;
3737
3838 PrivateGlobalPrefix = "L";
39 PrivateLabelPrefix = "L";
3940 SeparatorString = "%%";
4041 CommentString = ";";
4142 PointerSize = CalleeSaveStackSlotSize = 8;
7879
7980 CommentString = "//";
8081 PrivateGlobalPrefix = ".L";
82 PrivateLabelPrefix = ".L";
8183 Code32Directive = ".code\t32";
8284
8385 Data16bitsDirective = "\t.hword\t";
8888 AlignmentIsInBytes = false;
8989
9090 PrivateGlobalPrefix = "$M";
91 PrivateLabelPrefix = "$M";
9192 }
9293
9394 void ARMCOFFMCAsmInfoGNU::anchor() { }
100101 Code16Directive = ".code\t16";
101102 Code32Directive = ".code\t32";
102103 PrivateGlobalPrefix = ".L";
104 PrivateLabelPrefix = ".L";
103105
104106 SupportsDebugInformation = true;
105107 ExceptionsType = ExceptionHandling::None;
3333 Data32bitsDirective = "\t.4byte\t";
3434 Data64bitsDirective = "\t.8byte\t";
3535 PrivateGlobalPrefix = "$";
36 PrivateLabelPrefix = "$";
3637 CommentString = "#";
3738 ZeroDirective = "\t.space\t";
3839 GPRel32Directive = "\t.gpword\t";
1616 MaxInstLength = 16;
1717 SeparatorString = "\n";
1818 CommentString = ";";
19 PrivateGlobalPrefix = "";
20 PrivateLabelPrefix = "";
1921 InlineAsmStart = ";#ASMSTART";
2022 InlineAsmEnd = ";#ASMEND";
2123
133133 X86MCAsmInfoMicrosoft::X86MCAsmInfoMicrosoft(const Triple &Triple) {
134134 if (Triple.getArch() == Triple::x86_64) {
135135 PrivateGlobalPrefix = ".L";
136 PrivateLabelPrefix = ".L";
136137 PointerSize = 8;
137138 WinEHEncodingType = WinEH::EncodingType::Itanium;
138139 ExceptionsType = ExceptionHandling::ItaniumWinEH;
153154 assert(Triple.isOSWindows() && "Windows is the only supported COFF target");
154155 if (Triple.getArch() == Triple::x86_64) {
155156 PrivateGlobalPrefix = ".L";
157 PrivateLabelPrefix = ".L";
156158 PointerSize = 8;
157159 WinEHEncodingType = WinEH::EncodingType::Itanium;
158160 ExceptionsType = ExceptionHandling::ItaniumWinEH;