xref: /freebsd/contrib/llvm-project/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp (revision 62cfcf62f627e5093fb37026a6d8c98e4d2ef04c)
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/ADT/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 = T.getArch() == Triple::ppc64le;
29 
30   // ".comm align is in bytes but .align is pow-2."
31   AlignmentIsInBytes = false;
32 
33   CommentString = "#";
34 
35   // Uses '.section' before '.bss' directive
36   UsesELFSectionDirectiveForBSS = true;
37 
38   // Debug Information
39   SupportsDebugInformation = true;
40 
41   DollarIsPC = true;
42 
43   // Set up DWARF directives
44   MinInstAlignment = 4;
45 
46   // Exceptions handling
47   ExceptionsType = ExceptionHandling::DwarfCFI;
48 
49   ZeroDirective = "\t.space\t";
50   Data64bitsDirective = is64Bit ? "\t.quad\t" : nullptr;
51   AssemblerDialect = 1;           // New-Style mnemonics.
52   LCOMMDirectiveAlignmentType = LCOMM::ByteAlignment;
53 
54   UseIntegratedAssembler = true;
55 }
56 
57 void PPCXCOFFMCAsmInfo::anchor() {}
58 
59 PPCXCOFFMCAsmInfo::PPCXCOFFMCAsmInfo(bool Is64Bit, const Triple &T) {
60   assert(!IsLittleEndian && "Little-endian XCOFF not supported.");
61   CodePointerSize = CalleeSaveStackSlotSize = Is64Bit ? 8 : 4;
62   ZeroDirective = "\t.space\t";
63   SymbolsHaveSMC = true;
64 }
65