[llvm-bugs] [Bug 44061] New: shuffled/unsorted assembler output

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Nov 19 06:47:09 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=44061

            Bug ID: 44061
           Summary: shuffled/unsorted assembler output
           Product: libraries
           Version: 7.0
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: MC
          Assignee: unassignedbugs at nondot.org
          Reporter: baembel at gmx.de
                CC: llvm-bugs at lists.llvm.org

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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191119/ddc96d55/attachment.html>


More information about the llvm-bugs mailing list