1 //===-- ARMMCAsmInfo.cpp - ARM 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 contains the declarations of the ARMMCAsmInfo properties.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #include "ARMMCAsmInfo.h"
15 #include "llvm/ADT/Triple.h"
16 
17 using namespace llvm;
18 
anchor()19 void ARMMCAsmInfoDarwin::anchor() { }
20 
ARMMCAsmInfoDarwin(const Triple & TheTriple)21 ARMMCAsmInfoDarwin::ARMMCAsmInfoDarwin(const Triple &TheTriple) {
22   if ((TheTriple.getArch() == Triple::armeb) ||
23       (TheTriple.getArch() == Triple::thumbeb))
24     IsLittleEndian = false;
25 
26   Data64bitsDirective = nullptr;
27   CommentString = "@";
28   Code16Directive = ".code\t16";
29   Code32Directive = ".code\t32";
30   UseDataRegionDirectives = true;
31 
32   SupportsDebugInformation = true;
33 
34   // Exceptions handling
35   ExceptionsType = (TheTriple.isOSDarwin() && !TheTriple.isWatchABI())
36                        ? ExceptionHandling::SjLj
37                        : ExceptionHandling::DwarfCFI;
38 
39   UseIntegratedAssembler = true;
40 }
41 
anchor()42 void ARMELFMCAsmInfo::anchor() { }
43 
ARMELFMCAsmInfo(const Triple & TheTriple)44 ARMELFMCAsmInfo::ARMELFMCAsmInfo(const Triple &TheTriple) {
45   if ((TheTriple.getArch() == Triple::armeb) ||
46       (TheTriple.getArch() == Triple::thumbeb))
47     IsLittleEndian = false;
48 
49   // ".comm align is in bytes but .align is pow-2."
50   AlignmentIsInBytes = false;
51 
52   Data64bitsDirective = nullptr;
53   CommentString = "@";
54   Code16Directive = ".code\t16";
55   Code32Directive = ".code\t32";
56 
57   SupportsDebugInformation = true;
58 
59   // Exceptions handling
60   switch (TheTriple.getOS()) {
61   case Triple::Bitrig:
62   case Triple::NetBSD:
63     ExceptionsType = ExceptionHandling::DwarfCFI;
64     break;
65   default:
66     ExceptionsType = ExceptionHandling::ARM;
67     break;
68   }
69 
70   // foo(plt) instead of foo@plt
71   UseParensForSymbolVariant = true;
72 
73   UseIntegratedAssembler = true;
74 }
75 
setUseIntegratedAssembler(bool Value)76 void ARMELFMCAsmInfo::setUseIntegratedAssembler(bool Value) {
77   UseIntegratedAssembler = Value;
78   if (!UseIntegratedAssembler) {
79     // gas doesn't handle VFP register names in cfi directives,
80     // so don't use register names with external assembler.
81     // See https://sourceware.org/bugzilla/show_bug.cgi?id=16694
82     DwarfRegNumForCFI = true;
83   }
84 }
85 
anchor()86 void ARMCOFFMCAsmInfoMicrosoft::anchor() { }
87 
ARMCOFFMCAsmInfoMicrosoft()88 ARMCOFFMCAsmInfoMicrosoft::ARMCOFFMCAsmInfoMicrosoft() {
89   AlignmentIsInBytes = false;
90 
91   PrivateGlobalPrefix = "$M";
92   PrivateLabelPrefix = "$M";
93 }
94 
anchor()95 void ARMCOFFMCAsmInfoGNU::anchor() { }
96 
ARMCOFFMCAsmInfoGNU()97 ARMCOFFMCAsmInfoGNU::ARMCOFFMCAsmInfoGNU() {
98   AlignmentIsInBytes = false;
99   HasSingleParameterDotFile = true;
100 
101   CommentString = "@";
102   Code16Directive = ".code\t16";
103   Code32Directive = ".code\t32";
104   PrivateGlobalPrefix = ".L";
105   PrivateLabelPrefix = ".L";
106 
107   SupportsDebugInformation = true;
108   ExceptionsType = ExceptionHandling::None;
109   UseParensForSymbolVariant = true;
110 
111   UseIntegratedAssembler = false;
112   DwarfRegNumForCFI = true;
113 }
114 
115