1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

move mangler quote handling from asm printers to TargetAsmInfo.

llvm-svn: 73738
This commit is contained in:
Chris Lattner 2009-06-18 23:41:35 +00:00
parent fea7aa45b7
commit 6cd267dcc5
9 changed files with 39 additions and 38 deletions

View File

@ -278,6 +278,10 @@ namespace llvm {
/// use '\1' as the first character.
const char *StringConstantPrefix; // Defaults to ".str"
/// AllowQuotesInName - This is true if the assembler allows for complex
/// symbol names to be surrounded in quotes. This defaults to false.
bool AllowQuotesInName;
//===--- Data Emission Directives -------------------------------------===//
/// ZeroDirective - this should be set to the directive used to get some
@ -745,6 +749,9 @@ namespace llvm {
const char *getStringConstantPrefix() const {
return StringConstantPrefix;
}
bool doesAllowQuotesInName() const {
return AllowQuotesInName;
}
const char *getZeroDirective() const {
return ZeroDirective;
}

View File

@ -152,6 +152,9 @@ void AsmPrinter::getAnalysisUsage(AnalysisUsage &AU) const {
bool AsmPrinter::doInitialization(Module &M) {
Mang = new Mangler(M, TAI->getGlobalPrefix(), TAI->getPrivateGlobalPrefix());
if (TAI->doesAllowQuotesInName())
Mang->setUseQuotes(true);
GCModuleInfo *MI = getAnalysisIfAvailable<GCModuleInfo>();
assert(MI && "AsmPrinter didn't require GCModuleInfo?");

View File

@ -17,31 +17,31 @@
#include <cctype>
using namespace llvm;
const char *const llvm::arm_asm_table[] = {
"{r0}", "r0",
"{r1}", "r1",
"{r2}", "r2",
"{r3}", "r3",
"{r4}", "r4",
"{r5}", "r5",
"{r6}", "r6",
"{r7}", "r7",
"{r8}", "r8",
"{r9}", "r9",
"{r10}", "r10",
"{r11}", "r11",
"{r12}", "r12",
"{r13}", "r13",
"{r14}", "r14",
"{lr}", "lr",
"{sp}", "sp",
"{ip}", "ip",
"{fp}", "fp",
"{sl}", "sl",
"{memory}", "memory",
"{cc}", "cc",
0,0};
"{r0}", "r0",
"{r1}", "r1",
"{r2}", "r2",
"{r3}", "r3",
"{r4}", "r4",
"{r5}", "r5",
"{r6}", "r6",
"{r7}", "r7",
"{r8}", "r8",
"{r9}", "r9",
"{r10}", "r10",
"{r11}", "r11",
"{r12}", "r12",
"{r13}", "r13",
"{r14}", "r14",
"{lr}", "lr",
"{sp}", "sp",
"{ip}", "ip",
"{fp}", "fp",
"{sl}", "sl",
"{memory}", "memory",
"{cc}", "cc",
0,0
};
ARMDarwinTargetAsmInfo::ARMDarwinTargetAsmInfo(const ARMTargetMachine &TM):
ARMTargetAsmInfo<DarwinTargetAsmInfo>(TM) {
@ -64,6 +64,8 @@ ARMDarwinTargetAsmInfo::ARMDarwinTargetAsmInfo(const ARMTargetMachine &TM):
HasDotTypeDotSizeDirective = false;
HasSingleParameterDotFile = false;
NeedsIndirectEncoding = true;
AllowQuotesInName = true;
if (TM.getRelocationModel() == Reloc::Static) {
StaticCtorsSection = ".constructor";
StaticDtorsSection = ".destructor";

View File

@ -836,10 +836,6 @@ bool ARMAsmPrinter::doInitialization(Module &M) {
assert(DW && "Dwarf Writer is not available");
DW->BeginModule(&M, MMI, O, this, TAI);
// Darwin wants symbols to be quoted if they have complex names.
if (Subtarget->isTargetDarwin())
Mang->setUseQuotes(true);
// Thumb-2 instructions are supported only in unified assembler syntax mode.
if (Subtarget->hasThumb2())
O << "\t.syntax unified\n";

View File

@ -654,9 +654,6 @@ bool PPCLinuxAsmPrinter::doInitialization(Module &M) {
assert(DW && "DwarfWriter is not available");
DW->BeginModule(&M, MMI, O, this, TAI);
// GNU as handles section names wrapped in quotes
Mang->setUseQuotes(true);
SwitchToSection(TAI->getTextSection());
return Result;
@ -885,9 +882,6 @@ bool PPCDarwinAsmPrinter::doInitialization(Module &M) {
assert(DW && "DwarfWriter is not available");
DW->BeginModule(&M, MMI, O, this, TAI);
// Darwin wants symbols to be quoted if they have complex names.
Mang->setUseQuotes(true);
// Prime text sections so they are adjacent. This reduces the likelihood a
// large data or debug section causes a branch to exceed 16M limit.
SwitchToTextSection("\t.section __TEXT,__textcoal_nt,coalesced,"

View File

@ -45,6 +45,7 @@ PPCDarwinTargetAsmInfo::PPCDarwinTargetAsmInfo(const PPCTargetMachine &TM):
HiddenDirective = "\t.private_extern ";
SupportsExceptionHandling = true;
NeedsIndirectEncoding = true;
AllowQuotesInName = true;
NeedsSet = true;
BSSSection = 0;

View File

@ -58,6 +58,7 @@ void TargetAsmInfo::fillDefaultValues() {
InlineAsmEnd = "#NO_APP";
AssemblerDialect = 0;
StringConstantPrefix = ".str";
AllowQuotesInName = false;
ZeroDirective = "\t.zero\t";
ZeroDirectiveSuffix = 0;
AsciiDirective = "\t.ascii\t";

View File

@ -781,10 +781,6 @@ bool X86ATTAsmPrinter::doInitialization(Module &M) {
DW->BeginModule(&M, MMI, O, this, TAI);
}
// Darwin wants symbols to be quoted if they have complex names.
if (Subtarget->isTargetDarwin())
Mang->setUseQuotes(true);
return Result;
}

View File

@ -86,6 +86,7 @@ X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(const X86TargetMachine &TM):
PersonalitySuffix = "$non_lazy_ptr";
}
NeedsIndirectEncoding = true;
AllowQuotesInName = true;
InlineAsmStart = "## InlineAsm Start";
InlineAsmEnd = "## InlineAsm End";
CommentString = "##";