1 //===- lib/MC/MCInst.cpp - MCInst implementation --------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "llvm/MC/MCInst.h"
11 #include "llvm/MC/MCExpr.h"
12 #include "llvm/MC/MCInstPrinter.h"
13 #include "llvm/Support/Debug.h"
14 #include "llvm/Support/raw_ostream.h"
18 void MCOperand::print(raw_ostream &OS) const {
23 OS << "Reg:" << getReg();
25 OS << "Imm:" << getImm();
27 OS << "Expr:(" << *getExpr() << ")";
28 } else if (isInst()) {
29 OS << "Inst:(" << *getInst() << ")";
35 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
36 void MCOperand::dump() const {
42 void MCInst::print(raw_ostream &OS) const {
43 OS << "<MCInst " << getOpcode();
44 for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
46 getOperand(i).print(OS);
51 void MCInst::dump_pretty(raw_ostream &OS, const MCInstPrinter *Printer,
52 StringRef Separator) const {
53 OS << "<MCInst #" << getOpcode();
55 // Show the instruction opcode name if we have access to a printer.
57 OS << ' ' << Printer->getOpcodeName(getOpcode());
59 for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
61 getOperand(i).print(OS);
66 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
67 void MCInst::dump() const {