Change errs() to dbgs().
[oota-llvm.git] / lib / MC / MCInst.cpp
1 //===- lib/MC/MCInst.cpp - MCInst implementation --------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #include "llvm/MC/MCInst.h"
11 #include "llvm/MC/MCExpr.h"
12 #include "llvm/Support/Debug.h"
13 #include "llvm/Support/raw_ostream.h"
14
15 using namespace llvm;
16
17 void MCOperand::print(raw_ostream &OS, const MCAsmInfo *MAI) const {
18   OS << "<MCOperand ";
19   if (!isValid())
20     OS << "INVALID";
21   else if (isReg())
22     OS << "Reg:" << getReg();
23   else if (isImm())
24     OS << "Imm:" << getImm();
25   else if (isExpr()) {
26     OS << "Expr:(";
27     getExpr()->print(OS, MAI);
28     OS << ")";
29   } else
30     OS << "UNDEFINED";
31   OS << ">";
32 }
33
34 void MCOperand::dump() const {
35   print(dbgs(), 0);
36   dbgs() << "\n";
37 }
38
39 void MCInst::print(raw_ostream &OS, const MCAsmInfo *MAI) const {
40   OS << "<MCInst " << getOpcode();
41   for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
42     OS << " ";
43     getOperand(i).print(OS, MAI);
44   }
45   OS << ">";
46 }
47
48 void MCInst::dump() const {
49   print(dbgs(), 0);
50   dbgs() << "\n";
51 }