From bd4902c44a7c892468e1a8fdede5008a7d3c2f2d Mon Sep 17 00:00:00 2001 From: Bill Schmidt Date: Thu, 13 Dec 2012 18:45:54 +0000 Subject: [PATCH] This is just a clean-up patch that simplifies the initial-exec TLS logic by avoiding use of machine operand flags. No change in observable behavior, so no new test cases. llvm-svn: 170141 --- lib/Target/PowerPC/PPC.h | 4 +--- lib/Target/PowerPC/PPCISelLowering.cpp | 14 +++++--------- lib/Target/PowerPC/PPCInstr64Bit.td | 2 +- lib/Target/PowerPC/PPCMCInstLower.cpp | 6 ------ 4 files changed, 7 insertions(+), 19 deletions(-) diff --git a/lib/Target/PowerPC/PPC.h b/lib/Target/PowerPC/PPC.h index bbd247f20fb..e6d38ebf217 100644 --- a/lib/Target/PowerPC/PPC.h +++ b/lib/Target/PowerPC/PPC.h @@ -72,9 +72,7 @@ namespace llvm { MO_HA16 = 2 << 5, MO_TPREL16_HA = 3 << 5, - MO_TPREL16_LO = 4 << 5, - MO_GOT_TPREL16_DS = 5 << 5, - MO_TLS = 6 << 5 + MO_TPREL16_LO = 4 << 5 }; } // end namespace PPCII diff --git a/lib/Target/PowerPC/PPCISelLowering.cpp b/lib/Target/PowerPC/PPCISelLowering.cpp index 68f1bc6eaea..0748bd53a8c 100644 --- a/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/lib/Target/PowerPC/PPCISelLowering.cpp @@ -1351,15 +1351,11 @@ SDValue PPCTargetLowering::LowerGlobalTLSAddress(SDValue Op, llvm_unreachable("only local-exec is currently supported for ppc32"); if (Model == TLSModel::InitialExec) { - SDValue GOTOffset = DAG.getTargetGlobalAddress(GV, dl, PtrVT, 0, - PPCII::MO_GOT_TPREL16_DS); - SDValue TPReg = DAG.getTargetGlobalAddress(GV, dl, PtrVT, 0, - PPCII::MO_TLS); - SDValue GOTReg = DAG.getRegister(is64bit ? PPC::X2 : PPC::R2, - is64bit ? MVT::i64 : MVT::i32); - SDValue TPOffset = DAG.getNode(PPCISD::LD_GOT_TPREL, dl, PtrVT, - GOTOffset, GOTReg); - return DAG.getNode(PPCISD::ADD_TLS, dl, PtrVT, TPOffset, TPReg); + SDValue TGA = DAG.getTargetGlobalAddress(GV, dl, PtrVT, 0, 0); + SDValue GOTReg = DAG.getRegister(PPC::X2, MVT::i64); + SDValue TPOffset = DAG.getNode(PPCISD::LD_GOT_TPREL, dl, + PtrVT, TGA, GOTReg); + return DAG.getNode(PPCISD::ADD_TLS, dl, PtrVT, TPOffset, TGA); } if (Model == TLSModel::GeneralDynamic) { diff --git a/lib/Target/PowerPC/PPCInstr64Bit.td b/lib/Target/PowerPC/PPCInstr64Bit.td index bc66d5c0a06..429c60b742a 100644 --- a/lib/Target/PowerPC/PPCInstr64Bit.td +++ b/lib/Target/PowerPC/PPCInstr64Bit.td @@ -384,7 +384,7 @@ def ADD8 : XOForm_1<31, 266, 0, (outs G8RC:$rT), (ins G8RC:$rA, G8RC:$rB), // ADD8 has a special form: reg = ADD8(reg, sym@tls) for use by the // initial-exec thread-local storage model. def ADD8TLS : XOForm_1<31, 266, 0, (outs G8RC:$rT), (ins G8RC:$rA, tlsreg:$rB), - "add $rT, $rA, $rB", IntSimple, + "add $rT, $rA, $rB@tls", IntSimple, [(set G8RC:$rT, (add G8RC:$rA, tglobaltlsaddr:$rB))]>; let Defs = [CARRY] in { diff --git a/lib/Target/PowerPC/PPCMCInstLower.cpp b/lib/Target/PowerPC/PPCMCInstLower.cpp index 1c4af901f72..73f7a2cfd57 100644 --- a/lib/Target/PowerPC/PPCMCInstLower.cpp +++ b/lib/Target/PowerPC/PPCMCInstLower.cpp @@ -114,12 +114,6 @@ static MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol, break; case PPCII::MO_TPREL16_LO: RefKind = MCSymbolRefExpr::VK_PPC_TPREL16_LO; break; - case PPCII::MO_GOT_TPREL16_DS: - RefKind = MCSymbolRefExpr::VK_PPC_GOT_TPREL16_DS; - break; - case PPCII::MO_TLS: - RefKind = MCSymbolRefExpr::VK_PPC_TLS; - break; } // FIXME: This isn't right, but we don't have a good way to express this in