From e2b060161c92ddf60b5d020f981451e9e34a3f02 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 11 Aug 2009 22:39:40 +0000 Subject: [PATCH] Change the asmprinter to print the comment character before the "inlineasmstart/end" strings so that the contents of the directive are separate from the comment character. This lets elf targets get #APP/#NOAPP for free even if they don't use "#" as the comment character. This also allows hoisting the darwin stuff up to the shared TAI class. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78737 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 7 ++++--- lib/Target/ARM/ARMTargetAsmInfo.cpp | 5 ----- lib/Target/Blackfin/BlackfinTargetAsmInfo.cpp | 2 -- lib/Target/CellSPU/SPUTargetAsmInfo.cpp | 2 -- lib/Target/DarwinTargetAsmInfo.cpp | 2 ++ lib/Target/PowerPC/PPCTargetAsmInfo.cpp | 4 ---- lib/Target/TargetAsmInfo.cpp | 4 ++-- lib/Target/X86/X86TargetAsmInfo.cpp | 5 ----- 8 files changed, 8 insertions(+), 23 deletions(-) diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 50733e6cd53..55308967337 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -1336,11 +1336,12 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const { // If this asmstr is empty, just print the #APP/#NOAPP markers. // These are useful to see where empty asm's wound up. if (AsmStr[0] == 0) { - O << TAI->getInlineAsmStart() << "\n\t" << TAI->getInlineAsmEnd() << '\n'; + O << TAI->getCommentString() << TAI->getInlineAsmStart() << "\n\t"; + O << TAI->getCommentString() << TAI->getInlineAsmEnd() << '\n'; return; } - O << TAI->getInlineAsmStart() << "\n\t"; + O << TAI->getCommentString() << TAI->getInlineAsmStart() << "\n\t"; // The variant of the current asmprinter. int AsmPrinterVariant = TAI->getAssemblerDialect(); @@ -1511,7 +1512,7 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const { } } } - O << "\n\t" << TAI->getInlineAsmEnd() << '\n'; + O << "\n\t" << TAI->getCommentString() << TAI->getInlineAsmEnd() << '\n'; } /// printImplicitDef - This method prints the specified machine instruction diff --git a/lib/Target/ARM/ARMTargetAsmInfo.cpp b/lib/Target/ARM/ARMTargetAsmInfo.cpp index 85e9d6428eb..0c3df82bfe2 100644 --- a/lib/Target/ARM/ARMTargetAsmInfo.cpp +++ b/lib/Target/ARM/ARMTargetAsmInfo.cpp @@ -45,9 +45,6 @@ ARMDarwinTargetAsmInfo::ARMDarwinTargetAsmInfo() { Data64bitsDirective = 0; CommentString = "@"; COMMDirectiveTakesAlignment = false; - InlineAsmStart = "@ InlineAsm Start"; - InlineAsmEnd = "@ InlineAsm End"; - SupportsDebugInformation = true; // Exceptions handling @@ -60,8 +57,6 @@ ARMELFTargetAsmInfo::ARMELFTargetAsmInfo() { Data64bitsDirective = 0; CommentString = "@"; COMMDirectiveTakesAlignment = false; - InlineAsmStart = "@ InlineAsm Start"; - InlineAsmEnd = "@ InlineAsm End"; NeedsSet = false; HasLEB128 = true; diff --git a/lib/Target/Blackfin/BlackfinTargetAsmInfo.cpp b/lib/Target/Blackfin/BlackfinTargetAsmInfo.cpp index 8dcb44be501..3ab02d8c51f 100644 --- a/lib/Target/Blackfin/BlackfinTargetAsmInfo.cpp +++ b/lib/Target/Blackfin/BlackfinTargetAsmInfo.cpp @@ -18,6 +18,4 @@ using namespace llvm; BlackfinTargetAsmInfo::BlackfinTargetAsmInfo() { GlobalPrefix = "_"; CommentString = "//"; - InlineAsmStart = "// APP"; - InlineAsmEnd = "// NO_APP"; } diff --git a/lib/Target/CellSPU/SPUTargetAsmInfo.cpp b/lib/Target/CellSPU/SPUTargetAsmInfo.cpp index 991afa0e0b0..a295a4c29df 100644 --- a/lib/Target/CellSPU/SPUTargetAsmInfo.cpp +++ b/lib/Target/CellSPU/SPUTargetAsmInfo.cpp @@ -20,8 +20,6 @@ SPULinuxTargetAsmInfo::SPULinuxTargetAsmInfo() { Data64bitsDirective = "\t.quad\t"; AlignmentIsInBytes = false; LCOMMDirective = "\t.lcomm\t"; - InlineAsmStart = "# InlineAsm Start"; - InlineAsmEnd = "# InlineAsm End"; PCSymbol = "."; CommentString = "#"; diff --git a/lib/Target/DarwinTargetAsmInfo.cpp b/lib/Target/DarwinTargetAsmInfo.cpp index 08ad76d40fb..c37b41b7001 100644 --- a/lib/Target/DarwinTargetAsmInfo.cpp +++ b/lib/Target/DarwinTargetAsmInfo.cpp @@ -27,6 +27,8 @@ DarwinTargetAsmInfo::DarwinTargetAsmInfo() { HasSingleParameterDotFile = false; AlignmentIsInBytes = false; + InlineAsmStart = " InlineAsm Start"; + InlineAsmEnd = " InlineAsm End"; // In non-PIC modes, emit a special label before jump tables so that the // linker can perform more accurate dead code stripping. We do not check the diff --git a/lib/Target/PowerPC/PPCTargetAsmInfo.cpp b/lib/Target/PowerPC/PPCTargetAsmInfo.cpp index 58926e3b87d..891252b8a9a 100644 --- a/lib/Target/PowerPC/PPCTargetAsmInfo.cpp +++ b/lib/Target/PowerPC/PPCTargetAsmInfo.cpp @@ -29,8 +29,6 @@ PPCDarwinTargetAsmInfo::PPCDarwinTargetAsmInfo(const PPCTargetMachine &TM) { if (!isPPC64) Data64bitsDirective = 0; // we can't emit a 64-bit unit - InlineAsmStart = "# InlineAsm Start"; - InlineAsmEnd = "# InlineAsm End"; AssemblerDialect = Subtarget->getAsmFlavor(); } @@ -63,8 +61,6 @@ PPCLinuxTargetAsmInfo::PPCLinuxTargetAsmInfo(const PPCTargetMachine &TM) { Data64bitsDirective = isPPC64 ? "\t.quad\t" : 0; AlignmentIsInBytes = false; LCOMMDirective = "\t.lcomm\t"; - InlineAsmStart = "# InlineAsm Start"; - InlineAsmEnd = "# InlineAsm End"; AssemblerDialect = Subtarget->getAsmFlavor(); } diff --git a/lib/Target/TargetAsmInfo.cpp b/lib/Target/TargetAsmInfo.cpp index 51aeae43800..253d72c359c 100644 --- a/lib/Target/TargetAsmInfo.cpp +++ b/lib/Target/TargetAsmInfo.cpp @@ -37,8 +37,8 @@ TargetAsmInfo::TargetAsmInfo() { PersonalityPrefix = ""; PersonalitySuffix = ""; NeedsIndirectEncoding = false; - InlineAsmStart = "#APP"; - InlineAsmEnd = "#NO_APP"; + InlineAsmStart = "APP"; + InlineAsmEnd = "NO_APP"; AssemblerDialect = 0; AllowQuotesInName = false; ZeroDirective = "\t.zero\t"; diff --git a/lib/Target/X86/X86TargetAsmInfo.cpp b/lib/Target/X86/X86TargetAsmInfo.cpp index a07b2cc2b5b..1d9a4c2aaa6 100644 --- a/lib/Target/X86/X86TargetAsmInfo.cpp +++ b/lib/Target/X86/X86TargetAsmInfo.cpp @@ -61,8 +61,6 @@ X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(const X86TargetMachine &TM) { PersonalitySuffix = "$non_lazy_ptr"; } - InlineAsmStart = "## InlineAsm Start"; - InlineAsmEnd = "## InlineAsm End"; CommentString = "##"; PCSymbol = "."; @@ -113,9 +111,6 @@ X86WinTargetAsmInfo::X86WinTargetAsmInfo(const X86TargetMachine &TM) { GlobalPrefix = "_"; CommentString = ";"; - InlineAsmStart = "; InlineAsm Start"; - InlineAsmEnd = "; InlineAsm End"; - PrivateGlobalPrefix = "$"; AlignDirective = "\tALIGN\t"; ZeroDirective = "\tdb\t"; -- 2.34.1