LCOV - code coverage report
Current view: top level - lib/MC - MCValue.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 16 22 72.7 %
Date: 2018-10-20 13:21:21 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===- lib/MC/MCValue.cpp - MCValue 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/MCValue.h"
      11             : #include "llvm/Config/llvm-config.h"
      12             : #include "llvm/MC/MCExpr.h"
      13             : #include "llvm/Support/Debug.h"
      14             : #include "llvm/Support/ErrorHandling.h"
      15             : #include "llvm/Support/raw_ostream.h"
      16             : 
      17             : using namespace llvm;
      18             : 
      19           1 : void MCValue::print(raw_ostream &OS) const {
      20           1 :   if (isAbsolute()) {
      21           0 :     OS << getConstant();
      22           0 :     return;
      23             :   }
      24             : 
      25             :   // FIXME: prints as a number, which isn't ideal. But the meaning will be
      26             :   // target-specific anyway.
      27           1 :   if (getRefKind())
      28           0 :     OS << ':' << getRefKind() <<  ':';
      29             : 
      30           1 :   OS << *getSymA();
      31             : 
      32           1 :   if (getSymB()) {
      33           1 :     OS << " - ";
      34           1 :     OS << *getSymB();
      35             :   }
      36             : 
      37           1 :   if (getConstant())
      38           0 :     OS << " + " << getConstant();
      39             : }
      40             : 
      41             : #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
      42             : LLVM_DUMP_METHOD void MCValue::dump() const {
      43             :   print(dbgs());
      44             : }
      45             : #endif
      46             : 
      47     5055427 : MCSymbolRefExpr::VariantKind MCValue::getAccessVariant() const {
      48     5055427 :   const MCSymbolRefExpr *B = getSymB();
      49     5055427 :   if (B) {
      50      212608 :     if (B->getKind() != MCSymbolRefExpr::VK_None)
      51           0 :       llvm_unreachable("unsupported");
      52             :   }
      53             : 
      54     5055427 :   const MCSymbolRefExpr *A = getSymA();
      55     5055427 :   if (!A)
      56             :     return MCSymbolRefExpr::VK_None;
      57             : 
      58     5055419 :   MCSymbolRefExpr::VariantKind Kind = A->getKind();
      59     5055419 :   if (Kind == MCSymbolRefExpr::VK_WEAKREF)
      60           0 :     return MCSymbolRefExpr::VK_None;
      61             :   return Kind;
      62             : }

Generated by: LCOV version 1.13