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::NetBSD:
62     ExceptionsType = ExceptionHandling::DwarfCFI;
63     break;
64   default:
65     ExceptionsType = ExceptionHandling::ARM;
66     break;
67   }
68 
69   // foo(plt) instead of foo@plt
70   UseParensForSymbolVariant = true;
71 
72   UseIntegratedAssembler = true;
73 }
74 
setUseIntegratedAssembler(bool Value)75 void ARMELFMCAsmInfo::setUseIntegratedAssembler(bool Value) {
76   UseIntegratedAssembler = Value;
77   if (!UseIntegratedAssembler) {
78     // gas doesn't handle VFP register names in cfi directives,
79     // so don't use register names with external assembler.
80     // See https://sourceware.org/bugzilla/show_bug.cgi?id=16694
81     DwarfRegNumForCFI = true;
82   }
83 }
84 
anchor()85 void ARMCOFFMCAsmInfoMicrosoft::anchor() { }
86 
ARMCOFFMCAsmInfoMicrosoft()87 ARMCOFFMCAsmInfoMicrosoft::ARMCOFFMCAsmInfoMicrosoft() {
88   AlignmentIsInBytes = false;
89   ExceptionsType = ExceptionHandling::WinEH;
90   PrivateGlobalPrefix = "$M";
91   PrivateLabelPrefix = "$M";
92   CommentString = ";";
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::DwarfCFI;
109   UseParensForSymbolVariant = true;
110 
111   UseIntegratedAssembler = true;
112   DwarfRegNumForCFI = false;
113 }
114 
115