#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/ilist.h"
#include "llvm/ADT/ilist_node.h"
-#include "llvm/MC/MCValue.h"
#include "llvm/Support/Casting.h"
-#include "llvm/Support/DataTypes.h"
+#include "llvm/System/DataTypes.h"
#include <vector> // FIXME: Shouldn't be needed.
namespace llvm {
class raw_ostream;
class MCAssembler;
class MCContext;
+class MCExpr;
class MCSection;
class MCSectionData;
+class MCSymbol;
class MCFragment : public ilist_node<MCFragment> {
MCFragment(const MCFragment&); // DO NOT IMPLEMENT
class MCFillFragment : public MCFragment {
/// Value - Value to use for filling bytes.
- MCValue Value;
+ const MCExpr *Value;
/// ValueSize - The size (in bytes) of \arg Value to use when filling.
unsigned ValueSize;
uint64_t Count;
public:
- MCFillFragment(MCValue _Value, unsigned _ValueSize, uint64_t _Count,
+ MCFillFragment(const MCExpr &_Value, unsigned _ValueSize, uint64_t _Count,
MCSectionData *SD = 0)
: MCFragment(FT_Fill, SD),
- Value(_Value), ValueSize(_ValueSize), Count(_Count) {}
+ Value(&_Value), ValueSize(_ValueSize), Count(_Count) {}
/// @name Accessors
/// @{
return ValueSize * Count;
}
- MCValue getValue() const { return Value; }
+ const MCExpr &getValue() const { return *Value; }
unsigned getValueSize() const { return ValueSize; }
class MCOrgFragment : public MCFragment {
/// Offset - The offset this fragment should start at.
- MCValue Offset;
+ const MCExpr *Offset;
/// Value - Value to use for filling bytes.
int8_t Value;
public:
- MCOrgFragment(MCValue _Offset, int8_t _Value, MCSectionData *SD = 0)
+ MCOrgFragment(const MCExpr &_Offset, int8_t _Value, MCSectionData *SD = 0)
: MCFragment(FT_Org, SD),
- Offset(_Offset), Value(_Value) {}
+ Offset(&_Offset), Value(_Value) {}
/// @name Accessors
/// @{
return ~UINT64_C(0);
}
- MCValue getOffset() const { return Offset; }
+ const MCExpr &getOffset() const { return *Offset; }
uint8_t getValue() const { return Value; }
uint64_t Offset;
/// Value - The expression to eventually write into the fragment.
- //
- // FIXME: We could probably get away with requiring the client to pass in an
- // owned reference whose lifetime extends past that of the fixup.
- MCValue Value;
+ const MCExpr *Value;
/// Size - The fixup size.
unsigned Size;
uint64_t FixedValue;
public:
- Fixup(MCFragment &_Fragment, uint64_t _Offset, const MCValue &_Value,
+ Fixup(MCFragment &_Fragment, uint64_t _Offset, const MCExpr &_Value,
unsigned _Size)
- : Fragment(&_Fragment), Offset(_Offset), Value(_Value), Size(_Size),
+ : Fragment(&_Fragment), Offset(_Offset), Value(&_Value), Size(_Size),
FixedValue(0) {}
};
// FIXME: Same concerns as with SectionData.
class MCSymbolData : public ilist_node<MCSymbolData> {
public:
- const MCSymbol &Symbol;
+ const MCSymbol *Symbol;
/// Fragment - The fragment this symbol's value is relative to, if any.
MCFragment *Fragment;
/// @name Accessors
/// @{
- const MCSymbol &getSymbol() const { return Symbol; }
+ const MCSymbol &getSymbol() const { return *Symbol; }
MCFragment *getFragment() const { return Fragment; }
void setFragment(MCFragment *Value) { Fragment = Value; }