Coverage Report

Created: 2019-07-24 05:18

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