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 
19 void ARMMCAsmInfoDarwin::anchor() { }
20 
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 
42 void ARMELFMCAsmInfo::anchor() { }
43 
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 
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 
86 void ARMCOFFMCAsmInfoMicrosoft::anchor() { }
87 
88 ARMCOFFMCAsmInfoMicrosoft::ARMCOFFMCAsmInfoMicrosoft() {
89   AlignmentIsInBytes = false;
90 
91   PrivateGlobalPrefix = "$M";
92   PrivateLabelPrefix = "$M";
93   CommentString = ";";
94 }
95 
96 void ARMCOFFMCAsmInfoGNU::anchor() { }
97 
98 ARMCOFFMCAsmInfoGNU::ARMCOFFMCAsmInfoGNU() {
99   AlignmentIsInBytes = false;
100   HasSingleParameterDotFile = true;
101 
102   CommentString = "@";
103   Code16Directive = ".code\t16";
104   Code32Directive = ".code\t32";
105   PrivateGlobalPrefix = ".L";
106   PrivateLabelPrefix = ".L";
107 
108   SupportsDebugInformation = true;
109   ExceptionsType = ExceptionHandling::None;
110   UseParensForSymbolVariant = true;
111 
112   UseIntegratedAssembler = false;
113   DwarfRegNumForCFI = true;
114 }
115 
116