blob: 469dc7975e5d241b3f694f49b5c70dafdb8a00fb [file] [log] [blame]
Daniel Dunbar4b770c22009-08-27 07:57:12 +00001//===- 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/Support/raw_ostream.h"
12
13using namespace llvm;
14
15void MCOperand::print(raw_ostream &OS) const {
16 OS << "<MCOperand ";
17 if (!isValid())
18 OS << "INVALID";
19 else if (isReg())
20 OS << "Reg:" << getReg();
21 else if (isImm())
22 OS << "Imm:" << getImm();
23 else if (isMBBLabel())
24 OS << "MBB:(" << getMBBLabelFunction() << ","
25 << getMBBLabelBlock() << ")";
26 else if (isMCValue()) {
27 OS << "Value:(";
28 getMCValue().print(OS);
29 OS << ")";
30 } else
31 OS << "UNDEFINED";
32 OS << ">";
33}
34
35void MCOperand::dump() const {
36 print(errs());
37 errs() << "\n";
38}
39
40void MCInst::print(raw_ostream &OS) const {
41 OS << "<MCInst " << getOpcode();
42 for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
43 OS << " ";
44 getOperand(i).print(OS);
45 }
46 OS << ">";
47}
48
49void MCInst::dump() const {
50 print(errs());
51 errs() << "\n";
52}