LLVM  14.0.0git
PPCMCAsmInfo.cpp
Go to the documentation of this file.
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 #include <cassert>
16 
17 using namespace llvm;
18 
19 void PPCELFMCAsmInfo::anchor() { }
20 
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) {
28  }
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
39 
40  // Debug Information
42 
43  DollarIsPC = true;
44 
45  // Set up DWARF directives
46  MinInstAlignment = 4;
47 
48  // Exceptions handling
50 
51  ZeroDirective = "\t.space\t";
52  Data64bitsDirective = is64Bit ? "\t.quad\t" : nullptr;
53  AssemblerDialect = 1; // New-Style mnemonics.
55 }
56 
57 void PPCXCOFFMCAsmInfo::anchor() {}
58 
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
69 
70  // Set up DWARF directives
71  MinInstAlignment = 4;
72 
73  // Support $ as PC in inline asm
74  DollarIsPC = true;
75 }
llvm::PPCELFMCAsmInfo::PPCELFMCAsmInfo
PPCELFMCAsmInfo(bool is64Bit, const Triple &)
Definition: PPCMCAsmInfo.cpp:21
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
is64Bit
static bool is64Bit(const char *name)
Definition: X86Disassembler.cpp:1023
llvm::MCAsmInfo::SupportsDebugInformation
bool SupportsDebugInformation
True if target supports emission of debugging information.
Definition: MCAsmInfo.h:445
llvm::MCAsmInfo::AlignmentIsInBytes
bool AlignmentIsInBytes
If this is true (the default) then the asmprinter emits ".align N" directives, where N is the number ...
Definition: MCAsmInfo.h:329
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:45
llvm::MCAsmInfo::UsesELFSectionDirectiveForBSS
bool UsesELFSectionDirectiveForBSS
This is true if this target uses ELF '.section' directive before the '.bss' one.
Definition: MCAsmInfo.h:319
llvm::MCAsmInfo::Data64bitsDirective
const char * Data64bitsDirective
Definition: MCAsmInfo.h:288
T
#define T
Definition: Mips16ISelLowering.cpp:341
PPCMCAsmInfo.h
llvm::MCAsmInfo::MinInstAlignment
unsigned MinInstAlignment
Every possible instruction length is a multiple of this value.
Definition: MCAsmInfo.h:115
llvm::report_fatal_error
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
Definition: Error.cpp:140
llvm::Triple::ppc64le
@ ppc64le
Definition: Triple.h:70
llvm::PPCXCOFFMCAsmInfo::PPCXCOFFMCAsmInfo
PPCXCOFFMCAsmInfo(bool is64Bit, const Triple &)
Definition: PPCMCAsmInfo.cpp:59
llvm::MCAsmInfo::CommentString
StringRef CommentString
This indicates the comment string used by the assembler.
Definition: MCAsmInfo.h:135
llvm::MCAsmInfo::CodePointerSize
unsigned CodePointerSize
Code pointer size in bytes. Default is 4.
Definition: MCAsmInfo.h:72
llvm::MCAsmInfo::ZeroDirective
const char * ZeroDirective
This should be set to the directive used to get some number of zero (and non-zero if supported by the...
Definition: MCAsmInfo.h:249
llvm::MCAsmInfo::AssemblerDialect
unsigned AssemblerDialect
Which dialect of an assembler variant to use. Defaults to 0.
Definition: MCAsmInfo.h:193
Triple.h
llvm::Triple::ppcle
@ ppcle
Definition: Triple.h:68
llvm::MCAsmInfo::CalleeSaveStackSlotSize
unsigned CalleeSaveStackSlotSize
Size of the stack slot reserved for callee-saved registers, in bytes.
Definition: MCAsmInfo.h:76
llvm::MCAsmInfo::DollarIsPC
bool DollarIsPC
The '$' token, when not referencing an identifier or constant, refers to the current PC.
Definition: MCAsmInfo.h:119
llvm::LCOMM::ByteAlignment
@ ByteAlignment
Definition: MCAsmInfo.h:50
llvm::MCAsmInfo::LCOMMDirectiveAlignmentType
LCOMM::LCOMMType LCOMMDirectiveAlignmentType
Describes if the .lcomm directive for the target supports an alignment argument and how it is interpr...
Definition: MCAsmInfo.h:369
llvm::MCAsmInfo::ExceptionsType
ExceptionHandling ExceptionsType
Exception handling format for the target. Defaults to None.
Definition: MCAsmInfo.h:448
llvm::ExceptionHandling::DwarfCFI
@ DwarfCFI
DWARF-like instruction based exceptions.
llvm::MCAsmInfo::NeedsLocalForSize
bool NeedsLocalForSize
Definition: MCAsmInfo.h:163
llvm::MCAsmInfo::IsLittleEndian
bool IsLittleEndian
True if target is little endian. Default is true.
Definition: MCAsmInfo.h:79