[llvm-commits] [llvm] r77736 - in /llvm/trunk: include/llvm/Target/TargetAsmInfo.h lib/CodeGen/AsmPrinter/DwarfException.cpp lib/Target/TargetAsmInfo.cpp lib/Target/X86/X86TargetAsmInfo.cpp lib/Target/X86/X86TargetAsmInfo.h

Chris Lattner sabre at nondot.org
Fri Jul 31 14:39:55 PDT 2009


Author: lattner
Date: Fri Jul 31 16:39:55 2009
New Revision: 77736

URL: http://llvm.org/viewvc/llvm-project?rev=77736&view=rev
Log:
PreferredEHDataFormat is always call with data and global, but this whole
thing is #if0'd out anyway.  Just simplify the code by reducing the interface.
Not deleting this is essential for Bill's continuing happiness.

Modified:
    llvm/trunk/include/llvm/Target/TargetAsmInfo.h
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp
    llvm/trunk/lib/Target/TargetAsmInfo.cpp
    llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp
    llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h

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

==============================================================================
--- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Fri Jul 31 16:39:55 2009
@@ -24,15 +24,6 @@
   template <typename T> class SmallVectorImpl;
   class TargetMachine;
   
-  // DWARF encoding query type
-  namespace DwarfEncoding {
-    enum Target {
-      Data       = 0,
-      CodeLabels = 1,
-      Functions  = 2
-    };
-  }
-
   /// TargetAsmInfo - This class is intended to be used as a base class for asm
   /// properties and features specific to the target.
   class TargetAsmInfo {
@@ -429,11 +420,8 @@
     virtual unsigned getInlineAsmLength(const char *Str) const;
 
     /// PreferredEHDataFormat - This hook allows the target to select data
-    /// format used for encoding pointers in exception handling data. Reason is
-    /// 0 for data, 1 for code labels, 2 for function pointers. Global is true
-    /// if the symbol can be relocated.
-    virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
-                                           bool Global) const;
+    /// format used for encoding pointers in exception handling data.
+    virtual unsigned PreferredEHDataFormat() const;
 
 
     /// getSLEB128Size - Compute the number of bytes required for a signed

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

==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Fri Jul 31 16:39:55 2009
@@ -557,7 +557,7 @@
 #if 0
   // FIXME: This should default to what the system wants, not just "absptr".
   if (!TypeInfos.empty() || !FilterIds.empty()) {
-    Asm->EmitInt8(TAI->PreferredEHDataFormat(DwarfEncoding::Data, true));
+    Asm->EmitInt8(TAI->PreferredEHDataFormat());
     // FIXME: The comment here should correspond with what PreferredEHDataFormat
     // returned.
     Asm->EOL("TType format (DW_EH_PE_xxxxx)");

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

==============================================================================
--- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/TargetAsmInfo.cpp Fri Jul 31 16:39:55 2009
@@ -148,8 +148,7 @@
   return Length;
 }
 
-unsigned TargetAsmInfo::PreferredEHDataFormat(DwarfEncoding::Target Reason,
-                                              bool Global) const {
+unsigned TargetAsmInfo::PreferredEHDataFormat() const {
   return dwarf::DW_EH_PE_absptr;
 }
 

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

==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Fri Jul 31 16:39:55 2009
@@ -91,19 +91,10 @@
   DwarfExceptionSection = ".section __DATA,__gcc_except_tab";
 }
 
-unsigned
-X86DarwinTargetAsmInfo::PreferredEHDataFormat(DwarfEncoding::Target Reason,
-                                              bool Global) const {
+unsigned X86DarwinTargetAsmInfo::PreferredEHDataFormat() const {
   const X86Subtarget *Subtarget = &TM.getSubtarget<X86Subtarget>();
-
-  if (Subtarget->getDarwinVers() > 9) {
-    if ((Reason == DwarfEncoding::Data || Reason == DwarfEncoding::Functions)
-        && Global)
-      return DW_EH_PE_pcrel | DW_EH_PE_indirect | DW_EH_PE_sdata4;
-
-    if (Reason == DwarfEncoding::CodeLabels || !Global)
-      return DW_EH_PE_pcrel;
-  }
+  if (Subtarget->getDarwinVers() > 9)
+    return DW_EH_PE_pcrel | DW_EH_PE_indirect | DW_EH_PE_sdata4;
 
   return DW_EH_PE_absptr;
 }
@@ -155,8 +146,7 @@
 }
 
 unsigned
-X86ELFTargetAsmInfo::PreferredEHDataFormat(DwarfEncoding::Target Reason,
-                                           bool Global) const {
+X86ELFTargetAsmInfo::PreferredEHDataFormat() const {
   CodeModel::Model CM = TM.getCodeModel();
   bool is64Bit = TM.getSubtarget<X86Subtarget>().is64Bit();
 
@@ -171,32 +161,24 @@
       // - code model is small OR
       // - code model is medium and we're emitting externally visible symbols
       //   or any code symbols
-      if (CM == CodeModel::Small ||
-          (CM == CodeModel::Medium && (Global ||
-                                       Reason != DwarfEncoding::Data)))
+      if (CM == CodeModel::Small || CM == CodeModel::Medium)
         Format = DW_EH_PE_sdata4;
       else
         Format = DW_EH_PE_sdata8;
     }
 
-    if (Global)
-      Format |= DW_EH_PE_indirect;
-
+    Format |= DW_EH_PE_indirect;
     return (Format | DW_EH_PE_pcrel);
-  } else {
-    if (is64Bit &&
-        (CM == CodeModel::Small ||
-         (CM == CodeModel::Medium && Reason != DwarfEncoding::Data)))
-      return DW_EH_PE_udata4;
-    else
-      return DW_EH_PE_absptr;
   }
+  
+  if (is64Bit && CM == CodeModel::Small)
+    return DW_EH_PE_udata4;
+  return DW_EH_PE_absptr;
 }
 
 
 unsigned
-X86COFFTargetAsmInfo::PreferredEHDataFormat(DwarfEncoding::Target Reason,
-                                            bool Global) const {
+X86COFFTargetAsmInfo::PreferredEHDataFormat() const {
   CodeModel::Model CM = TM.getCodeModel();
   bool is64Bit = TM.getSubtarget<X86Subtarget>().is64Bit();
 
@@ -211,23 +193,17 @@
       // - code model is small OR
       // - code model is medium and we're emitting externally visible symbols
       //   or any code symbols
-      if (CM == CodeModel::Small ||
-          (CM == CodeModel::Medium && (Global ||
-                                       Reason != DwarfEncoding::Data)))
+      if (CM == CodeModel::Small || CM == CodeModel::Medium)
         Format = DW_EH_PE_sdata4;
       else
         Format = DW_EH_PE_sdata8;
     }
 
-    if (Global)
-      Format |= DW_EH_PE_indirect;
-
+    Format |= DW_EH_PE_indirect;
     return (Format | DW_EH_PE_pcrel);
   }
   
-  if (is64Bit &&
-      (CM == CodeModel::Small ||
-       (CM == CodeModel::Medium && Reason != DwarfEncoding::Data)))
+  if (is64Bit && CM == CodeModel::Small)
     return DW_EH_PE_udata4;
   return DW_EH_PE_absptr;
 }

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

==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h (original)
+++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h Fri Jul 31 16:39:55 2009
@@ -37,22 +37,19 @@
 
   struct X86DarwinTargetAsmInfo : public X86TargetAsmInfo<DarwinTargetAsmInfo> {
     explicit X86DarwinTargetAsmInfo(const X86TargetMachine &TM);
-    virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
-                                           bool Global) const;
+    virtual unsigned PreferredEHDataFormat() const;
     virtual const char *getEHGlobalPrefix() const;
   };
 
   struct X86ELFTargetAsmInfo : public X86TargetAsmInfo<ELFTargetAsmInfo> {
     explicit X86ELFTargetAsmInfo(const X86TargetMachine &TM);
-    virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
-                                           bool Global) const;
+    virtual unsigned PreferredEHDataFormat() const;
   };
 
   struct X86COFFTargetAsmInfo : public X86TargetAsmInfo<COFFTargetAsmInfo> {
     explicit X86COFFTargetAsmInfo(const X86TargetMachine &TM) :
       X86TargetAsmInfo<COFFTargetAsmInfo>(TM) {}
-    virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
-                                           bool Global) const;
+    virtual unsigned PreferredEHDataFormat() const;
   };
   
 





More information about the llvm-commits mailing list