Re-commit r247683: Replace Triple with a new TargetTuple in MCTargetDesc/* and relate...
[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/TargetTuple.h"
16 #include "llvm/Support/CommandLine.h"
17
18 using namespace llvm;
19
20 void ARMMCAsmInfoDarwin::anchor() { }
21
22 ARMMCAsmInfoDarwin::ARMMCAsmInfoDarwin(const TargetTuple &TT) {
23   if ((TT.getArch() == TargetTuple::armeb) ||
24       (TT.getArch() == TargetTuple::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 = ExceptionHandling::SjLj;
37
38   UseIntegratedAssembler = true;
39 }
40
41 void ARMELFMCAsmInfo::anchor() { }
42
43 ARMELFMCAsmInfo::ARMELFMCAsmInfo(const TargetTuple &TT) {
44   if ((TT.getArch() == TargetTuple::armeb) ||
45       (TT.getArch() == TargetTuple::thumbeb))
46     IsLittleEndian = false;
47
48   // ".comm align is in bytes but .align is pow-2."
49   AlignmentIsInBytes = false;
50
51   Data64bitsDirective = nullptr;
52   CommentString = "@";
53   Code16Directive = ".code\t16";
54   Code32Directive = ".code\t32";
55
56   SupportsDebugInformation = true;
57
58   // Exceptions handling
59   switch (TT.getOS()) {
60   case TargetTuple::Bitrig:
61   case TargetTuple::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
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
85 void ARMCOFFMCAsmInfoMicrosoft::anchor() { }
86
87 ARMCOFFMCAsmInfoMicrosoft::ARMCOFFMCAsmInfoMicrosoft() {
88   AlignmentIsInBytes = false;
89
90   PrivateGlobalPrefix = "$M";
91   PrivateLabelPrefix = "$M";
92 }
93
94 void ARMCOFFMCAsmInfoGNU::anchor() { }
95
96 ARMCOFFMCAsmInfoGNU::ARMCOFFMCAsmInfoGNU() {
97   AlignmentIsInBytes = false;
98   HasSingleParameterDotFile = true;
99
100   CommentString = "@";
101   Code16Directive = ".code\t16";
102   Code32Directive = ".code\t32";
103   PrivateGlobalPrefix = ".L";
104   PrivateLabelPrefix = ".L";
105
106   SupportsDebugInformation = true;
107   ExceptionsType = ExceptionHandling::None;
108   UseParensForSymbolVariant = true;
109
110   UseIntegratedAssembler = false;
111   DwarfRegNumForCFI = true;
112 }
113