2012-02-18 20:03:15 +08:00
|
|
|
//===-- PPCMCAsmInfo.cpp - PPC asm properties -----------------------------===//
|
2006-09-08 06:05:02 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-30 04:36:04 +08:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2006-09-08 06:05:02 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2009-08-23 05:03:30 +08:00
|
|
|
// This file contains the declarations of the MCAsmInfoDarwin properties.
|
2006-09-08 06:05:02 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2009-08-23 04:48:53 +08:00
|
|
|
#include "PPCMCAsmInfo.h"
|
Re-commit r247683: Replace Triple with a new TargetTuple in MCTargetDesc/* and related. NFC.
Summary:
This is the first patch in the series to migrate Triple's (which are ambiguous)
to TargetTuple's (which aren't).
For the moment, TargetTuple simply passes all requests to the Triple object it
holds. Once it has replaced Triple, it will start to implement the interface in
a more suitable way.
This change makes some changes to the public C++ API. In particular,
InitMCSubtargetInfo(), createMCRelocationInfo(), and createMCSymbolizer()
now take TargetTuples instead of Triples. The other public C++ API's have
been left as-is for the moment to reduce patch size.
This commit also contains a trivial patch to clang to account for the C++ API
change. Thanks go to Pavel Labath for fixing LLDB for me.
Reviewers: rengolin
Subscribers: jyknight, dschuff, arsenm, rampitec, danalbert, srhines, javed.absar, dsanders, echristo, emaste, jholewinski, tberghammer, ted, jfb, llvm-commits, rengolin
Differential Revision: http://reviews.llvm.org/D10969
llvm-svn: 247692
2015-09-15 22:08:28 +08:00
|
|
|
#include "llvm/ADT/TargetTuple.h"
|
2013-12-11 05:37:41 +08:00
|
|
|
|
2006-09-08 06:05:02 +08:00
|
|
|
using namespace llvm;
|
|
|
|
|
2011-12-20 10:50:00 +08:00
|
|
|
void PPCMCAsmInfoDarwin::anchor() { }
|
|
|
|
|
Re-commit r247683: Replace Triple with a new TargetTuple in MCTargetDesc/* and related. NFC.
Summary:
This is the first patch in the series to migrate Triple's (which are ambiguous)
to TargetTuple's (which aren't).
For the moment, TargetTuple simply passes all requests to the Triple object it
holds. Once it has replaced Triple, it will start to implement the interface in
a more suitable way.
This change makes some changes to the public C++ API. In particular,
InitMCSubtargetInfo(), createMCRelocationInfo(), and createMCSymbolizer()
now take TargetTuples instead of Triples. The other public C++ API's have
been left as-is for the moment to reduce patch size.
This commit also contains a trivial patch to clang to account for the C++ API
change. Thanks go to Pavel Labath for fixing LLDB for me.
Reviewers: rengolin
Subscribers: jyknight, dschuff, arsenm, rampitec, danalbert, srhines, javed.absar, dsanders, echristo, emaste, jholewinski, tberghammer, ted, jfb, llvm-commits, rengolin
Differential Revision: http://reviews.llvm.org/D10969
llvm-svn: 247692
2015-09-15 22:08:28 +08:00
|
|
|
PPCMCAsmInfoDarwin::PPCMCAsmInfoDarwin(bool is64Bit, const TargetTuple &TT) {
|
2013-01-24 00:22:04 +08:00
|
|
|
if (is64Bit) {
|
|
|
|
PointerSize = CalleeSaveStackSlotSize = 8;
|
|
|
|
}
|
2011-07-15 10:09:41 +08:00
|
|
|
IsLittleEndian = false;
|
|
|
|
|
2006-12-22 04:26:09 +08:00
|
|
|
CommentString = ";";
|
2011-05-02 23:58:16 +08:00
|
|
|
ExceptionsType = ExceptionHandling::DwarfCFI;
|
2009-08-11 08:09:57 +08:00
|
|
|
|
2009-08-14 01:03:38 +08:00
|
|
|
if (!is64Bit)
|
2014-04-25 13:30:21 +08:00
|
|
|
Data64bitsDirective = nullptr; // We can't emit a 64-bit unit in PPC32 mode.
|
2010-12-04 11:21:47 +08:00
|
|
|
|
2009-08-12 07:03:40 +08:00
|
|
|
AssemblerDialect = 1; // New-Style mnemonics.
|
2010-01-06 10:21:00 +08:00
|
|
|
SupportsDebugInformation= true; // Debug information.
|
2013-12-11 05:37:41 +08:00
|
|
|
|
2013-12-13 23:46:48 +08:00
|
|
|
// The installed assembler for OSX < 10.6 lacks some directives.
|
2013-12-11 05:37:41 +08:00
|
|
|
// FIXME: this should really be a check on the assembler characteristics
|
|
|
|
// rather than OS version
|
Re-commit r247683: Replace Triple with a new TargetTuple in MCTargetDesc/* and related. NFC.
Summary:
This is the first patch in the series to migrate Triple's (which are ambiguous)
to TargetTuple's (which aren't).
For the moment, TargetTuple simply passes all requests to the Triple object it
holds. Once it has replaced Triple, it will start to implement the interface in
a more suitable way.
This change makes some changes to the public C++ API. In particular,
InitMCSubtargetInfo(), createMCRelocationInfo(), and createMCSymbolizer()
now take TargetTuples instead of Triples. The other public C++ API's have
been left as-is for the moment to reduce patch size.
This commit also contains a trivial patch to clang to account for the C++ API
change. Thanks go to Pavel Labath for fixing LLDB for me.
Reviewers: rengolin
Subscribers: jyknight, dschuff, arsenm, rampitec, danalbert, srhines, javed.absar, dsanders, echristo, emaste, jholewinski, tberghammer, ted, jfb, llvm-commits, rengolin
Differential Revision: http://reviews.llvm.org/D10969
llvm-svn: 247692
2015-09-15 22:08:28 +08:00
|
|
|
if (TT.isMacOSX() && TT.isMacOSXVersionLT(10, 6))
|
2013-12-11 05:37:41 +08:00
|
|
|
HasWeakDefCanBeHiddenDirective = false;
|
2014-02-13 22:44:26 +08:00
|
|
|
|
|
|
|
UseIntegratedAssembler = true;
|
2006-12-22 04:26:09 +08:00
|
|
|
}
|
|
|
|
|
2014-08-05 02:46:13 +08:00
|
|
|
void PPCELFMCAsmInfo::anchor() { }
|
2011-12-20 10:50:00 +08:00
|
|
|
|
Re-commit r247683: Replace Triple with a new TargetTuple in MCTargetDesc/* and related. NFC.
Summary:
This is the first patch in the series to migrate Triple's (which are ambiguous)
to TargetTuple's (which aren't).
For the moment, TargetTuple simply passes all requests to the Triple object it
holds. Once it has replaced Triple, it will start to implement the interface in
a more suitable way.
This change makes some changes to the public C++ API. In particular,
InitMCSubtargetInfo(), createMCRelocationInfo(), and createMCSymbolizer()
now take TargetTuples instead of Triples. The other public C++ API's have
been left as-is for the moment to reduce patch size.
This commit also contains a trivial patch to clang to account for the C++ API
change. Thanks go to Pavel Labath for fixing LLDB for me.
Reviewers: rengolin
Subscribers: jyknight, dschuff, arsenm, rampitec, danalbert, srhines, javed.absar, dsanders, echristo, emaste, jholewinski, tberghammer, ted, jfb, llvm-commits, rengolin
Differential Revision: http://reviews.llvm.org/D10969
llvm-svn: 247692
2015-09-15 22:08:28 +08:00
|
|
|
PPCELFMCAsmInfo::PPCELFMCAsmInfo(bool is64Bit, const TargetTuple &TT) {
|
2015-03-06 02:55:50 +08:00
|
|
|
// FIXME: This is not always needed. For example, it is not needed in the
|
|
|
|
// v2 abi.
|
|
|
|
NeedsLocalForSize = true;
|
|
|
|
|
2013-01-24 01:12:15 +08:00
|
|
|
if (is64Bit) {
|
|
|
|
PointerSize = CalleeSaveStackSlotSize = 8;
|
|
|
|
}
|
Re-commit r247683: Replace Triple with a new TargetTuple in MCTargetDesc/* and related. NFC.
Summary:
This is the first patch in the series to migrate Triple's (which are ambiguous)
to TargetTuple's (which aren't).
For the moment, TargetTuple simply passes all requests to the Triple object it
holds. Once it has replaced Triple, it will start to implement the interface in
a more suitable way.
This change makes some changes to the public C++ API. In particular,
InitMCSubtargetInfo(), createMCRelocationInfo(), and createMCSymbolizer()
now take TargetTuples instead of Triples. The other public C++ API's have
been left as-is for the moment to reduce patch size.
This commit also contains a trivial patch to clang to account for the C++ API
change. Thanks go to Pavel Labath for fixing LLDB for me.
Reviewers: rengolin
Subscribers: jyknight, dschuff, arsenm, rampitec, danalbert, srhines, javed.absar, dsanders, echristo, emaste, jholewinski, tberghammer, ted, jfb, llvm-commits, rengolin
Differential Revision: http://reviews.llvm.org/D10969
llvm-svn: 247692
2015-09-15 22:08:28 +08:00
|
|
|
IsLittleEndian = TT.getArch() == TargetTuple::ppc64le;
|
2011-08-02 03:43:05 +08:00
|
|
|
|
2010-02-06 11:32:21 +08:00
|
|
|
// ".comm align is in bytes but .align is pow-2."
|
|
|
|
AlignmentIsInBytes = false;
|
|
|
|
|
2006-12-22 04:26:09 +08:00
|
|
|
CommentString = "#";
|
2013-10-16 09:34:32 +08:00
|
|
|
|
2009-08-14 07:30:21 +08:00
|
|
|
// Uses '.section' before '.bss' directive
|
|
|
|
UsesELFSectionDirectiveForBSS = true;
|
2007-07-25 11:48:45 +08:00
|
|
|
|
2007-12-21 20:19:44 +08:00
|
|
|
// Debug Information
|
|
|
|
SupportsDebugInformation = true;
|
|
|
|
|
2013-09-25 18:47:21 +08:00
|
|
|
DollarIsPC = true;
|
|
|
|
|
2007-12-21 20:19:44 +08:00
|
|
|
// Set up DWARF directives
|
2013-06-12 22:46:54 +08:00
|
|
|
MinInstAlignment = 4;
|
2007-12-21 20:19:44 +08:00
|
|
|
|
|
|
|
// Exceptions handling
|
2012-09-12 23:29:32 +08:00
|
|
|
ExceptionsType = ExceptionHandling::DwarfCFI;
|
2009-08-12 06:06:07 +08:00
|
|
|
|
|
|
|
ZeroDirective = "\t.space\t";
|
2014-04-25 13:30:21 +08: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.)
llvm-svn: 185858
2013-07-09 04:20:51 +08:00
|
|
|
AssemblerDialect = 1; // New-Style mnemonics.
|
2014-08-05 02:45:10 +08:00
|
|
|
LCOMMDirectiveAlignmentType = LCOMM::ByteAlignment;
|
2014-02-13 22:44:26 +08:00
|
|
|
|
2015-01-14 03:43:45 +08:00
|
|
|
UseIntegratedAssembler = true;
|
2006-12-22 04:26:09 +08:00
|
|
|
}
|
2008-02-28 07:49:15 +08:00
|
|
|
|