1 //===-- PPCMCAsmInfo.cpp - PPC 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 MCAsmInfoDarwin properties. 10 // 11 //===----------------------------------------------------------------------===// 12 13 #include "PPCMCAsmInfo.h" 14 #include "llvm/TargetParser/Triple.h" 15 16 using namespace llvm; 17 18 void PPCELFMCAsmInfo::anchor() { } 19 20 PPCELFMCAsmInfo::PPCELFMCAsmInfo(bool is64Bit, const Triple& T) { 21 // FIXME: This is not always needed. For example, it is not needed in the 22 // v2 abi. 23 NeedsLocalForSize = true; 24 25 if (is64Bit) { 26 CodePointerSize = CalleeSaveStackSlotSize = 8; 27 } 28 IsLittleEndian = 29 T.getArch() == Triple::ppc64le || T.getArch() == Triple::ppcle; 30 31 // ".comm align is in bytes but .align is pow-2." 32 AlignmentIsInBytes = false; 33 34 CommentString = "#"; 35 36 // Uses '.section' before '.bss' directive 37 UsesELFSectionDirectiveForBSS = true; 38 39 // Debug Information 40 SupportsDebugInformation = true; 41 42 DollarIsPC = true; 43 44 // Set up DWARF directives 45 MinInstAlignment = 4; 46 47 // Exceptions handling 48 ExceptionsType = ExceptionHandling::DwarfCFI; 49 50 ZeroDirective = "\t.space\t"; 51 Data64bitsDirective = is64Bit ? "\t.quad\t" : nullptr; 52 AssemblerDialect = 1; // New-Style mnemonics. 53 LCOMMDirectiveAlignmentType = LCOMM::ByteAlignment; 54 } 55 56 void PPCXCOFFMCAsmInfo::anchor() {} 57 58 PPCXCOFFMCAsmInfo::PPCXCOFFMCAsmInfo(bool Is64Bit, const Triple &T) { 59 if (T.getArch() == Triple::ppc64le || T.getArch() == Triple::ppcle) 60 report_fatal_error("XCOFF is not supported for little-endian targets"); 61 CodePointerSize = CalleeSaveStackSlotSize = Is64Bit ? 8 : 4; 62 63 // A size of 8 is only supported by the assembler under 64-bit. 64 Data64bitsDirective = Is64Bit ? "\t.vbyte\t8, " : nullptr; 65 66 // Debug Information 67 SupportsDebugInformation = true; 68 69 // Set up DWARF directives 70 MinInstAlignment = 4; 71 72 // Support $ as PC in inline asm 73 DollarIsPC = true; 74 } 75