xref: /freebsd/contrib/llvm-project/llvm/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp (revision c8e7f78a3d28ff6e6223ed136ada8e1e2f34965e)
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/TargetParser/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   SupportsDebugInformation = true;
91   ExceptionsType = ExceptionHandling::WinEH;
92   WinEHEncodingType = WinEH::EncodingType::Itanium;
93   PrivateGlobalPrefix = "$M";
94   PrivateLabelPrefix = "$M";
95   CommentString = "@";
96 
97   // Conditional Thumb 4-byte instructions can have an implicit IT.
98   MaxInstLength = 6;
99 }
100 
101 void ARMCOFFMCAsmInfoGNU::anchor() { }
102 
103 ARMCOFFMCAsmInfoGNU::ARMCOFFMCAsmInfoGNU() {
104   AlignmentIsInBytes = false;
105   HasSingleParameterDotFile = true;
106 
107   CommentString = "@";
108   Code16Directive = ".code\t16";
109   Code32Directive = ".code\t32";
110   PrivateGlobalPrefix = ".L";
111   PrivateLabelPrefix = ".L";
112 
113   SupportsDebugInformation = true;
114   ExceptionsType = ExceptionHandling::WinEH;
115   WinEHEncodingType = WinEH::EncodingType::Itanium;
116   UseParensForSymbolVariant = true;
117 
118   DwarfRegNumForCFI = false;
119 
120   // Conditional Thumb 4-byte instructions can have an implicit IT.
121   MaxInstLength = 6;
122 }
123