• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
anchor()18 void ARMMCAsmInfoDarwin::anchor() { }
19 
ARMMCAsmInfoDarwin(const Triple & TheTriple)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 
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   // 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 
setUseIntegratedAssembler(bool Value)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 
anchor()86 void ARMCOFFMCAsmInfoMicrosoft::anchor() { }
87 
ARMCOFFMCAsmInfoMicrosoft()88 ARMCOFFMCAsmInfoMicrosoft::ARMCOFFMCAsmInfoMicrosoft() {
89   AlignmentIsInBytes = false;
90   SupportsDebugInformation = true;
91   ExceptionsType = ExceptionHandling::WinEH;
92   PrivateGlobalPrefix = "$M";
93   PrivateLabelPrefix = "$M";
94   CommentString = ";";
95 
96   // Conditional Thumb 4-byte instructions can have an implicit IT.
97   MaxInstLength = 6;
98 }
99 
anchor()100 void ARMCOFFMCAsmInfoGNU::anchor() { }
101 
ARMCOFFMCAsmInfoGNU()102 ARMCOFFMCAsmInfoGNU::ARMCOFFMCAsmInfoGNU() {
103   AlignmentIsInBytes = false;
104   HasSingleParameterDotFile = true;
105 
106   CommentString = "@";
107   Code16Directive = ".code\t16";
108   Code32Directive = ".code\t32";
109   PrivateGlobalPrefix = ".L";
110   PrivateLabelPrefix = ".L";
111 
112   SupportsDebugInformation = true;
113   ExceptionsType = ExceptionHandling::DwarfCFI;
114   UseParensForSymbolVariant = true;
115 
116   DwarfRegNumForCFI = false;
117 
118   // Conditional Thumb 4-byte instructions can have an implicit IT.
119   MaxInstLength = 6;
120 }
121