109467b48Spatrick //===-- PPCMCAsmInfo.cpp - PPC asm properties -----------------------------===//
209467b48Spatrick //
309467b48Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
409467b48Spatrick // See https://llvm.org/LICENSE.txt for license information.
509467b48Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
609467b48Spatrick //
709467b48Spatrick //===----------------------------------------------------------------------===//
809467b48Spatrick //
909467b48Spatrick // This file contains the declarations of the MCAsmInfoDarwin properties.
1009467b48Spatrick //
1109467b48Spatrick //===----------------------------------------------------------------------===//
1209467b48Spatrick 
1309467b48Spatrick #include "PPCMCAsmInfo.h"
1409467b48Spatrick #include "llvm/ADT/Triple.h"
15097a140dSpatrick #include <cassert>
1609467b48Spatrick 
1709467b48Spatrick using namespace llvm;
1809467b48Spatrick 
anchor()1909467b48Spatrick void PPCELFMCAsmInfo::anchor() { }
2009467b48Spatrick 
PPCELFMCAsmInfo(bool is64Bit,const Triple & T)2109467b48Spatrick PPCELFMCAsmInfo::PPCELFMCAsmInfo(bool is64Bit, const Triple& T) {
2209467b48Spatrick   // FIXME: This is not always needed. For example, it is not needed in the
2309467b48Spatrick   // v2 abi.
2409467b48Spatrick   NeedsLocalForSize = true;
2509467b48Spatrick 
2609467b48Spatrick   if (is64Bit) {
2709467b48Spatrick     CodePointerSize = CalleeSaveStackSlotSize = 8;
2809467b48Spatrick   }
29*73471bf0Spatrick   IsLittleEndian =
30*73471bf0Spatrick       T.getArch() == Triple::ppc64le || T.getArch() == Triple::ppcle;
3109467b48Spatrick 
3209467b48Spatrick   // ".comm align is in bytes but .align is pow-2."
3309467b48Spatrick   AlignmentIsInBytes = false;
3409467b48Spatrick 
3509467b48Spatrick   CommentString = "#";
3609467b48Spatrick 
3709467b48Spatrick   // Uses '.section' before '.bss' directive
3809467b48Spatrick   UsesELFSectionDirectiveForBSS = true;
3909467b48Spatrick 
4009467b48Spatrick   // Debug Information
4109467b48Spatrick   SupportsDebugInformation = true;
4209467b48Spatrick 
4309467b48Spatrick   DollarIsPC = true;
4409467b48Spatrick 
4509467b48Spatrick   // Set up DWARF directives
4609467b48Spatrick   MinInstAlignment = 4;
4709467b48Spatrick 
4809467b48Spatrick   // Exceptions handling
4909467b48Spatrick   ExceptionsType = ExceptionHandling::DwarfCFI;
5009467b48Spatrick 
5109467b48Spatrick   ZeroDirective = "\t.space\t";
5209467b48Spatrick   Data64bitsDirective = is64Bit ? "\t.quad\t" : nullptr;
5309467b48Spatrick   AssemblerDialect = 1;           // New-Style mnemonics.
5409467b48Spatrick   LCOMMDirectiveAlignmentType = LCOMM::ByteAlignment;
5509467b48Spatrick }
5609467b48Spatrick 
anchor()5709467b48Spatrick void PPCXCOFFMCAsmInfo::anchor() {}
5809467b48Spatrick 
PPCXCOFFMCAsmInfo(bool Is64Bit,const Triple & T)5909467b48Spatrick PPCXCOFFMCAsmInfo::PPCXCOFFMCAsmInfo(bool Is64Bit, const Triple &T) {
60*73471bf0Spatrick   if (T.getArch() == Triple::ppc64le || T.getArch() == Triple::ppcle)
61097a140dSpatrick     report_fatal_error("XCOFF is not supported for little-endian targets");
6209467b48Spatrick   CodePointerSize = CalleeSaveStackSlotSize = Is64Bit ? 8 : 4;
63097a140dSpatrick 
64097a140dSpatrick   // A size of 8 is only supported by the assembler under 64-bit.
65097a140dSpatrick   Data64bitsDirective = Is64Bit ? "\t.vbyte\t8, " : nullptr;
66*73471bf0Spatrick 
67*73471bf0Spatrick   // Debug Information
68*73471bf0Spatrick   SupportsDebugInformation = true;
69*73471bf0Spatrick 
70*73471bf0Spatrick   // Set up DWARF directives
71*73471bf0Spatrick   MinInstAlignment = 4;
72*73471bf0Spatrick 
73*73471bf0Spatrick   // Support $ as PC in inline asm
74*73471bf0Spatrick   DollarIsPC = true;
7509467b48Spatrick }
76