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   // Conditional Thumb 4-byte instructions can have an implicit IT.
35   MaxInstLength = 6;
36 
37   // Exceptions handling
38   ExceptionsType = (TheTriple.isOSDarwin() && !TheTriple.isWatchABI())
39                        ? ExceptionHandling::SjLj
40                        : ExceptionHandling::DwarfCFI;
41 
42   UseIntegratedAssembler = true;
43 }
44 
anchor()45 void ARMELFMCAsmInfo::anchor() { }
46 
ARMELFMCAsmInfo(const Triple & TheTriple)47 ARMELFMCAsmInfo::ARMELFMCAsmInfo(const Triple &TheTriple) {
48   if ((TheTriple.getArch() == Triple::armeb) ||
49       (TheTriple.getArch() == Triple::thumbeb))
50     IsLittleEndian = false;
51 
52   // ".comm align is in bytes but .align is pow-2."
53   AlignmentIsInBytes = false;
54 
55   Data64bitsDirective = nullptr;
56   CommentString = "@";
57   Code16Directive = ".code\t16";
58   Code32Directive = ".code\t32";
59 
60   SupportsDebugInformation = true;
61 
62   // Conditional Thumb 4-byte instructions can have an implicit IT.
63   MaxInstLength = 6;
64 
65   // Exceptions handling
66   switch (TheTriple.getOS()) {
67   case Triple::NetBSD:
68     ExceptionsType = ExceptionHandling::DwarfCFI;
69     break;
70   default:
71     ExceptionsType = ExceptionHandling::ARM;
72     break;
73   }
74 
75   // foo(plt) instead of foo@plt
76   UseParensForSymbolVariant = true;
77 
78   UseIntegratedAssembler = true;
79 }
80 
setUseIntegratedAssembler(bool Value)81 void ARMELFMCAsmInfo::setUseIntegratedAssembler(bool Value) {
82   UseIntegratedAssembler = Value;
83   if (!UseIntegratedAssembler) {
84     // gas doesn't handle VFP register names in cfi directives,
85     // so don't use register names with external assembler.
86     // See https://sourceware.org/bugzilla/show_bug.cgi?id=16694
87     DwarfRegNumForCFI = true;
88   }
89 }
90 
anchor()91 void ARMCOFFMCAsmInfoMicrosoft::anchor() { }
92 
ARMCOFFMCAsmInfoMicrosoft()93 ARMCOFFMCAsmInfoMicrosoft::ARMCOFFMCAsmInfoMicrosoft() {
94   AlignmentIsInBytes = false;
95   ExceptionsType = ExceptionHandling::WinEH;
96   PrivateGlobalPrefix = "$M";
97   PrivateLabelPrefix = "$M";
98   CommentString = ";";
99 
100   // Conditional Thumb 4-byte instructions can have an implicit IT.
101   MaxInstLength = 6;
102 }
103 
anchor()104 void ARMCOFFMCAsmInfoGNU::anchor() { }
105 
ARMCOFFMCAsmInfoGNU()106 ARMCOFFMCAsmInfoGNU::ARMCOFFMCAsmInfoGNU() {
107   AlignmentIsInBytes = false;
108   HasSingleParameterDotFile = true;
109 
110   CommentString = "@";
111   Code16Directive = ".code\t16";
112   Code32Directive = ".code\t32";
113   PrivateGlobalPrefix = ".L";
114   PrivateLabelPrefix = ".L";
115 
116   SupportsDebugInformation = true;
117   ExceptionsType = ExceptionHandling::DwarfCFI;
118   UseParensForSymbolVariant = true;
119 
120   UseIntegratedAssembler = true;
121   DwarfRegNumForCFI = false;
122 
123   // Conditional Thumb 4-byte instructions can have an implicit IT.
124   MaxInstLength = 6;
125 }
126