aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCAssembler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/MC/MCAssembler.cpp')
-rw-r--r--llvm/lib/MC/MCAssembler.cpp31
1 files changed, 13 insertions, 18 deletions
diff --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp
index 480e6fe..fd8a8c3 100644
--- a/llvm/lib/MC/MCAssembler.cpp
+++ b/llvm/lib/MC/MCAssembler.cpp
@@ -553,18 +553,11 @@ static void writeFragment(raw_ostream &OS, const MCAssembler &Asm,
case MCFragment::FT_Align: {
++stats::EmittedAlignFragments;
const MCAlignFragment &AF = cast<MCAlignFragment>(F);
- assert(AF.getValueSize() && "Invalid virtual align in concrete fragment!");
+ assert(AF.getFillLen() && "Invalid virtual align in concrete fragment!");
- uint64_t Count = FragmentSize / AF.getValueSize();
-
- // FIXME: This error shouldn't actually occur (the front end should emit
- // multiple .align directives to enforce the semantics it wants), but is
- // severe enough that we want to report it. How to handle this?
- if (Count * AF.getValueSize() != FragmentSize)
- report_fatal_error("undefined .align directive, value size '" +
- Twine(AF.getValueSize()) +
- "' is not a divisor of padding size '" +
- Twine(FragmentSize) + "'");
+ uint64_t Count = FragmentSize / AF.getFillLen();
+ assert(FragmentSize % AF.getFillLen() == 0 &&
+ "computeFragmentSize computed size is incorrect");
// See if we are aligning with nops, and if so do that first to try to fill
// the Count bytes. Then if that did not fill any bytes or there are any
@@ -579,17 +572,19 @@ static void writeFragment(raw_ostream &OS, const MCAssembler &Asm,
// Otherwise, write out in multiples of the value size.
for (uint64_t i = 0; i != Count; ++i) {
- switch (AF.getValueSize()) {
+ switch (AF.getFillLen()) {
default: llvm_unreachable("Invalid size!");
- case 1: OS << char(AF.getValue()); break;
+ case 1:
+ OS << char(AF.getFill());
+ break;
case 2:
- support::endian::write<uint16_t>(OS, AF.getValue(), Endian);
+ support::endian::write<uint16_t>(OS, AF.getFill(), Endian);
break;
case 4:
- support::endian::write<uint32_t>(OS, AF.getValue(), Endian);
+ support::endian::write<uint32_t>(OS, AF.getFill(), Endian);
break;
case 8:
- support::endian::write<uint64_t>(OS, AF.getValue(), Endian);
+ support::endian::write<uint64_t>(OS, AF.getFill(), Endian);
break;
}
}
@@ -733,8 +728,8 @@ void MCAssembler::writeSectionData(raw_ostream &OS,
case MCFragment::FT_Align:
// Check that we aren't trying to write a non-zero value into a virtual
// section.
- assert((cast<MCAlignFragment>(F).getValueSize() == 0 ||
- cast<MCAlignFragment>(F).getValue() == 0) &&
+ assert((cast<MCAlignFragment>(F).getFillLen() == 0 ||
+ cast<MCAlignFragment>(F).getFill() == 0) &&
"Invalid align in virtual section!");
break;
case MCFragment::FT_Fill: