2012-02-18 12:03:15 +00:00
|
|
|
//===-- PPCMCAsmInfo.cpp - PPC asm properties -----------------------------===//
|
2006-09-07 22:05:02 +00:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 20:36:04 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2006-09-07 22:05:02 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2009-08-22 21:03:30 +00:00
|
|
|
// This file contains the declarations of the MCAsmInfoDarwin properties.
|
2006-09-07 22:05:02 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2009-08-22 20:48:53 +00:00
|
|
|
#include "PPCMCAsmInfo.h"
|
2013-12-10 21:37:41 +00:00
|
|
|
#include "llvm/ADT/Triple.h"
|
|
|
|
|
2006-09-07 22:05:02 +00:00
|
|
|
using namespace llvm;
|
|
|
|
|
2011-12-20 02:50:00 +00:00
|
|
|
void PPCMCAsmInfoDarwin::anchor() { }
|
|
|
|
|
2013-12-10 21:37:41 +00:00
|
|
|
PPCMCAsmInfoDarwin::PPCMCAsmInfoDarwin(bool is64Bit, const Triple& T) {
|
2013-01-23 16:22:04 +00:00
|
|
|
if (is64Bit) {
|
|
|
|
PointerSize = CalleeSaveStackSlotSize = 8;
|
|
|
|
}
|
2011-07-15 02:09:41 +00:00
|
|
|
IsLittleEndian = false;
|
|
|
|
|
2006-12-21 20:26:09 +00:00
|
|
|
CommentString = ";";
|
2011-05-02 15:58:16 +00:00
|
|
|
ExceptionsType = ExceptionHandling::DwarfCFI;
|
2009-08-11 00:09:57 +00:00
|
|
|
|
2009-08-13 17:03:38 +00:00
|
|
|
if (!is64Bit)
|
2014-04-25 05:30:21 +00:00
|
|
|
Data64bitsDirective = nullptr; // We can't emit a 64-bit unit in PPC32 mode.
|
2010-12-04 03:21:47 +00:00
|
|
|
|
2009-08-11 23:03:40 +00:00
|
|
|
AssemblerDialect = 1; // New-Style mnemonics.
|
2010-01-06 02:21:00 +00:00
|
|
|
SupportsDebugInformation= true; // Debug information.
|
2013-12-10 21:37:41 +00:00
|
|
|
|
2013-12-13 15:46:48 +00:00
|
|
|
// The installed assembler for OSX < 10.6 lacks some directives.
|
2013-12-10 21:37:41 +00:00
|
|
|
// FIXME: this should really be a check on the assembler characteristics
|
|
|
|
// rather than OS version
|
|
|
|
if (T.isMacOSX() && T.isMacOSXVersionLT(10, 6))
|
|
|
|
HasWeakDefCanBeHiddenDirective = false;
|
2014-02-13 14:44:26 +00:00
|
|
|
|
|
|
|
UseIntegratedAssembler = true;
|
2006-12-21 20:26:09 +00:00
|
|
|
}
|
|
|
|
|
2014-08-04 18:46:13 +00:00
|
|
|
void PPCELFMCAsmInfo::anchor() { }
|
2011-12-20 02:50:00 +00:00
|
|
|
|
2014-08-04 18:46:13 +00:00
|
|
|
PPCELFMCAsmInfo::PPCELFMCAsmInfo(bool is64Bit, const Triple& T) {
|
2013-01-23 17:12:15 +00:00
|
|
|
if (is64Bit) {
|
|
|
|
PointerSize = CalleeSaveStackSlotSize = 8;
|
|
|
|
}
|
2014-03-24 18:16:09 +00:00
|
|
|
IsLittleEndian = T.getArch() == Triple::ppc64le;
|
2011-08-01 19:43:05 +00:00
|
|
|
|
2010-02-06 03:32:21 +00:00
|
|
|
// ".comm align is in bytes but .align is pow-2."
|
|
|
|
AlignmentIsInBytes = false;
|
|
|
|
|
2006-12-21 20:26:09 +00:00
|
|
|
CommentString = "#";
|
2013-10-16 01:34:32 +00:00
|
|
|
|
2009-08-13 23:30:21 +00:00
|
|
|
// Uses '.section' before '.bss' directive
|
|
|
|
UsesELFSectionDirectiveForBSS = true;
|
2007-07-25 03:48:45 +00:00
|
|
|
|
2007-12-21 12:19:44 +00:00
|
|
|
// Debug Information
|
|
|
|
SupportsDebugInformation = true;
|
|
|
|
|
2013-09-25 10:47:21 +00:00
|
|
|
DollarIsPC = true;
|
|
|
|
|
2007-12-21 12:19:44 +00:00
|
|
|
// Set up DWARF directives
|
2013-06-12 14:46:54 +00:00
|
|
|
MinInstAlignment = 4;
|
2007-12-21 12:19:44 +00:00
|
|
|
|
|
|
|
// Exceptions handling
|
2012-09-12 15:29:32 +00:00
|
|
|
ExceptionsType = ExceptionHandling::DwarfCFI;
|
2009-08-11 22:06:07 +00:00
|
|
|
|
|
|
|
ZeroDirective = "\t.space\t";
|
2014-04-25 05:30:21 +00:00
|
|
|
Data64bitsDirective = is64Bit ? "\t.quad\t" : nullptr;
|
[PowerPC] Always use "assembler dialect" 1
A setting in MCAsmInfo defines the "assembler dialect" to use. This is used
by common code to choose between alternatives in a multi-alternative GNU
inline asm statement like the following:
__asm__ ("{sfe|subfe} %0,%1,%2" : "=r" (out) : "r" (in1), "r" (in2));
The meaning of these dialects is platform specific, and GCC defines those
for PowerPC to use dialect 0 for old-style (POWER) mnemonics and 1 for
new-style (PowerPC) mnemonics, like in the example above.
To be compatible with inline asm used with GCC, LLVM ought to do the same.
Specifically, this means we should always use assembler dialect 1 since
old-style mnemonics really aren't supported on any current platform.
However, the current LLVM back-end uses:
AssemblerDialect = 1; // New-Style mnemonics.
in PPCMCAsmInfoDarwin, and
AssemblerDialect = 0; // Old-Style mnemonics.
in PPCLinuxMCAsmInfo.
The Linux setting really isn't correct, we should be using new-style
mnemonics everywhere. This is changed by this commit.
Unfortunately, the setting of this variable is overloaded in the back-end
to decide whether or not we are on a Darwin target. This is done in
PPCInstPrinter (the "SyntaxVariant" is initialized from the MCAsmInfo
AssemblerDialect setting), and also in PPCMCExpr. Setting AssemblerDialect
to 1 for both Darwin and Linux no longer allows us to make this distinction.
Instead, this patch uses the MCSubtargetInfo passed to createPPCMCInstPrinter
to distinguish Darwin targets, and ignores the SyntaxVariant parameter.
As to PPCMCExpr, this patch adds an explicit isDarwin argument that needs
to be passed in by the caller when creating a target MCExpr. (To do so
this patch implicitly also reverts commit 184441.)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185858 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-08 20:20:51 +00:00
|
|
|
AssemblerDialect = 1; // New-Style mnemonics.
|
2014-08-04 18:45:10 +00:00
|
|
|
LCOMMDirectiveAlignmentType = LCOMM::ByteAlignment;
|
2014-02-13 14:44:26 +00:00
|
|
|
|
2015-01-13 19:43:45 +00:00
|
|
|
UseIntegratedAssembler = true;
|
2006-12-21 20:26:09 +00:00
|
|
|
}
|
2008-02-27 23:49:15 +00:00
|
|
|
|