]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm / lib / Target / PowerPC / MCTargetDesc / PPCMCAsmInfo.cpp
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 PPCMCAsmInfoDarwin::anchor() { }
19
20 PPCMCAsmInfoDarwin::PPCMCAsmInfoDarwin(bool is64Bit, const Triple& T) {
21   if (is64Bit) {
22     CodePointerSize = CalleeSaveStackSlotSize = 8;
23   }
24   IsLittleEndian = false;
25
26   SeparatorString = "@";
27   CommentString = ";";
28   ExceptionsType = ExceptionHandling::DwarfCFI;
29
30   if (!is64Bit)
31     Data64bitsDirective = nullptr; // We can't emit a 64-bit unit in PPC32 mode.
32
33   AssemblerDialect = 1;           // New-Style mnemonics.
34   SupportsDebugInformation= true; // Debug information.
35
36   // The installed assembler for OSX < 10.6 lacks some directives.
37   // FIXME: this should really be a check on the assembler characteristics
38   // rather than OS version
39   if (T.isMacOSX() && T.isMacOSXVersionLT(10, 6))
40     HasWeakDefCanBeHiddenDirective = false;
41
42   UseIntegratedAssembler = true;
43 }
44
45 void PPCELFMCAsmInfo::anchor() { }
46
47 PPCELFMCAsmInfo::PPCELFMCAsmInfo(bool is64Bit, const Triple& T) {
48   // FIXME: This is not always needed. For example, it is not needed in the
49   // v2 abi.
50   NeedsLocalForSize = true;
51
52   if (is64Bit) {
53     CodePointerSize = CalleeSaveStackSlotSize = 8;
54   }
55   IsLittleEndian = T.getArch() == Triple::ppc64le;
56
57   // ".comm align is in bytes but .align is pow-2."
58   AlignmentIsInBytes = false;
59
60   CommentString = "#";
61
62   // Uses '.section' before '.bss' directive
63   UsesELFSectionDirectiveForBSS = true;
64
65   // Debug Information
66   SupportsDebugInformation = true;
67
68   DollarIsPC = true;
69
70   // Set up DWARF directives
71   MinInstAlignment = 4;
72
73   // Exceptions handling
74   ExceptionsType = ExceptionHandling::DwarfCFI;
75
76   ZeroDirective = "\t.space\t";
77   Data64bitsDirective = is64Bit ? "\t.quad\t" : nullptr;
78   AssemblerDialect = 1;           // New-Style mnemonics.
79   LCOMMDirectiveAlignmentType = LCOMM::ByteAlignment;
80
81   UseIntegratedAssembler = true;
82 }
83
84 void PPCXCOFFMCAsmInfo::anchor() {}
85
86 PPCXCOFFMCAsmInfo::PPCXCOFFMCAsmInfo(bool Is64Bit, const Triple &T) {
87   assert(!IsLittleEndian && "Little-endian XCOFF not supported.");
88   CodePointerSize = CalleeSaveStackSlotSize = Is64Bit ? 8 : 4;
89 }