mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-16 12:24:03 +00:00
MC: Switch MCFillFragment to storing total fill size instead of a count. This allows using ValueSize==0 to represent a virtual fill.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103662 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -293,17 +293,21 @@ class MCFillFragment : public MCFragment {
|
|||||||
/// Value - Value to use for filling bytes.
|
/// Value - Value to use for filling bytes.
|
||||||
int64_t Value;
|
int64_t Value;
|
||||||
|
|
||||||
/// ValueSize - The size (in bytes) of \arg Value to use when filling.
|
/// ValueSize - The size (in bytes) of \arg Value to use when filling, or 0 if
|
||||||
|
/// this is a virtual fill fragment.
|
||||||
unsigned ValueSize;
|
unsigned ValueSize;
|
||||||
|
|
||||||
/// Count - The number of copies of \arg Value to insert.
|
/// Size - The number of bytes to insert.
|
||||||
uint64_t Count;
|
uint64_t Size;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MCFillFragment(int64_t _Value, unsigned _ValueSize, uint64_t _Count,
|
MCFillFragment(int64_t _Value, unsigned _ValueSize, uint64_t _Size,
|
||||||
MCSectionData *SD = 0)
|
MCSectionData *SD = 0)
|
||||||
: MCFragment(FT_Fill, SD),
|
: MCFragment(FT_Fill, SD),
|
||||||
Value(_Value), ValueSize(_ValueSize), Count(_Count) {}
|
Value(_Value), ValueSize(_ValueSize), Size(_Size) {
|
||||||
|
assert((!ValueSize || (Size % ValueSize) == 0) &&
|
||||||
|
"Fill size must be a multiple of the value size!");
|
||||||
|
}
|
||||||
|
|
||||||
/// @name Accessors
|
/// @name Accessors
|
||||||
/// @{
|
/// @{
|
||||||
@ -312,7 +316,7 @@ public:
|
|||||||
|
|
||||||
unsigned getValueSize() const { return ValueSize; }
|
unsigned getValueSize() const { return ValueSize; }
|
||||||
|
|
||||||
uint64_t getCount() const { return Count; }
|
uint64_t getSize() const { return Size; }
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
|
@ -395,7 +395,7 @@ void MCAssembler::LayoutFragment(MCAsmLayout &Layout, MCFragment &F) {
|
|||||||
|
|
||||||
case MCFragment::FT_Fill: {
|
case MCFragment::FT_Fill: {
|
||||||
MCFillFragment &FF = cast<MCFillFragment>(F);
|
MCFillFragment &FF = cast<MCFillFragment>(F);
|
||||||
EffectiveSize = FF.getValueSize() * FF.getCount();
|
EffectiveSize = FF.getSize();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -534,7 +534,7 @@ static void WriteFragmentData(const MCAssembler &Asm, const MCAsmLayout &Layout,
|
|||||||
|
|
||||||
case MCFragment::FT_Fill: {
|
case MCFragment::FT_Fill: {
|
||||||
MCFillFragment &FF = cast<MCFillFragment>(F);
|
MCFillFragment &FF = cast<MCFillFragment>(F);
|
||||||
for (uint64_t i = 0, e = FF.getCount(); i != e; ++i) {
|
for (uint64_t i = 0, e = FF.getSize() / FF.getValueSize(); i != e; ++i) {
|
||||||
switch (FF.getValueSize()) {
|
switch (FF.getValueSize()) {
|
||||||
default:
|
default:
|
||||||
assert(0 && "Invalid size!");
|
assert(0 && "Invalid size!");
|
||||||
@ -876,7 +876,7 @@ void MCFillFragment::dump() {
|
|||||||
this->MCFragment::dump();
|
this->MCFragment::dump();
|
||||||
OS << "\n ";
|
OS << "\n ";
|
||||||
OS << " Value:" << getValue() << " ValueSize:" << getValueSize()
|
OS << " Value:" << getValue() << " ValueSize:" << getValueSize()
|
||||||
<< " Count:" << getCount() << ">";
|
<< " Size:" << getSize() << ">";
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCInstFragment::dump() {
|
void MCInstFragment::dump() {
|
||||||
|
Reference in New Issue
Block a user