mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
[MC] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 294369
This commit is contained in:
parent
ad0489e470
commit
b36bc37b12
@ -11,15 +11,17 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
||||
#ifndef LLVM_MC_CONSTANTPOOLS_H
|
||||
#define LLVM_MC_CONSTANTPOOLS_H
|
||||
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/MapVector.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/Support/SMLoc.h"
|
||||
#include <cstdint>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class MCContext;
|
||||
class MCExpr;
|
||||
class MCSection;
|
||||
@ -30,6 +32,7 @@ class MCSymbolRefExpr;
|
||||
struct ConstantPoolEntry {
|
||||
ConstantPoolEntry(MCSymbol *L, const MCExpr *Val, unsigned Sz, SMLoc Loc_)
|
||||
: Label(L), Value(Val), Size(Sz), Loc(Loc_) {}
|
||||
|
||||
MCSymbol *Label;
|
||||
const MCExpr *Value;
|
||||
unsigned Size;
|
||||
@ -45,7 +48,7 @@ class ConstantPool {
|
||||
|
||||
public:
|
||||
// Initialize a new empty constant pool
|
||||
ConstantPool() {}
|
||||
ConstantPool() = default;
|
||||
|
||||
// Add a new entry to the constant pool in the next slot.
|
||||
// \param Value is the new entry to put in the constant pool.
|
||||
@ -90,6 +93,7 @@ private:
|
||||
ConstantPool *getConstantPool(MCSection *Section);
|
||||
ConstantPool &getOrCreateConstantPool(MCSection *Section);
|
||||
};
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
#endif // LLVM_MC_CONSTANTPOOLS_H
|
||||
|
@ -10,33 +10,35 @@
|
||||
#ifndef LLVM_MC_MCASSEMBLER_H
|
||||
#define LLVM_MC_MCASSEMBLER_H
|
||||
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/SmallPtrSet.h"
|
||||
#include "llvm/ADT/ilist.h"
|
||||
#include "llvm/ADT/ilist_node.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/iterator.h"
|
||||
#include "llvm/ADT/iterator_range.h"
|
||||
#include "llvm/ADT/SmallPtrSet.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/MC/MCDirectives.h"
|
||||
#include "llvm/MC/MCDwarf.h"
|
||||
#include "llvm/MC/MCFixup.h"
|
||||
#include "llvm/MC/MCFragment.h"
|
||||
#include "llvm/MC/MCInst.h"
|
||||
#include "llvm/MC/MCLinkerOptimizationHint.h"
|
||||
#include "llvm/MC/MCSubtargetInfo.h"
|
||||
#include "llvm/MC/MCSymbol.h"
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
class raw_ostream;
|
||||
|
||||
class MCAsmBackend;
|
||||
class MCAsmLayout;
|
||||
class MCAssembler;
|
||||
class MCContext;
|
||||
class MCCodeEmitter;
|
||||
class MCExpr;
|
||||
class MCFragment;
|
||||
class MCObjectWriter;
|
||||
class MCSection;
|
||||
class MCSubtargetInfo;
|
||||
class MCValue;
|
||||
class MCAsmBackend;
|
||||
|
||||
// FIXME: This really doesn't belong here. See comments below.
|
||||
struct IndirectSymbolData {
|
||||
@ -90,9 +92,6 @@ public:
|
||||
} VersionMinInfoType;
|
||||
|
||||
private:
|
||||
MCAssembler(const MCAssembler &) = delete;
|
||||
void operator=(const MCAssembler &) = delete;
|
||||
|
||||
MCContext &Context;
|
||||
|
||||
MCAsmBackend &Backend;
|
||||
@ -131,9 +130,9 @@ private:
|
||||
/// By default it's 0, which means bundling is disabled.
|
||||
unsigned BundleAlignSize;
|
||||
|
||||
unsigned RelaxAll : 1;
|
||||
unsigned SubsectionsViaSymbols : 1;
|
||||
unsigned IncrementalLinkerCompatible : 1;
|
||||
bool RelaxAll : 1;
|
||||
bool SubsectionsViaSymbols : 1;
|
||||
bool IncrementalLinkerCompatible : 1;
|
||||
|
||||
/// ELF specific e_header flags
|
||||
// It would be good if there were an MCELFAssembler class to hold this.
|
||||
@ -148,7 +147,6 @@ private:
|
||||
|
||||
VersionMinInfoType VersionMinInfo;
|
||||
|
||||
private:
|
||||
/// Evaluate a fixup to a relocatable expression and the value which should be
|
||||
/// placed into the fixup.
|
||||
///
|
||||
@ -201,6 +199,18 @@ private:
|
||||
MCFragment &F, const MCFixup &Fixup);
|
||||
|
||||
public:
|
||||
/// Construct a new assembler instance.
|
||||
//
|
||||
// FIXME: How are we going to parameterize this? Two obvious options are stay
|
||||
// concrete and require clients to pass in a target like object. The other
|
||||
// option is to make this abstract, and have targets provide concrete
|
||||
// implementations as we do with AsmParser.
|
||||
MCAssembler(MCContext &Context, MCAsmBackend &Backend,
|
||||
MCCodeEmitter &Emitter, MCObjectWriter &Writer);
|
||||
MCAssembler(const MCAssembler &) = delete;
|
||||
MCAssembler &operator=(const MCAssembler &) = delete;
|
||||
~MCAssembler();
|
||||
|
||||
/// Compute the effective fragment size assuming it is laid out at the given
|
||||
/// \p SectionAddress and \p FragmentOffset.
|
||||
uint64_t computeFragmentSize(const MCAsmLayout &Layout,
|
||||
@ -240,17 +250,6 @@ public:
|
||||
VersionMinInfo.Update = Update;
|
||||
}
|
||||
|
||||
public:
|
||||
/// Construct a new assembler instance.
|
||||
//
|
||||
// FIXME: How are we going to parameterize this? Two obvious options are stay
|
||||
// concrete and require clients to pass in a target like object. The other
|
||||
// option is to make this abstract, and have targets provide concrete
|
||||
// implementations as we do with AsmParser.
|
||||
MCAssembler(MCContext &Context, MCAsmBackend &Backend,
|
||||
MCCodeEmitter &Emitter, MCObjectWriter &Writer);
|
||||
~MCAssembler();
|
||||
|
||||
/// Reuse an assembler instance
|
||||
///
|
||||
void reset();
|
||||
@ -425,4 +424,4 @@ uint64_t computeBundlePadding(const MCAssembler &Assembler, const MCFragment *F,
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
#endif // LLVM_MC_MCASSEMBLER_H
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- llvm/MC/MCELFObjectWriter.h - ELF Object Writer ---------*- C++ -*-===//
|
||||
//===- llvm/MC/MCELFObjectWriter.h - ELF Object Writer ----------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -11,22 +11,21 @@
|
||||
#define LLVM_MC_MCELFOBJECTWRITER_H
|
||||
|
||||
#include "llvm/ADT/Triple.h"
|
||||
#include "llvm/MC/MCValue.h"
|
||||
#include "llvm/Support/DataTypes.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/ELF.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class MCAssembler;
|
||||
class MCContext;
|
||||
class MCFixup;
|
||||
class MCFragment;
|
||||
class MCObjectWriter;
|
||||
class MCSymbol;
|
||||
class MCSymbolELF;
|
||||
class MCValue;
|
||||
class raw_pwrite_stream;
|
||||
|
||||
struct ELFRelocationEntry {
|
||||
uint64_t Offset; // Where is the relocation.
|
||||
@ -47,6 +46,7 @@ struct ELFRelocationEntry {
|
||||
<< ", Addend=" << Addend << ", OriginalSymbol=" << OriginalSymbol
|
||||
<< ", OriginalAddend=" << OriginalAddend;
|
||||
}
|
||||
|
||||
void dump() const { print(errs()); }
|
||||
};
|
||||
|
||||
@ -58,12 +58,12 @@ class MCELFObjectTargetWriter {
|
||||
const unsigned IsN64 : 1;
|
||||
|
||||
protected:
|
||||
|
||||
MCELFObjectTargetWriter(bool Is64Bit_, uint8_t OSABI_,
|
||||
uint16_t EMachine_, bool HasRelocationAddend,
|
||||
bool IsN64=false);
|
||||
MCELFObjectTargetWriter(bool Is64Bit_, uint8_t OSABI_, uint16_t EMachine_,
|
||||
bool HasRelocationAddend, bool IsN64 = false);
|
||||
|
||||
public:
|
||||
virtual ~MCELFObjectTargetWriter() = default;
|
||||
|
||||
static uint8_t getOSABI(Triple::OSType OSType) {
|
||||
switch (OSType) {
|
||||
case Triple::CloudABI:
|
||||
@ -76,8 +76,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual ~MCELFObjectTargetWriter() {}
|
||||
|
||||
virtual unsigned getRelocType(MCContext &Ctx, const MCValue &Target,
|
||||
const MCFixup &Fixup, bool IsPCRel) const = 0;
|
||||
|
||||
@ -144,6 +142,7 @@ public:
|
||||
MCObjectWriter *createELFObjectWriter(MCELFObjectTargetWriter *MOTW,
|
||||
raw_pwrite_stream &OS,
|
||||
bool IsLittleEndian);
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_MC_MCELFOBJECTWRITER_H
|
||||
|
@ -10,27 +10,24 @@
|
||||
#ifndef LLVM_MC_MCELFSTREAMER_H
|
||||
#define LLVM_MC_MCELFSTREAMER_H
|
||||
|
||||
#include "llvm/ADT/SmallPtrSet.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/MC/MCDirectives.h"
|
||||
#include "llvm/MC/MCObjectStreamer.h"
|
||||
#include "llvm/MC/SectionKind.h"
|
||||
#include "llvm/Support/DataTypes.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class MCAsmBackend;
|
||||
class MCAssembler;
|
||||
class MCCodeEmitter;
|
||||
class MCExpr;
|
||||
class MCInst;
|
||||
class raw_ostream;
|
||||
|
||||
class MCELFStreamer : public MCObjectStreamer {
|
||||
public:
|
||||
MCELFStreamer(MCContext &Context, MCAsmBackend &TAB, raw_pwrite_stream &OS,
|
||||
MCCodeEmitter *Emitter)
|
||||
: MCObjectStreamer(Context, TAB, OS, Emitter), SeenIdent(false) {}
|
||||
: MCObjectStreamer(Context, TAB, OS, Emitter) {}
|
||||
|
||||
~MCELFStreamer() override;
|
||||
~MCELFStreamer() override = default;
|
||||
|
||||
/// state management
|
||||
void reset() override {
|
||||
@ -91,11 +88,11 @@ private:
|
||||
/// \brief Merge the content of the fragment \p EF into the fragment \p DF.
|
||||
void mergeFragment(MCDataFragment *, MCDataFragment *);
|
||||
|
||||
bool SeenIdent;
|
||||
bool SeenIdent = false;
|
||||
|
||||
/// BundleGroups - The stack of fragments holding the bundle-locked
|
||||
/// instructions.
|
||||
llvm::SmallVector<MCDataFragment *, 4> BundleGroups;
|
||||
SmallVector<MCDataFragment *, 4> BundleGroups;
|
||||
};
|
||||
|
||||
MCELFStreamer *createARMELFStreamer(MCContext &Context, MCAsmBackend &TAB,
|
||||
@ -105,4 +102,4 @@ MCELFStreamer *createARMELFStreamer(MCContext &Context, MCAsmBackend &TAB,
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
#endif // LLVM_MC_MCELFSTREAMER_H
|
||||
|
@ -11,11 +11,11 @@
|
||||
#define LLVM_MC_MCEXPR_H
|
||||
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/DataTypes.h"
|
||||
#include "llvm/Support/SMLoc.h"
|
||||
#include <cstdint>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class MCAsmInfo;
|
||||
class MCAsmLayout;
|
||||
class MCAssembler;
|
||||
@ -46,9 +46,6 @@ private:
|
||||
ExprKind Kind;
|
||||
SMLoc Loc;
|
||||
|
||||
MCExpr(const MCExpr&) = delete;
|
||||
void operator=(const MCExpr&) = delete;
|
||||
|
||||
bool evaluateAsAbsolute(int64_t &Res, const MCAssembler *Asm,
|
||||
const MCAsmLayout *Layout,
|
||||
const SectionAddrMap *Addrs) const;
|
||||
@ -66,6 +63,9 @@ protected:
|
||||
const SectionAddrMap *Addrs, bool InSet) const;
|
||||
|
||||
public:
|
||||
MCExpr(const MCExpr &) = delete;
|
||||
MCExpr &operator=(const MCExpr &) = delete;
|
||||
|
||||
/// \name Accessors
|
||||
/// @{
|
||||
|
||||
@ -359,15 +359,19 @@ public:
|
||||
|
||||
static const MCUnaryExpr *create(Opcode Op, const MCExpr *Expr,
|
||||
MCContext &Ctx);
|
||||
|
||||
static const MCUnaryExpr *createLNot(const MCExpr *Expr, MCContext &Ctx) {
|
||||
return create(LNot, Expr, Ctx);
|
||||
}
|
||||
|
||||
static const MCUnaryExpr *createMinus(const MCExpr *Expr, MCContext &Ctx) {
|
||||
return create(Minus, Expr, Ctx);
|
||||
}
|
||||
|
||||
static const MCUnaryExpr *createNot(const MCExpr *Expr, MCContext &Ctx) {
|
||||
return create(Not, Expr, Ctx);
|
||||
}
|
||||
|
||||
static const MCUnaryExpr *createPlus(const MCExpr *Expr, MCContext &Ctx) {
|
||||
return create(Plus, Expr, Ctx);
|
||||
}
|
||||
@ -433,78 +437,97 @@ public:
|
||||
static const MCBinaryExpr *create(Opcode Op, const MCExpr *LHS,
|
||||
const MCExpr *RHS, MCContext &Ctx,
|
||||
SMLoc Loc = SMLoc());
|
||||
|
||||
static const MCBinaryExpr *createAdd(const MCExpr *LHS, const MCExpr *RHS,
|
||||
MCContext &Ctx) {
|
||||
return create(Add, LHS, RHS, Ctx);
|
||||
}
|
||||
|
||||
static const MCBinaryExpr *createAnd(const MCExpr *LHS, const MCExpr *RHS,
|
||||
MCContext &Ctx) {
|
||||
return create(And, LHS, RHS, Ctx);
|
||||
}
|
||||
|
||||
static const MCBinaryExpr *createDiv(const MCExpr *LHS, const MCExpr *RHS,
|
||||
MCContext &Ctx) {
|
||||
return create(Div, LHS, RHS, Ctx);
|
||||
}
|
||||
|
||||
static const MCBinaryExpr *createEQ(const MCExpr *LHS, const MCExpr *RHS,
|
||||
MCContext &Ctx) {
|
||||
return create(EQ, LHS, RHS, Ctx);
|
||||
}
|
||||
|
||||
static const MCBinaryExpr *createGT(const MCExpr *LHS, const MCExpr *RHS,
|
||||
MCContext &Ctx) {
|
||||
return create(GT, LHS, RHS, Ctx);
|
||||
}
|
||||
|
||||
static const MCBinaryExpr *createGTE(const MCExpr *LHS, const MCExpr *RHS,
|
||||
MCContext &Ctx) {
|
||||
return create(GTE, LHS, RHS, Ctx);
|
||||
}
|
||||
|
||||
static const MCBinaryExpr *createLAnd(const MCExpr *LHS, const MCExpr *RHS,
|
||||
MCContext &Ctx) {
|
||||
return create(LAnd, LHS, RHS, Ctx);
|
||||
}
|
||||
|
||||
static const MCBinaryExpr *createLOr(const MCExpr *LHS, const MCExpr *RHS,
|
||||
MCContext &Ctx) {
|
||||
return create(LOr, LHS, RHS, Ctx);
|
||||
}
|
||||
|
||||
static const MCBinaryExpr *createLT(const MCExpr *LHS, const MCExpr *RHS,
|
||||
MCContext &Ctx) {
|
||||
return create(LT, LHS, RHS, Ctx);
|
||||
}
|
||||
|
||||
static const MCBinaryExpr *createLTE(const MCExpr *LHS, const MCExpr *RHS,
|
||||
MCContext &Ctx) {
|
||||
return create(LTE, LHS, RHS, Ctx);
|
||||
}
|
||||
|
||||
static const MCBinaryExpr *createMod(const MCExpr *LHS, const MCExpr *RHS,
|
||||
MCContext &Ctx) {
|
||||
return create(Mod, LHS, RHS, Ctx);
|
||||
}
|
||||
|
||||
static const MCBinaryExpr *createMul(const MCExpr *LHS, const MCExpr *RHS,
|
||||
MCContext &Ctx) {
|
||||
return create(Mul, LHS, RHS, Ctx);
|
||||
}
|
||||
|
||||
static const MCBinaryExpr *createNE(const MCExpr *LHS, const MCExpr *RHS,
|
||||
MCContext &Ctx) {
|
||||
return create(NE, LHS, RHS, Ctx);
|
||||
}
|
||||
|
||||
static const MCBinaryExpr *createOr(const MCExpr *LHS, const MCExpr *RHS,
|
||||
MCContext &Ctx) {
|
||||
return create(Or, LHS, RHS, Ctx);
|
||||
}
|
||||
|
||||
static const MCBinaryExpr *createShl(const MCExpr *LHS, const MCExpr *RHS,
|
||||
MCContext &Ctx) {
|
||||
return create(Shl, LHS, RHS, Ctx);
|
||||
}
|
||||
|
||||
static const MCBinaryExpr *createAShr(const MCExpr *LHS, const MCExpr *RHS,
|
||||
MCContext &Ctx) {
|
||||
return create(AShr, LHS, RHS, Ctx);
|
||||
}
|
||||
|
||||
static const MCBinaryExpr *createLShr(const MCExpr *LHS, const MCExpr *RHS,
|
||||
MCContext &Ctx) {
|
||||
return create(LShr, LHS, RHS, Ctx);
|
||||
}
|
||||
|
||||
static const MCBinaryExpr *createSub(const MCExpr *LHS, const MCExpr *RHS,
|
||||
MCContext &Ctx) {
|
||||
return create(Sub, LHS, RHS, Ctx);
|
||||
}
|
||||
|
||||
static const MCBinaryExpr *createXor(const MCExpr *LHS, const MCExpr *RHS,
|
||||
MCContext &Ctx) {
|
||||
return create(Xor, LHS, RHS, Ctx);
|
||||
@ -537,9 +560,11 @@ public:
|
||||
/// MCExprs are bump pointer allocated and not destructed.
|
||||
class MCTargetExpr : public MCExpr {
|
||||
virtual void anchor();
|
||||
|
||||
protected:
|
||||
MCTargetExpr() : MCExpr(Target, SMLoc()) {}
|
||||
virtual ~MCTargetExpr() {}
|
||||
virtual ~MCTargetExpr() = default;
|
||||
|
||||
public:
|
||||
virtual void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const = 0;
|
||||
virtual bool evaluateAsRelocatableImpl(MCValue &Res,
|
||||
@ -557,4 +582,4 @@ public:
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
#endif // LLVM_MC_MCEXPR_H
|
||||
|
@ -10,25 +10,26 @@
|
||||
#ifndef LLVM_MC_MCFRAGMENT_H
|
||||
#define LLVM_MC_MCFRAGMENT_H
|
||||
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/ilist.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/ilist_node.h"
|
||||
#include "llvm/ADT/iterator.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/MC/MCFixup.h"
|
||||
#include "llvm/MC/MCInst.h"
|
||||
#include "llvm/Support/SMLoc.h"
|
||||
#include <cstdint>
|
||||
#include <utility>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class MCSection;
|
||||
class MCSymbol;
|
||||
class MCSubtargetInfo;
|
||||
class MCSymbol;
|
||||
|
||||
class MCFragment : public ilist_node_with_parent<MCFragment, MCSection> {
|
||||
friend class MCAsmLayout;
|
||||
|
||||
MCFragment() = delete;
|
||||
MCFragment(const MCFragment &) = delete;
|
||||
void operator=(const MCFragment &) = delete;
|
||||
|
||||
public:
|
||||
enum FragmentType : uint8_t {
|
||||
FT_Align,
|
||||
@ -86,6 +87,10 @@ protected:
|
||||
~MCFragment();
|
||||
|
||||
public:
|
||||
MCFragment() = delete;
|
||||
MCFragment(const MCFragment &) = delete;
|
||||
MCFragment &operator=(const MCFragment &) = delete;
|
||||
|
||||
/// Destroys the current fragment.
|
||||
///
|
||||
/// This must be used instead of delete as MCFragment is non-virtual.
|
||||
@ -131,7 +136,8 @@ public:
|
||||
class MCDummyFragment : public MCFragment {
|
||||
public:
|
||||
explicit MCDummyFragment(MCSection *Sec)
|
||||
: MCFragment(FT_Dummy, false, 0, Sec){};
|
||||
: MCFragment(FT_Dummy, false, 0, Sec) {}
|
||||
|
||||
static bool classof(const MCFragment *F) { return F->getKind() == FT_Dummy; }
|
||||
};
|
||||
|
||||
@ -271,7 +277,6 @@ public:
|
||||
};
|
||||
|
||||
class MCAlignFragment : public MCFragment {
|
||||
|
||||
/// Alignment - The alignment to ensure, in bytes.
|
||||
unsigned Alignment;
|
||||
|
||||
@ -319,7 +324,6 @@ public:
|
||||
};
|
||||
|
||||
class MCFillFragment : public MCFragment {
|
||||
|
||||
/// Value to use for filling bytes.
|
||||
uint8_t Value;
|
||||
|
||||
@ -339,7 +343,6 @@ public:
|
||||
};
|
||||
|
||||
class MCOrgFragment : public MCFragment {
|
||||
|
||||
/// Offset - The offset this fragment should start at.
|
||||
const MCExpr *Offset;
|
||||
|
||||
@ -371,7 +374,6 @@ public:
|
||||
};
|
||||
|
||||
class MCLEBFragment : public MCFragment {
|
||||
|
||||
/// Value - The value this fragment should contain.
|
||||
const MCExpr *Value;
|
||||
|
||||
@ -404,7 +406,6 @@ public:
|
||||
};
|
||||
|
||||
class MCDwarfLineAddrFragment : public MCFragment {
|
||||
|
||||
/// LineDelta - the value of the difference between the two line numbers
|
||||
/// between two .loc dwarf directives.
|
||||
int64_t LineDelta;
|
||||
@ -441,7 +442,6 @@ public:
|
||||
};
|
||||
|
||||
class MCDwarfCallFrameFragment : public MCFragment {
|
||||
|
||||
/// AddrDelta - The expression for the difference of the two symbols that
|
||||
/// make up the address delta between two .cfi_* dwarf directives.
|
||||
const MCExpr *AddrDelta;
|
||||
@ -561,4 +561,4 @@ public:
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
#endif // LLVM_MC_MCFRAGMENT_H
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- llvm/MC/MCMachObjectWriter.h - Mach Object Writer -------*- C++ -*-===//
|
||||
//===- llvm/MC/MCMachObjectWriter.h - Mach Object Writer --------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -11,12 +11,15 @@
|
||||
#define LLVM_MC_MCMACHOBJECTWRITER_H
|
||||
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/MC/MCExpr.h"
|
||||
#include "llvm/MC/MCSection.h"
|
||||
#include "llvm/MC/MCObjectWriter.h"
|
||||
#include "llvm/MC/StringTableBuilder.h"
|
||||
#include "llvm/Support/DataTypes.h"
|
||||
#include "llvm/Support/MachO.h"
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
@ -95,8 +98,8 @@ class MachObjectWriter : public MCObjectWriter {
|
||||
: Sym(Sym), MRE(MRE) {}
|
||||
};
|
||||
|
||||
llvm::DenseMap<const MCSection *, std::vector<RelAndSymbol>> Relocations;
|
||||
llvm::DenseMap<const MCSection *, unsigned> IndirectSymBase;
|
||||
DenseMap<const MCSection *, std::vector<RelAndSymbol>> Relocations;
|
||||
DenseMap<const MCSection *, unsigned> IndirectSymBase;
|
||||
|
||||
SectionAddrMap SectionAddress;
|
||||
|
||||
@ -271,6 +274,6 @@ MCObjectWriter *createMachObjectWriter(MCMachObjectTargetWriter *MOTW,
|
||||
raw_pwrite_stream &OS,
|
||||
bool IsLittleEndian);
|
||||
|
||||
} // End llvm namespace
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
#endif // LLVM_MC_MCMACHOBJECTWRITER_H
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- llvm/MC/MCAsmParser.h - Abstract Asm Parser Interface ---*- C++ -*-===//
|
||||
//===- llvm/MC/MCAsmParser.h - Abstract Asm Parser Interface ----*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -10,16 +10,21 @@
|
||||
#ifndef LLVM_MC_MCPARSER_MCASMPARSER_H
|
||||
#define LLVM_MC_MCPARSER_MCASMPARSER_H
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/None.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/Twine.h"
|
||||
#include "llvm/MC/MCParser/AsmLexer.h"
|
||||
#include "llvm/Support/DataTypes.h"
|
||||
#include "llvm/MC/MCParser/MCAsmLexer.h"
|
||||
#include "llvm/Support/SMLoc.h"
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class MCAsmInfo;
|
||||
class MCAsmLexer;
|
||||
class MCAsmParserExtension;
|
||||
class MCContext;
|
||||
class MCExpr;
|
||||
@ -27,10 +32,7 @@ class MCInstPrinter;
|
||||
class MCInstrInfo;
|
||||
class MCStreamer;
|
||||
class MCTargetAsmParser;
|
||||
class SMLoc;
|
||||
class SMRange;
|
||||
class SourceMgr;
|
||||
class Twine;
|
||||
|
||||
class InlineAsmIdentifierInfo {
|
||||
public:
|
||||
@ -51,12 +53,12 @@ public:
|
||||
class MCAsmParserSemaCallback {
|
||||
public:
|
||||
virtual ~MCAsmParserSemaCallback();
|
||||
|
||||
virtual void *LookupInlineAsmIdentifier(StringRef &LineBuf,
|
||||
InlineAsmIdentifierInfo &Info,
|
||||
bool IsUnevaluatedContext) = 0;
|
||||
virtual StringRef LookupInlineAsmLabel(StringRef Identifier, SourceMgr &SM,
|
||||
SMLoc Location, bool Create) = 0;
|
||||
|
||||
virtual bool LookupInlineAsmField(StringRef Base, StringRef Member,
|
||||
unsigned &Offset) = 0;
|
||||
};
|
||||
@ -76,22 +78,21 @@ public:
|
||||
};
|
||||
|
||||
private:
|
||||
MCAsmParser(const MCAsmParser &) = delete;
|
||||
void operator=(const MCAsmParser &) = delete;
|
||||
|
||||
MCTargetAsmParser *TargetParser;
|
||||
MCTargetAsmParser *TargetParser = nullptr;
|
||||
|
||||
unsigned ShowParsedOperands : 1;
|
||||
|
||||
protected: // Can only create subclasses.
|
||||
MCAsmParser();
|
||||
|
||||
bool HadError;
|
||||
bool HadError = false;
|
||||
|
||||
SmallVector<MCPendingError, 1> PendingErrors;
|
||||
/// Flag tracking whether any errors have been encountered.
|
||||
|
||||
public:
|
||||
MCAsmParser(const MCAsmParser &) = delete;
|
||||
MCAsmParser &operator=(const MCAsmParser &) = delete;
|
||||
virtual ~MCAsmParser();
|
||||
|
||||
virtual void addDirectiveHandler(StringRef Directive,
|
||||
@ -190,8 +191,8 @@ public:
|
||||
|
||||
bool parseIntToken(int64_t &V, const Twine &ErrMsg);
|
||||
|
||||
bool check(bool P, const llvm::Twine &Msg);
|
||||
bool check(bool P, SMLoc Loc, const llvm::Twine &Msg);
|
||||
bool check(bool P, const Twine &Msg);
|
||||
bool check(bool P, SMLoc Loc, const Twine &Msg);
|
||||
|
||||
/// \brief Parse an identifier or string (as a quoted identifier) and set \p
|
||||
/// Res to the identifier contents.
|
||||
@ -260,6 +261,6 @@ public:
|
||||
MCAsmParser *createMCAsmParser(SourceMgr &, MCContext &, MCStreamer &,
|
||||
const MCAsmInfo &);
|
||||
|
||||
} // End llvm namespace
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
#endif // LLVM_MC_MCPARSER_MCASMPARSER_H
|
||||
|
@ -15,17 +15,26 @@
|
||||
#define LLVM_MC_MCSTREAMER_H
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/MC/MCDirectives.h"
|
||||
#include "llvm/MC/MCDwarf.h"
|
||||
#include "llvm/MC/MCLinkerOptimizationHint.h"
|
||||
#include "llvm/MC/MCSymbol.h"
|
||||
#include "llvm/MC/MCWinEH.h"
|
||||
#include "llvm/Support/DataTypes.h"
|
||||
#include "llvm/Support/SMLoc.h"
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class AssemblerConstantPools;
|
||||
class formatted_raw_ostream;
|
||||
class MCAsmBackend;
|
||||
class MCCodeEmitter;
|
||||
class MCContext;
|
||||
@ -34,14 +43,10 @@ class MCInst;
|
||||
class MCInstPrinter;
|
||||
class MCSection;
|
||||
class MCStreamer;
|
||||
class MCSymbolELF;
|
||||
class MCSymbolRefExpr;
|
||||
class MCSubtargetInfo;
|
||||
class StringRef;
|
||||
class Twine;
|
||||
class raw_ostream;
|
||||
class formatted_raw_ostream;
|
||||
class AssemblerConstantPools;
|
||||
class Twine;
|
||||
|
||||
typedef std::pair<MCSection *, const MCExpr *> MCSectionSubPair;
|
||||
|
||||
@ -162,9 +167,6 @@ class MCStreamer {
|
||||
MCContext &Context;
|
||||
std::unique_ptr<MCTargetStreamer> TargetStreamer;
|
||||
|
||||
MCStreamer(const MCStreamer &) = delete;
|
||||
MCStreamer &operator=(const MCStreamer &) = delete;
|
||||
|
||||
std::vector<MCDwarfFrameInfo> DwarfFrameInfos;
|
||||
MCDwarfFrameInfo *getCurrentDwarfFrameInfo();
|
||||
void EnsureValidDwarfFrame();
|
||||
@ -205,6 +207,8 @@ protected:
|
||||
virtual void EmitRawTextImpl(StringRef String);
|
||||
|
||||
public:
|
||||
MCStreamer(const MCStreamer &) = delete;
|
||||
MCStreamer &operator=(const MCStreamer &) = delete;
|
||||
virtual ~MCStreamer();
|
||||
|
||||
void visitUsedExpr(const MCExpr &Expr);
|
||||
@ -282,6 +286,7 @@ public:
|
||||
/// \brief Add explicit comment T. T is required to be a valid
|
||||
/// comment in the output and does not need to be escaped.
|
||||
virtual void addExplicitComment(const Twine &T);
|
||||
|
||||
/// \brief Emit added explicit comments.
|
||||
virtual void emitExplicitComments();
|
||||
|
||||
@ -876,6 +881,7 @@ MCStreamer *createAsmStreamer(MCContext &Ctx,
|
||||
bool isVerboseAsm, bool useDwarfDirectory,
|
||||
MCInstPrinter *InstPrint, MCCodeEmitter *CE,
|
||||
MCAsmBackend *TAB, bool ShowInst);
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
#endif // LLVM_MC_MCSTREAMER_H
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- llvm/MC/MCWinCOFFObjectWriter.h - Win COFF Object Writer *- C++ -*-===//
|
||||
//===- llvm/MC/MCWinCOFFObjectWriter.h - Win COFF Object Writer -*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -11,22 +11,23 @@
|
||||
#define LLVM_MC_MCWINCOFFOBJECTWRITER_H
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class MCAsmBackend;
|
||||
class MCFixup;
|
||||
class MCObjectWriter;
|
||||
class MCValue;
|
||||
class raw_ostream;
|
||||
class raw_pwrite_stream;
|
||||
|
||||
class MCWinCOFFObjectTargetWriter {
|
||||
virtual void anchor();
|
||||
|
||||
const unsigned Machine;
|
||||
|
||||
protected:
|
||||
MCWinCOFFObjectTargetWriter(unsigned Machine_);
|
||||
|
||||
public:
|
||||
virtual ~MCWinCOFFObjectTargetWriter() {}
|
||||
virtual ~MCWinCOFFObjectTargetWriter() = default;
|
||||
|
||||
unsigned getMachine() const { return Machine; }
|
||||
virtual unsigned getRelocType(const MCValue &Target, const MCFixup &Fixup,
|
||||
@ -42,6 +43,6 @@ class raw_pwrite_stream;
|
||||
/// \returns The constructed object writer.
|
||||
MCObjectWriter *createWinCOFFObjectWriter(MCWinCOFFObjectTargetWriter *MOTW,
|
||||
raw_pwrite_stream &OS);
|
||||
} // End llvm namespace
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
#endif // LLVM_MC_MCWINCOFFOBJECTWRITER_H
|
||||
|
@ -14,16 +14,15 @@
|
||||
#include "llvm/MC/MCObjectStreamer.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class MCAsmBackend;
|
||||
class MCContext;
|
||||
class MCCodeEmitter;
|
||||
class MCExpr;
|
||||
class MCInst;
|
||||
class MCSection;
|
||||
class MCSubtargetInfo;
|
||||
class MCSymbol;
|
||||
class StringRef;
|
||||
class raw_ostream;
|
||||
class raw_pwrite_stream;
|
||||
|
||||
class MCWinCOFFStreamer : public MCObjectStreamer {
|
||||
@ -70,12 +69,13 @@ public:
|
||||
|
||||
protected:
|
||||
const MCSymbol *CurSymbol;
|
||||
|
||||
void EmitInstToData(const MCInst &Inst, const MCSubtargetInfo &STI) override;
|
||||
|
||||
private:
|
||||
void Error(const Twine &Msg) const;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_MC_MCWINCOFFSTREAMER_H
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===- ConstantPools.cpp - ConstantPool class --*- C++ -*---------===//
|
||||
//===- ConstantPools.cpp - ConstantPool class -----------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -10,13 +10,16 @@
|
||||
// This file implements the ConstantPool and AssemblerConstantPools classes.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
#include "llvm/ADT/MapVector.h"
|
||||
|
||||
#include "llvm/MC/ConstantPools.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
#include "llvm/MC/MCDirectives.h"
|
||||
#include "llvm/MC/MCExpr.h"
|
||||
#include "llvm/MC/MCStreamer.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
//
|
||||
// ConstantPool implementation
|
||||
//
|
||||
|
@ -7,36 +7,49 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/MC/MCAssembler.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/Statistic.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/Twine.h"
|
||||
#include "llvm/MC/MCAsmBackend.h"
|
||||
#include "llvm/MC/MCAsmInfo.h"
|
||||
#include "llvm/MC/MCAsmLayout.h"
|
||||
#include "llvm/MC/MCAssembler.h"
|
||||
#include "llvm/MC/MCCodeEmitter.h"
|
||||
#include "llvm/MC/MCCodeView.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
#include "llvm/MC/MCDwarf.h"
|
||||
#include "llvm/MC/MCExpr.h"
|
||||
#include "llvm/MC/MCFixup.h"
|
||||
#include "llvm/MC/MCFixupKindInfo.h"
|
||||
#include "llvm/MC/MCFragment.h"
|
||||
#include "llvm/MC/MCInst.h"
|
||||
#include "llvm/MC/MCObjectWriter.h"
|
||||
#include "llvm/MC/MCSection.h"
|
||||
#include "llvm/MC/MCSectionELF.h"
|
||||
#include "llvm/MC/MCSymbol.h"
|
||||
#include "llvm/MC/MCValue.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/LEB128.h"
|
||||
#include "llvm/Support/TargetRegistry.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <cstring>
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
#define DEBUG_TYPE "assembler"
|
||||
|
||||
namespace {
|
||||
namespace stats {
|
||||
|
||||
STATISTIC(EmittedFragments, "Number of emitted assembler fragments - total");
|
||||
STATISTIC(EmittedRelaxableFragments,
|
||||
"Number of emitted assembler fragments - relaxable");
|
||||
@ -55,8 +68,9 @@ STATISTIC(FragmentLayouts, "Number of fragment layouts");
|
||||
STATISTIC(ObjectBytes, "Number of emitted object file bytes");
|
||||
STATISTIC(RelaxationSteps, "Number of assembler layout and relaxation steps");
|
||||
STATISTIC(RelaxedInstructions, "Number of relaxed instructions");
|
||||
}
|
||||
}
|
||||
|
||||
} // end namespace stats
|
||||
} // end anonymous namespace
|
||||
|
||||
// FIXME FIXME FIXME: There are number of places in this file where we convert
|
||||
// what is a 64-bit assembler value used for computation into a value in the
|
||||
@ -73,8 +87,7 @@ MCAssembler::MCAssembler(MCContext &Context, MCAsmBackend &Backend,
|
||||
VersionMinInfo.Major = 0; // Major version == 0 for "none specified"
|
||||
}
|
||||
|
||||
MCAssembler::~MCAssembler() {
|
||||
}
|
||||
MCAssembler::~MCAssembler() = default;
|
||||
|
||||
void MCAssembler::reset() {
|
||||
Sections.clear();
|
||||
@ -225,7 +238,6 @@ bool MCAssembler::evaluateFixup(const MCAsmLayout &Layout,
|
||||
Value -= Layout.getSymbolOffset(Sym);
|
||||
}
|
||||
|
||||
|
||||
bool ShouldAlignPC = Backend.getFixupKindInfo(Fixup.getKind()).Flags &
|
||||
MCFixupKindInfo::FKF_IsAlignedDownTo32Bits;
|
||||
assert((ShouldAlignPC ? IsPCRel : true) &&
|
||||
@ -647,7 +659,7 @@ std::pair<uint64_t, bool> MCAssembler::handleFixup(const MCAsmLayout &Layout,
|
||||
|
||||
void MCAssembler::layout(MCAsmLayout &Layout) {
|
||||
DEBUG_WITH_TYPE("mc-dump", {
|
||||
llvm::errs() << "assembler backend - pre-layout\n--\n";
|
||||
errs() << "assembler backend - pre-layout\n--\n";
|
||||
dump(); });
|
||||
|
||||
// Create dummy fragments and assign section ordinals.
|
||||
@ -677,14 +689,14 @@ void MCAssembler::layout(MCAsmLayout &Layout) {
|
||||
return;
|
||||
|
||||
DEBUG_WITH_TYPE("mc-dump", {
|
||||
llvm::errs() << "assembler backend - post-relaxation\n--\n";
|
||||
errs() << "assembler backend - post-relaxation\n--\n";
|
||||
dump(); });
|
||||
|
||||
// Finalize the layout, including fragment lowering.
|
||||
finishLayout(Layout);
|
||||
|
||||
DEBUG_WITH_TYPE("mc-dump", {
|
||||
llvm::errs() << "assembler backend - final-layout\n--\n";
|
||||
errs() << "assembler backend - final-layout\n--\n";
|
||||
dump(); });
|
||||
|
||||
// Allow the object writer a chance to perform post-layout binding (for
|
||||
|
@ -7,10 +7,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/MC/MCELFObjectWriter.h"
|
||||
#include "llvm/MC/MCExpr.h"
|
||||
#include "llvm/MC/MCValue.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
|
@ -11,30 +11,31 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/MC/MCELFStreamer.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/SmallPtrSet.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/MC/MCAsmBackend.h"
|
||||
#include "llvm/MC/MCAsmLayout.h"
|
||||
#include "llvm/MC/MCAsmInfo.h"
|
||||
#include "llvm/MC/MCAssembler.h"
|
||||
#include "llvm/MC/MCCodeEmitter.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
#include "llvm/MC/MCELFStreamer.h"
|
||||
#include "llvm/MC/MCExpr.h"
|
||||
#include "llvm/MC/MCInst.h"
|
||||
#include "llvm/MC/MCFixup.h"
|
||||
#include "llvm/MC/MCFragment.h"
|
||||
#include "llvm/MC/MCObjectFileInfo.h"
|
||||
#include "llvm/MC/MCObjectStreamer.h"
|
||||
#include "llvm/MC/MCObjectWriter.h"
|
||||
#include "llvm/MC/MCSection.h"
|
||||
#include "llvm/MC/MCSectionELF.h"
|
||||
#include "llvm/MC/MCStreamer.h"
|
||||
#include "llvm/MC/MCSymbolELF.h"
|
||||
#include "llvm/MC/MCSymbol.h"
|
||||
#include "llvm/MC/MCValue.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/ELF.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/TargetRegistry.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
@ -42,9 +43,6 @@ bool MCELFStreamer::isBundleLocked() const {
|
||||
return getCurrentSectionOnly()->isBundleLocked();
|
||||
}
|
||||
|
||||
MCELFStreamer::~MCELFStreamer() {
|
||||
}
|
||||
|
||||
void MCELFStreamer::mergeFragment(MCDataFragment *DF,
|
||||
MCDataFragment *EF) {
|
||||
MCAssembler &Assembler = getAssembler();
|
||||
@ -621,15 +619,6 @@ void MCELFStreamer::FinishImpl() {
|
||||
this->MCObjectStreamer::FinishImpl();
|
||||
}
|
||||
|
||||
MCStreamer *llvm::createELFStreamer(MCContext &Context, MCAsmBackend &MAB,
|
||||
raw_pwrite_stream &OS, MCCodeEmitter *CE,
|
||||
bool RelaxAll) {
|
||||
MCELFStreamer *S = new MCELFStreamer(Context, MAB, OS, CE);
|
||||
if (RelaxAll)
|
||||
S->getAssembler().setRelaxAll(true);
|
||||
return S;
|
||||
}
|
||||
|
||||
void MCELFStreamer::EmitThumbFunc(MCSymbol *Func) {
|
||||
llvm_unreachable("Generic ELF doesn't support this directive");
|
||||
}
|
||||
@ -663,3 +652,12 @@ void MCELFStreamer::EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol,
|
||||
uint64_t Size, unsigned ByteAlignment) {
|
||||
llvm_unreachable("ELF doesn't support this directive");
|
||||
}
|
||||
|
||||
MCStreamer *llvm::createELFStreamer(MCContext &Context, MCAsmBackend &MAB,
|
||||
raw_pwrite_stream &OS, MCCodeEmitter *CE,
|
||||
bool RelaxAll) {
|
||||
MCELFStreamer *S = new MCELFStreamer(Context, MAB, OS, CE);
|
||||
if (RelaxAll)
|
||||
S->getAssembler().setRelaxAll(true);
|
||||
return S;
|
||||
}
|
||||
|
@ -7,28 +7,35 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/MC/MCExpr.h"
|
||||
#include "llvm/ADT/Statistic.h"
|
||||
#include "llvm/ADT/StringSwitch.h"
|
||||
#include "llvm/MC/MCAsmInfo.h"
|
||||
#include "llvm/MC/MCAsmLayout.h"
|
||||
#include "llvm/MC/MCAssembler.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
#include "llvm/MC/MCExpr.h"
|
||||
#include "llvm/MC/MCObjectWriter.h"
|
||||
#include "llvm/MC/MCSymbol.h"
|
||||
#include "llvm/MC/MCValue.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
#define DEBUG_TYPE "mcexpr"
|
||||
|
||||
namespace {
|
||||
namespace stats {
|
||||
|
||||
STATISTIC(MCExprEvaluate, "Number of MCExpr evaluations");
|
||||
}
|
||||
}
|
||||
|
||||
} // end namespace stats
|
||||
} // end anonymous namespace
|
||||
|
||||
void MCExpr::print(raw_ostream &OS, const MCAsmInfo *MAI, bool InParens) const {
|
||||
switch (getKind()) {
|
||||
@ -44,7 +51,7 @@ void MCExpr::print(raw_ostream &OS, const MCAsmInfo *MAI, bool InParens) const {
|
||||
// Parenthesize names that start with $ so that they don't look like
|
||||
// absolute names.
|
||||
bool UseParens =
|
||||
!InParens && Sym.getName().size() && Sym.getName()[0] == '$';
|
||||
!InParens && !Sym.getName().empty() && Sym.getName()[0] == '$';
|
||||
if (UseParens) {
|
||||
OS << '(';
|
||||
Sym.print(OS, MAI);
|
||||
|
@ -7,30 +7,29 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/MC/MCFragment.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/ADT/Twine.h"
|
||||
#include "llvm/MC/MCAssembler.h"
|
||||
#include "llvm/MC/MCAsmBackend.h"
|
||||
#include "llvm/MC/MCAsmInfo.h"
|
||||
#include "llvm/MC/MCAsmLayout.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
#include "llvm/MC/MCDwarf.h"
|
||||
#include "llvm/MC/MCExpr.h"
|
||||
#include "llvm/MC/MCFixupKindInfo.h"
|
||||
#include "llvm/MC/MCFixup.h"
|
||||
#include "llvm/MC/MCFragment.h"
|
||||
#include "llvm/MC/MCSection.h"
|
||||
#include "llvm/MC/MCSectionELF.h"
|
||||
#include "llvm/MC/MCSymbol.h"
|
||||
#include "llvm/MC/MCValue.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/LEB128.h"
|
||||
#include "llvm/Support/TargetRegistry.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <utility>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
MCAsmLayout::MCAsmLayout(MCAssembler &Asm)
|
||||
: Assembler(Asm), LastValidFragment()
|
||||
{
|
||||
MCAsmLayout::MCAsmLayout(MCAssembler &Asm) : Assembler(Asm) {
|
||||
// Compute the section layout order. Virtual sections must go last.
|
||||
for (MCSection &Sec : Asm)
|
||||
if (!Sec.isVirtualSection())
|
||||
@ -233,7 +232,7 @@ uint64_t llvm::computeBundlePadding(const MCAssembler &Assembler,
|
||||
|
||||
void ilist_alloc_traits<MCFragment>::deleteNode(MCFragment *V) { V->destroy(); }
|
||||
|
||||
MCFragment::~MCFragment() { }
|
||||
MCFragment::~MCFragment() = default;
|
||||
|
||||
MCFragment::MCFragment(FragmentType Kind, bool HasInstructions,
|
||||
uint8_t BundlePadding, MCSection *Parent)
|
||||
@ -294,8 +293,6 @@ void MCFragment::destroy() {
|
||||
}
|
||||
}
|
||||
|
||||
/* *** */
|
||||
|
||||
// Debugging methods
|
||||
|
||||
namespace llvm {
|
||||
@ -307,11 +304,11 @@ raw_ostream &operator<<(raw_ostream &OS, const MCFixup &AF) {
|
||||
return OS;
|
||||
}
|
||||
|
||||
}
|
||||
} // end namespace llvm
|
||||
|
||||
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
|
||||
LLVM_DUMP_METHOD void MCFragment::dump() {
|
||||
raw_ostream &OS = llvm::errs();
|
||||
raw_ostream &OS = errs();
|
||||
|
||||
OS << "<";
|
||||
switch (getKind()) {
|
||||
@ -449,7 +446,7 @@ LLVM_DUMP_METHOD void MCFragment::dump() {
|
||||
}
|
||||
|
||||
LLVM_DUMP_METHOD void MCAssembler::dump() {
|
||||
raw_ostream &OS = llvm::errs();
|
||||
raw_ostream &OS = errs();
|
||||
|
||||
OS << "<MCAssembler\n";
|
||||
OS << " Sections:[\n ";
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- MCMachOStreamer.cpp - MachO Streamer ------------------------------===//
|
||||
//===- MCMachOStreamer.cpp - MachO Streamer -------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -7,27 +7,35 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/MC/MCStreamer.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/Triple.h"
|
||||
#include "llvm/MC/MCAsmBackend.h"
|
||||
#include "llvm/MC/MCAssembler.h"
|
||||
#include "llvm/MC/MCCodeEmitter.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
#include "llvm/MC/MCDwarf.h"
|
||||
#include "llvm/MC/MCDirectives.h"
|
||||
#include "llvm/MC/MCExpr.h"
|
||||
#include "llvm/MC/MCFixup.h"
|
||||
#include "llvm/MC/MCFragment.h"
|
||||
#include "llvm/MC/MCInst.h"
|
||||
#include "llvm/MC/MCLinkerOptimizationHint.h"
|
||||
#include "llvm/MC/MCObjectFileInfo.h"
|
||||
#include "llvm/MC/MCObjectStreamer.h"
|
||||
#include "llvm/MC/MCSection.h"
|
||||
#include "llvm/MC/MCSectionMachO.h"
|
||||
#include "llvm/MC/MCStreamer.h"
|
||||
#include "llvm/MC/MCSymbol.h"
|
||||
#include "llvm/MC/MCSymbolMachO.h"
|
||||
#include "llvm/MC/MCValue.h"
|
||||
#include "llvm/Support/Dwarf.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/TargetRegistry.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/Support/TargetRegistry.h"
|
||||
#include <cassert>
|
||||
#include <vector>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
@ -83,18 +91,23 @@ public:
|
||||
void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) override;
|
||||
void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
||||
unsigned ByteAlignment) override;
|
||||
|
||||
void BeginCOFFSymbolDef(const MCSymbol *Symbol) override {
|
||||
llvm_unreachable("macho doesn't support this directive");
|
||||
}
|
||||
|
||||
void EmitCOFFSymbolStorageClass(int StorageClass) override {
|
||||
llvm_unreachable("macho doesn't support this directive");
|
||||
}
|
||||
|
||||
void EmitCOFFSymbolType(int Type) override {
|
||||
llvm_unreachable("macho doesn't support this directive");
|
||||
}
|
||||
|
||||
void EndCOFFSymbolDef() override {
|
||||
llvm_unreachable("macho doesn't support this directive");
|
||||
}
|
||||
|
||||
void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
||||
unsigned ByteAlignment) override;
|
||||
void EmitZerofill(MCSection *Section, MCSymbol *Symbol = nullptr,
|
||||
|
@ -7,17 +7,29 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/MC/MCParser/MCAsmParserExtension.h"
|
||||
#include "llvm/ADT/StringSwitch.h"
|
||||
#include "llvm/ADT/Twine.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/MC/MCAsmInfo.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
#include "llvm/MC/MCDirectives.h"
|
||||
#include "llvm/MC/MCExpr.h"
|
||||
#include "llvm/MC/MCParser/MCAsmLexer.h"
|
||||
#include "llvm/MC/MCParser/MCAsmParser.h"
|
||||
#include "llvm/MC/MCParser/MCAsmParserExtension.h"
|
||||
#include "llvm/MC/MCSection.h"
|
||||
#include "llvm/MC/MCSectionELF.h"
|
||||
#include "llvm/MC/MCStreamer.h"
|
||||
#include "llvm/MC/MCSymbol.h"
|
||||
#include "llvm/MC/MCSymbolELF.h"
|
||||
#include "llvm/MC/SectionKind.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/ELF.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include "llvm/Support/SMLoc.h"
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <utility>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
@ -148,7 +160,7 @@ private:
|
||||
bool maybeParseUniqueID(int64_t &UniqueID);
|
||||
};
|
||||
|
||||
}
|
||||
} // end anonymous namespace
|
||||
|
||||
/// ParseDirectiveSymbolAttribute
|
||||
/// ::= { ".local", ".weak", ... } [ identifier ( , identifier )* ]
|
||||
@ -162,7 +174,7 @@ bool ELFAsmParser::ParseDirectiveSymbolAttribute(StringRef Directive, SMLoc) {
|
||||
.Default(MCSA_Invalid);
|
||||
assert(Attr != MCSA_Invalid && "unexpected symbol attribute directive!");
|
||||
if (getLexer().isNot(AsmToken::EndOfStatement)) {
|
||||
for (;;) {
|
||||
while (true) {
|
||||
StringRef Name;
|
||||
|
||||
if (getParser().parseIdentifier(Name))
|
||||
@ -234,8 +246,7 @@ bool ELFAsmParser::ParseSectionName(StringRef &SectionName) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
|
||||
while (true) {
|
||||
SMLoc PrevLoc = getLexer().getLoc();
|
||||
if (getLexer().is(AsmToken::Comma) ||
|
||||
getLexer().is(AsmToken::EndOfStatement))
|
||||
@ -784,4 +795,4 @@ MCAsmParserExtension *createELFAsmParser() {
|
||||
return new ELFAsmParser;
|
||||
}
|
||||
|
||||
}
|
||||
} // end namespace llvm
|
||||
|
@ -7,22 +7,22 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/MC/MCParser/MCAsmParser.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/Twine.h"
|
||||
#include "llvm/MC/MCParser/MCAsmLexer.h"
|
||||
#include "llvm/MC/MCParser/MCAsmParser.h"
|
||||
#include "llvm/MC/MCParser/MCParsedAsmOperand.h"
|
||||
#include "llvm/MC/MCParser/MCTargetAsmParser.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/SourceMgr.h"
|
||||
#include "llvm/Support/SMLoc.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <cassert>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
MCAsmParser::MCAsmParser()
|
||||
: TargetParser(nullptr), ShowParsedOperands(0), HadError(false),
|
||||
PendingErrors() {}
|
||||
MCAsmParser::MCAsmParser() : ShowParsedOperands(0) {}
|
||||
|
||||
MCAsmParser::~MCAsmParser() {
|
||||
}
|
||||
MCAsmParser::~MCAsmParser() = default;
|
||||
|
||||
void MCAsmParser::setTargetParser(MCTargetAsmParser &P) {
|
||||
assert(!TargetParser && "Target parser is already initialized!");
|
||||
@ -121,7 +121,7 @@ bool MCAsmParser::addErrorSuffix(const Twine &Suffix) {
|
||||
bool MCAsmParser::parseMany(function_ref<bool()> parseOne, bool hasComma) {
|
||||
if (parseOptionalToken(AsmToken::EndOfStatement))
|
||||
return false;
|
||||
while (1) {
|
||||
while (true) {
|
||||
if (parseOne())
|
||||
return true;
|
||||
if (parseOptionalToken(AsmToken::EndOfStatement))
|
||||
|
@ -7,36 +7,44 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/MC/MCStreamer.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/Twine.h"
|
||||
#include "llvm/MC/MCAsmBackend.h"
|
||||
#include "llvm/MC/MCAsmInfo.h"
|
||||
#include "llvm/MC/MCCodeView.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
#include "llvm/MC/MCDwarf.h"
|
||||
#include "llvm/MC/MCExpr.h"
|
||||
#include "llvm/MC/MCInst.h"
|
||||
#include "llvm/MC/MCInstPrinter.h"
|
||||
#include "llvm/MC/MCObjectFileInfo.h"
|
||||
#include "llvm/MC/MCObjectWriter.h"
|
||||
#include "llvm/MC/MCSection.h"
|
||||
#include "llvm/MC/MCSectionCOFF.h"
|
||||
#include "llvm/MC/MCStreamer.h"
|
||||
#include "llvm/MC/MCSymbol.h"
|
||||
#include "llvm/MC/MCWin64EH.h"
|
||||
#include "llvm/MC/MCWinEH.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/COFF.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/LEB128.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <cstdlib>
|
||||
using namespace llvm;
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <utility>
|
||||
|
||||
// Pin the vtables to this file.
|
||||
MCTargetStreamer::~MCTargetStreamer() {}
|
||||
using namespace llvm;
|
||||
|
||||
MCTargetStreamer::MCTargetStreamer(MCStreamer &S) : Streamer(S) {
|
||||
S.setTargetStreamer(this);
|
||||
}
|
||||
|
||||
// Pin the vtables to this file.
|
||||
MCTargetStreamer::~MCTargetStreamer() = default;
|
||||
|
||||
void MCTargetStreamer::emitLabel(MCSymbol *Symbol) {}
|
||||
|
||||
void MCTargetStreamer::finish() {}
|
||||
@ -666,7 +674,7 @@ void MCStreamer::EmitWinCFISaveXMM(unsigned Register, unsigned Offset) {
|
||||
|
||||
void MCStreamer::EmitWinCFIPushFrame(bool Code) {
|
||||
EnsureValidWinFrameInfo();
|
||||
if (CurrentWinFrameInfo->Instructions.size() > 0)
|
||||
if (!CurrentWinFrameInfo->Instructions.empty())
|
||||
report_fatal_error("If present, PushMachFrame must be the first UOP");
|
||||
|
||||
MCSymbol *Label = EmitCFILabel();
|
||||
|
@ -7,23 +7,36 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/MC/MCMachObjectWriter.h"
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/iterator_range.h"
|
||||
#include "llvm/ADT/Twine.h"
|
||||
#include "llvm/MC/MCAsmBackend.h"
|
||||
#include "llvm/MC/MCAsmLayout.h"
|
||||
#include "llvm/MC/MCAssembler.h"
|
||||
#include "llvm/MC/MCDirectives.h"
|
||||
#include "llvm/MC/MCExpr.h"
|
||||
#include "llvm/MC/MCFixupKindInfo.h"
|
||||
#include "llvm/MC/MCFragment.h"
|
||||
#include "llvm/MC/MCMachObjectWriter.h"
|
||||
#include "llvm/MC/MCObjectWriter.h"
|
||||
#include "llvm/MC/MCSection.h"
|
||||
#include "llvm/MC/MCSectionMachO.h"
|
||||
#include "llvm/MC/MCSymbol.h"
|
||||
#include "llvm/MC/MCSymbolMachO.h"
|
||||
#include "llvm/MC/MCValue.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/MachO.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
#define DEBUG_TYPE "mc"
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- llvm/MC/WinCOFFObjectWriter.cpp -------------------------*- C++ -*-===//
|
||||
//===- llvm/MC/WinCOFFObjectWriter.cpp ------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -11,37 +11,48 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/MC/MCWinCOFFObjectWriter.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/Twine.h"
|
||||
#include "llvm/Config/config.h"
|
||||
#include "llvm/MC/MCAsmLayout.h"
|
||||
#include "llvm/MC/MCAssembler.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
#include "llvm/MC/MCExpr.h"
|
||||
#include "llvm/MC/MCObjectFileInfo.h"
|
||||
#include "llvm/MC/MCFixup.h"
|
||||
#include "llvm/MC/MCFragment.h"
|
||||
#include "llvm/MC/MCObjectWriter.h"
|
||||
#include "llvm/MC/MCSection.h"
|
||||
#include "llvm/MC/MCSectionCOFF.h"
|
||||
#include "llvm/MC/MCSymbol.h"
|
||||
#include "llvm/MC/MCSymbolCOFF.h"
|
||||
#include "llvm/MC/MCValue.h"
|
||||
#include "llvm/MC/MCWinCOFFObjectWriter.h"
|
||||
#include "llvm/MC/StringTableBuilder.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/COFF.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/JamCRC.h"
|
||||
#include <cstdio>
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <ctime>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
#define DEBUG_TYPE "WinCOFFObjectWriter"
|
||||
|
||||
namespace {
|
||||
|
||||
typedef SmallString<COFF::NameSize> name;
|
||||
|
||||
enum AuxiliaryType {
|
||||
@ -57,7 +68,6 @@ struct AuxSymbol {
|
||||
COFF::Auxiliary Aux;
|
||||
};
|
||||
|
||||
class COFFSymbol;
|
||||
class COFFSection;
|
||||
|
||||
class COFFSymbol {
|
||||
@ -69,13 +79,13 @@ public:
|
||||
name Name;
|
||||
int Index;
|
||||
AuxiliarySymbols Aux;
|
||||
COFFSymbol *Other;
|
||||
COFFSection *Section;
|
||||
int Relocations;
|
||||
|
||||
const MCSymbol *MC;
|
||||
COFFSymbol *Other = nullptr;
|
||||
COFFSection *Section = nullptr;
|
||||
int Relocations = 0;
|
||||
const MCSymbol *MC = nullptr;
|
||||
|
||||
COFFSymbol(StringRef name);
|
||||
|
||||
void set_name_offset(uint32_t Offset);
|
||||
|
||||
int64_t getIndex() const { return Index; }
|
||||
@ -89,9 +99,10 @@ public:
|
||||
// This class contains staging data for a COFF relocation entry.
|
||||
struct COFFRelocation {
|
||||
COFF::relocation Data;
|
||||
COFFSymbol *Symb;
|
||||
COFFSymbol *Symb = nullptr;
|
||||
|
||||
COFFRelocation() = default;
|
||||
|
||||
COFFRelocation() : Symb(nullptr) {}
|
||||
static size_t size() { return COFF::RelocationSize; }
|
||||
};
|
||||
|
||||
@ -103,8 +114,8 @@ public:
|
||||
|
||||
std::string Name;
|
||||
int Number;
|
||||
MCSectionCOFF const *MCSection;
|
||||
COFFSymbol *Symbol;
|
||||
MCSectionCOFF const *MCSection = nullptr;
|
||||
COFFSymbol *Symbol = nullptr;
|
||||
relocations Relocations;
|
||||
|
||||
COFFSection(StringRef name);
|
||||
@ -190,7 +201,8 @@ public:
|
||||
|
||||
void writeObject(MCAssembler &Asm, const MCAsmLayout &Layout) override;
|
||||
};
|
||||
}
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
static inline void write_uint32_le(void *Data, uint32_t Value) {
|
||||
support::endian::write<uint32_t, support::little, support::unaligned>(Data,
|
||||
@ -200,9 +212,7 @@ static inline void write_uint32_le(void *Data, uint32_t Value) {
|
||||
//------------------------------------------------------------------------------
|
||||
// Symbol class implementation
|
||||
|
||||
COFFSymbol::COFFSymbol(StringRef name)
|
||||
: Name(name.begin(), name.end()), Other(nullptr), Section(nullptr),
|
||||
Relocations(0), MC(nullptr) {
|
||||
COFFSymbol::COFFSymbol(StringRef name) : Name(name.begin(), name.end()) {
|
||||
memset(&Data, 0, sizeof(Data));
|
||||
}
|
||||
|
||||
@ -217,8 +227,7 @@ void COFFSymbol::set_name_offset(uint32_t Offset) {
|
||||
//------------------------------------------------------------------------------
|
||||
// Section class implementation
|
||||
|
||||
COFFSection::COFFSection(StringRef name)
|
||||
: Name(name), MCSection(nullptr), Symbol(nullptr) {
|
||||
COFFSection::COFFSection(StringRef name) : Name(name) {
|
||||
memset(&Header, 0, sizeof(Header));
|
||||
}
|
||||
|
||||
@ -938,7 +947,7 @@ void WinCOFFObjectWriter::writeObject(MCAssembler &Asm,
|
||||
offset += Sec->Header.SizeOfRawData;
|
||||
}
|
||||
|
||||
if (Sec->Relocations.size() > 0) {
|
||||
if (!Sec->Relocations.empty()) {
|
||||
bool RelocationsOverflow = Sec->Relocations.size() >= 0xffff;
|
||||
|
||||
if (RelocationsOverflow) {
|
||||
@ -1052,7 +1061,7 @@ void WinCOFFObjectWriter::writeObject(MCAssembler &Asm,
|
||||
SecDef.Aux.SectionDefinition.CheckSum = JC.getCRC();
|
||||
}
|
||||
|
||||
if ((*i)->Relocations.size() > 0) {
|
||||
if (!(*i)->Relocations.empty()) {
|
||||
assert(getStream().tell() == (*i)->Header.PointerToRelocations &&
|
||||
"Section::PointerToRelocations is insane!");
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- llvm/MC/WinCOFFStreamer.cpp -----------------------------*- C++ -*-===//
|
||||
//===- llvm/MC/WinCOFFStreamer.cpp ----------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -11,32 +11,36 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/Triple.h"
|
||||
#include "llvm/ADT/Twine.h"
|
||||
#include "llvm/MC/MCAsmBackend.h"
|
||||
#include "llvm/MC/MCAsmLayout.h"
|
||||
#include "llvm/MC/MCAssembler.h"
|
||||
#include "llvm/MC/MCCodeEmitter.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
#include "llvm/MC/MCExpr.h"
|
||||
#include "llvm/MC/MCFixup.h"
|
||||
#include "llvm/MC/MCFragment.h"
|
||||
#include "llvm/MC/MCObjectFileInfo.h"
|
||||
#include "llvm/MC/MCObjectStreamer.h"
|
||||
#include "llvm/MC/MCSection.h"
|
||||
#include "llvm/MC/MCSectionCOFF.h"
|
||||
#include "llvm/MC/MCStreamer.h"
|
||||
#include "llvm/MC/MCSymbolCOFF.h"
|
||||
#include "llvm/MC/MCValue.h"
|
||||
#include "llvm/MC/MCWinCOFFStreamer.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/COFF.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include "llvm/Support/TargetRegistry.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/Support/SMLoc.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
#define DEBUG_TYPE "WinCOFFStreamer"
|
||||
|
||||
namespace llvm {
|
||||
MCWinCOFFStreamer::MCWinCOFFStreamer(MCContext &Context, MCAsmBackend &MAB,
|
||||
MCCodeEmitter &CE, raw_pwrite_stream &OS)
|
||||
: MCObjectStreamer(Context, MAB, OS, &CE), CurSymbol(nullptr) {}
|
||||
@ -295,5 +299,3 @@ void MCWinCOFFStreamer::FinishImpl() {
|
||||
void MCWinCOFFStreamer::Error(const Twine &Msg) const {
|
||||
getContext().reportError(SMLoc(), Msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user