PIC16 is also using COFF as its target.<br><br>
<div class="gmail_quote">On Tue, Jul 28, 2009 at 12:46 AM, Chris Lattner <span dir="ltr"><<a href="mailto:sabre@nondot.org">sabre@nondot.org</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">Author: lattner<br>Date: Mon Jul 27 11:45:59 2009<br>New Revision: 77204<br><br>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=77204&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=77204&view=rev</a><br>
Log:<br>make COFF work like ELF and macho, by splitting out into its own<br>header even though there is only one COFF target.<br><br>Added:<br>   llvm/trunk/include/llvm/Target/COFFTargetAsmInfo.h<br>   llvm/trunk/lib/Target/COFFTargetAsmInfo.cpp<br>
Modified:<br>   llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h<br>   llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp<br>   llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h<br><br>Added: llvm/trunk/include/llvm/Target/COFFTargetAsmInfo.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/COFFTargetAsmInfo.h?rev=77204&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/COFFTargetAsmInfo.h?rev=77204&view=auto</a><br>
<br>==============================================================================<br>--- llvm/trunk/include/llvm/Target/COFFTargetAsmInfo.h (added)<br>+++ llvm/trunk/include/llvm/Target/COFFTargetAsmInfo.h Mon Jul 27 11:45:59 2009<br>
@@ -0,0 +1,30 @@<br>+//===-- COFFTargetAsmInfo.h - COFF asm properties ---------------*- C++ -*-===//<br>+//<br>+//                     The LLVM Compiler Infrastructure<br>+//<br>+// This file is distributed under the University of Illinois Open Source<br>
+// License. See LICENSE.TXT for details.<br>+//<br>+//===----------------------------------------------------------------------===//<br>+<br>+#ifndef LLVM_COFF_TARGET_ASM_INFO_H<br>+#define LLVM_COFF_TARGET_ASM_INFO_H<br>
+<br>+#include "llvm/Target/TargetAsmInfo.h"<br>+<br>+namespace llvm {<br>+  class COFFTargetAsmInfo : public TargetAsmInfo {<br>+  protected:<br>+    explicit COFFTargetAsmInfo(const TargetMachine &TM);<br>
+  public:<br>+<br>+    virtual const char *<br>+    getSectionPrefixForUniqueGlobal(SectionKind kind) const;<br>+<br>+    virtual void getSectionFlagsAsString(SectionKind Kind,<br>+                                         SmallVectorImpl<char> &Str) const;<br>
+  };<br>+}<br>+<br>+<br>+#endif // LLVM_ELF_TARGET_ASM_INFO_H<br><br>Modified: llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h<br>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h?rev=77204&r1=77203&r2=77204&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h?rev=77204&r1=77203&r2=77204&view=diff</a><br>
<br>==============================================================================<br>--- llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h (original)<br>+++ llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h Mon Jul 27 11:45:59 2009<br>
@@ -18,7 +18,6 @@<br> #include "llvm/Target/TargetAsmInfo.h"<br><br> namespace llvm {<br>-  class GlobalValue;<br><br>  struct ELFTargetAsmInfo : public TargetAsmInfo {<br>    ELFTargetAsmInfo(const TargetMachine &TM);<br>
<br>Added: llvm/trunk/lib/Target/COFFTargetAsmInfo.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/COFFTargetAsmInfo.cpp?rev=77204&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/COFFTargetAsmInfo.cpp?rev=77204&view=auto</a><br>
<br>==============================================================================<br>--- llvm/trunk/lib/Target/COFFTargetAsmInfo.cpp (added)<br>+++ llvm/trunk/lib/Target/COFFTargetAsmInfo.cpp Mon Jul 27 11:45:59 2009<br>
@@ -0,0 +1,76 @@<br>+//===-- COFFTargetAsmInfo.cpp - COFF asm properties -------------*- C++ -*-===//<br>+//<br>+//                     The LLVM Compiler Infrastructure<br>+//<br>+// This file is distributed under the University of Illinois Open Source<br>
+// License. See LICENSE.TXT for details.<br>+//<br>+//===----------------------------------------------------------------------===//<br>+//<br>+// This file defines target asm properties related what form asm statements<br>
+// should take in general on COFF-based targets<br>+//<br>+//===----------------------------------------------------------------------===//<br>+<br>+#include "llvm/Target/COFFTargetAsmInfo.h"<br>+#include "llvm/ADT/SmallVector.h"<br>
+using namespace llvm;<br>+<br>+COFFTargetAsmInfo::COFFTargetAsmInfo(const TargetMachine &TM)<br>+  : TargetAsmInfo(TM) {<br>+<br>+  TextSection = getOrCreateSection("_text", true, SectionKind::Text);<br>+  DataSection = getOrCreateSection("_data", true, SectionKind::DataRel);<br>
+<br>+  GlobalPrefix = "_";<br>+  LCOMMDirective = "\t.lcomm\t";<br>+  COMMDirectiveTakesAlignment = false;<br>+  HasDotTypeDotSizeDirective = false;<br>+  HasSingleParameterDotFile = false;<br>+  StaticCtorsSection = "\t.section .ctors,\"aw\"";<br>
+  StaticDtorsSection = "\t.section .dtors,\"aw\"";<br>+  HiddenDirective = NULL;<br>+  PrivateGlobalPrefix = "L";  // Prefix for private global symbols<br>+  WeakRefDirective = "\t.weak\t";<br>
+  SetDirective = "\t.set\t";<br>+<br>+  // Set up DWARF directives<br>+  HasLEB128 = true;  // Target asm supports leb128 directives (little-endian)<br>+  AbsoluteDebugSectionOffsets = true;<br>+  AbsoluteEHSectionOffsets = false;<br>
+  SupportsDebugInformation = true;<br>+  DwarfSectionOffsetDirective = "\t.secrel32\t";<br>+  DwarfAbbrevSection =  "\t.section\t.debug_abbrev,\"dr\"";<br>+  DwarfInfoSection =    "\t.section\t.debug_info,\"dr\"";<br>
+  DwarfLineSection =    "\t.section\t.debug_line,\"dr\"";<br>+  DwarfFrameSection =   "\t.section\t.debug_frame,\"dr\"";<br>+  DwarfPubNamesSection ="\t.section\t.debug_pubnames,\"dr\"";<br>
+  DwarfPubTypesSection ="\t.section\t.debug_pubtypes,\"dr\"";<br>+  DwarfStrSection =     "\t.section\t.debug_str,\"dr\"";<br>+  DwarfLocSection =     "\t.section\t.debug_loc,\"dr\"";<br>
+  DwarfARangesSection = "\t.section\t.debug_aranges,\"dr\"";<br>+  DwarfRangesSection =  "\t.section\t.debug_ranges,\"dr\"";<br>+  DwarfMacroInfoSection = "\t.section\t.debug_macinfo,\"dr\"";<br>
+}<br>+<br>+const char *COFFTargetAsmInfo::<br>+getSectionPrefixForUniqueGlobal(SectionKind Kind) const {<br>+  if (Kind.isText())<br>+    return ".text$linkonce";<br>+  if (Kind.isWriteable())<br>+    return ".data$linkonce";<br>
+  return ".rdata$linkonce";<br>+}<br>+<br>+void COFFTargetAsmInfo::getSectionFlagsAsString(SectionKind Kind,<br>+                                            SmallVectorImpl<char> &Str) const {<br>+  // FIXME: Inefficient.<br>
+  std::string Res = ",\"";<br>+  if (Kind.isText())<br>+    Res += 'x';<br>+  if (Kind.isWriteable())<br>+    Res += 'w';<br>+  Res += "\"";<br>+<br>+  Str.append(Res.begin(), Res.end());<br>
+}<br><br>Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp?rev=77204&r1=77203&r2=77204&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp?rev=77204&r1=77203&r2=77204&view=diff</a><br>
<br>==============================================================================<br>--- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp (original)<br>+++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Mon Jul 27 11:45:59 2009<br>
@@ -188,42 +188,6 @@<br>  }<br> }<br><br>-X86COFFTargetAsmInfo::X86COFFTargetAsmInfo(const X86TargetMachine &TM):<br>-  X86GenericTargetAsmInfo(TM) {<br>-<br>-  TextSection = getOrCreateSection("_text", true, SectionKind::Text);<br>
-  DataSection = getOrCreateSection("_data", true, SectionKind::DataRel);<br>-<br>-  GlobalPrefix = "_";<br>-  LCOMMDirective = "\t.lcomm\t";<br>-  COMMDirectiveTakesAlignment = false;<br>-  HasDotTypeDotSizeDirective = false;<br>
-  HasSingleParameterDotFile = false;<br>-  StaticCtorsSection = "\t.section .ctors,\"aw\"";<br>-  StaticDtorsSection = "\t.section .dtors,\"aw\"";<br>-  HiddenDirective = NULL;<br>
-  PrivateGlobalPrefix = "L";  // Prefix for private global symbols<br>-  WeakRefDirective = "\t.weak\t";<br>-  SetDirective = "\t.set\t";<br>-<br>-  // Set up DWARF directives<br>-  HasLEB128 = true;  // Target asm supports leb128 directives (little-endian)<br>
-  AbsoluteDebugSectionOffsets = true;<br>-  AbsoluteEHSectionOffsets = false;<br>-  SupportsDebugInformation = true;<br>-  DwarfSectionOffsetDirective = "\t.secrel32\t";<br>-  DwarfAbbrevSection =  "\t.section\t.debug_abbrev,\"dr\"";<br>
-  DwarfInfoSection =    "\t.section\t.debug_info,\"dr\"";<br>-  DwarfLineSection =    "\t.section\t.debug_line,\"dr\"";<br>-  DwarfFrameSection =   "\t.section\t.debug_frame,\"dr\"";<br>
-  DwarfPubNamesSection ="\t.section\t.debug_pubnames,\"dr\"";<br>-  DwarfPubTypesSection ="\t.section\t.debug_pubtypes,\"dr\"";<br>-  DwarfStrSection =     "\t.section\t.debug_str,\"dr\"";<br>
-  DwarfLocSection =     "\t.section\t.debug_loc,\"dr\"";<br>-  DwarfARangesSection = "\t.section\t.debug_aranges,\"dr\"";<br>-  DwarfRangesSection =  "\t.section\t.debug_ranges,\"dr\"";<br>
-  DwarfMacroInfoSection = "\t.section\t.debug_macinfo,\"dr\"";<br>-}<br><br> unsigned<br> X86COFFTargetAsmInfo::PreferredEHDataFormat(DwarfEncoding::Target Reason,<br>@@ -263,32 +227,10 @@<br>  return DW_EH_PE_absptr;<br>
 }<br><br>-const char *X86COFFTargetAsmInfo::<br>-getSectionPrefixForUniqueGlobal(SectionKind Kind) const {<br>-  if (Kind.isText())<br>-    return ".text$linkonce";<br>-  if (Kind.isWriteable())<br>-    return ".data$linkonce";<br>
-  return ".rdata$linkonce";<br>-}<br>-<br><br><br>-void X86COFFTargetAsmInfo::getSectionFlagsAsString(SectionKind Kind,<br>-                                            SmallVectorImpl<char> &Str) const {<br>
-  // FIXME: Inefficient.<br>-  std::string Res = ",\"";<br>-  if (Kind.isText())<br>-    Res += 'x';<br>-  if (Kind.isWriteable())<br>-    Res += 'w';<br>-  Res += "\"";<br>-<br>
-  Str.append(Res.begin(), Res.end());<br>-}<br>-<br> X86WinTargetAsmInfo::X86WinTargetAsmInfo(const X86TargetMachine &TM):<br>-  X86GenericTargetAsmInfo(TM) {<br>+  X86TargetAsmInfo<TargetAsmInfo>(TM) {<br>  GlobalPrefix = "_";<br>
  CommentString = ";";<br><br><br>Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h<br>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h?rev=77204&r1=77203&r2=77204&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h?rev=77204&r1=77203&r2=77204&view=diff</a><br>
<br>==============================================================================<br>--- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h (original)<br>+++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h Mon Jul 27 11:45:59 2009<br>
@@ -16,8 +16,9 @@<br><br> #include "X86TargetMachine.h"<br> #include "llvm/Target/TargetAsmInfo.h"<br>-#include "llvm/Target/ELFTargetAsmInfo.h"<br>+#include "llvm/Target/COFFTargetAsmInfo.h"<br>
 #include "llvm/Target/DarwinTargetAsmInfo.h"<br>+#include "llvm/Target/ELFTargetAsmInfo.h"<br> #include "llvm/Support/Compiler.h"<br><br> namespace llvm {<br>@@ -49,16 +50,13 @@<br>                                           bool Global) const;<br>
  };<br><br>-  struct X86COFFTargetAsmInfo : public X86GenericTargetAsmInfo {<br>-    explicit X86COFFTargetAsmInfo(const X86TargetMachine &TM);<br>+  struct X86COFFTargetAsmInfo : public X86TargetAsmInfo<COFFTargetAsmInfo> {<br>
+    explicit X86COFFTargetAsmInfo(const X86TargetMachine &TM) :<br>+      X86TargetAsmInfo<COFFTargetAsmInfo>(TM) {}<br>    virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,<br>                                           bool Global) const;<br>
-    virtual const char *<br>-    getSectionPrefixForUniqueGlobal(SectionKind kind) const;<br>-<br>-    virtual void getSectionFlagsAsString(SectionKind Kind,<br>-                                         SmallVectorImpl<char> &Str) const;<br>
  };<br>+<br><br>  struct X86WinTargetAsmInfo : public X86GenericTargetAsmInfo {<br>    explicit X86WinTargetAsmInfo(const X86TargetMachine &TM);<br><br><br>_______________________________________________<br>llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br></blockquote>
</div><br><br clear="all">
<div></div><br>-- <br>-Howard<br>