xref: /freebsd-src/contrib/llvm-project/llvm/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp (revision 06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e)
10b57cec5SDimitry Andric //===-- ARMMCAsmInfo.cpp - ARM asm properties -----------------------------===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric //
90b57cec5SDimitry Andric // This file contains the declarations of the ARMMCAsmInfo properties.
100b57cec5SDimitry Andric //
110b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
120b57cec5SDimitry Andric 
130b57cec5SDimitry Andric #include "ARMMCAsmInfo.h"
14*06c3fb27SDimitry Andric #include "llvm/TargetParser/Triple.h"
150b57cec5SDimitry Andric 
160b57cec5SDimitry Andric using namespace llvm;
170b57cec5SDimitry Andric 
anchor()180b57cec5SDimitry Andric void ARMMCAsmInfoDarwin::anchor() { }
190b57cec5SDimitry Andric 
ARMMCAsmInfoDarwin(const Triple & TheTriple)200b57cec5SDimitry Andric ARMMCAsmInfoDarwin::ARMMCAsmInfoDarwin(const Triple &TheTriple) {
210b57cec5SDimitry Andric   if ((TheTriple.getArch() == Triple::armeb) ||
220b57cec5SDimitry Andric       (TheTriple.getArch() == Triple::thumbeb))
230b57cec5SDimitry Andric     IsLittleEndian = false;
240b57cec5SDimitry Andric 
250b57cec5SDimitry Andric   Data64bitsDirective = nullptr;
260b57cec5SDimitry Andric   CommentString = "@";
270b57cec5SDimitry Andric   Code16Directive = ".code\t16";
280b57cec5SDimitry Andric   Code32Directive = ".code\t32";
290b57cec5SDimitry Andric   UseDataRegionDirectives = true;
300b57cec5SDimitry Andric 
310b57cec5SDimitry Andric   SupportsDebugInformation = true;
320b57cec5SDimitry Andric 
330b57cec5SDimitry Andric   // Conditional Thumb 4-byte instructions can have an implicit IT.
340b57cec5SDimitry Andric   MaxInstLength = 6;
350b57cec5SDimitry Andric 
360b57cec5SDimitry Andric   // Exceptions handling
370b57cec5SDimitry Andric   ExceptionsType = (TheTriple.isOSDarwin() && !TheTriple.isWatchABI())
380b57cec5SDimitry Andric                        ? ExceptionHandling::SjLj
390b57cec5SDimitry Andric                        : ExceptionHandling::DwarfCFI;
400b57cec5SDimitry Andric }
410b57cec5SDimitry Andric 
anchor()420b57cec5SDimitry Andric void ARMELFMCAsmInfo::anchor() { }
430b57cec5SDimitry Andric 
ARMELFMCAsmInfo(const Triple & TheTriple)440b57cec5SDimitry Andric ARMELFMCAsmInfo::ARMELFMCAsmInfo(const Triple &TheTriple) {
450b57cec5SDimitry Andric   if ((TheTriple.getArch() == Triple::armeb) ||
460b57cec5SDimitry Andric       (TheTriple.getArch() == Triple::thumbeb))
470b57cec5SDimitry Andric     IsLittleEndian = false;
480b57cec5SDimitry Andric 
490b57cec5SDimitry Andric   // ".comm align is in bytes but .align is pow-2."
500b57cec5SDimitry Andric   AlignmentIsInBytes = false;
510b57cec5SDimitry Andric 
520b57cec5SDimitry Andric   Data64bitsDirective = nullptr;
530b57cec5SDimitry Andric   CommentString = "@";
540b57cec5SDimitry Andric   Code16Directive = ".code\t16";
550b57cec5SDimitry Andric   Code32Directive = ".code\t32";
560b57cec5SDimitry Andric 
570b57cec5SDimitry Andric   SupportsDebugInformation = true;
580b57cec5SDimitry Andric 
590b57cec5SDimitry Andric   // Conditional Thumb 4-byte instructions can have an implicit IT.
600b57cec5SDimitry Andric   MaxInstLength = 6;
610b57cec5SDimitry Andric 
620b57cec5SDimitry Andric   // Exceptions handling
630b57cec5SDimitry Andric   switch (TheTriple.getOS()) {
640b57cec5SDimitry Andric   case Triple::NetBSD:
650b57cec5SDimitry Andric     ExceptionsType = ExceptionHandling::DwarfCFI;
660b57cec5SDimitry Andric     break;
670b57cec5SDimitry Andric   default:
680b57cec5SDimitry Andric     ExceptionsType = ExceptionHandling::ARM;
690b57cec5SDimitry Andric     break;
700b57cec5SDimitry Andric   }
710b57cec5SDimitry Andric 
720b57cec5SDimitry Andric   // foo(plt) instead of foo@plt
730b57cec5SDimitry Andric   UseParensForSymbolVariant = true;
740b57cec5SDimitry Andric }
750b57cec5SDimitry Andric 
setUseIntegratedAssembler(bool Value)760b57cec5SDimitry Andric void ARMELFMCAsmInfo::setUseIntegratedAssembler(bool Value) {
770b57cec5SDimitry Andric   UseIntegratedAssembler = Value;
780b57cec5SDimitry Andric   if (!UseIntegratedAssembler) {
790b57cec5SDimitry Andric     // gas doesn't handle VFP register names in cfi directives,
800b57cec5SDimitry Andric     // so don't use register names with external assembler.
810b57cec5SDimitry Andric     // See https://sourceware.org/bugzilla/show_bug.cgi?id=16694
820b57cec5SDimitry Andric     DwarfRegNumForCFI = true;
830b57cec5SDimitry Andric   }
840b57cec5SDimitry Andric }
850b57cec5SDimitry Andric 
anchor()860b57cec5SDimitry Andric void ARMCOFFMCAsmInfoMicrosoft::anchor() { }
870b57cec5SDimitry Andric 
ARMCOFFMCAsmInfoMicrosoft()880b57cec5SDimitry Andric ARMCOFFMCAsmInfoMicrosoft::ARMCOFFMCAsmInfoMicrosoft() {
890b57cec5SDimitry Andric   AlignmentIsInBytes = false;
90e8d8bef9SDimitry Andric   SupportsDebugInformation = true;
910b57cec5SDimitry Andric   ExceptionsType = ExceptionHandling::WinEH;
9281ad6265SDimitry Andric   WinEHEncodingType = WinEH::EncodingType::Itanium;
930b57cec5SDimitry Andric   PrivateGlobalPrefix = "$M";
940b57cec5SDimitry Andric   PrivateLabelPrefix = "$M";
95349cc55cSDimitry Andric   CommentString = "@";
960b57cec5SDimitry Andric 
970b57cec5SDimitry Andric   // Conditional Thumb 4-byte instructions can have an implicit IT.
980b57cec5SDimitry Andric   MaxInstLength = 6;
990b57cec5SDimitry Andric }
1000b57cec5SDimitry Andric 
anchor()1010b57cec5SDimitry Andric void ARMCOFFMCAsmInfoGNU::anchor() { }
1020b57cec5SDimitry Andric 
ARMCOFFMCAsmInfoGNU()1030b57cec5SDimitry Andric ARMCOFFMCAsmInfoGNU::ARMCOFFMCAsmInfoGNU() {
1040b57cec5SDimitry Andric   AlignmentIsInBytes = false;
1050b57cec5SDimitry Andric   HasSingleParameterDotFile = true;
1060b57cec5SDimitry Andric 
1070b57cec5SDimitry Andric   CommentString = "@";
1080b57cec5SDimitry Andric   Code16Directive = ".code\t16";
1090b57cec5SDimitry Andric   Code32Directive = ".code\t32";
1100b57cec5SDimitry Andric   PrivateGlobalPrefix = ".L";
1110b57cec5SDimitry Andric   PrivateLabelPrefix = ".L";
1120b57cec5SDimitry Andric 
1130b57cec5SDimitry Andric   SupportsDebugInformation = true;
11481ad6265SDimitry Andric   ExceptionsType = ExceptionHandling::WinEH;
11581ad6265SDimitry Andric   WinEHEncodingType = WinEH::EncodingType::Itanium;
1160b57cec5SDimitry Andric   UseParensForSymbolVariant = true;
1170b57cec5SDimitry Andric 
1180b57cec5SDimitry Andric   DwarfRegNumForCFI = false;
1190b57cec5SDimitry Andric 
1200b57cec5SDimitry Andric   // Conditional Thumb 4-byte instructions can have an implicit IT.
1210b57cec5SDimitry Andric   MaxInstLength = 6;
1220b57cec5SDimitry Andric }
123