================
@@ -433,42 +434,44 @@ static void writeFragment(raw_ostream &OS, const 
MCAssembler &Asm,
     const auto &EF = cast<MCFragment>(F);
     OS << StringRef(EF.getContents().data(), EF.getContents().size());
     OS << StringRef(EF.getVarContents().data(), EF.getVarContents().size());
-    if (F.getKind() == MCFragment::FT_Align) {
-      ++stats::EmittedAlignFragments;
-      assert(F.getAlignFillLen() &&
-             "Invalid virtual align in concrete fragment!");
-
-      uint64_t Count = (FragmentSize - F.getFixedSize()) / F.getAlignFillLen();
-      assert((FragmentSize - F.getFixedSize()) % F.getAlignFillLen() == 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 bytes left to fill use the Value and ValueSize to fill the rest. 
If
-      // we are aligning with nops, ask that target to emit the right data.
-      if (F.hasAlignEmitNops()) {
-        if (!Asm.getBackend().writeNopData(OS, Count, F.getSubtargetInfo()))
-          report_fatal_error("unable to write nop sequence of " + Twine(Count) 
+
-                             " bytes");
-      } else {
-        // Otherwise, write out in multiples of the value size.
-        for (uint64_t i = 0; i != Count; ++i) {
-          switch (F.getAlignFillLen()) {
-          default:
-            llvm_unreachable("Invalid size!");
-          case 1:
-            OS << char(F.getAlignFill());
-            break;
-          case 2:
-            support::endian::write<uint16_t>(OS, F.getAlignFill(), Endian);
-            break;
-          case 4:
-            support::endian::write<uint32_t>(OS, F.getAlignFill(), Endian);
-            break;
-          case 8:
-            support::endian::write<uint64_t>(OS, F.getAlignFill(), Endian);
-            break;
-          }
+  } break;
+
+  case MCFragment::FT_Align: {
+    ++stats::EmittedAlignFragments;
+    OS << StringRef(F.getContents().data(), F.getContents().size());
+    assert(F.getAlignFillLen() &&
+           "Invalid virtual align in concrete fragment!");
+
+    uint64_t Count = (FragmentSize - F.getFixedSize()) / F.getAlignFillLen();
+    assert((FragmentSize - F.getFixedSize()) % F.getAlignFillLen() == 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 bytes left to fill use the Value and ValueSize to fill the rest. If
+    // we are aligning with nops, ask that target to emit the right data.
----------------
aengelke wrote:

Comment outdated?

https://github.com/llvm/llvm-project/pull/149465
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to