/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/llvm/lib/MC/MCInst.cpp
Line | Count | Source (jump to first uncovered line) |
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/MC/MCInstPrinter.h" |
13 | | #include "llvm/Support/Compiler.h" |
14 | | #include "llvm/Support/Debug.h" |
15 | | #include "llvm/Support/raw_ostream.h" |
16 | | |
17 | | using namespace llvm; |
18 | | |
19 | 2.83k | void MCOperand::print(raw_ostream &OS) const { |
20 | 2.83k | OS << "<MCOperand "; |
21 | 2.83k | if (!isValid()) |
22 | 0 | OS << "INVALID"; |
23 | 2.83k | else if (2.83k isReg()2.83k ) |
24 | 2.05k | OS << "Reg:" << getReg(); |
25 | 781 | else if (781 isImm()781 ) |
26 | 624 | OS << "Imm:" << getImm(); |
27 | 157 | else if (157 isFPImm()157 ) |
28 | 0 | OS << "FPImm:" << getFPImm(); |
29 | 157 | else if (157 isExpr()157 ) { |
30 | 157 | OS << "Expr:(" << *getExpr() << ")"; |
31 | 157 | } else if (0 isInst()0 ) { |
32 | 0 | OS << "Inst:(" << *getInst() << ")"; |
33 | 0 | } else |
34 | 0 | OS << "UNDEFINED"; |
35 | 2.83k | OS << ">"; |
36 | 2.83k | } |
37 | | |
38 | | #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) |
39 | | LLVM_DUMP_METHOD void MCOperand::dump() const { |
40 | | print(dbgs()); |
41 | | dbgs() << "\n"; |
42 | | } |
43 | | #endif |
44 | | |
45 | 0 | void MCInst::print(raw_ostream &OS) const { |
46 | 0 | OS << "<MCInst " << getOpcode(); |
47 | 0 | for (unsigned i = 0, e = getNumOperands(); i != e0 ; ++i0 ) { |
48 | 0 | OS << " "; |
49 | 0 | getOperand(i).print(OS); |
50 | 0 | } |
51 | 0 | OS << ">"; |
52 | 0 | } |
53 | | |
54 | | void MCInst::dump_pretty(raw_ostream &OS, const MCInstPrinter *Printer, |
55 | 1.13k | StringRef Separator) const { |
56 | 1.13k | OS << "<MCInst #" << getOpcode(); |
57 | 1.13k | |
58 | 1.13k | // Show the instruction opcode name if we have access to a printer. |
59 | 1.13k | if (Printer) |
60 | 1.13k | OS << ' ' << Printer->getOpcodeName(getOpcode()); |
61 | 1.13k | |
62 | 3.97k | for (unsigned i = 0, e = getNumOperands(); i != e3.97k ; ++i2.83k ) { |
63 | 2.83k | OS << Separator; |
64 | 2.83k | getOperand(i).print(OS); |
65 | 2.83k | } |
66 | 1.13k | OS << ">"; |
67 | 1.13k | } |
68 | | |
69 | | #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) |
70 | | LLVM_DUMP_METHOD void MCInst::dump() const { |
71 | | print(dbgs()); |
72 | | dbgs() << "\n"; |
73 | | } |
74 | | #endif |