Coverage Report

Created: 2017-10-03 07:32

/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/llvm/lib/MC/MCAsmBackend.cpp
Line
Count
Source
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/MCFixupKindInfo.h"
14
#include <cassert>
15
#include <cstddef>
16
#include <cstdint>
17
18
using namespace llvm;
19
20
37.7k
MCAsmBackend::MCAsmBackend() = default;
21
22
37.5k
MCAsmBackend::~MCAsmBackend() = default;
23
24
22
Optional<MCFixupKind> MCAsmBackend::getFixupKind(StringRef Name) const {
25
22
  return None;
26
22
}
27
28
1.84M
const MCFixupKindInfo &MCAsmBackend::getFixupKindInfo(MCFixupKind Kind) const {
29
1.84M
  static const MCFixupKindInfo Builtins[] = {
30
1.84M
      {"FK_Data_1", 0, 8, 0},
31
1.84M
      {"FK_Data_2", 0, 16, 0},
32
1.84M
      {"FK_Data_4", 0, 32, 0},
33
1.84M
      {"FK_Data_8", 0, 64, 0},
34
1.84M
      {"FK_PCRel_1", 0, 8, MCFixupKindInfo::FKF_IsPCRel},
35
1.84M
      {"FK_PCRel_2", 0, 16, MCFixupKindInfo::FKF_IsPCRel},
36
1.84M
      {"FK_PCRel_4", 0, 32, MCFixupKindInfo::FKF_IsPCRel},
37
1.84M
      {"FK_PCRel_8", 0, 64, MCFixupKindInfo::FKF_IsPCRel},
38
1.84M
      {"FK_GPRel_1", 0, 8, 0},
39
1.84M
      {"FK_GPRel_2", 0, 16, 0},
40
1.84M
      {"FK_GPRel_4", 0, 32, 0},
41
1.84M
      {"FK_GPRel_8", 0, 64, 0},
42
1.84M
      {"FK_DTPRel_4", 0, 32, 0},
43
1.84M
      {"FK_DTPRel_8", 0, 64, 0},
44
1.84M
      {"FK_TPRel_4", 0, 32, 0},
45
1.84M
      {"FK_TPRel_8", 0, 64, 0},
46
1.84M
      {"FK_SecRel_1", 0, 8, 0},
47
1.84M
      {"FK_SecRel_2", 0, 16, 0},
48
1.84M
      {"FK_SecRel_4", 0, 32, 0},
49
1.84M
      {"FK_SecRel_8", 0, 64, 0}};
50
1.84M
51
1.84M
  assert((size_t)Kind <= array_lengthof(Builtins) && "Unknown fixup kind");
52
1.84M
  return Builtins[Kind];
53
1.84M
}
54
55
bool MCAsmBackend::fixupNeedsRelaxationAdvanced(
56
    const MCFixup &Fixup, bool Resolved, uint64_t Value,
57
135k
    const MCRelaxableFragment *DF, const MCAsmLayout &Layout) const {
58
135k
  if (!Resolved)
59
1.06k
    return true;
60
134k
  return fixupNeedsRelaxation(Fixup, Value, DF, Layout);
61
134k
}