-//===-- llvm/MC/MCAsmBackend.h - MC Asm Backend -----------------*- C++ -*-===//
+//===- llvm/MC/MCAsmBackend.h - MC Asm Backend ------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/Optional.h"
+#include "llvm/ADT/StringRef.h"
#include "llvm/MC/MCDirectives.h"
#include "llvm/MC/MCFixup.h"
-#include "llvm/Support/DataTypes.h"
-#include "llvm/Support/ErrorHandling.h"
+#include <cstdint>
namespace llvm {
+
class MCAsmLayout;
class MCAssembler;
class MCCFIInstruction;
-class MCELFObjectTargetWriter;
struct MCFixupKindInfo;
class MCFragment;
class MCInst;
-class MCRelaxableFragment;
class MCObjectWriter;
-class MCSection;
+class MCRelaxableFragment;
class MCSubtargetInfo;
class MCValue;
class raw_pwrite_stream;
/// Generic interface to target specific assembler backends.
class MCAsmBackend {
- MCAsmBackend(const MCAsmBackend &) = delete;
- void operator=(const MCAsmBackend &) = delete;
-
protected: // Can only create subclasses.
MCAsmBackend();
public:
+ MCAsmBackend(const MCAsmBackend &) = delete;
+ MCAsmBackend &operator=(const MCAsmBackend &) = delete;
virtual ~MCAsmBackend();
/// lifetime management
}
};
-} // End llvm namespace
+} // end namespace llvm
-#endif
+#endif // LLVM_MC_MCASMBACKEND_H
-//===-- llvm/MC/MCCodeEmitter.h - Instruction Encoding ----------*- C++ -*-===//
+//===- llvm/MC/MCCodeEmitter.h - Instruction Encoding -----------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
#ifndef LLVM_MC_MCCODEEMITTER_H
#define LLVM_MC_MCCODEEMITTER_H
-#include "llvm/Support/Compiler.h"
-
namespace llvm {
+
class MCFixup;
class MCInst;
class MCSubtargetInfo;
/// MCCodeEmitter - Generic instruction encoding interface.
class MCCodeEmitter {
-private:
- MCCodeEmitter(const MCCodeEmitter &) = delete;
- void operator=(const MCCodeEmitter &) = delete;
-
protected: // Can only create subclasses.
MCCodeEmitter();
public:
+ MCCodeEmitter(const MCCodeEmitter &) = delete;
+ MCCodeEmitter &operator=(const MCCodeEmitter &) = delete;
virtual ~MCCodeEmitter();
/// Lifetime management
const MCSubtargetInfo &STI) const = 0;
};
-} // End llvm namespace
+} // end namespace llvm
-#endif
+#endif // LLVM_MC_MCCODEEMITTER_H
-//===-- llvm/MC/MCDisassembler.h - Disassembler interface -------*- C++ -*-===//
+//===- llvm/MC/MCDisassembler.h - Disassembler interface --------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+
#ifndef LLVM_MC_MCDISASSEMBLER_MCDISASSEMBLER_H
#define LLVM_MC_MCDISASSEMBLER_MCDISASSEMBLER_H
-#include "llvm-c/Disassembler.h"
#include "llvm/MC/MCDisassembler/MCSymbolizer.h"
-#include "llvm/Support/DataTypes.h"
+#include <cstdint>
+#include <memory>
namespace llvm {
template <typename T> class ArrayRef;
+class MCContext;
class MCInst;
class MCSubtargetInfo;
class raw_ostream;
-class MCContext;
/// Superclass for all disassemblers. Consumes a memory region and provides an
/// array of assembly instructions.
};
MCDisassembler(const MCSubtargetInfo &STI, MCContext &Ctx)
- : Ctx(Ctx), STI(STI), Symbolizer(), CommentStream(nullptr) {}
+ : Ctx(Ctx), STI(STI) {}
virtual ~MCDisassembler();
// Marked mutable because we cache it inside the disassembler, rather than
// having to pass it around as an argument through all the autogenerated code.
- mutable raw_ostream *CommentStream;
+ mutable raw_ostream *CommentStream = nullptr;
};
-} // namespace llvm
+} // end namespace llvm
-#endif
+#endif // LLVM_MC_MCDISASSEMBLER_MCDISASSEMBLER_H
-//==-- llvm/MC/MCRelocationInfo.h --------------------------------*- C++ -*-==//
+//===- llvm/MC/MCRelocationInfo.h -------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
#ifndef LLVM_MC_MCDISASSEMBLER_MCRELOCATIONINFO_H
#define LLVM_MC_MCDISASSEMBLER_MCRELOCATIONINFO_H
-#include "llvm/Support/Compiler.h"
-
namespace llvm {
-namespace object {
-class RelocationRef;
-}
-class MCExpr;
class MCContext;
+class MCExpr;
/// \brief Create MCExprs from relocations found in an object file.
class MCRelocationInfo {
- MCRelocationInfo(const MCRelocationInfo &) = delete;
- void operator=(const MCRelocationInfo &) = delete;
-
protected:
MCContext &Ctx;
public:
MCRelocationInfo(MCContext &Ctx);
+ MCRelocationInfo(const MCRelocationInfo &) = delete;
+ MCRelocationInfo &operator=(const MCRelocationInfo &) = delete;
virtual ~MCRelocationInfo();
/// \brief Create an MCExpr for the target-specific \p VariantKind.
unsigned VariantKind);
};
-}
+} // end namespace llvm
-#endif
+#endif // LLVM_MC_MCDISASSEMBLER_MCRELOCATIONINFO_H
-//===-- llvm/MC/MCSymbolizer.h - MCSymbolizer class -------------*- C++ -*-===//
+//===- llvm/MC/MCSymbolizer.h - MCSymbolizer class --------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
#define LLVM_MC_MCDISASSEMBLER_MCSYMBOLIZER_H
#include "llvm/MC/MCDisassembler/MCRelocationInfo.h"
-#include "llvm/Support/Compiler.h"
-#include "llvm/Support/DataTypes.h"
-#include <cassert>
+#include <algorithm>
+#include <cstdint>
#include <memory>
namespace llvm {
/// operands are actually symbolizable, and in what way. I don't think this
/// information exists right now.
class MCSymbolizer {
- MCSymbolizer(const MCSymbolizer &) = delete;
- void operator=(const MCSymbolizer &) = delete;
-
protected:
MCContext &Ctx;
std::unique_ptr<MCRelocationInfo> RelInfo;
: Ctx(Ctx), RelInfo(std::move(RelInfo)) {
}
+ MCSymbolizer(const MCSymbolizer &) = delete;
+ MCSymbolizer &operator=(const MCSymbolizer &) = delete;
virtual ~MCSymbolizer();
/// \brief Try to add a symbolic operand instead of \p Value to the MCInst.
uint64_t Address) = 0;
};
-}
+} // end namespace llvm
-#endif
+#endif // LLVM_MC_MCDISASSEMBLER_MCSYMBOLIZER_H
#ifndef LLVM_MC_MCLABEL_H
#define LLVM_MC_MCLABEL_H
-#include "llvm/Support/Compiler.h"
-
namespace llvm {
-class MCContext;
+
class raw_ostream;
/// \brief Instances of this class represent a label name in the MC file,
private: // MCContext creates and uniques these.
friend class MCContext;
+
MCLabel(unsigned instance) : Instance(instance) {}
+public:
MCLabel(const MCLabel &) = delete;
- void operator=(const MCLabel &) = delete;
+ MCLabel &operator=(const MCLabel &) = delete;
-public:
/// \brief Get the current instance of this Directional Local Label.
unsigned getInstance() const { return Instance; }
Label.print(OS);
return OS;
}
+
} // end namespace llvm
-#endif
+#endif // LLVM_MC_MCLABEL_H
-//===-- llvm/MC/MCObjectWriter.h - Object File Writer Interface -*- C++ -*-===//
+//===- llvm/MC/MCObjectWriter.h - Object File Writer Interface --*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
#define LLVM_MC_MCOBJECTWRITER_H
#include "llvm/ADT/SmallVector.h"
-#include "llvm/Support/Compiler.h"
-#include "llvm/Support/DataTypes.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Endian.h"
#include "llvm/Support/EndianStream.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
+#include <cstdint>
namespace llvm {
+
class MCAsmLayout;
class MCAssembler;
class MCFixup;
/// The object writer also contains a number of helper methods for writing
/// binary data to the output stream.
class MCObjectWriter {
- MCObjectWriter(const MCObjectWriter &) = delete;
- void operator=(const MCObjectWriter &) = delete;
-
raw_pwrite_stream *OS;
protected:
unsigned IsLittleEndian : 1;
-protected: // Can only create subclasses.
+ // Can only create subclasses.
MCObjectWriter(raw_pwrite_stream &OS, bool IsLittleEndian)
: OS(&OS), IsLittleEndian(IsLittleEndian) {}
}
public:
+ MCObjectWriter(const MCObjectWriter &) = delete;
+ MCObjectWriter &operator=(const MCObjectWriter &) = delete;
virtual ~MCObjectWriter();
/// lifetime management
/// @}
};
-} // End llvm namespace
+} // end namespace llvm
-#endif
+#endif // LLVM_MC_MCOBJECTWRITER_H
#ifndef LLVM_MC_MCSECTION_H
#define LLVM_MC_MCSECTION_H
-#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/ilist.h"
-#include "llvm/ADT/ilist_node.h"
+#include "llvm/ADT/SmallVector.h"
#include "llvm/MC/MCFragment.h"
#include "llvm/MC/SectionKind.h"
-#include "llvm/Support/Compiler.h"
+#include <cassert>
+#include <utility>
namespace llvm {
+
class MCAsmInfo;
-class MCAssembler;
class MCContext;
class MCExpr;
-class MCFragment;
-class MCSection;
class MCSymbol;
-class Triple;
class raw_ostream;
+class Triple;
template <> struct ilist_alloc_traits<MCFragment> {
static void deleteNode(MCFragment *V);
typedef FragmentListType::reverse_iterator reverse_iterator;
private:
- MCSection(const MCSection &) = delete;
- void operator=(const MCSection &) = delete;
-
MCSymbol *Begin;
MCSymbol *End = nullptr;
/// The alignment requirement of this section.
/// \brief We've seen a bundle_lock directive but not its first instruction
/// yet.
- unsigned BundleGroupBeforeFirstInst : 1;
+ bool BundleGroupBeforeFirstInst : 1;
/// Whether this section has had instructions emitted into it.
- unsigned HasInstructions : 1;
+ bool HasInstructions : 1;
- unsigned IsRegistered : 1;
+ bool IsRegistered : 1;
MCDummyFragment DummyFragment;
SmallVector<std::pair<unsigned, MCFragment *>, 1> SubsectionFragmentMap;
protected:
- MCSection(SectionVariant V, SectionKind K, MCSymbol *Begin);
SectionVariant Variant;
SectionKind Kind;
+
+ MCSection(SectionVariant V, SectionKind K, MCSymbol *Begin);
~MCSection();
public:
+ MCSection(const MCSection &) = delete;
+ MCSection &operator=(const MCSection &) = delete;
+
SectionKind getKind() const { return Kind; }
SectionVariant getVariant() const { return Variant; }
} // end namespace llvm
-#endif
+#endif // LLVM_MC_MCSECTION_H
-//==-- llvm/MC/MCSubtargetInfo.h - Subtarget Information ---------*- C++ -*-==//
+//===- llvm/MC/MCSubtargetInfo.h - Subtarget Information --------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
#define LLVM_MC_MCSUBTARGETINFO_H
#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/Triple.h"
#include "llvm/MC/MCInstrItineraries.h"
+#include "llvm/MC/MCSchedule.h"
#include "llvm/MC/SubtargetFeature.h"
+#include <algorithm>
+#include <cassert>
+#include <cstdint>
#include <string>
namespace llvm {
-class StringRef;
-
//===----------------------------------------------------------------------===//
///
/// MCSubtargetInfo - Generic base class for all target subtargets.
const unsigned *ForwardingPaths; // Forwarding paths
FeatureBitset FeatureBits; // Feature bits for current CPU + FS
- MCSubtargetInfo() = delete;
- MCSubtargetInfo &operator=(MCSubtargetInfo &&) = delete;
- MCSubtargetInfo &operator=(const MCSubtargetInfo &) = delete;
-
public:
MCSubtargetInfo(const MCSubtargetInfo &) = default;
MCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS,
const MCWriteProcResEntry *WPR, const MCWriteLatencyEntry *WL,
const MCReadAdvanceEntry *RA, const InstrStage *IS,
const unsigned *OC, const unsigned *FP);
+ MCSubtargetInfo() = delete;
+ MCSubtargetInfo &operator=(const MCSubtargetInfo &) = delete;
+ MCSubtargetInfo &operator=(MCSubtargetInfo &&) = delete;
/// getTargetTriple - Return the target triple string.
const Triple &getTargetTriple() const { return TargetTriple; }
}
};
-} // End llvm namespace
+} // end namespace llvm
-#endif
+#endif // LLVM_MC_MCSUBTARGETINFO_H
#define LLVM_MC_MCSYMBOL_H
#include "llvm/ADT/PointerIntPair.h"
-#include "llvm/ADT/PointerUnion.h"
#include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringRef.h"
#include "llvm/MC/MCFragment.h"
-#include "llvm/Support/Compiler.h"
+#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/MathExtras.h"
+#include <cassert>
+#include <cstddef>
+#include <cstdint>
namespace llvm {
+
class MCAsmInfo;
+class MCContext;
class MCExpr;
-class MCSymbol;
-class MCFragment;
class MCSection;
-class MCContext;
class raw_ostream;
/// MCSymbol - Instances of this class represent a symbol name in the MC file,
const MCExpr *Value;
};
-protected: // MCContext creates and uniques these.
+ // MCContext creates and uniques these.
friend class MCExpr;
friend class MCContext;
MCContext &Ctx);
private:
-
void operator delete(void *);
/// \brief Placement delete - required by std, but never called.
void operator delete(void*, unsigned) {
llvm_unreachable("Constructor throws?");
}
- MCSymbol(const MCSymbol &) = delete;
- void operator=(const MCSymbol &) = delete;
MCSection *getSectionPtr(bool SetUsed = true) const {
if (MCFragment *F = getFragment(SetUsed)) {
assert(F != AbsolutePseudoFragment);
}
public:
+ MCSymbol(const MCSymbol &) = delete;
+ MCSymbol &operator=(const MCSymbol &) = delete;
+
/// getName - Get the symbol name.
StringRef getName() const {
if (!FragmentAndHasName.getInt())
Sym.print(OS, nullptr);
return OS;
}
+
} // end namespace llvm
-#endif
+#endif // LLVM_MC_MCSYMBOL_H
-//===-- MCAsmBackend.cpp - Target MC Assembly Backend ----------------------==//
+//===- MCAsmBackend.cpp - Target MC Assembly Backend ----------------------===//
//
// The LLVM Compiler Infrastructure
//
//
//===----------------------------------------------------------------------===//
-#include "llvm/MC/MCAsmBackend.h"
+#include "llvm/ADT/None.h"
#include "llvm/ADT/STLExtras.h"
+#include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCFixupKindInfo.h"
+#include <cassert>
+#include <cstddef>
+#include <cstdint>
+
using namespace llvm;
-MCAsmBackend::MCAsmBackend() {}
+MCAsmBackend::MCAsmBackend() = default;
-MCAsmBackend::~MCAsmBackend() {}
+MCAsmBackend::~MCAsmBackend() = default;
Optional<MCFixupKind> MCAsmBackend::getFixupKind(StringRef Name) const {
return None;
-//===-- MCCodeEmitter.cpp - Instruction Encoding --------------------------===//
+//===- MCCodeEmitter.cpp - Instruction Encoding ---------------------------===//
//
// The LLVM Compiler Infrastructure
//
using namespace llvm;
-MCCodeEmitter::MCCodeEmitter() {
-}
+MCCodeEmitter::MCCodeEmitter() = default;
-MCCodeEmitter::~MCCodeEmitter() {
-}
+MCCodeEmitter::~MCCodeEmitter() = default;
-//===-- MCDisassembler.cpp - Disassembler interface -----------------------===//
+//===- MCDisassembler.cpp - Disassembler interface ------------------------===//
//
// The LLVM Compiler Infrastructure
//
//===----------------------------------------------------------------------===//
#include "llvm/MC/MCDisassembler/MCDisassembler.h"
-#include "llvm/MC/MCDisassembler/MCExternalSymbolizer.h"
#include "llvm/Support/raw_ostream.h"
+#include <algorithm>
using namespace llvm;
-MCDisassembler::~MCDisassembler() {
-}
+MCDisassembler::~MCDisassembler() = default;
bool MCDisassembler::tryAddingSymbolicOperand(MCInst &Inst, int64_t Value,
uint64_t Address, bool IsBranch,
-//==-- MCRelocationInfo.cpp ------------------------------------------------==//
+//===-- MCRelocationInfo.cpp ----------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
//===----------------------------------------------------------------------===//
#include "llvm/MC/MCDisassembler/MCRelocationInfo.h"
-#include "llvm-c/Disassembler.h"
#include "llvm/Support/TargetRegistry.h"
+#include "llvm-c/Disassembler.h"
using namespace llvm;
-MCRelocationInfo::MCRelocationInfo(MCContext &Ctx)
- : Ctx(Ctx) {
-}
+MCRelocationInfo::MCRelocationInfo(MCContext &Ctx) : Ctx(Ctx) {}
-MCRelocationInfo::~MCRelocationInfo() {
-}
+MCRelocationInfo::~MCRelocationInfo() = default;
const MCExpr *
MCRelocationInfo::createExprForCAPIVariantKind(const MCExpr *SubExpr,
-//===-- llvm/MC/MCSymbolizer.cpp - MCSymbolizer class -----------*- C++ -*-===//
+//===-- llvm/MC/MCSymbolizer.cpp - MCSymbolizer class ---------------------===//
//
// The LLVM Compiler Infrastructure
//
using namespace llvm;
-MCSymbolizer::~MCSymbolizer() {
-}
+MCSymbolizer::~MCSymbolizer() = default;
-//===- lib/MC/MCLabel.cpp - MCLabel implementation ----------------------===//
+//===- lib/MC/MCLabel.cpp - MCLabel implementation ------------------------===//
//
// The LLVM Compiler Infrastructure
//
//===----------------------------------------------------------------------===//
#include "llvm/MC/MCLabel.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
+
using namespace llvm;
void MCLabel::print(raw_ostream &OS) const {
//===----------------------------------------------------------------------===//
#include "llvm/MC/MCAssembler.h"
+#include "llvm/MC/MCFragment.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCObjectWriter.h"
#include "llvm/MC/MCSymbol.h"
using namespace llvm;
-MCObjectWriter::~MCObjectWriter() {
-}
+MCObjectWriter::~MCObjectWriter() = default;
bool MCObjectWriter::isSymbolRefDifferenceFullyResolved(
const MCAssembler &Asm, const MCSymbolRefExpr *A, const MCSymbolRefExpr *B,
//
//===----------------------------------------------------------------------===//
-#include "llvm/MC/MCSection.h"
-#include "llvm/MC/MCAssembler.h"
-#include "llvm/MC/MCAsmInfo.h"
+#include "llvm/ADT/SmallVector.h"
#include "llvm/MC/MCContext.h"
+#include "llvm/MC/MCFragment.h"
+#include "llvm/MC/MCSection.h"
#include "llvm/MC/MCSymbol.h"
+#include "llvm/Support/Compiler.h"
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
-using namespace llvm;
+#include <algorithm>
+#include <utility>
-//===----------------------------------------------------------------------===//
-// MCSection
-//===----------------------------------------------------------------------===//
+using namespace llvm;
MCSection::MCSection(SectionVariant V, SectionKind K, MCSymbol *Begin)
: Begin(Begin), BundleGroupBeforeFirstInst(false), HasInstructions(false),
bool MCSection::hasEnded() const { return End && End->isInSection(); }
-MCSection::~MCSection() {
-}
+MCSection::~MCSection() = default;
void MCSection::setBundleLockState(BundleLockStateType NewState) {
if (NewState == NotBundleLocked) {
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
LLVM_DUMP_METHOD void MCSection::dump() {
- raw_ostream &OS = llvm::errs();
+ raw_ostream &OS = errs();
OS << "<MCSection";
OS << " Fragments:[\n ";
-//===-- MCSubtargetInfo.cpp - Subtarget Information -----------------------===//
+//===- MCSubtargetInfo.cpp - Subtarget Information ------------------------===//
//
// The LLVM Compiler Infrastructure
//
//
//===----------------------------------------------------------------------===//
-#include "llvm/MC/MCSubtargetInfo.h"
+#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
-#include "llvm/ADT/Triple.h"
#include "llvm/MC/MCInstrItineraries.h"
+#include "llvm/MC/MCSchedule.h"
+#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/MC/SubtargetFeature.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
+#include <cassert>
+#include <cstring>
using namespace llvm;
//
//===----------------------------------------------------------------------===//
-#include "llvm/MC/MCSymbol.h"
+#include "llvm/ADT/StringRef.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"
+#include "llvm/MC/MCFragment.h"
+#include "llvm/MC/MCSymbol.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 <cstddef>
+
using namespace llvm;
// Only the address of this fragment is ever actually used.