aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/PowerPC/MCTargetDesc/PPCMCExpr.h
diff options
context:
space:
mode:
authorUlrich Weigand <ulrich.weigand@de.ibm.com>2013-07-08 20:20:51 +0000
committerUlrich Weigand <ulrich.weigand@de.ibm.com>2013-07-08 20:20:51 +0000
commita68f58ab2bec6a024afae498e4082ddd8b01f178 (patch)
treed8915238546de8235374cd1556fd5844938c4b1a /lib/Target/PowerPC/MCTargetDesc/PPCMCExpr.h
parent947d447ee0ac927cc308e5e53062e0edb71e7d8e (diff)
downloadexternal_llvm-a68f58ab2bec6a024afae498e4082ddd8b01f178.zip
external_llvm-a68f58ab2bec6a024afae498e4082ddd8b01f178.tar.gz
external_llvm-a68f58ab2bec6a024afae498e4082ddd8b01f178.tar.bz2
[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
Diffstat (limited to 'lib/Target/PowerPC/MCTargetDesc/PPCMCExpr.h')
-rw-r--r--lib/Target/PowerPC/MCTargetDesc/PPCMCExpr.h25
1 files changed, 14 insertions, 11 deletions
diff --git a/lib/Target/PowerPC/MCTargetDesc/PPCMCExpr.h b/lib/Target/PowerPC/MCTargetDesc/PPCMCExpr.h
index 3cbb493..e44c7c1 100644
--- a/lib/Target/PowerPC/MCTargetDesc/PPCMCExpr.h
+++ b/lib/Target/PowerPC/MCTargetDesc/PPCMCExpr.h
@@ -32,29 +32,32 @@ public:
private:
const VariantKind Kind;
const MCExpr *Expr;
- const int AssemblerDialect;
+ bool IsDarwin;
explicit PPCMCExpr(VariantKind _Kind, const MCExpr *_Expr,
- int _AssemblerDialect)
- : Kind(_Kind), Expr(_Expr), AssemblerDialect(_AssemblerDialect) {}
+ bool _IsDarwin)
+ : Kind(_Kind), Expr(_Expr), IsDarwin(_IsDarwin) {}
public:
/// @name Construction
/// @{
static const PPCMCExpr *Create(VariantKind Kind, const MCExpr *Expr,
- MCContext &Ctx);
+ bool isDarwin, MCContext &Ctx);
- static const PPCMCExpr *CreateLo(const MCExpr *Expr, MCContext &Ctx) {
- return Create(VK_PPC_LO, Expr, Ctx);
+ static const PPCMCExpr *CreateLo(const MCExpr *Expr,
+ bool isDarwin, MCContext &Ctx) {
+ return Create(VK_PPC_LO, Expr, isDarwin, Ctx);
}
- static const PPCMCExpr *CreateHi(const MCExpr *Expr, MCContext &Ctx) {
- return Create(VK_PPC_HI, Expr, Ctx);
+ static const PPCMCExpr *CreateHi(const MCExpr *Expr,
+ bool isDarwin, MCContext &Ctx) {
+ return Create(VK_PPC_HI, Expr, isDarwin, Ctx);
}
- static const PPCMCExpr *CreateHa(const MCExpr *Expr, MCContext &Ctx) {
- return Create(VK_PPC_HA, Expr, Ctx);
+ static const PPCMCExpr *CreateHa(const MCExpr *Expr,
+ bool isDarwin, MCContext &Ctx) {
+ return Create(VK_PPC_HA, Expr, isDarwin, Ctx);
}
/// @}
@@ -68,7 +71,7 @@ public:
const MCExpr *getSubExpr() const { return Expr; }
/// isDarwinSyntax - True if expression is to be printed using Darwin syntax.
- bool isDarwinSyntax() const { return AssemblerDialect == 1; }
+ bool isDarwinSyntax() const { return IsDarwin; }
/// @}