LCOV - code coverage report
Current view: top level - lib/Target/AVR/MCTargetDesc - AVRMCELFStreamer.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 9 11 81.8 %
Date: 2018-10-20 13:21:21 Functions: 1 2 50.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===--------- AVRMCELFStreamer.cpp - AVR subclass of MCELFStreamer -------===//
       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             : // This file is a stub that parses a MCInst bundle and passes the
      11             : // instructions on to the real streamer.
      12             : //
      13             : //===----------------------------------------------------------------------===//
      14             : #define DEBUG_TYPE "avrmcelfstreamer"
      15             : 
      16             : #include "MCTargetDesc/AVRMCELFStreamer.h"
      17             : #include "llvm/MC/MCContext.h"
      18             : #include "llvm/MC/MCExpr.h"
      19             : #include "llvm/MC/MCSymbol.h"
      20             : #include "llvm/MC/MCObjectWriter.h"
      21             : 
      22             : using namespace llvm;
      23             : 
      24           8 : void AVRMCELFStreamer::EmitValueForModiferKind(
      25             :     const MCSymbol *Sym, unsigned SizeInBytes, SMLoc Loc,
      26             :     AVRMCExpr::VariantKind ModifierKind) {
      27             :   MCSymbolRefExpr::VariantKind Kind = MCSymbolRefExpr::VK_AVR_NONE;
      28           8 :   if (ModifierKind == AVRMCExpr::VK_AVR_None) {
      29             :     Kind = MCSymbolRefExpr::VK_AVR_DIFF8;
      30           3 :     if (SizeInBytes == SIZE_LONG)
      31             :       Kind = MCSymbolRefExpr::VK_AVR_DIFF32;
      32           2 :     else if (SizeInBytes == SIZE_WORD)
      33             :       Kind = MCSymbolRefExpr::VK_AVR_DIFF16;
      34           5 :   } else if (ModifierKind == AVRMCExpr::VK_AVR_LO8)
      35             :     Kind = MCSymbolRefExpr::VK_AVR_LO8;
      36           4 :   else if (ModifierKind == AVRMCExpr::VK_AVR_HI8)
      37             :     Kind = MCSymbolRefExpr::VK_AVR_HI8;
      38           3 :   else if (ModifierKind == AVRMCExpr::VK_AVR_HH8)
      39             :     Kind = MCSymbolRefExpr::VK_AVR_HLO8;
      40           8 :   MCELFStreamer::EmitValue(MCSymbolRefExpr::create(Sym, Kind, getContext()),
      41             :                            SizeInBytes, Loc);
      42           8 : }
      43             : 
      44             : namespace llvm {
      45           0 : MCStreamer *createAVRELFStreamer(Triple const &TT, MCContext &Context,
      46             :                                  std::unique_ptr<MCAsmBackend> MAB,
      47             :                                  std::unique_ptr<MCObjectWriter> OW,
      48             :                                  std::unique_ptr<MCCodeEmitter> CE) {
      49             :   return new AVRMCELFStreamer(Context, std::move(MAB), std::move(OW),
      50           0 :                               std::move(CE));
      51             : }
      52             : 
      53             : } // end namespace llvm

Generated by: LCOV version 1.13