2009-08-27 09:57:12 +02:00
|
|
|
//===- lib/MC/MCInst.cpp - MCInst implementation --------------------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "llvm/MC/MCInst.h"
|
2009-08-31 10:08:38 +02:00
|
|
|
#include "llvm/MC/MCExpr.h"
|
2010-01-05 02:28:22 +01:00
|
|
|
#include "llvm/Support/Debug.h"
|
2009-08-27 09:57:12 +02:00
|
|
|
#include "llvm/Support/raw_ostream.h"
|
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
2009-09-03 07:46:51 +02:00
|
|
|
void MCOperand::print(raw_ostream &OS, const MCAsmInfo *MAI) const {
|
2009-08-27 09:57:12 +02:00
|
|
|
OS << "<MCOperand ";
|
|
|
|
if (!isValid())
|
|
|
|
OS << "INVALID";
|
|
|
|
else if (isReg())
|
|
|
|
OS << "Reg:" << getReg();
|
|
|
|
else if (isImm())
|
|
|
|
OS << "Imm:" << getImm();
|
2009-08-31 10:08:38 +02:00
|
|
|
else if (isExpr()) {
|
2010-01-18 01:37:40 +01:00
|
|
|
OS << "Expr:(" << *getExpr() << ")";
|
2009-08-27 09:57:12 +02:00
|
|
|
} else
|
|
|
|
OS << "UNDEFINED";
|
|
|
|
OS << ">";
|
|
|
|
}
|
|
|
|
|
|
|
|
void MCOperand::dump() const {
|
2010-01-05 02:28:22 +01:00
|
|
|
print(dbgs(), 0);
|
|
|
|
dbgs() << "\n";
|
2009-08-27 09:57:12 +02:00
|
|
|
}
|
|
|
|
|
2009-09-03 07:46:51 +02:00
|
|
|
void MCInst::print(raw_ostream &OS, const MCAsmInfo *MAI) const {
|
2009-08-27 09:57:12 +02:00
|
|
|
OS << "<MCInst " << getOpcode();
|
|
|
|
for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
|
|
|
|
OS << " ";
|
2009-09-03 07:46:51 +02:00
|
|
|
getOperand(i).print(OS, MAI);
|
2009-08-27 09:57:12 +02:00
|
|
|
}
|
|
|
|
OS << ">";
|
|
|
|
}
|
|
|
|
|
|
|
|
void MCInst::dump() const {
|
2010-01-05 02:28:22 +01:00
|
|
|
print(dbgs(), 0);
|
|
|
|
dbgs() << "\n";
|
2009-08-27 09:57:12 +02:00
|
|
|
}
|