xref: /freebsd/contrib/llvm-project/llvm/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp (revision 6be3386466ab79a84b48429ae66244f21526d3df)
1 //===-- ARMMCAsmInfo.cpp - ARM asm properties -----------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file contains the declarations of the ARMMCAsmInfo properties.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "ARMMCAsmInfo.h"
14 #include "llvm/ADT/Triple.h"
15 
16 using namespace llvm;
17 
18 void ARMMCAsmInfoDarwin::anchor() { }
19 
20 ARMMCAsmInfoDarwin::ARMMCAsmInfoDarwin(const Triple &TheTriple) {
21   if ((TheTriple.getArch() == Triple::armeb) ||
22       (TheTriple.getArch() == Triple::thumbeb))
23     IsLittleEndian = false;
24 
25   Data64bitsDirective = nullptr;
26   CommentString = "@";
27   Code16Directive = ".code\t16";
28   Code32Directive = ".code\t32";
29   UseDataRegionDirectives = true;
30 
31   SupportsDebugInformation = true;
32 
33   // Conditional Thumb 4-byte instructions can have an implicit IT.
34   MaxInstLength = 6;
35 
36   // Exceptions handling
37   ExceptionsType = (TheTriple.isOSDarwin() && !TheTriple.isWatchABI())
38                        ? ExceptionHandling::SjLj
39                        : ExceptionHandling::DwarfCFI;
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   // Conditional Thumb 4-byte instructions can have an implicit IT.
60   MaxInstLength = 6;
61 
62   // Exceptions handling
63   switch (TheTriple.getOS()) {
64   case Triple::NetBSD:
65     ExceptionsType = ExceptionHandling::DwarfCFI;
66     break;
67   default:
68     ExceptionsType = ExceptionHandling::ARM;
69     break;
70   }
71 
72   // foo(plt) instead of foo@plt
73   UseParensForSymbolVariant = 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   ExceptionsType = ExceptionHandling::WinEH;
91   PrivateGlobalPrefix = "$M";
92   PrivateLabelPrefix = "$M";
93   CommentString = ";";
94 
95   // Conditional Thumb 4-byte instructions can have an implicit IT.
96   MaxInstLength = 6;
97 }
98 
99 void ARMCOFFMCAsmInfoGNU::anchor() { }
100 
101 ARMCOFFMCAsmInfoGNU::ARMCOFFMCAsmInfoGNU() {
102   AlignmentIsInBytes = false;
103   HasSingleParameterDotFile = true;
104 
105   CommentString = "@";
106   Code16Directive = ".code\t16";
107   Code32Directive = ".code\t32";
108   PrivateGlobalPrefix = ".L";
109   PrivateLabelPrefix = ".L";
110 
111   SupportsDebugInformation = true;
112   ExceptionsType = ExceptionHandling::DwarfCFI;
113   UseParensForSymbolVariant = true;
114 
115   DwarfRegNumForCFI = false;
116 
117   // Conditional Thumb 4-byte instructions can have an implicit IT.
118   MaxInstLength = 6;
119 }
120