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 18 void ARMMCAsmInfoDarwin::anchor() { } 19 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 UseIntegratedAssembler = true; 42 } 43 44 void ARMELFMCAsmInfo::anchor() { } 45 46 ARMELFMCAsmInfo::ARMELFMCAsmInfo(const Triple &TheTriple) { 47 if ((TheTriple.getArch() == Triple::armeb) || 48 (TheTriple.getArch() == Triple::thumbeb)) 49 IsLittleEndian = false; 50 51 // ".comm align is in bytes but .align is pow-2." 52 AlignmentIsInBytes = false; 53 54 Data64bitsDirective = nullptr; 55 CommentString = "@"; 56 Code16Directive = ".code\t16"; 57 Code32Directive = ".code\t32"; 58 59 SupportsDebugInformation = true; 60 61 // Conditional Thumb 4-byte instructions can have an implicit IT. 62 MaxInstLength = 6; 63 64 // Exceptions handling 65 switch (TheTriple.getOS()) { 66 case Triple::NetBSD: 67 ExceptionsType = ExceptionHandling::DwarfCFI; 68 break; 69 default: 70 ExceptionsType = ExceptionHandling::ARM; 71 break; 72 } 73 74 // foo(plt) instead of foo@plt 75 UseParensForSymbolVariant = true; 76 77 UseIntegratedAssembler = true; 78 } 79 80 void ARMELFMCAsmInfo::setUseIntegratedAssembler(bool Value) { 81 UseIntegratedAssembler = Value; 82 if (!UseIntegratedAssembler) { 83 // gas doesn't handle VFP register names in cfi directives, 84 // so don't use register names with external assembler. 85 // See https://sourceware.org/bugzilla/show_bug.cgi?id=16694 86 DwarfRegNumForCFI = true; 87 } 88 } 89 90 void ARMCOFFMCAsmInfoMicrosoft::anchor() { } 91 92 ARMCOFFMCAsmInfoMicrosoft::ARMCOFFMCAsmInfoMicrosoft() { 93 AlignmentIsInBytes = false; 94 ExceptionsType = ExceptionHandling::WinEH; 95 PrivateGlobalPrefix = "$M"; 96 PrivateLabelPrefix = "$M"; 97 CommentString = ";"; 98 99 // Conditional Thumb 4-byte instructions can have an implicit IT. 100 MaxInstLength = 6; 101 } 102 103 void ARMCOFFMCAsmInfoGNU::anchor() { } 104 105 ARMCOFFMCAsmInfoGNU::ARMCOFFMCAsmInfoGNU() { 106 AlignmentIsInBytes = false; 107 HasSingleParameterDotFile = true; 108 109 CommentString = "@"; 110 Code16Directive = ".code\t16"; 111 Code32Directive = ".code\t32"; 112 PrivateGlobalPrefix = ".L"; 113 PrivateLabelPrefix = ".L"; 114 115 SupportsDebugInformation = true; 116 ExceptionsType = ExceptionHandling::DwarfCFI; 117 UseParensForSymbolVariant = true; 118 119 UseIntegratedAssembler = true; 120 DwarfRegNumForCFI = false; 121 122 // Conditional Thumb 4-byte instructions can have an implicit IT. 123 MaxInstLength = 6; 124 } 125