xref: /freebsd-src/contrib/llvm-project/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp (revision 5f757f3ff9144b609b3c433dfd370cc6bdc191ad)
10b57cec5SDimitry Andric //===-- PPCMCAsmInfo.cpp - PPC 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 MCAsmInfoDarwin properties.
100b57cec5SDimitry Andric //
110b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
120b57cec5SDimitry Andric 
130b57cec5SDimitry Andric #include "PPCMCAsmInfo.h"
14*06c3fb27SDimitry Andric #include "llvm/TargetParser/Triple.h"
150b57cec5SDimitry Andric 
160b57cec5SDimitry Andric using namespace llvm;
170b57cec5SDimitry Andric 
anchor()180b57cec5SDimitry Andric void PPCELFMCAsmInfo::anchor() { }
190b57cec5SDimitry Andric 
PPCELFMCAsmInfo(bool is64Bit,const Triple & T)200b57cec5SDimitry Andric PPCELFMCAsmInfo::PPCELFMCAsmInfo(bool is64Bit, const Triple& T) {
210b57cec5SDimitry Andric   // FIXME: This is not always needed. For example, it is not needed in the
220b57cec5SDimitry Andric   // v2 abi.
230b57cec5SDimitry Andric   NeedsLocalForSize = true;
240b57cec5SDimitry Andric 
250b57cec5SDimitry Andric   if (is64Bit) {
260b57cec5SDimitry Andric     CodePointerSize = CalleeSaveStackSlotSize = 8;
270b57cec5SDimitry Andric   }
28e8d8bef9SDimitry Andric   IsLittleEndian =
29e8d8bef9SDimitry Andric       T.getArch() == Triple::ppc64le || T.getArch() == Triple::ppcle;
300b57cec5SDimitry Andric 
310b57cec5SDimitry Andric   // ".comm align is in bytes but .align is pow-2."
320b57cec5SDimitry Andric   AlignmentIsInBytes = false;
330b57cec5SDimitry Andric 
340b57cec5SDimitry Andric   CommentString = "#";
350b57cec5SDimitry Andric 
360b57cec5SDimitry Andric   // Uses '.section' before '.bss' directive
370b57cec5SDimitry Andric   UsesELFSectionDirectiveForBSS = true;
380b57cec5SDimitry Andric 
390b57cec5SDimitry Andric   // Debug Information
400b57cec5SDimitry Andric   SupportsDebugInformation = true;
410b57cec5SDimitry Andric 
420b57cec5SDimitry Andric   DollarIsPC = true;
430b57cec5SDimitry Andric 
440b57cec5SDimitry Andric   // Set up DWARF directives
450b57cec5SDimitry Andric   MinInstAlignment = 4;
460b57cec5SDimitry Andric 
470b57cec5SDimitry Andric   // Exceptions handling
480b57cec5SDimitry Andric   ExceptionsType = ExceptionHandling::DwarfCFI;
490b57cec5SDimitry Andric 
500b57cec5SDimitry Andric   ZeroDirective = "\t.space\t";
510b57cec5SDimitry Andric   Data64bitsDirective = is64Bit ? "\t.quad\t" : nullptr;
520b57cec5SDimitry Andric   AssemblerDialect = 1;           // New-Style mnemonics.
530b57cec5SDimitry Andric   LCOMMDirectiveAlignmentType = LCOMM::ByteAlignment;
540b57cec5SDimitry Andric }
550b57cec5SDimitry Andric 
anchor()560b57cec5SDimitry Andric void PPCXCOFFMCAsmInfo::anchor() {}
570b57cec5SDimitry Andric 
PPCXCOFFMCAsmInfo(bool Is64Bit,const Triple & T)580b57cec5SDimitry Andric PPCXCOFFMCAsmInfo::PPCXCOFFMCAsmInfo(bool Is64Bit, const Triple &T) {
59e8d8bef9SDimitry Andric   if (T.getArch() == Triple::ppc64le || T.getArch() == Triple::ppcle)
605ffd83dbSDimitry Andric     report_fatal_error("XCOFF is not supported for little-endian targets");
610b57cec5SDimitry Andric   CodePointerSize = CalleeSaveStackSlotSize = Is64Bit ? 8 : 4;
625ffd83dbSDimitry Andric 
635ffd83dbSDimitry Andric   // A size of 8 is only supported by the assembler under 64-bit.
645ffd83dbSDimitry Andric   Data64bitsDirective = Is64Bit ? "\t.vbyte\t8, " : nullptr;
65fe6060f1SDimitry Andric 
66fe6060f1SDimitry Andric   // Debug Information
67fe6060f1SDimitry Andric   SupportsDebugInformation = true;
68fe6060f1SDimitry Andric 
69fe6060f1SDimitry Andric   // Set up DWARF directives
70fe6060f1SDimitry Andric   MinInstAlignment = 4;
71fe6060f1SDimitry Andric 
72fe6060f1SDimitry Andric   // Support $ as PC in inline asm
73fe6060f1SDimitry Andric   DollarIsPC = true;
740b57cec5SDimitry Andric }
75