Another step in merging MCSectionData and MCSection.
llvm-svn: 238158
#include "llvm/MC/MCFixup.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCLinkerOptimizationHint.h"
+#include "llvm/MC/MCSection.h"
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/Support/Casting.h"
}
};
-// FIXME: Should this be a separate class, or just merged into MCSection? Since
-// we anticipate the fast path being through an MCAssembler, the only reason to
-// keep it out is for API abstraction.
-class MCSectionData : public ilist_node<MCSectionData> {
- friend class MCAsmLayout;
-
- MCSectionData(const MCSectionData &) = delete;
- void operator=(const MCSectionData &) = delete;
-
-public:
- typedef iplist<MCFragment> FragmentListType;
-
- typedef FragmentListType::const_iterator const_iterator;
- typedef FragmentListType::iterator iterator;
-
- typedef FragmentListType::const_reverse_iterator const_reverse_iterator;
- typedef FragmentListType::reverse_iterator reverse_iterator;
-
-private:
- FragmentListType Fragments;
- MCSection *Section;
-
- /// \name Assembler Backend Data
- /// @{
- //
- // FIXME: This could all be kept private to the assembler implementation.
-
- /// Mapping from subsection number to insertion point for subsection numbers
- /// below that number.
- SmallVector<std::pair<unsigned, MCFragment *>, 1> SubsectionFragmentMap;
-
- /// @}
-
-public:
- // Only for use as sentinel.
- MCSectionData();
- MCSectionData(MCSection &Section);
-
- MCSection &getSection() const { return *Section; }
-
- /// \name Fragment Access
- /// @{
-
- const FragmentListType &getFragmentList() const { return Fragments; }
- FragmentListType &getFragmentList() { return Fragments; }
-
- iterator begin() { return Fragments.begin(); }
- const_iterator begin() const { return Fragments.begin(); }
-
- iterator end() { return Fragments.end(); }
- const_iterator end() const { return Fragments.end(); }
-
- reverse_iterator rbegin() { return Fragments.rbegin(); }
- const_reverse_iterator rbegin() const { return Fragments.rbegin(); }
-
- reverse_iterator rend() { return Fragments.rend(); }
- const_reverse_iterator rend() const { return Fragments.rend(); }
-
- size_t size() const { return Fragments.size(); }
-
- bool empty() const { return Fragments.empty(); }
-
- iterator getSubsectionInsertionPoint(unsigned Subsection);
-
- void dump();
-
- /// @}
-};
-
// FIXME: This really doesn't belong here. See comments below.
struct IndirectSymbolData {
MCSymbol *Symbol;
#include "llvm/ADT/SmallVector.h"
#include "llvm/MC/MCAssembler.h"
+#include "llvm/MC/MCSection.h"
#include "llvm/MC/MCStreamer.h"
namespace llvm {
#ifndef LLVM_MC_MCSECTION_H
#define LLVM_MC_MCSECTION_H
+#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/ilist.h"
+#include "llvm/ADT/ilist_node.h"
#include "llvm/MC/SectionKind.h"
#include "llvm/Support/Compiler.h"
namespace llvm {
+class MCAssembler;
class MCAsmInfo;
class MCContext;
class MCExpr;
+class MCFragment;
+class MCSection;
class MCSymbol;
class raw_ostream;
+class MCSectionData : public ilist_node<MCSectionData> {
+ friend class MCAsmLayout;
+
+ MCSectionData(const MCSectionData &) = delete;
+ void operator=(const MCSectionData &) = delete;
+
+public:
+ typedef iplist<MCFragment> FragmentListType;
+
+ typedef FragmentListType::const_iterator const_iterator;
+ typedef FragmentListType::iterator iterator;
+
+ typedef FragmentListType::const_reverse_iterator const_reverse_iterator;
+ typedef FragmentListType::reverse_iterator reverse_iterator;
+
+private:
+ FragmentListType Fragments;
+ MCSection *Section;
+
+ /// \name Assembler Backend Data
+ /// @{
+ //
+ // FIXME: This could all be kept private to the assembler implementation.
+
+ /// Mapping from subsection number to insertion point for subsection numbers
+ /// below that number.
+ SmallVector<std::pair<unsigned, MCFragment *>, 1> SubsectionFragmentMap;
+
+ /// @}
+
+public:
+ // Only for use as sentinel.
+ MCSectionData();
+ MCSectionData(MCSection &Section);
+
+ MCSection &getSection() const { return *Section; }
+
+ /// \name Fragment Access
+ /// @{
+
+ const FragmentListType &getFragmentList() const { return Fragments; }
+ FragmentListType &getFragmentList() { return Fragments; }
+
+ iterator begin();
+ const_iterator begin() const {
+ return const_cast<MCSectionData *>(this)->begin();
+ }
+
+ iterator end();
+ const_iterator end() const {
+ return const_cast<MCSectionData *>(this)->end();
+ }
+
+ reverse_iterator rbegin();
+ const_reverse_iterator rbegin() const {
+ return const_cast<MCSectionData *>(this)->rbegin();
+ }
+
+ reverse_iterator rend();
+ const_reverse_iterator rend() const {
+ return const_cast<MCSectionData *>(this)->rend();
+ }
+
+ size_t size() const;
+
+ bool empty() const;
+
+ iterator getSubsectionInsertionPoint(unsigned Subsection);
+
+ void dump();
+
+ /// @}
+};
+
/// Instances of this class represent a uniqued identifier for a section in the
/// current translation unit. The MCContext class uniques and creates these.
class MCSection {
//===----------------------------------------------------------------------===//
#include "llvm/MC/MCSection.h"
+#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCSymbol.h"
}
++BundleLockNestingDepth;
}
+
+MCSectionData::iterator MCSectionData::begin() { return Fragments.begin(); }
+
+MCSectionData::iterator MCSectionData::end() { return Fragments.end(); }
+
+MCSectionData::reverse_iterator MCSectionData::rbegin() {
+ return Fragments.rbegin();
+}
+
+MCSectionData::reverse_iterator MCSectionData::rend() {
+ return Fragments.rend();
+}
+
+size_t MCSectionData::size() const { return Fragments.size(); }
+
+bool MCSectionData::empty() const { return Fragments.empty(); }