mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-26 07:18:15 +00:00
Revert "Move MCSymbol Value in to the union of Offset and CommonSize."
This reverts commit 2e449ec5bcdf67b52b315b16c2128aaf25d5b73c. This was svn r239440. Its currently failing an ARM test so reverting while I work out what to do next. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239441 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -65,6 +65,9 @@ protected:
|
|||||||
/// relative to, if any.
|
/// relative to, if any.
|
||||||
mutable PointerUnion<MCSection *, MCFragment *> SectionOrFragment;
|
mutable PointerUnion<MCSection *, MCFragment *> SectionOrFragment;
|
||||||
|
|
||||||
|
/// Value - If non-null, the value for a variable symbol.
|
||||||
|
const MCExpr *Value;
|
||||||
|
|
||||||
/// IsTemporary - True if this is an assembler temporary label, which
|
/// IsTemporary - True if this is an assembler temporary label, which
|
||||||
/// typically does not survive in the .o file's symbol table. Usually
|
/// typically does not survive in the .o file's symbol table. Usually
|
||||||
/// "Lfoo" or ".foo".
|
/// "Lfoo" or ".foo".
|
||||||
@@ -93,17 +96,6 @@ protected:
|
|||||||
/// unsigned to avoid sign extension and achieve better bitpacking with MSVC.
|
/// unsigned to avoid sign extension and achieve better bitpacking with MSVC.
|
||||||
unsigned Kind : 2;
|
unsigned Kind : 2;
|
||||||
|
|
||||||
/// A symbol can contain an Offset, or Value, or be Common, but never more
|
|
||||||
/// than one of these.
|
|
||||||
enum Contents : uint8_t {
|
|
||||||
SymContentsUnset,
|
|
||||||
SymContentsOffset,
|
|
||||||
SymContentsVariable,
|
|
||||||
SymContentsCommon,
|
|
||||||
};
|
|
||||||
|
|
||||||
Contents SymbolContents : 2;
|
|
||||||
|
|
||||||
/// Index field, for use by the object file implementation.
|
/// Index field, for use by the object file implementation.
|
||||||
mutable uint32_t Index = 0;
|
mutable uint32_t Index = 0;
|
||||||
|
|
||||||
@@ -113,9 +105,6 @@ protected:
|
|||||||
|
|
||||||
/// The size of the symbol, if it is 'common'.
|
/// The size of the symbol, if it is 'common'.
|
||||||
uint64_t CommonSize;
|
uint64_t CommonSize;
|
||||||
|
|
||||||
/// If non-null, the value for a variable symbol.
|
|
||||||
const MCExpr *Value;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// The alignment of the symbol, if it is 'common', or -1.
|
/// The alignment of the symbol, if it is 'common', or -1.
|
||||||
@@ -141,10 +130,10 @@ protected: // MCContext creates and uniques these.
|
|||||||
} NameEntryStorageTy;
|
} NameEntryStorageTy;
|
||||||
|
|
||||||
MCSymbol(SymbolKind Kind, const StringMapEntry<bool> *Name, bool isTemporary)
|
MCSymbol(SymbolKind Kind, const StringMapEntry<bool> *Name, bool isTemporary)
|
||||||
: IsTemporary(isTemporary),
|
: Value(nullptr), IsTemporary(isTemporary),
|
||||||
IsRedefinable(false), IsUsed(false), IsRegistered(false),
|
IsRedefinable(false), IsUsed(false), IsRegistered(false),
|
||||||
IsExternal(false), IsPrivateExtern(false), HasName(!!Name),
|
IsExternal(false), IsPrivateExtern(false), HasName(!!Name),
|
||||||
Kind(Kind), SymbolContents(SymContentsUnset) {
|
Kind(Kind) {
|
||||||
Offset = 0;
|
Offset = 0;
|
||||||
if (Name)
|
if (Name)
|
||||||
getNameEntryPtr() = Name;
|
getNameEntryPtr() = Name;
|
||||||
@@ -174,9 +163,9 @@ private:
|
|||||||
return F->getParent();
|
return F->getParent();
|
||||||
assert(!SectionOrFragment.is<MCFragment *>() && "Section or null expected");
|
assert(!SectionOrFragment.is<MCFragment *>() && "Section or null expected");
|
||||||
MCSection *Section = SectionOrFragment.dyn_cast<MCSection *>();
|
MCSection *Section = SectionOrFragment.dyn_cast<MCSection *>();
|
||||||
if (Section || !isVariable())
|
if (Section || !Value)
|
||||||
return Section;
|
return Section;
|
||||||
return Section = getVariableValue()->findAssociatedSection();
|
return Section = Value->findAssociatedSection();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief Get a reference to the name field. Requires that we have a name
|
/// \brief Get a reference to the name field. Requires that we have a name
|
||||||
@@ -218,10 +207,7 @@ public:
|
|||||||
/// \brief Prepare this symbol to be redefined.
|
/// \brief Prepare this symbol to be redefined.
|
||||||
void redefineIfPossible() {
|
void redefineIfPossible() {
|
||||||
if (IsRedefinable) {
|
if (IsRedefinable) {
|
||||||
if (SymbolContents == SymContentsVariable) {
|
Value = nullptr;
|
||||||
Value = nullptr;
|
|
||||||
SymbolContents = SymContentsUnset;
|
|
||||||
}
|
|
||||||
SectionOrFragment = nullptr;
|
SectionOrFragment = nullptr;
|
||||||
IsRedefinable = false;
|
IsRedefinable = false;
|
||||||
}
|
}
|
||||||
@@ -275,9 +261,7 @@ public:
|
|||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
/// isVariable - Check if this is a variable symbol.
|
/// isVariable - Check if this is a variable symbol.
|
||||||
bool isVariable() const {
|
bool isVariable() const { return Value != nullptr; }
|
||||||
return SymbolContents == SymContentsVariable;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// getVariableValue() - Get the value for variable symbols.
|
/// getVariableValue() - Get the value for variable symbols.
|
||||||
const MCExpr *getVariableValue() const {
|
const MCExpr *getVariableValue() const {
|
||||||
@@ -301,17 +285,12 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint64_t getOffset() const {
|
uint64_t getOffset() const {
|
||||||
assert((SymbolContents == SymContentsUnset ||
|
assert(!isCommon());
|
||||||
SymbolContents == SymContentsOffset) &&
|
|
||||||
"Cannot get offset for a common/variable symbol");
|
|
||||||
return Offset;
|
return Offset;
|
||||||
}
|
}
|
||||||
void setOffset(uint64_t Value) {
|
void setOffset(uint64_t Value) {
|
||||||
assert((SymbolContents == SymContentsUnset ||
|
assert(!isCommon());
|
||||||
SymbolContents == SymContentsOffset) &&
|
|
||||||
"Cannot set offset for a common/variable symbol");
|
|
||||||
Offset = Value;
|
Offset = Value;
|
||||||
SymbolContents = SymContentsOffset;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the size of a 'common' symbol.
|
/// Return the size of a 'common' symbol.
|
||||||
@@ -328,7 +307,6 @@ public:
|
|||||||
assert(getOffset() == 0);
|
assert(getOffset() == 0);
|
||||||
CommonSize = Size;
|
CommonSize = Size;
|
||||||
CommonAlign = Align;
|
CommonAlign = Align;
|
||||||
SymbolContents = SymContentsCommon;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the alignment of a 'common' symbol.
|
/// Return the alignment of a 'common' symbol.
|
||||||
@@ -353,9 +331,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Is this a 'common' symbol.
|
/// Is this a 'common' symbol.
|
||||||
bool isCommon() const {
|
bool isCommon() const { return CommonAlign != -1U; }
|
||||||
return SymbolContents == SymContentsCommon;
|
|
||||||
}
|
|
||||||
|
|
||||||
MCFragment *getFragment() const {
|
MCFragment *getFragment() const {
|
||||||
return SectionOrFragment.dyn_cast<MCFragment *>();
|
return SectionOrFragment.dyn_cast<MCFragment *>();
|
||||||
|
|||||||
@@ -40,11 +40,7 @@ void *MCSymbol::operator new(size_t s, const StringMapEntry<bool> *Name,
|
|||||||
void MCSymbol::setVariableValue(const MCExpr *Value) {
|
void MCSymbol::setVariableValue(const MCExpr *Value) {
|
||||||
assert(!IsUsed && "Cannot set a variable that has already been used.");
|
assert(!IsUsed && "Cannot set a variable that has already been used.");
|
||||||
assert(Value && "Invalid variable value!");
|
assert(Value && "Invalid variable value!");
|
||||||
assert((SymbolContents == SymContentsUnset ||
|
|
||||||
SymbolContents == SymContentsVariable) &&
|
|
||||||
"Cannot give common/offset symbol a variable value");
|
|
||||||
this->Value = Value;
|
this->Value = Value;
|
||||||
SymbolContents = SymContentsVariable;
|
|
||||||
SectionOrFragment = nullptr;
|
SectionOrFragment = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user