mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 04:02:41 +01:00
llvm-mc: Print encodings after the instruction, and only when we have an asm
printer. llvm-svn: 80233
This commit is contained in:
parent
87eb328bcf
commit
b11e3eb82f
@ -295,26 +295,27 @@ static raw_ostream &operator<<(raw_ostream &OS, const MCOperand &Op) {
|
||||
void MCAsmStreamer::EmitInstruction(const MCInst &Inst) {
|
||||
assert(CurSection && "Cannot emit contents before setting section!");
|
||||
|
||||
// Show the encoding if we have a code emitter.
|
||||
if (Emitter) {
|
||||
SmallString<256> Code;
|
||||
raw_svector_ostream VecOS(Code);
|
||||
Emitter->EncodeInstruction(Inst, VecOS);
|
||||
VecOS.flush();
|
||||
|
||||
OS.indent(20);
|
||||
OS << " # encoding: [";
|
||||
for (unsigned i = 0, e = Code.size(); i != e; ++i) {
|
||||
if (i + 1 != e)
|
||||
OS << ',';
|
||||
OS << format("%#04x", Code[i]);
|
||||
}
|
||||
OS << "]\n";
|
||||
}
|
||||
|
||||
// If we have an AsmPrinter, use that to print.
|
||||
if (Printer) {
|
||||
Printer->printMCInst(&Inst);
|
||||
|
||||
// Show the encoding if we have a code emitter.
|
||||
if (Emitter) {
|
||||
SmallString<256> Code;
|
||||
raw_svector_ostream VecOS(Code);
|
||||
Emitter->EncodeInstruction(Inst, VecOS);
|
||||
VecOS.flush();
|
||||
|
||||
OS.indent(20);
|
||||
OS << " # encoding: [";
|
||||
for (unsigned i = 0, e = Code.size(); i != e; ++i) {
|
||||
if (i)
|
||||
OS << ',';
|
||||
OS << format("%#04x", uint8_t(Code[i]));
|
||||
}
|
||||
OS << "]\n";
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user