mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-08 09:43:20 +00:00
Merge MCSymbol and MCSymbolData.
As a transition hack leave MCSymbolData as a typedef of MCSymbol. I will be removing that in a second. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238609 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
873d4e200d
commit
63e7baf8f6
@ -18,7 +18,6 @@ class MCAssembler;
|
||||
class MCFragment;
|
||||
class MCSection;
|
||||
class MCSymbol;
|
||||
class MCSymbolData;
|
||||
|
||||
/// Encapsulates the layout of an assembly file at a particular point in time.
|
||||
///
|
||||
|
@ -21,7 +21,6 @@ class MCFixup;
|
||||
class MCFragment;
|
||||
class MCObjectWriter;
|
||||
class MCSymbol;
|
||||
class MCSymbolData;
|
||||
class MCValue;
|
||||
class raw_pwrite_stream;
|
||||
|
||||
|
@ -24,7 +24,6 @@ class MCCodeEmitter;
|
||||
class MCExpr;
|
||||
class MCInst;
|
||||
class MCSymbol;
|
||||
class MCSymbolData;
|
||||
class raw_ostream;
|
||||
|
||||
class MCELFStreamer : public MCObjectStreamer {
|
||||
|
@ -22,7 +22,6 @@ class MCAsmLayout;
|
||||
class MCAssembler;
|
||||
class MCFixup;
|
||||
class MCFragment;
|
||||
class MCSymbolData;
|
||||
class MCSymbolRefExpr;
|
||||
class MCValue;
|
||||
|
||||
|
@ -27,39 +27,6 @@ class MCSection;
|
||||
class MCContext;
|
||||
class raw_ostream;
|
||||
|
||||
// TODO: Merge completely with MCSymbol.
|
||||
class MCSymbolData {
|
||||
/// Fragment - The fragment this symbol's value is relative to, if any. Also
|
||||
/// stores if this symbol is visible outside this translation unit (bit 0) or
|
||||
/// if it is private extern (bit 1).
|
||||
PointerIntPair<MCFragment *, 2> Fragment;
|
||||
|
||||
|
||||
public:
|
||||
MCSymbolData() = default;
|
||||
|
||||
MCFragment *getFragment() const { return Fragment.getPointer(); }
|
||||
void setFragment(MCFragment *Value) { Fragment.setPointer(Value); }
|
||||
|
||||
/// @}
|
||||
/// \name Symbol Attributes
|
||||
/// @{
|
||||
|
||||
bool isExternal() const { return Fragment.getInt() & 1; }
|
||||
void setExternal(bool Value) {
|
||||
Fragment.setInt((Fragment.getInt() & ~1) | unsigned(Value));
|
||||
}
|
||||
|
||||
bool isPrivateExtern() const { return Fragment.getInt() & 2; }
|
||||
void setPrivateExtern(bool Value) {
|
||||
Fragment.setInt((Fragment.getInt() & ~2) | (unsigned(Value) << 1));
|
||||
}
|
||||
|
||||
/// @}
|
||||
|
||||
void dump() const;
|
||||
};
|
||||
|
||||
/// MCSymbol - Instances of this class represent a symbol name in the MC file,
|
||||
/// and MCSymbols are created and uniqued by the MCContext class. MCSymbols
|
||||
/// should only be constructed with valid names for the object file.
|
||||
@ -122,7 +89,10 @@ class MCSymbol {
|
||||
/// additional per symbol information which is not easily classified.
|
||||
mutable uint32_t Flags = 0;
|
||||
|
||||
mutable MCSymbolData Data;
|
||||
/// The fragment this symbol's value is relative to, if any. Also stores if
|
||||
/// this symbol is visible outside this translation unit (bit 0) or if it is
|
||||
/// private extern (bit 1).
|
||||
mutable PointerIntPair<MCFragment *, 2> Fragment;
|
||||
|
||||
private: // MCContext creates and uniques these.
|
||||
friend class MCExpr;
|
||||
@ -147,11 +117,7 @@ public:
|
||||
|
||||
bool hasData() const { return HasData; }
|
||||
|
||||
/// Get associated symbol data.
|
||||
MCSymbolData &getData() const {
|
||||
assert(HasData && "Missing symbol data!");
|
||||
return Data;
|
||||
}
|
||||
MCSymbol &getData() const { return *const_cast<MCSymbol *>(this); }
|
||||
|
||||
/// Initialize symbol data.
|
||||
///
|
||||
@ -297,6 +263,19 @@ public:
|
||||
Flags = (Flags & ~Mask) | Value;
|
||||
}
|
||||
|
||||
MCFragment *getFragment() const { return Fragment.getPointer(); }
|
||||
void setFragment(MCFragment *Value) const { Fragment.setPointer(Value); }
|
||||
|
||||
bool isExternal() const { return Fragment.getInt() & 1; }
|
||||
void setExternal(bool Value) const {
|
||||
Fragment.setInt((Fragment.getInt() & ~1) | unsigned(Value));
|
||||
}
|
||||
|
||||
bool isPrivateExtern() const { return Fragment.getInt() & 2; }
|
||||
void setPrivateExtern(bool Value) {
|
||||
Fragment.setInt((Fragment.getInt() & ~2) | (unsigned(Value) << 1));
|
||||
}
|
||||
|
||||
/// print - Print the value to the stream \p OS.
|
||||
void print(raw_ostream &OS) const;
|
||||
|
||||
@ -304,6 +283,8 @@ public:
|
||||
void dump() const;
|
||||
};
|
||||
|
||||
typedef MCSymbol MCSymbolData;
|
||||
|
||||
inline raw_ostream &operator<<(raw_ostream &OS, const MCSymbol &Sym) {
|
||||
Sym.print(OS);
|
||||
return OS;
|
||||
|
@ -1183,18 +1183,6 @@ void MCFragment::dump() {
|
||||
OS << ">";
|
||||
}
|
||||
|
||||
void MCSymbolData::dump() const {
|
||||
raw_ostream &OS = llvm::errs();
|
||||
|
||||
OS << "<MCSymbolData"
|
||||
<< " Fragment:" << getFragment();
|
||||
if (isExternal())
|
||||
OS << " (external)";
|
||||
if (isPrivateExtern())
|
||||
OS << " (private extern)";
|
||||
OS << ">";
|
||||
}
|
||||
|
||||
void MCAssembler::dump() {
|
||||
raw_ostream &OS = llvm::errs();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user