<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - shuffled/unsorted assembler output"
   href="https://bugs.llvm.org/show_bug.cgi?id=44061">44061</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>shuffled/unsorted assembler output
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>7.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>MC
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>baembel@gmx.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I do use a target assembler streamer, which implements the method emitValue().
Then
1) emitValue() hat to emit newlines by itself
2) comments are not at their correct place, but in lines below the emitted
values

An implemented method emitValue() is used at the end of
MCAsmStreamer::EmitValueImpl():

void MCAsmStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size,
                                  SMLoc Loc) {

  ...
  assert(Directive && "Invalid size for machine code value!");
  OS << Directive;
  if (MCTargetStreamer *TS = getTargetStreamer()) {
    TS->emitValue(Value);  /// <- here it is used.
  } else {
    Value->print(OS, MAI);
    EmitEOL();
  }
}

The proposed solution is to emit the EOL in both cases:

  assert(Directive && "Invalid size for machine code value!");
  OS << Directive;
  if (MCTargetStreamer *TS = getTargetStreamer()) {
    TS->emitValue(Value);  /// <- here it is used.
  } else {
    Value->print(OS, MAI);
  }
  EmitEOL();
}

In this case emitValue() does not have to emit EOLs and comments are at their
correct place. At least in my back-end this works as expected.

Boris</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>