mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-09 13:33:17 +00:00
MC: Move MCAlignFragment::EmitNops value out of the constructor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103665 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4e544870c4
commit
1c15413ebc
@ -253,17 +253,17 @@ class MCAlignFragment : public MCFragment {
|
|||||||
/// cannot be satisfied in this width then this fragment is ignored.
|
/// cannot be satisfied in this width then this fragment is ignored.
|
||||||
unsigned MaxBytesToEmit;
|
unsigned MaxBytesToEmit;
|
||||||
|
|
||||||
/// EmitNops - true when aligning code and optimal nops to be used for
|
/// EmitNops - Flag to indicate that (optimal) NOPs should be emitted instead
|
||||||
/// filling.
|
/// of using the provided value. The exact interpretation of this flag is
|
||||||
bool EmitNops;
|
/// target dependent.
|
||||||
|
bool EmitNops : 1;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MCAlignFragment(unsigned _Alignment, int64_t _Value, unsigned _ValueSize,
|
MCAlignFragment(unsigned _Alignment, int64_t _Value, unsigned _ValueSize,
|
||||||
unsigned _MaxBytesToEmit, bool _EmitNops,
|
unsigned _MaxBytesToEmit, MCSectionData *SD = 0)
|
||||||
MCSectionData *SD = 0)
|
|
||||||
: MCFragment(FT_Align, SD), Alignment(_Alignment),
|
: MCFragment(FT_Align, SD), Alignment(_Alignment),
|
||||||
Value(_Value),ValueSize(_ValueSize),
|
Value(_Value),ValueSize(_ValueSize),
|
||||||
MaxBytesToEmit(_MaxBytesToEmit), EmitNops(_EmitNops) {}
|
MaxBytesToEmit(_MaxBytesToEmit), EmitNops(false) {}
|
||||||
|
|
||||||
/// @name Accessors
|
/// @name Accessors
|
||||||
/// @{
|
/// @{
|
||||||
@ -276,7 +276,8 @@ public:
|
|||||||
|
|
||||||
unsigned getMaxBytesToEmit() const { return MaxBytesToEmit; }
|
unsigned getMaxBytesToEmit() const { return MaxBytesToEmit; }
|
||||||
|
|
||||||
unsigned getEmitNops() const { return EmitNops; }
|
bool hasEmitNops() const { return EmitNops; }
|
||||||
|
void setEmitNops(bool Value) { EmitNops = Value; }
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
|
@ -498,7 +498,7 @@ static void WriteFragmentData(const MCAssembler &Asm, const MCAsmLayout &Layout,
|
|||||||
// the Count bytes. Then if that did not fill any bytes or there are any
|
// the Count bytes. Then if that did not fill any bytes or there are any
|
||||||
// bytes left to fill use the the Value and ValueSize to fill the rest.
|
// bytes left to fill use the the Value and ValueSize to fill the rest.
|
||||||
// If we are aligning with nops, ask that target to emit the right data.
|
// If we are aligning with nops, ask that target to emit the right data.
|
||||||
if (AF.getEmitNops()) {
|
if (AF.hasEmitNops()) {
|
||||||
if (!Asm.getBackend().WriteNopData(Count, OW))
|
if (!Asm.getBackend().WriteNopData(Count, OW))
|
||||||
report_fatal_error("unable to write nop sequence of " +
|
report_fatal_error("unable to write nop sequence of " +
|
||||||
Twine(Count) + " bytes");
|
Twine(Count) + " bytes");
|
||||||
|
@ -323,8 +323,7 @@ void MCMachOStreamer::EmitZerofill(const MCSection *Section, MCSymbol *Symbol,
|
|||||||
|
|
||||||
// Emit an align fragment if necessary.
|
// Emit an align fragment if necessary.
|
||||||
if (ByteAlignment != 1)
|
if (ByteAlignment != 1)
|
||||||
new MCAlignFragment(ByteAlignment, 0, 0, ByteAlignment, /*EmitNops=*/false,
|
new MCAlignFragment(ByteAlignment, 0, 0, ByteAlignment, &SectData);
|
||||||
&SectData);
|
|
||||||
|
|
||||||
MCFragment *F = new MCFillFragment(0, 0, Size, &SectData);
|
MCFragment *F = new MCFillFragment(0, 0, Size, &SectData);
|
||||||
SD.setFragment(F);
|
SD.setFragment(F);
|
||||||
@ -365,8 +364,7 @@ void MCMachOStreamer::EmitValueToAlignment(unsigned ByteAlignment,
|
|||||||
if (MaxBytesToEmit == 0)
|
if (MaxBytesToEmit == 0)
|
||||||
MaxBytesToEmit = ByteAlignment;
|
MaxBytesToEmit = ByteAlignment;
|
||||||
MCFragment *F = new MCAlignFragment(ByteAlignment, Value, ValueSize,
|
MCFragment *F = new MCAlignFragment(ByteAlignment, Value, ValueSize,
|
||||||
MaxBytesToEmit, /*EmitNops=*/false,
|
MaxBytesToEmit, CurSectionData);
|
||||||
CurSectionData);
|
|
||||||
F->setAtom(CurrentAtomMap.lookup(CurSectionData));
|
F->setAtom(CurrentAtomMap.lookup(CurSectionData));
|
||||||
|
|
||||||
// Update the maximum alignment on the current section if necessary.
|
// Update the maximum alignment on the current section if necessary.
|
||||||
@ -378,8 +376,9 @@ void MCMachOStreamer::EmitCodeAlignment(unsigned ByteAlignment,
|
|||||||
unsigned MaxBytesToEmit) {
|
unsigned MaxBytesToEmit) {
|
||||||
if (MaxBytesToEmit == 0)
|
if (MaxBytesToEmit == 0)
|
||||||
MaxBytesToEmit = ByteAlignment;
|
MaxBytesToEmit = ByteAlignment;
|
||||||
MCFragment *F = new MCAlignFragment(ByteAlignment, 0, 1, MaxBytesToEmit,
|
MCAlignFragment *F = new MCAlignFragment(ByteAlignment, 0, 1, MaxBytesToEmit,
|
||||||
/*EmitNops=*/true, CurSectionData);
|
CurSectionData);
|
||||||
|
F->setEmitNops(true);
|
||||||
F->setAtom(CurrentAtomMap.lookup(CurSectionData));
|
F->setAtom(CurrentAtomMap.lookup(CurSectionData));
|
||||||
|
|
||||||
// Update the maximum alignment on the current section if necessary.
|
// Update the maximum alignment on the current section if necessary.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user