LCOV - code coverage report
Current view: top level - lib/MC - MCAsmInfoDarwin.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 28 28 100.0 %
Date: 2018-10-20 13:21:21 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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        1933 : bool MCAsmInfoDarwin::isSectionAtomizableBySymbols(
      23             :     const MCSection &Section) const {
      24             :   const MCSectionMachO &SMO = static_cast<const MCSectionMachO &>(Section);
      25             : 
      26             :   // Sections holding 1 byte strings are atomized based on the data they
      27             :   // contain.
      28             :   // Sections holding 2 byte strings require symbols in order to be atomized.
      29             :   // There is no dedicated section for 4 byte strings.
      30        3866 :   if (SMO.getType() == MachO::S_CSTRING_LITERALS)
      31             :     return false;
      32             : 
      33             :   if (SMO.getSegmentName() == "__DATA" && SMO.getSectionName() == "__cfstring")
      34             :     return false;
      35             : 
      36             :   if (SMO.getSegmentName() == "__DATA" &&
      37             :       SMO.getSectionName() == "__objc_classrefs")
      38             :     return false;
      39             : 
      40             :   switch (SMO.getType()) {
      41             :   default:
      42             :     return true;
      43             : 
      44             :   // These sections are atomized at the element boundaries without using
      45             :   // symbols.
      46             :   case MachO::S_4BYTE_LITERALS:
      47             :   case MachO::S_8BYTE_LITERALS:
      48             :   case MachO::S_16BYTE_LITERALS:
      49             :   case MachO::S_LITERAL_POINTERS:
      50             :   case MachO::S_NON_LAZY_SYMBOL_POINTERS:
      51             :   case MachO::S_LAZY_SYMBOL_POINTERS:
      52             :   case MachO::S_THREAD_LOCAL_VARIABLE_POINTERS:
      53             :   case MachO::S_MOD_INIT_FUNC_POINTERS:
      54             :   case MachO::S_MOD_TERM_FUNC_POINTERS:
      55             :   case MachO::S_INTERPOSING:
      56             :     return false;
      57             :   }
      58             : }
      59             : 
      60        5922 : MCAsmInfoDarwin::MCAsmInfoDarwin() {
      61             :   // Common settings for all Darwin targets.
      62             :   // Syntax:
      63        5922 :   LinkerPrivateGlobalPrefix = "l";
      64        5922 :   HasSingleParameterDotFile = false;
      65        5922 :   HasSubsectionsViaSymbols = true;
      66             : 
      67        5922 :   AlignmentIsInBytes = false;
      68        5922 :   COMMDirectiveAlignmentIsInBytes = false;
      69        5922 :   LCOMMDirectiveAlignmentType = LCOMM::Log2Alignment;
      70        5922 :   InlineAsmStart = " InlineAsm Start";
      71        5922 :   InlineAsmEnd = " InlineAsm End";
      72             : 
      73             :   // Directives:
      74        5922 :   HasWeakDefDirective = true;
      75        5922 :   HasWeakDefCanBeHiddenDirective = true;
      76        5922 :   WeakRefDirective = "\t.weak_reference ";
      77        5922 :   ZeroDirective = "\t.space\t";  // ".space N" emits N zeros.
      78        5922 :   HasMachoZeroFillDirective = true;  // Uses .zerofill
      79        5922 :   HasMachoTBSSDirective = true; // Uses .tbss
      80             : 
      81             :   // FIXME: Change this once MC is the system assembler.
      82        5922 :   HasAggressiveSymbolFolding = false;
      83             : 
      84        5922 :   HiddenVisibilityAttr = MCSA_PrivateExtern;
      85        5922 :   HiddenDeclarationVisibilityAttr = MCSA_Invalid;
      86             : 
      87             :   // Doesn't support protected visibility.
      88        5922 :   ProtectedVisibilityAttr = MCSA_Invalid;
      89             : 
      90        5922 :   HasDotTypeDotSizeDirective = false;
      91        5922 :   HasNoDeadStrip = true;
      92        5922 :   HasAltEntry = true;
      93             : 
      94        5922 :   DwarfUsesRelocationsAcrossSections = false;
      95             : 
      96        5922 :   UseIntegratedAssembler = true;
      97        5922 :   SetDirectiveSuppressesReloc = true;
      98        5922 : }

Generated by: LCOV version 1.13