LLVM  8.0.1
MCAsmInfoDarwin.cpp
Go to the documentation of this file.
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 
17 #include "llvm/MC/MCDirectives.h"
18 #include "llvm/MC/MCSectionMachO.h"
19 
20 using namespace llvm;
21 
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.
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.
56  return false;
57  }
58 }
59 
61  // Common settings for all Darwin targets.
62  // Syntax:
66 
67  AlignmentIsInBytes = false;
70  InlineAsmStart = " InlineAsm Start";
71  InlineAsmEnd = " InlineAsm End";
72 
73  // Directives:
74  HasWeakDefDirective = true;
76  WeakRefDirective = "\t.weak_reference ";
77  ZeroDirective = "\t.space\t"; // ".space N" emits N zeros.
78  HasMachoZeroFillDirective = true; // Uses .zerofill
79  HasMachoTBSSDirective = true; // Uses .tbss
80 
81  // FIXME: Change this once MC is the system assembler.
83 
86 
87  // Doesn't support protected visibility.
89 
91  HasNoDeadStrip = true;
92  HasAltEntry = true;
93 
95 
98 }
bool HasSingleParameterDotFile
True if the target has a single parameter .file directive, this is true for ELF targets.
Definition: MCAsmInfo.h:283
Instances of this class represent a uniqued identifier for a section in the current translation unit...
Definition: MCSection.h:39
LCOMM::LCOMMType LCOMMDirectiveAlignmentType
Describes if the .lcomm directive for the target supports an alignment argument and how it is interpr...
Definition: MCAsmInfo.h:271
S_NON_LAZY_SYMBOL_POINTERS - Section with non-lazy symbol pointers.
Definition: MachO.h:132
This represents a section on a Mach-O system (used by Mac OS X).
bool HasSubsectionsViaSymbols
True if this target has the MachO .subsections_via_symbols directive.
Definition: MCAsmInfo.h:77
bool UseIntegratedAssembler
Should we use the integrated assembler? The integrated assembler should be enabled by default (by the...
Definition: MCAsmInfo.h:371
This class represents lattice values for constants.
Definition: AllocatorList.h:24
Not a valid directive.
Definition: MCDirectives.h:20
bool DwarfUsesRelocationsAcrossSections
True if Dwarf2 output generally uses relocations for references to other .debug_* sections...
Definition: MCAsmInfo.h:342
const char * ZeroDirective
This should be set to the directive used to get some number of zero bytes emitted to the current sect...
Definition: MCAsmInfo.h:174
bool HasWeakDefCanBeHiddenDirective
True if we have a directive to declare a global as being a weak defined symbol that can be hidden (un...
Definition: MCAsmInfo.h:310
bool HasDotTypeDotSizeDirective
True if the target has .type and .size directives, this is true for most ELF targets.
Definition: MCAsmInfo.h:279
bool AlignmentIsInBytes
If this is true (the default) then the asmprinter emits ".align N" directives, where N is the number ...
Definition: MCAsmInfo.h:231
bool HasNoDeadStrip
True if this target supports the MachO .no_dead_strip directive.
Definition: MCAsmInfo.h:291
S_4BYTE_LITERALS - Section with 4 byte literals.
Definition: MachO.h:126
bool HasAggressiveSymbolFolding
False if the assembler requires that we use.
Definition: MCAsmInfo.h:263
S_8BYTE_LITERALS - Section with 8 byte literals.
Definition: MachO.h:128
StringRef getSectionName() const
S_MOD_TERM_FUNC_POINTERS - Section with only function pointers for termination.
Definition: MachO.h:143
MCSymbolAttr HiddenVisibilityAttr
This attribute, if not MCSA_Invalid, is used to declare a symbol as having hidden visibility...
Definition: MCAsmInfo.h:318
StringRef getSegmentName() const
S_INTERPOSING - Section with only pairs of function pointers for interposing.
Definition: MachO.h:151
const char * InlineAsmStart
If these are nonempty, they contain a directive to emit before and after an inline assembly statement...
Definition: MCAsmInfo.h:142
S_LITERAL_POINTERS - Section with pointers to literals.
Definition: MachO.h:130
bool COMMDirectiveAlignmentIsInBytes
True is .comm&#39;s and .lcomms optional alignment is to be specified in bytes instead of log2(n)...
Definition: MCAsmInfo.h:267
const char * WeakRefDirective
This directive, if non-null, is used to declare a global as being a weak undefined symbol...
Definition: MCAsmInfo.h:302
S_CSTRING_LITERALS - Section with literal C strings.
Definition: MachO.h:124
MachO::SectionType getType() const
bool HasWeakDefDirective
True if we have a directive to declare a global as being a weak defined symbol.
Definition: MCAsmInfo.h:306
S_LAZY_SYMBOL_POINTERS - Section with lazy symbol pointers.
Definition: MachO.h:134
bool HasAltEntry
True if this target supports the MachO .alt_entry directive.
Definition: MCAsmInfo.h:295
bool HasMachoZeroFillDirective
True if this is a MachO target that supports the macho-specific .zerofill directive for emitting BSS ...
Definition: MCAsmInfo.h:81
bool isSectionAtomizableBySymbols(const MCSection &Section) const override
True if the section is atomized using the symbols in it.
S_THREAD_LOCAL_VARIABLE_POINTERS - Section with pointers to thread local structures.
Definition: MachO.h:168
const char * InlineAsmEnd
Definition: MCAsmInfo.h:143
bool HasMachoTBSSDirective
True if this is a MachO target that supports the macho-specific .tbss directive for emitting thread l...
Definition: MCAsmInfo.h:85
S_16BYTE_LITERALS - Section with only 16 byte literals.
Definition: MachO.h:153
MCSymbolAttr ProtectedVisibilityAttr
This attribute, if not MCSA_Invalid, is used to declare a symbol as having protected visibility...
Definition: MCAsmInfo.h:326
bool SetDirectiveSuppressesReloc
True if the expression .long f - g uses a relocation but it can be suppressed by writing a = f - g ...
Definition: MCAsmInfo.h:248
StringRef LinkerPrivateGlobalPrefix
This prefix is used for symbols that should be passed through the assembler but be removed by the lin...
Definition: MCAsmInfo.h:138
MCSymbolAttr HiddenDeclarationVisibilityAttr
This attribute, if not MCSA_Invalid, is used to declare an undefined symbol as having hidden visibili...
Definition: MCAsmInfo.h:322
.private_extern (MachO)
Definition: MCDirectives.h:39
S_MOD_INIT_FUNC_POINTERS - Section with only function pointers for initialization.
Definition: MachO.h:140