LLVM API Documentation

PPCMCAsmInfo.cpp
Go to the documentation of this file.
00001 //===-- PPCMCAsmInfo.cpp - PPC asm properties -----------------------------===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file contains the declarations of the MCAsmInfoDarwin properties.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #include "PPCMCAsmInfo.h"
00015 #include "llvm/ADT/Triple.h"
00016 
00017 using namespace llvm;
00018 
00019 void PPCMCAsmInfoDarwin::anchor() { }
00020 
00021 PPCMCAsmInfoDarwin::PPCMCAsmInfoDarwin(bool is64Bit, const Triple& T) {
00022   if (is64Bit) {
00023     PointerSize = CalleeSaveStackSlotSize = 8;
00024   }
00025   IsLittleEndian = false;
00026 
00027   CommentString = ";";
00028   ExceptionsType = ExceptionHandling::DwarfCFI;
00029 
00030   if (!is64Bit)
00031     Data64bitsDirective = nullptr; // We can't emit a 64-bit unit in PPC32 mode.
00032 
00033   AssemblerDialect = 1;           // New-Style mnemonics.
00034   SupportsDebugInformation= true; // Debug information.
00035 
00036   // The installed assembler for OSX < 10.6 lacks some directives.
00037   // FIXME: this should really be a check on the assembler characteristics
00038   // rather than OS version
00039   if (T.isMacOSX() && T.isMacOSXVersionLT(10, 6))
00040     HasWeakDefCanBeHiddenDirective = false;
00041 
00042   UseIntegratedAssembler = true;
00043 }
00044 
00045 void PPCELFMCAsmInfo::anchor() { }
00046 
00047 PPCELFMCAsmInfo::PPCELFMCAsmInfo(bool is64Bit, const Triple& T) {
00048   if (is64Bit) {
00049     PointerSize = CalleeSaveStackSlotSize = 8;
00050   }
00051   IsLittleEndian = T.getArch() == Triple::ppc64le;
00052 
00053   // ".comm align is in bytes but .align is pow-2."
00054   AlignmentIsInBytes = false;
00055 
00056   CommentString = "#";
00057 
00058   // Uses '.section' before '.bss' directive
00059   UsesELFSectionDirectiveForBSS = true;  
00060 
00061   // Debug Information
00062   SupportsDebugInformation = true;
00063 
00064   DollarIsPC = true;
00065 
00066   // Set up DWARF directives
00067   MinInstAlignment = 4;
00068 
00069   // Exceptions handling
00070   ExceptionsType = ExceptionHandling::DwarfCFI;
00071     
00072   ZeroDirective = "\t.space\t";
00073   Data64bitsDirective = is64Bit ? "\t.quad\t" : nullptr;
00074   AssemblerDialect = 1;           // New-Style mnemonics.
00075   LCOMMDirectiveAlignmentType = LCOMM::ByteAlignment;
00076 
00077   if (T.getOS() == llvm::Triple::FreeBSD ||
00078       (T.getOS() == llvm::Triple::NetBSD && !is64Bit) ||
00079       (T.getOS() == llvm::Triple::OpenBSD && !is64Bit))
00080     UseIntegratedAssembler = true;
00081 }
00082