[llvm-commits] [llvm] r60480 - in /llvm/trunk: include/llvm/Target/TargetAsmInfo.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp lib/Target/ARM/ARMTargetAsmInfo.cpp lib/Target/PowerPC/PPCTargetAsmInfo.cpp lib/Target/TargetAsmInfo.cpp lib/Target/X86/X86TargetAsmInfo.cpp

Rafael Espindola rafael.espindola at gmail.com
Wed Dec 3 03:01:38 PST 2008


Author: rafael
Date: Wed Dec  3 05:01:37 2008
New Revision: 60480

URL: http://llvm.org/viewvc/llvm-project?rev=60480&view=rev
Log:
Fix bug 3140.
Print a single parameter .file directive if we have an ELF target.


Modified:
    llvm/trunk/include/llvm/Target/TargetAsmInfo.h
    llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
    llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp
    llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
    llvm/trunk/lib/Target/TargetAsmInfo.cpp
    llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp

Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmInfo.h?rev=60480&r1=60479&r2=60480&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Wed Dec  3 05:01:37 2008
@@ -390,7 +390,11 @@
     /// HasDotTypeDotSizeDirective - True if the target has .type and .size
     /// directives, this is true for most ELF targets.
     bool HasDotTypeDotSizeDirective;      // Defaults to true.
-    
+
+    /// HasSingleParameterDotFile - True if the target has a single parameter
+    /// .file directive, this is true for ELF targets.
+    bool HasSingleParameterDotFile;      // Defaults to true.
+
     /// UsedDirective - This directive, if non-null, is used to declare a global
     /// as being used somehow that the assembler can't see.  This prevents dead
     /// code elimination on some targets.
@@ -765,6 +769,9 @@
     bool hasDotTypeDotSizeDirective() const {
       return HasDotTypeDotSizeDirective;
     }
+    bool hasSingleParameterDotFile() const {
+      return HasSingleParameterDotFile;
+    }
     const char *getUsedDirective() const {
       return UsedDirective;
     }
@@ -856,4 +863,3 @@
 }
 
 #endif
-

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=60480&r1=60479&r2=60480&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Wed Dec  3 05:01:37 2008
@@ -142,6 +142,14 @@
   
   GCModuleInfo *MI = getAnalysisToUpdate<GCModuleInfo>();
   assert(MI && "AsmPrinter didn't require GCModuleInfo?");
+
+  if (TAI->hasSingleParameterDotFile()) {
+    /* Very minimal debug info. It is ignored if we emit actual
+       debug info. If we don't, this at helps the user find where
+       a function came from. */
+    O << "\t.file\t\"" << M.getModuleIdentifier() << "\"\n";
+  }
+
   for (GCModuleInfo::iterator I = MI->begin(), E = MI->end(); I != E; ++I)
     if (GCMetadataPrinter *MP = GetOrCreateGCPrinter(*I))
       MP->beginAssembly(O, *this, *TAI);

Modified: llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp?rev=60480&r1=60479&r2=60480&view=diff

==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp Wed Dec  3 05:01:37 2008
@@ -61,6 +61,7 @@
   JumpTableDataSection = ".const";
   CStringSection = "\t.cstring";
   HasDotTypeDotSizeDirective = false;
+  HasSingleParameterDotFile = false;
   NeedsIndirectEncoding = true;
   if (TM.getRelocationModel() == Reloc::Static) {
     StaticCtorsSection = ".constructor";

Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp?rev=60480&r1=60479&r2=60480&view=diff

==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Wed Dec  3 05:01:37 2008
@@ -37,6 +37,7 @@
     StaticCtorsSection = ".mod_init_func";
     StaticDtorsSection = ".mod_term_func";
   }
+  HasSingleParameterDotFile = false;
   SwitchToSectionDirective = "\t.section ";
   UsedDirective = "\t.no_dead_strip\t";
   WeakDefDirective = "\t.weak_definition ";

Modified: llvm/trunk/lib/Target/TargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetAsmInfo.cpp?rev=60480&r1=60479&r2=60480&view=diff

==============================================================================
--- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/TargetAsmInfo.cpp Wed Dec  3 05:01:37 2008
@@ -85,6 +85,7 @@
   COMMDirective = "\t.comm\t";
   COMMDirectiveTakesAlignment = true;
   HasDotTypeDotSizeDirective = true;
+  HasSingleParameterDotFile = true;
   UsedDirective = 0;
   WeakRefDirective = 0;
   WeakDefDirective = 0;

Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp?rev=60480&r1=60479&r2=60480&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Wed Dec  3 05:01:37 2008
@@ -69,6 +69,7 @@
   // Leopard and above support aligned common symbols.
   COMMDirectiveTakesAlignment = (Subtarget->getDarwinVers() >= 9);
   HasDotTypeDotSizeDirective = false;
+  HasSingleParameterDotFile = false;
   if (TM.getRelocationModel() == Reloc::Static) {
     StaticCtorsSection = ".constructor";
     StaticDtorsSection = ".destructor";
@@ -221,6 +222,7 @@
   LCOMMDirective = "\t.lcomm\t";
   COMMDirectiveTakesAlignment = false;
   HasDotTypeDotSizeDirective = false;
+  HasSingleParameterDotFile = false;
   StaticCtorsSection = "\t.section .ctors,\"aw\"";
   StaticDtorsSection = "\t.section .dtors,\"aw\"";
   HiddenDirective = NULL;
@@ -335,6 +337,7 @@
   Data32bitsDirective = "\tdd\t";
   Data64bitsDirective = "\tdq\t";
   HasDotTypeDotSizeDirective = false;
+  HasSingleParameterDotFile = false;
 
   TextSection = getUnnamedSection("_text", SectionFlags::Code);
   DataSection = getUnnamedSection("_data", SectionFlags::Writeable);





More information about the llvm-commits mailing list