Coverage Report

Created: 2017-10-03 07:32

/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/llvm/lib/MC/MCAsmInfoDarwin.cpp
Line
Count
Source (jump to first uncovered line)
1
//===- MCAsmInfoDarwin.cpp - Darwin asm properties ------------------------===//
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 defines target asm properties related what form asm statements
11
// should take in general on Darwin-based targets
12
//
13
//===----------------------------------------------------------------------===//
14
15
#include "llvm/MC/MCAsmInfoDarwin.h"
16
#include "llvm/BinaryFormat/MachO.h"
17
#include "llvm/MC/MCDirectives.h"
18
#include "llvm/MC/MCSectionMachO.h"
19
20
using namespace llvm;
21
22
bool MCAsmInfoDarwin::isSectionAtomizableBySymbols(
23
166k
    const MCSection &Section) const {
24
166k
  const MCSectionMachO &SMO = static_cast<const MCSectionMachO &>(Section);
25
166k
26
166k
  // Sections holding 1 byte strings are atomized based on the data they
27
166k
  // contain.
28
166k
  // Sections holding 2 byte strings require symbols in order to be atomized.
29
166k
  // There is no dedicated section for 4 byte strings.
30
166k
  if (SMO.getType() == MachO::S_CSTRING_LITERALS)
31
55.3k
    return false;
32
111k
33
111k
  
if (111k
SMO.getSegmentName() == "__DATA" && 111k
SMO.getSectionName() == "__cfstring"744
)
34
48
    return false;
35
111k
36
111k
  
if (111k
SMO.getSegmentName() == "__DATA" &&
37
696
      SMO.getSectionName() == "__objc_classrefs")
38
20
    return false;
39
111k
40
111k
  switch (SMO.getType()) {
41
110k
  default:
42
110k
    return true;
43
111k
44
111k
  // These sections are atomized at the element boundaries without using
45
111k
  // symbols.
46
854
  case MachO::S_4BYTE_LITERALS:
47
854
  case MachO::S_8BYTE_LITERALS:
48
854
  case MachO::S_16BYTE_LITERALS:
49
854
  case MachO::S_LITERAL_POINTERS:
50
854
  case MachO::S_NON_LAZY_SYMBOL_POINTERS:
51
854
  case MachO::S_LAZY_SYMBOL_POINTERS:
52
854
  case MachO::S_THREAD_LOCAL_VARIABLE_POINTERS:
53
854
  case MachO::S_MOD_INIT_FUNC_POINTERS:
54
854
  case MachO::S_MOD_TERM_FUNC_POINTERS:
55
854
  case MachO::S_INTERPOSING:
56
854
    return false;
57
0
  }
58
0
}
59
60
24.9k
MCAsmInfoDarwin::MCAsmInfoDarwin() {
61
24.9k
  // Common settings for all Darwin targets.
62
24.9k
  // Syntax:
63
24.9k
  LinkerPrivateGlobalPrefix = "l";
64
24.9k
  HasSingleParameterDotFile = false;
65
24.9k
  HasSubsectionsViaSymbols = true;
66
24.9k
67
24.9k
  AlignmentIsInBytes = false;
68
24.9k
  COMMDirectiveAlignmentIsInBytes = false;
69
24.9k
  LCOMMDirectiveAlignmentType = LCOMM::Log2Alignment;
70
24.9k
  InlineAsmStart = " InlineAsm Start";
71
24.9k
  InlineAsmEnd = " InlineAsm End";
72
24.9k
73
24.9k
  // Directives:
74
24.9k
  HasWeakDefDirective = true;
75
24.9k
  HasWeakDefCanBeHiddenDirective = true;
76
24.9k
  WeakRefDirective = "\t.weak_reference ";
77
24.9k
  ZeroDirective = "\t.space\t";  // ".space N" emits N zeros.
78
24.9k
  HasMachoZeroFillDirective = true;  // Uses .zerofill
79
24.9k
  HasMachoTBSSDirective = true; // Uses .tbss
80
24.9k
81
24.9k
  // FIXME: Change this once MC is the system assembler.
82
24.9k
  HasAggressiveSymbolFolding = false;
83
24.9k
84
24.9k
  HiddenVisibilityAttr = MCSA_PrivateExtern;
85
24.9k
  HiddenDeclarationVisibilityAttr = MCSA_Invalid;
86
24.9k
87
24.9k
  // Doesn't support protected visibility.
88
24.9k
  ProtectedVisibilityAttr = MCSA_Invalid;
89
24.9k
90
24.9k
  HasDotTypeDotSizeDirective = false;
91
24.9k
  HasNoDeadStrip = true;
92
24.9k
  HasAltEntry = true;
93
24.9k
94
24.9k
  DwarfUsesRelocationsAcrossSections = false;
95
24.9k
96
24.9k
  UseIntegratedAssembler = true;
97
24.9k
  SetDirectiveSuppressesReloc = true;
98
24.9k
}