Remove the MCObjectFormat class.
authorRafael Espindola <rafael.espindola@gmail.com>
Sat, 18 Dec 2010 05:37:28 +0000 (05:37 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Sat, 18 Dec 2010 05:37:28 +0000 (05:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122147 91177308-0d34-0410-b5e6-96231b3b80d8

13 files changed:
include/llvm/MC/MCObjectFormat.h [deleted file]
include/llvm/MC/MCObjectWriter.h
include/llvm/Target/TargetAsmBackend.h
lib/MC/CMakeLists.txt
lib/MC/ELFObjectWriter.cpp
lib/MC/MCExpr.cpp
lib/MC/MCObjectFormat.cpp [deleted file]
lib/MC/MachObjectWriter.cpp
lib/MC/WinCOFFObjectWriter.cpp
lib/Target/ARM/ARMAsmBackend.cpp
lib/Target/MBlaze/MBlazeAsmBackend.cpp
lib/Target/PowerPC/PPCAsmBackend.cpp
lib/Target/X86/X86AsmBackend.cpp

diff --git a/include/llvm/MC/MCObjectFormat.h b/include/llvm/MC/MCObjectFormat.h
deleted file mode 100644 (file)
index 5c3f003..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-//===-- llvm/MC/MCObjectFormat.h - Object Format Info -----------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_MC_MCOBJECTFORMAT_H
-#define LLVM_MC_MCOBJECTFORMAT_H
-
-namespace llvm {
-class MCSymbol;
-
-class MCObjectFormat {
-public:
-  virtual ~MCObjectFormat();
-
-  /// isAbsolute - Check if A - B is an absolute value
-  ///
-  /// \param InSet - True if this expression is in a set. For example:
-  ///   a:
-  ///   ...
-  ///   b:
-  ///   tmp = a - b
-  ///       .long tmp
-  /// \param A - LHS
-  /// \param B - RHS
-  virtual bool isAbsolute(bool InSet, const MCSymbol &A,
-                          const MCSymbol &B) const = 0;
-};
-
-class MCELFObjectFormat : public MCObjectFormat {
-public:
-  virtual bool isAbsolute(bool InSet, const MCSymbol &A,
-                          const MCSymbol &B) const;
-};
-
-class MCMachOObjectFormat : public MCObjectFormat {
-public:
-  virtual bool isAbsolute(bool InSet, const MCSymbol &A,
-                          const MCSymbol &B) const;
-};
-
-class MCCOFFObjectFormat : public MCObjectFormat {
-public:
-  virtual bool isAbsolute(bool InSet, const MCSymbol &A,
-                          const MCSymbol &B) const;
-};
-
-}  // End llvm namespace
-
-#endif
index 73bad2a179a3cfbd6a033fb198a25090daf857c2..ef1a969b8c476dd2424dd17ff819eafade5ff62b 100644 (file)
@@ -20,6 +20,7 @@ class MCAsmLayout;
 class MCAssembler;
 class MCFixup;
 class MCFragment;
+class MCSymbol;
 class MCSymbolRefExpr;
 class MCValue;
 class raw_ostream;
@@ -98,6 +99,9 @@ public:
                                     bool IsPCRel,
                                     const MCFragment *DF) const = 0;
 
+  virtual bool isAbsolute(bool IsSet, const MCSymbol &A,
+                          const MCSymbol &B) const = 0;
+
   /// Write the object file.
   ///
   /// This routine is called by the assembler after layout and relaxation is
index 50904b135f86eec3bbd5561b4c79f3d04d28928e..7527298efa9e62c988a59f43d6974d1d17d25a83 100644 (file)
@@ -18,7 +18,6 @@
 namespace llvm {
 class MCFixup;
 class MCInst;
-class MCObjectFormat;
 class MCObjectWriter;
 class MCSection;
 template<typename T>
@@ -37,8 +36,6 @@ protected: // Can only create subclasses.
 public:
   virtual ~TargetAsmBackend();
 
-  virtual const MCObjectFormat &getObjectFormat() const = 0;
-
   /// createObjectWriter - Create a new MCObjectWriter instance for use by the
   /// assembler backend to emit the final object file.
   virtual MCObjectWriter *createObjectWriter(raw_ostream &OS) const = 0;
index ccec2dc426735e55c496f64d0c7cb5f0dbd5a201..c17e1505b0971eeeb7c023f51a4a6181ae7cea80 100644 (file)
@@ -20,7 +20,6 @@ add_llvm_library(LLVMMC
   MCMachObjectTargetWriter.cpp
   MCNullStreamer.cpp
   MCObjectStreamer.cpp
-  MCObjectFormat.cpp
   MCObjectWriter.cpp
   MCPureStreamer.cpp
   MCSection.cpp
index 10e67d20d5c45a9a0363963ccc999b742261875e..a6503b7cacb7bee85e416cb79c44ed9bdab5d483 100644 (file)
@@ -352,6 +352,12 @@ namespace {
       return false;
     }
 
+    virtual bool isAbsolute(bool IsSet, const MCSymbol &A,
+                            const MCSymbol &B) const {
+      // On ELF A - B is absolute if A and B are in the same section.
+      return &A.getSection() == &B.getSection();
+    }
+
     virtual bool IsFixupFullyResolved(const MCAssembler &Asm,
                               const MCValue Target,
                               bool IsPCRel,
index 3533da2cf646e7883923fb1a2a1ac041e878468f..22d8740a197d65bc41e8de88505b481bbeb7fcc4 100644 (file)
@@ -14,7 +14,6 @@
 #include "llvm/MC/MCAsmLayout.h"
 #include "llvm/MC/MCAssembler.h"
 #include "llvm/MC/MCContext.h"
-#include "llvm/MC/MCObjectFormat.h"
 #include "llvm/MC/MCSymbol.h"
 #include "llvm/MC/MCValue.h"
 #include "llvm/Support/Debug.h"
@@ -388,8 +387,8 @@ static bool EvaluateSymbolicAdd(const MCAssembler *Asm,
   if (Asm && A && B) {
     const MCSymbol &SA = A->getSymbol();
     const MCSymbol &SB = B->getSymbol();
-    const MCObjectFormat &F = Asm->getBackend().getObjectFormat();
-    if (SA.isDefined() && SB.isDefined() && F.isAbsolute(InSet, SA, SB)) {
+    if (SA.isDefined() && SB.isDefined() &&
+        Asm->getWriter().isAbsolute(InSet, SA, SB)) {
       MCSymbolData &AD = Asm->getSymbolData(A->getSymbol());
       MCSymbolData &BD = Asm->getSymbolData(B->getSymbol());
 
diff --git a/lib/MC/MCObjectFormat.cpp b/lib/MC/MCObjectFormat.cpp
deleted file mode 100644 (file)
index aeff334..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-//===- lib/MC/MCObjectFormat.cpp - MCObjectFormat implementation ----------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/MC/MCObjectFormat.h"
-#include "llvm/MC/MCSymbol.h"
-
-using namespace llvm;
-
-MCObjectFormat::~MCObjectFormat() {
-}
-
-bool MCELFObjectFormat::isAbsolute(bool IsSet, const MCSymbol &A,
-                                   const MCSymbol &B) const {
-  // On ELF A - B is absolute if A and B are in the same section.
-  return &A.getSection() == &B.getSection();
-}
-
-bool MCMachOObjectFormat::isAbsolute(bool IsSet, const MCSymbol &A,
-                                     const MCSymbol &B) const  {
-  // On MachO A - B is absolute only if in a set.
-  return IsSet;
-}
-
-bool MCCOFFObjectFormat::isAbsolute(bool IsSet, const MCSymbol &A,
-                                    const MCSymbol &B) const  {
-  // On COFF A - B is absolute if A and B are in the same section.
-  return &A.getSection() == &B.getSection();
-}
index 6ebc782c8e2483df46a70a5700b017166bf215b1..42cf43fea34ea0ee82a06afdabb52a636d7d220e 100644 (file)
@@ -1123,6 +1123,12 @@ public:
                        UndefinedSymbolData);
   }
 
+  bool isAbsolute(bool IsSet, const MCSymbol &A,
+                                     const MCSymbol &B) const  {
+    // On MachO A - B is absolute only if in a set.
+    return IsSet;
+  }
+
   bool IsSymbolRefDifferenceFullyResolved(const MCAssembler &Asm,
                                           const MCSymbolRefExpr *A,
                                           const MCSymbolRefExpr *B) const {
index 0ad086cbee092dd815fb1e2b08ba928749ea1658..7f75662219743d988a68d7775e0fbf3e99e15314 100644 (file)
@@ -187,6 +187,12 @@ public:
     return false;
   }
 
+  virtual bool isAbsolute(bool IsSet, const MCSymbol &A,
+                          const MCSymbol &B) const  {
+    // On COFF A - B is absolute if A and B are in the same section.
+    return &A.getSection() == &B.getSection();
+  }
+
   virtual bool IsFixupFullyResolved(const MCAssembler &Asm,
                                     const MCValue Target,
                                     bool IsPCRel,
index b7274ca0f52e06b365adf10cd7fa90610ba35213..c72e79082987c3ca177f3fb5c565b00ec19eeb0e 100644 (file)
@@ -16,7 +16,6 @@
 #include "llvm/MC/MCELFObjectWriter.h"
 #include "llvm/MC/MCExpr.h"
 #include "llvm/MC/MCMachObjectWriter.h"
-#include "llvm/MC/MCObjectFormat.h"
 #include "llvm/MC/MCObjectWriter.h"
 #include "llvm/MC/MCSectionELF.h"
 #include "llvm/MC/MCSectionMachO.h"
@@ -350,17 +349,11 @@ namespace {
 // FIXME: This should be in a separate file.
 // ELF is an ELF of course...
 class ELFARMAsmBackend : public ARMAsmBackend {
-  MCELFObjectFormat Format;
-
 public:
   Triple::OSType OSType;
   ELFARMAsmBackend(const Target &T, Triple::OSType _OSType)
     : ARMAsmBackend(T), OSType(_OSType) { }
 
-  virtual const MCObjectFormat &getObjectFormat() const {
-    return Format;
-  }
-
   void ApplyFixup(const MCFixup &Fixup, char *Data, unsigned DataSize,
                   uint64_t Value) const;
 
@@ -389,14 +382,9 @@ void ELFARMAsmBackend::ApplyFixup(const MCFixup &Fixup, char *Data,
 
 // FIXME: This should be in a separate file.
 class DarwinARMAsmBackend : public ARMAsmBackend {
-  MCMachOObjectFormat Format;
 public:
   DarwinARMAsmBackend(const Target &T) : ARMAsmBackend(T) { }
 
-  virtual const MCObjectFormat &getObjectFormat() const {
-    return Format;
-  }
-
   void ApplyFixup(const MCFixup &Fixup, char *Data, unsigned DataSize,
                   uint64_t Value) const;
 
index 8a799f2f9696d2fbb90454398499ff99b4087486..a4b21afa599e66a7d73670be15b18c4d4b5e337d 100644 (file)
@@ -16,7 +16,6 @@
 #include "llvm/MC/MCELFObjectWriter.h"
 #include "llvm/MC/MCELFSymbolFlags.h"
 #include "llvm/MC/MCExpr.h"
-#include "llvm/MC/MCObjectFormat.h"
 #include "llvm/MC/MCObjectWriter.h"
 #include "llvm/MC/MCSectionELF.h"
 #include "llvm/MC/MCSectionMachO.h"
@@ -108,18 +107,11 @@ bool MBlazeAsmBackend::WriteNopData(uint64_t Count, MCObjectWriter *OW) const {
 
 namespace {
 class ELFMBlazeAsmBackend : public MBlazeAsmBackend {
-  MCELFObjectFormat Format;
-
 public:
   Triple::OSType OSType;
   ELFMBlazeAsmBackend(const Target &T, Triple::OSType _OSType)
     : MBlazeAsmBackend(T), OSType(_OSType) { }
 
-  virtual const MCObjectFormat &getObjectFormat() const {
-    return Format;
-  }
-
-
   void ApplyFixup(const MCFixup &Fixup, char *Data, unsigned DataSize,
                   uint64_t Value) const;
 
index 9dfc6fce9470b78577803bc3e537dfc41565fd5c..c4d4ac9b3eb94eb7896d890c431275a2069da458 100644 (file)
@@ -12,7 +12,6 @@
 #include "PPCFixupKinds.h"
 #include "llvm/MC/MCMachObjectWriter.h"
 #include "llvm/MC/MCSectionMachO.h"
-#include "llvm/MC/MCObjectFormat.h"
 #include "llvm/MC/MCObjectWriter.h"
 #include "llvm/Object/MachOFormat.h"
 #include "llvm/Target/TargetRegistry.h"
@@ -82,14 +81,9 @@ public:
 // FIXME: This should be in a separate file.
 namespace {
   class DarwinPPCAsmBackend : public PPCAsmBackend {
-    MCMachOObjectFormat Format;
   public:
     DarwinPPCAsmBackend(const Target &T) : PPCAsmBackend(T) { }
     
-    virtual const MCObjectFormat &getObjectFormat() const {
-      return Format;
-    }
-    
     void ApplyFixup(const MCFixup &Fixup, char *Data, unsigned DataSize,
                     uint64_t Value) const {
       assert(0 && "UNIMP");
index 5e7ce0bd1fc29fe26ed63f6620c87d0df4451731..c39d07b12ed60e654a022a2215616f4f0bc1304e 100644 (file)
@@ -16,7 +16,6 @@
 #include "llvm/MC/MCExpr.h"
 #include "llvm/MC/MCFixupKindInfo.h"
 #include "llvm/MC/MCMachObjectWriter.h"
-#include "llvm/MC/MCObjectFormat.h"
 #include "llvm/MC/MCObjectWriter.h"
 #include "llvm/MC/MCSectionCOFF.h"
 #include "llvm/MC/MCSectionELF.h"
@@ -295,8 +294,6 @@ bool X86AsmBackend::WriteNopData(uint64_t Count, MCObjectWriter *OW) const {
 
 namespace {
 class ELFX86AsmBackend : public X86AsmBackend {
-  MCELFObjectFormat Format;
-
 public:
   Triple::OSType OSType;
   ELFX86AsmBackend(const Target &T, Triple::OSType _OSType)
@@ -304,10 +301,6 @@ public:
     HasReliableSymbolDifference = true;
   }
 
-  virtual const MCObjectFormat &getObjectFormat() const {
-    return Format;
-  }
-
   virtual bool doesSectionRequireSymbols(const MCSection &Section) const {
     const MCSectionELF &ES = static_cast<const MCSectionELF&>(Section);
     return ES.getFlags() & MCSectionELF::SHF_MERGE;
@@ -340,7 +333,6 @@ public:
 
 class WindowsX86AsmBackend : public X86AsmBackend {
   bool Is64Bit;
-  MCCOFFObjectFormat Format;
 
 public:
   WindowsX86AsmBackend(const Target &T, bool is64Bit)
@@ -348,25 +340,15 @@ public:
     , Is64Bit(is64Bit) {
   }
 
-  virtual const MCObjectFormat &getObjectFormat() const {
-    return Format;
-  }
-
   MCObjectWriter *createObjectWriter(raw_ostream &OS) const {
     return createWinCOFFObjectWriter(OS, Is64Bit);
   }
 };
 
 class DarwinX86AsmBackend : public X86AsmBackend {
-  MCMachOObjectFormat Format;
-
 public:
   DarwinX86AsmBackend(const Target &T)
     : X86AsmBackend(T) { }
-
-  virtual const MCObjectFormat &getObjectFormat() const {
-    return Format;
-  }
 };
 
 class DarwinX86_32AsmBackend : public DarwinX86AsmBackend {