2114fa964731068d8ea1f0a5cacf25628ea5d1bd
[oota-llvm.git] / lib / Target / ARM / MCTargetDesc / ARMMCAsmInfo.cpp
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 #include "llvm/Support/CommandLine.h"
17
18 using namespace llvm;
19
20 void ARMMCAsmInfoDarwin::anchor() { }
21
22 ARMMCAsmInfoDarwin::ARMMCAsmInfoDarwin(const Triple &TheTriple) {
23   if ((TheTriple.getArch() == Triple::armeb) ||
24       (TheTriple.getArch() == Triple::thumbeb))
25     IsLittleEndian = false;
26
27   Data64bitsDirective = nullptr;
28   CommentString = "@";
29   Code16Directive = ".code\t16";
30   Code32Directive = ".code\t32";
31   UseDataRegionDirectives = true;
32
33   SupportsDebugInformation = true;
34
35   // Exceptions handling
36   ExceptionsType = TheTriple.isWatchOS() ? ExceptionHandling::DwarfCFI
37                                          : ExceptionHandling::SjLj;
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 }
94
95 void ARMCOFFMCAsmInfoGNU::anchor() { }
96
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::None;
109   UseParensForSymbolVariant = true;
110
111   UseIntegratedAssembler = false;
112   DwarfRegNumForCFI = true;
113 }
114