]> granicus.if.org Git - llvm/commitdiff
Prune some includes from headers and sink some inline functions
authorReid Kleckner <rnk@google.com>
Wed, 22 Jun 2016 23:23:08 +0000 (23:23 +0000)
committerReid Kleckner <rnk@google.com>
Wed, 22 Jun 2016 23:23:08 +0000 (23:23 +0000)
MCSymbol.h shouldn't pull in MCAssembler.h, just MCFragment.h.
MCLinkerOptimizationHint.h shouldn't need MCMachObjectWriter.h.  The
rest is fixing the fallout.

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

include/llvm/MC/MCELFObjectWriter.h
include/llvm/MC/MCLinkerOptimizationHint.h
include/llvm/MC/MCSymbol.h
lib/MC/MCCodeView.cpp
lib/MC/MCDwarf.cpp
lib/MC/MCLinkerOptimizationHint.cpp
lib/Target/BPF/MCTargetDesc/BPFMCCodeEmitter.cpp
lib/Target/Hexagon/MCTargetDesc/HexagonAsmBackend.cpp
lib/Target/Sparc/InstPrinter/SparcInstPrinter.cpp
lib/Target/Sparc/MCTargetDesc/SparcMCCodeEmitter.cpp

index ea399b63f61fec0464c0d9bc1d0a6230c33f144a..376e21821316d286de87eef2a77d6d4a1c0f8027 100644 (file)
@@ -14,6 +14,7 @@
 #include "llvm/MC/MCValue.h"
 #include "llvm/Support/DataTypes.h"
 #include "llvm/Support/ELF.h"
+#include "llvm/Support/raw_ostream.h"
 #include <vector>
 
 namespace llvm {
index a519c4b71b033163b8d4ff500d1e177d0164e844..200bb93f64c8de7a0421f50079c9dca73621a94b 100644 (file)
@@ -20,7 +20,6 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/StringSwitch.h"
-#include "llvm/MC/MCMachObjectWriter.h"
 #include "llvm/Support/raw_ostream.h"
 
 namespace llvm {
@@ -28,6 +27,7 @@ namespace llvm {
 // Forward declarations.
 class MCAsmLayout;
 class MCSymbol;
+class MachObjectWriter;
 
 /// Linker Optimization Hint Type.
 enum MCLOHType {
@@ -123,31 +123,12 @@ public:
 
   /// Emit this directive as:
   /// <kind, numArgs, addr1, ..., addrN>
-  void emit(MachObjectWriter &ObjWriter, const MCAsmLayout &Layout) const {
-    raw_ostream &OutStream = ObjWriter.getStream();
-    emit_impl(OutStream, ObjWriter, Layout);
-  }
+  void emit(MachObjectWriter &ObjWriter, const MCAsmLayout &Layout) const;
 
   /// Get the size in bytes of this directive if emitted in \p ObjWriter with
   /// the given \p Layout.
   uint64_t getEmitSize(const MachObjectWriter &ObjWriter,
-                       const MCAsmLayout &Layout) const {
-    class raw_counting_ostream : public raw_ostream {
-      uint64_t Count;
-
-      void write_impl(const char *, size_t size) override { Count += size; }
-
-      uint64_t current_pos() const override { return Count; }
-
-    public:
-      raw_counting_ostream() : Count(0) {}
-      ~raw_counting_ostream() override { flush(); }
-    };
-
-    raw_counting_ostream OutStream;
-    emit_impl(OutStream, ObjWriter, Layout);
-    return OutStream.tell();
-  }
+                       const MCAsmLayout &Layout) const;
 };
 
 class MCLOHContainer {
index c51ecfcb0c5c9c018552c97f1315260cc8d23063..2c0fa083187fea7091e7e7c5ce6df58a63c6558d 100644 (file)
@@ -17,7 +17,7 @@
 #include "llvm/ADT/PointerIntPair.h"
 #include "llvm/ADT/PointerUnion.h"
 #include "llvm/ADT/StringMap.h"
-#include "llvm/MC/MCAssembler.h"
+#include "llvm/MC/MCFragment.h"
 #include "llvm/Support/Compiler.h"
 
 namespace llvm {
index 2d8ef442f75141844ffa6cf9b2abe5e06aeacbbb..d3f2aa2a80c01a1878adeef0d477b3237cf99637 100644 (file)
@@ -21,6 +21,7 @@
 #include "llvm/MC/MCObjectStreamer.h"
 #include "llvm/MC/MCValue.h"
 #include "llvm/Support/COFF.h"
+#include "llvm/Support/EndianStream.h"
 
 using namespace llvm;
 using namespace llvm::codeview;
index 47f002f619b495499b9e3f6c93b08ee113e09fe5..57252a07d9ed135211e8f442773bb002e1d19c52 100644 (file)
@@ -22,6 +22,7 @@
 #include "llvm/MC/MCSection.h"
 #include "llvm/MC/MCSymbol.h"
 #include "llvm/Support/Debug.h"
+#include "llvm/Support/EndianStream.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/LEB128.h"
 #include "llvm/Support/Path.h"
index 5f6a57980ad45ac3b4212b949c4002b9549ededa..9dd1439f0fb15ba3b74a06d8905c75b5953c63ad 100644 (file)
@@ -10,6 +10,7 @@
 #include "llvm/MC/MCLinkerOptimizationHint.h"
 #include "llvm/MC/MCAsmLayout.h"
 #include "llvm/MC/MCAssembler.h"
+#include "llvm/MC/MCMachObjectWriter.h"
 #include "llvm/Support/LEB128.h"
 
 using namespace llvm;
@@ -31,3 +32,28 @@ void MCLOHDirective::emit_impl(raw_ostream &OutStream,
        It != EndIt; ++It)
     encodeULEB128(ObjWriter.getSymbolAddress(**It, Layout), OutStream);
 }
+
+void MCLOHDirective::emit(MachObjectWriter &ObjWriter,
+                          const MCAsmLayout &Layout) const {
+  raw_ostream &OutStream = ObjWriter.getStream();
+  emit_impl(OutStream, ObjWriter, Layout);
+}
+
+uint64_t MCLOHDirective::getEmitSize(const MachObjectWriter &ObjWriter,
+                                     const MCAsmLayout &Layout) const {
+  class raw_counting_ostream : public raw_ostream {
+    uint64_t Count;
+
+    void write_impl(const char *, size_t size) override { Count += size; }
+
+    uint64_t current_pos() const override { return Count; }
+
+  public:
+    raw_counting_ostream() : Count(0) {}
+    ~raw_counting_ostream() override { flush(); }
+  };
+
+  raw_counting_ostream OutStream;
+  emit_impl(OutStream, ObjWriter, Layout);
+  return OutStream.tell();
+}
index dc4ede30f1919cd1335a9acfc0f8c393fb946671..c6561ddda26e05a8826ed45ce90e3f40dc713cf8 100644 (file)
@@ -20,6 +20,7 @@
 #include "llvm/MC/MCSubtargetInfo.h"
 #include "llvm/MC/MCSymbol.h"
 #include "llvm/ADT/Statistic.h"
+#include "llvm/Support/EndianStream.h"
 #include "llvm/Support/raw_ostream.h"
 using namespace llvm;
 
index cab8a0b34a1db710e9f6cc0f336e8ae0a7031abd..25fce72019bbf09997f0a1a584ce451d3246fe0f 100644 (file)
@@ -22,6 +22,7 @@
 #include "llvm/MC/MCELFObjectWriter.h"
 #include "llvm/MC/MCFixupKindInfo.h"
 #include "llvm/MC/MCInstrInfo.h"
+#include "llvm/MC/MCObjectWriter.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/TargetRegistry.h"
 
index 554f32745f8826830ea97d26dbb2ec9b34ab18f0..4981deae6af65fc3b0def11a90989246535c57ed 100644 (file)
@@ -16,6 +16,7 @@
 #include "llvm/MC/MCExpr.h"
 #include "llvm/MC/MCInst.h"
 #include "llvm/MC/MCRegisterInfo.h"
+#include "llvm/MC/MCSubtargetInfo.h"
 #include "llvm/MC/MCSymbol.h"
 #include "llvm/Support/raw_ostream.h"
 using namespace llvm;
index 9171d4dc9c00e507227e8897007ee161ed9bc84a..45bc4a1de01ba9523a66d2957f7163100ff1dd9f 100644 (file)
@@ -22,6 +22,7 @@
 #include "llvm/MC/MCRegisterInfo.h"
 #include "llvm/MC/MCSymbol.h"
 #include "llvm/MC/MCAsmInfo.h"
+#include "llvm/Support/EndianStream.h"
 #include "llvm/Support/raw_ostream.h"
 
 using namespace llvm;