Move MCObjectSymbolizer.h to MC/MCAnalysis.
authorRafael Espindola <rafael.espindola@gmail.com>
Thu, 31 Jul 2014 19:29:23 +0000 (19:29 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Thu, 31 Jul 2014 19:29:23 +0000 (19:29 +0000)
The cpp file is already in lib/MC/MCAnalysis.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214424 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/MC/MCAnalysis/MCObjectSymbolizer.h [new file with mode: 0644]
include/llvm/MC/MCObjectSymbolizer.h [deleted file]
lib/MC/MCAnalysis/MCObjectDisassembler.cpp
lib/MC/MCAnalysis/MCObjectSymbolizer.cpp
tools/llvm-objdump/llvm-objdump.cpp

diff --git a/include/llvm/MC/MCAnalysis/MCObjectSymbolizer.h b/include/llvm/MC/MCAnalysis/MCObjectSymbolizer.h
new file mode 100644 (file)
index 0000000..d494195
--- /dev/null
@@ -0,0 +1,83 @@
+//===-- MCObjectSymbolizer.h ----------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file declares the MCObjectSymbolizer class, an MCSymbolizer that is
+// backed by an object::ObjectFile.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_MC_MCANALYSIS_MCOBJECTSYMBOLIZER_H
+#define LLVM_MC_MCANALYSIS_MCOBJECTSYMBOLIZER_H
+
+#include "llvm/ADT/DenseMap.h"
+#include "llvm/MC/MCSymbolizer.h"
+#include "llvm/Object/ObjectFile.h"
+#include <vector>
+
+namespace llvm {
+
+class MCExpr;
+class MCInst;
+class MCRelocationInfo;
+class raw_ostream;
+
+/// \brief An ObjectFile-backed symbolizer.
+class MCObjectSymbolizer : public MCSymbolizer {
+protected:
+  const object::ObjectFile *Obj;
+
+  // Map a load address to the first relocation that applies there. As far as I
+  // know, if there are several relocations at the exact same address, they are
+  // related and the others can be determined from the first that was found in
+  // the relocation table. For instance, on x86-64 mach-o, a SUBTRACTOR
+  // relocation (referencing the minuend symbol) is followed by an UNSIGNED
+  // relocation (referencing the subtrahend symbol).
+  const object::RelocationRef *findRelocationAt(uint64_t Addr);
+  const object::SectionRef *findSectionContaining(uint64_t Addr);
+
+  MCObjectSymbolizer(MCContext &Ctx, std::unique_ptr<MCRelocationInfo> RelInfo,
+                     const object::ObjectFile *Obj);
+
+public:
+  /// \name Overridden MCSymbolizer methods:
+  /// @{
+  bool tryAddingSymbolicOperand(MCInst &MI, raw_ostream &cStream,
+                                int64_t Value, uint64_t Address,
+                                bool IsBranch, uint64_t Offset,
+                                uint64_t InstSize) override;
+
+  void tryAddingPcLoadReferenceComment(raw_ostream &cStream,
+                                       int64_t Value,
+                                       uint64_t Address) override;
+  /// @}
+
+  /// \brief Look for an external function symbol at \p Addr.
+  /// (References through the ELF PLT, Mach-O stubs, and similar).
+  /// \returns An MCExpr representing the external symbol, or 0 if not found.
+  virtual StringRef findExternalFunctionAt(uint64_t Addr);
+
+  /// \brief Create an object symbolizer for \p Obj.
+  static MCObjectSymbolizer *
+  createObjectSymbolizer(MCContext &Ctx,
+                         std::unique_ptr<MCRelocationInfo> RelInfo,
+                         const object::ObjectFile *Obj);
+
+private:
+  typedef DenseMap<uint64_t, object::RelocationRef> AddrToRelocMap;
+  typedef std::vector<object::SectionRef> SortedSectionList;
+  SortedSectionList SortedSections;
+  AddrToRelocMap AddrToReloc;
+
+  void buildSectionList();
+  void buildRelocationByAddrMap();
+};
+
+}
+
+#endif
diff --git a/include/llvm/MC/MCObjectSymbolizer.h b/include/llvm/MC/MCObjectSymbolizer.h
deleted file mode 100644 (file)
index f75b7f5..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-//===-- llvm/MC/MCObjectSymbolizer.h --------------------------------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file declares the MCObjectSymbolizer class, an MCSymbolizer that is
-// backed by an object::ObjectFile.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_MC_MCOBJECTSYMBOLIZER_H
-#define LLVM_MC_MCOBJECTSYMBOLIZER_H
-
-#include "llvm/ADT/DenseMap.h"
-#include "llvm/MC/MCSymbolizer.h"
-#include "llvm/Object/ObjectFile.h"
-#include <vector>
-
-namespace llvm {
-
-class MCExpr;
-class MCInst;
-class MCRelocationInfo;
-class raw_ostream;
-
-/// \brief An ObjectFile-backed symbolizer.
-class MCObjectSymbolizer : public MCSymbolizer {
-protected:
-  const object::ObjectFile *Obj;
-
-  // Map a load address to the first relocation that applies there. As far as I
-  // know, if there are several relocations at the exact same address, they are
-  // related and the others can be determined from the first that was found in
-  // the relocation table. For instance, on x86-64 mach-o, a SUBTRACTOR
-  // relocation (referencing the minuend symbol) is followed by an UNSIGNED
-  // relocation (referencing the subtrahend symbol).
-  const object::RelocationRef *findRelocationAt(uint64_t Addr);
-  const object::SectionRef *findSectionContaining(uint64_t Addr);
-
-  MCObjectSymbolizer(MCContext &Ctx, std::unique_ptr<MCRelocationInfo> RelInfo,
-                     const object::ObjectFile *Obj);
-
-public:
-  /// \name Overridden MCSymbolizer methods:
-  /// @{
-  bool tryAddingSymbolicOperand(MCInst &MI, raw_ostream &cStream,
-                                int64_t Value, uint64_t Address,
-                                bool IsBranch, uint64_t Offset,
-                                uint64_t InstSize) override;
-
-  void tryAddingPcLoadReferenceComment(raw_ostream &cStream,
-                                       int64_t Value,
-                                       uint64_t Address) override;
-  /// @}
-
-  /// \brief Look for an external function symbol at \p Addr.
-  /// (References through the ELF PLT, Mach-O stubs, and similar).
-  /// \returns An MCExpr representing the external symbol, or 0 if not found.
-  virtual StringRef findExternalFunctionAt(uint64_t Addr);
-
-  /// \brief Create an object symbolizer for \p Obj.
-  static MCObjectSymbolizer *
-  createObjectSymbolizer(MCContext &Ctx,
-                         std::unique_ptr<MCRelocationInfo> RelInfo,
-                         const object::ObjectFile *Obj);
-
-private:
-  typedef DenseMap<uint64_t, object::RelocationRef> AddrToRelocMap;
-  typedef std::vector<object::SectionRef> SortedSectionList;
-  SortedSectionList SortedSections;
-  AddrToRelocMap AddrToReloc;
-
-  void buildSectionList();
-  void buildRelocationByAddrMap();
-};
-
-}
-
-#endif
index 16bd84815ef18a37a56384f46eaccc49c0dc82f1..557e94315b19ce3bbc8ee4afd7d7ea147036d871 100644 (file)
@@ -16,9 +16,9 @@
 #include "llvm/MC/MCAnalysis/MCAtom.h"
 #include "llvm/MC/MCAnalysis/MCFunction.h"
 #include "llvm/MC/MCAnalysis/MCModule.h"
+#include "llvm/MC/MCAnalysis/MCObjectSymbolizer.h"
 #include "llvm/MC/MCDisassembler.h"
 #include "llvm/MC/MCInstrAnalysis.h"
-#include "llvm/MC/MCObjectSymbolizer.h"
 #include "llvm/Object/MachO.h"
 #include "llvm/Object/ObjectFile.h"
 #include "llvm/Support/Debug.h"
index b14959689d953ab49efdd2caf8a82e187c6beb56..984f7360409c1b90160234e153488a553c473a94 100644 (file)
@@ -7,7 +7,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/MC/MCObjectSymbolizer.h"
+#include "llvm/MC/MCAnalysis/MCObjectSymbolizer.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/MC/MCContext.h"
 #include "llvm/MC/MCExpr.h"
index 26707a3fd04cc0975b7dfa0736bf5f8ffcd61395..97087a276c70eaf7fa261267e4119e82d5480882 100644 (file)
@@ -24,6 +24,7 @@
 #include "llvm/MC/MCAnalysis/MCFunction.h"
 #include "llvm/MC/MCAnalysis/MCModule.h"
 #include "llvm/MC/MCAnalysis/MCModuleYAML.h"
+#include "llvm/MC/MCAnalysis/MCObjectSymbolizer.h"
 #include "llvm/MC/MCAsmInfo.h"
 #include "llvm/MC/MCContext.h"
 #include "llvm/MC/MCDisassembler.h"
@@ -33,7 +34,6 @@
 #include "llvm/MC/MCInstrInfo.h"
 #include "llvm/MC/MCObjectDisassembler.h"
 #include "llvm/MC/MCObjectFileInfo.h"
-#include "llvm/MC/MCObjectSymbolizer.h"
 #include "llvm/MC/MCRegisterInfo.h"
 #include "llvm/MC/MCRelocationInfo.h"
 #include "llvm/MC/MCSubtargetInfo.h"