Prune some includes from headers and sink some inline functions

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
This commit is contained in:
Reid Kleckner 2016-06-22 23:23:08 +00:00
parent 42fe7e4c85
commit 26f1ddead4
10 changed files with 37 additions and 23 deletions

View File

@ -14,6 +14,7 @@
#include "llvm/MC/MCValue.h" #include "llvm/MC/MCValue.h"
#include "llvm/Support/DataTypes.h" #include "llvm/Support/DataTypes.h"
#include "llvm/Support/ELF.h" #include "llvm/Support/ELF.h"
#include "llvm/Support/raw_ostream.h"
#include <vector> #include <vector>
namespace llvm { namespace llvm {

View File

@ -20,7 +20,6 @@
#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSwitch.h" #include "llvm/ADT/StringSwitch.h"
#include "llvm/MC/MCMachObjectWriter.h"
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
namespace llvm { namespace llvm {
@ -28,6 +27,7 @@ namespace llvm {
// Forward declarations. // Forward declarations.
class MCAsmLayout; class MCAsmLayout;
class MCSymbol; class MCSymbol;
class MachObjectWriter;
/// Linker Optimization Hint Type. /// Linker Optimization Hint Type.
enum MCLOHType { enum MCLOHType {
@ -123,31 +123,12 @@ public:
/// Emit this directive as: /// Emit this directive as:
/// <kind, numArgs, addr1, ..., addrN> /// <kind, numArgs, addr1, ..., addrN>
void emit(MachObjectWriter &ObjWriter, const MCAsmLayout &Layout) const { void emit(MachObjectWriter &ObjWriter, const MCAsmLayout &Layout) const;
raw_ostream &OutStream = ObjWriter.getStream();
emit_impl(OutStream, ObjWriter, Layout);
}
/// Get the size in bytes of this directive if emitted in \p ObjWriter with /// Get the size in bytes of this directive if emitted in \p ObjWriter with
/// the given \p Layout. /// the given \p Layout.
uint64_t getEmitSize(const MachObjectWriter &ObjWriter, uint64_t getEmitSize(const MachObjectWriter &ObjWriter,
const MCAsmLayout &Layout) const { 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();
}
}; };
class MCLOHContainer { class MCLOHContainer {

View File

@ -17,7 +17,7 @@
#include "llvm/ADT/PointerIntPair.h" #include "llvm/ADT/PointerIntPair.h"
#include "llvm/ADT/PointerUnion.h" #include "llvm/ADT/PointerUnion.h"
#include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringMap.h"
#include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCFragment.h"
#include "llvm/Support/Compiler.h" #include "llvm/Support/Compiler.h"
namespace llvm { namespace llvm {

View File

@ -21,6 +21,7 @@
#include "llvm/MC/MCObjectStreamer.h" #include "llvm/MC/MCObjectStreamer.h"
#include "llvm/MC/MCValue.h" #include "llvm/MC/MCValue.h"
#include "llvm/Support/COFF.h" #include "llvm/Support/COFF.h"
#include "llvm/Support/EndianStream.h"
using namespace llvm; using namespace llvm;
using namespace llvm::codeview; using namespace llvm::codeview;

View File

@ -22,6 +22,7 @@
#include "llvm/MC/MCSection.h" #include "llvm/MC/MCSection.h"
#include "llvm/MC/MCSymbol.h" #include "llvm/MC/MCSymbol.h"
#include "llvm/Support/Debug.h" #include "llvm/Support/Debug.h"
#include "llvm/Support/EndianStream.h"
#include "llvm/Support/ErrorHandling.h" #include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/LEB128.h" #include "llvm/Support/LEB128.h"
#include "llvm/Support/Path.h" #include "llvm/Support/Path.h"

View File

@ -10,6 +10,7 @@
#include "llvm/MC/MCLinkerOptimizationHint.h" #include "llvm/MC/MCLinkerOptimizationHint.h"
#include "llvm/MC/MCAsmLayout.h" #include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCMachObjectWriter.h"
#include "llvm/Support/LEB128.h" #include "llvm/Support/LEB128.h"
using namespace llvm; using namespace llvm;
@ -31,3 +32,28 @@ void MCLOHDirective::emit_impl(raw_ostream &OutStream,
It != EndIt; ++It) It != EndIt; ++It)
encodeULEB128(ObjWriter.getSymbolAddress(**It, Layout), OutStream); 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();
}

View File

@ -20,6 +20,7 @@
#include "llvm/MC/MCSubtargetInfo.h" #include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/MC/MCSymbol.h" #include "llvm/MC/MCSymbol.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
#include "llvm/Support/EndianStream.h"
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
using namespace llvm; using namespace llvm;

View File

@ -22,6 +22,7 @@
#include "llvm/MC/MCELFObjectWriter.h" #include "llvm/MC/MCELFObjectWriter.h"
#include "llvm/MC/MCFixupKindInfo.h" #include "llvm/MC/MCFixupKindInfo.h"
#include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCObjectWriter.h"
#include "llvm/Support/Debug.h" #include "llvm/Support/Debug.h"
#include "llvm/Support/TargetRegistry.h" #include "llvm/Support/TargetRegistry.h"

View File

@ -16,6 +16,7 @@
#include "llvm/MC/MCExpr.h" #include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCInst.h" #include "llvm/MC/MCInst.h"
#include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/MC/MCSymbol.h" #include "llvm/MC/MCSymbol.h"
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
using namespace llvm; using namespace llvm;

View File

@ -22,6 +22,7 @@
#include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSymbol.h" #include "llvm/MC/MCSymbol.h"
#include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCAsmInfo.h"
#include "llvm/Support/EndianStream.h"
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
using namespace llvm; using namespace llvm;