LCOV - code coverage report
Current view: top level - lib/MC - MCInst.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 21 33 63.6 %
Date: 2017-09-14 15:23:50 Functions: 2 3 66.7 %
Legend: Lines: hit not hit

          Line data    Source code
       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        2835 : void MCOperand::print(raw_ostream &OS) const {
      20        2835 :   OS << "<MCOperand ";
      21        2835 :   if (!isValid())
      22           0 :     OS << "INVALID";
      23        2835 :   else if (isReg())
      24        2054 :     OS << "Reg:" << getReg();
      25         781 :   else if (isImm())
      26         624 :     OS << "Imm:" << getImm();
      27         157 :   else if (isFPImm())
      28           0 :     OS << "FPImm:" << getFPImm();
      29         157 :   else if (isExpr()) {
      30         314 :     OS << "Expr:(" << *getExpr() << ")";
      31           0 :   } else if (isInst()) {
      32           0 :     OS << "Inst:(" << *getInst() << ")";
      33             :   } else
      34           0 :     OS << "UNDEFINED";
      35        2835 :   OS << ">";
      36        2835 : }
      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 != e; ++i) {
      48           0 :     OS << " ";
      49           0 :     getOperand(i).print(OS);
      50             :   }
      51           0 :   OS << ">";
      52           0 : }
      53             : 
      54        1135 : void MCInst::dump_pretty(raw_ostream &OS, const MCInstPrinter *Printer,
      55             :                          StringRef Separator) const {
      56        2270 :   OS << "<MCInst #" << getOpcode();
      57             : 
      58             :   // Show the instruction opcode name if we have access to a printer.
      59        1135 :   if (Printer)
      60        1135 :     OS << ' ' << Printer->getOpcodeName(getOpcode());
      61             : 
      62        5105 :   for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
      63        2835 :     OS << Separator;
      64        2835 :     getOperand(i).print(OS);
      65             :   }
      66        1135 :   OS << ">";
      67        1135 : }
      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

Generated by: LCOV version 1.13