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