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: unassignedb...@nondot.org
          Reporter: baem...@gmx.de
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to