mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-12 01:25:49 +00:00
Dump MCInsts in the MC .s printer, for now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74593 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
#include "llvm/MC/MCStreamer.h"
|
#include "llvm/MC/MCStreamer.h"
|
||||||
|
|
||||||
#include "llvm/MC/MCContext.h"
|
#include "llvm/MC/MCContext.h"
|
||||||
|
#include "llvm/MC/MCInst.h"
|
||||||
#include "llvm/MC/MCSection.h"
|
#include "llvm/MC/MCSection.h"
|
||||||
#include "llvm/MC/MCSymbol.h"
|
#include "llvm/MC/MCSymbol.h"
|
||||||
#include "llvm/MC/MCValue.h"
|
#include "llvm/MC/MCValue.h"
|
||||||
@@ -195,10 +196,30 @@ void MCAsmStreamer::EmitValueToOffset(const MCValue &Offset,
|
|||||||
OS << ".org " << Offset << ", " << (unsigned) Value << '\n';
|
OS << ".org " << Offset << ", " << (unsigned) Value << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static raw_ostream &operator<<(raw_ostream &OS, const MCOperand &Op) {
|
||||||
|
if (Op.isReg())
|
||||||
|
return OS << "reg:" << Op.getReg();
|
||||||
|
if (Op.isImm())
|
||||||
|
return OS << "imm:" << Op.getImm();
|
||||||
|
if (Op.isMBBLabel())
|
||||||
|
return OS << "mbblabel:("
|
||||||
|
<< Op.getMBBLabelFunction() << ", " << Op.getMBBLabelBlock();
|
||||||
|
assert(Op.isMCValue() && "Invalid operand!");
|
||||||
|
return OS << "val:" << Op.getMCValue();
|
||||||
|
}
|
||||||
|
|
||||||
void MCAsmStreamer::EmitInstruction(const MCInst &Inst) {
|
void MCAsmStreamer::EmitInstruction(const MCInst &Inst) {
|
||||||
assert(CurSection && "Cannot emit contents before setting section!");
|
assert(CurSection && "Cannot emit contents before setting section!");
|
||||||
// FIXME: Implement.
|
// FIXME: Implement proper printing.
|
||||||
OS << "# FIXME: Implement instruction printing!\n";
|
OS << "MCInst("
|
||||||
|
<< "opcode=" << Inst.getOpcode() << ", "
|
||||||
|
<< "operands=[";
|
||||||
|
for (unsigned i = 0, e = Inst.getNumOperands(); i != e; ++i) {
|
||||||
|
if (i)
|
||||||
|
OS << ", ";
|
||||||
|
OS << Inst.getOperand(i);
|
||||||
|
}
|
||||||
|
OS << "])\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCAsmStreamer::Finish() {
|
void MCAsmStreamer::Finish() {
|
||||||
|
Reference in New Issue
Block a user