LCOV - code coverage report
Current view: top level - lib/MC - MCAsmBackend.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 20 24 83.3 %
Date: 2018-02-21 17:27:13 Functions: 8 10 80.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===- MCAsmBackend.cpp - Target MC Assembly Backend ----------------------===//
       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/MCAsmBackend.h"
      11             : #include "llvm/ADT/None.h"
      12             : #include "llvm/ADT/STLExtras.h"
      13             : #include "llvm/MC/MCCodePadder.h"
      14             : #include "llvm/MC/MCFixupKindInfo.h"
      15             : #include <cassert>
      16             : #include <cstddef>
      17             : #include <cstdint>
      18             : 
      19             : using namespace llvm;
      20             : 
      21       49734 : MCAsmBackend::MCAsmBackend() : CodePadder(new MCCodePadder()) {}
      22             : 
      23           0 : MCAsmBackend::MCAsmBackend(std::unique_ptr<MCCodePadder> TargetCodePadder)
      24           0 :     : CodePadder(std::move(TargetCodePadder)) {}
      25             : 
      26             : MCAsmBackend::~MCAsmBackend() = default;
      27             : 
      28          22 : Optional<MCFixupKind> MCAsmBackend::getFixupKind(StringRef Name) const {
      29          22 :   return None;
      30             : }
      31             : 
      32     5484584 : const MCFixupKindInfo &MCAsmBackend::getFixupKindInfo(MCFixupKind Kind) const {
      33             :   static const MCFixupKindInfo Builtins[] = {
      34             :       {"FK_Data_1", 0, 8, 0},
      35             :       {"FK_Data_2", 0, 16, 0},
      36             :       {"FK_Data_4", 0, 32, 0},
      37             :       {"FK_Data_8", 0, 64, 0},
      38             :       {"FK_PCRel_1", 0, 8, MCFixupKindInfo::FKF_IsPCRel},
      39             :       {"FK_PCRel_2", 0, 16, MCFixupKindInfo::FKF_IsPCRel},
      40             :       {"FK_PCRel_4", 0, 32, MCFixupKindInfo::FKF_IsPCRel},
      41             :       {"FK_PCRel_8", 0, 64, MCFixupKindInfo::FKF_IsPCRel},
      42             :       {"FK_GPRel_1", 0, 8, 0},
      43             :       {"FK_GPRel_2", 0, 16, 0},
      44             :       {"FK_GPRel_4", 0, 32, 0},
      45             :       {"FK_GPRel_8", 0, 64, 0},
      46             :       {"FK_DTPRel_4", 0, 32, 0},
      47             :       {"FK_DTPRel_8", 0, 64, 0},
      48             :       {"FK_TPRel_4", 0, 32, 0},
      49             :       {"FK_TPRel_8", 0, 64, 0},
      50             :       {"FK_SecRel_1", 0, 8, 0},
      51             :       {"FK_SecRel_2", 0, 16, 0},
      52             :       {"FK_SecRel_4", 0, 32, 0},
      53             :       {"FK_SecRel_8", 0, 64, 0}};
      54             : 
      55             :   assert((size_t)Kind <= array_lengthof(Builtins) && "Unknown fixup kind");
      56     5484584 :   return Builtins[Kind];
      57             : }
      58             : 
      59      148005 : bool MCAsmBackend::fixupNeedsRelaxationAdvanced(
      60             :     const MCFixup &Fixup, bool Resolved, uint64_t Value,
      61             :     const MCRelaxableFragment *DF, const MCAsmLayout &Layout) const {
      62      148005 :   if (!Resolved)
      63             :     return true;
      64      147085 :   return fixupNeedsRelaxation(Fixup, Value, DF, Layout);
      65             : }
      66             : 
      67      211220 : void MCAsmBackend::handleCodePaddingBasicBlockStart(
      68             :     MCObjectStreamer *OS, const MCCodePaddingContext &Context) {
      69      211220 :   CodePadder->handleBasicBlockStart(OS, Context);
      70      211221 : }
      71             : 
      72      211221 : void MCAsmBackend::handleCodePaddingBasicBlockEnd(
      73             :     const MCCodePaddingContext &Context) {
      74      211221 :   CodePadder->handleBasicBlockEnd(Context);
      75      211221 : }
      76             : 
      77     2270752 : void MCAsmBackend::handleCodePaddingInstructionBegin(const MCInst &Inst) {
      78     2270752 :   CodePadder->handleInstructionBegin(Inst);
      79     2270752 : }
      80             : 
      81     2270752 : void MCAsmBackend::handleCodePaddingInstructionEnd(const MCInst &Inst) {
      82     2270752 :   CodePadder->handleInstructionEnd(Inst);
      83     2270752 : }
      84             : 
      85           0 : bool MCAsmBackend::relaxFragment(MCPaddingFragment *PF, MCAsmLayout &Layout) {
      86           0 :   return CodePadder->relaxFragment(PF, Layout);
      87             : }

Generated by: LCOV version 1.13