mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-07 01:38:26 +00:00
Move MCSectionData to MCSection.h.
Another step in merging MCSectionData and MCSection. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238158 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
50c2fe1d5c
commit
5e435847b0
@ -21,6 +21,7 @@
|
||||
#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"
|
||||
@ -530,75 +531,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
// 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;
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/MC/MCAssembler.h"
|
||||
#include "llvm/MC/MCSection.h"
|
||||
#include "llvm/MC/MCStreamer.h"
|
||||
|
||||
namespace llvm {
|
||||
|
@ -14,17 +14,97 @@
|
||||
#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 {
|
||||
|
@ -8,6 +8,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#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"
|
||||
@ -47,3 +48,19 @@ void MCSection::setBundleLockState(BundleLockStateType NewState) {
|
||||
}
|
||||
++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(); }
|
||||
|
Loading…
x
Reference in New Issue
Block a user