diff options
author | Hal Finkel <hfinkel@anl.gov> | 2015-02-06 23:07:40 +0000 |
---|---|---|
committer | Hal Finkel <hfinkel@anl.gov> | 2015-02-06 23:07:40 +0000 |
commit | 0d2a1515d5e677ca60348c60292620cb68a6fb6a (patch) | |
tree | 5a8965a7333902f3c9581c6b01341554fd29aec1 /llvm/lib/Target/PowerPC/PPCTLSDynamicCall.cpp | |
parent | ed218a0da0d4bee104fa84e205af45b54ac21034 (diff) | |
download | llvm-0d2a1515d5e677ca60348c60292620cb68a6fb6a.zip llvm-0d2a1515d5e677ca60348c60292620cb68a6fb6a.tar.gz llvm-0d2a1515d5e677ca60348c60292620cb68a6fb6a.tar.bz2 |
Revert "r227976 - [PowerPC] Yet another approach to __tls_get_addr" and related fixups
Unfortunately, even with the workaround of disabling the linker TLS
optimizations in Clang restored (which has already been done), this still
breaks self-hosting on my P7 machine (-O3 -DNDEBUG -mcpu=native).
Bill is currently working on an alternate implementation to address the TLS
issue in a way that also fully elides the linker bug (which, unfortunately,
this approach did not fully), so I'm reverting this now.
llvm-svn: 228460
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCTLSDynamicCall.cpp')
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCTLSDynamicCall.cpp | 113 |
1 files changed, 0 insertions, 113 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCTLSDynamicCall.cpp b/llvm/lib/Target/PowerPC/PPCTLSDynamicCall.cpp deleted file mode 100644 index a665fc6..0000000 --- a/llvm/lib/Target/PowerPC/PPCTLSDynamicCall.cpp +++ /dev/null @@ -1,113 +0,0 @@ -//===---------- PPCTLSDynamicCall.cpp - TLS Dynamic Call Fixup ------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This pass fixes up GETtls[ld]ADDR[32] machine instructions so that -// they read and write GPR3. These are really call instructions, so -// must use the calling convention registers. This is done in a late -// pass so that TLS variable accesses can be fully commoned. -// -//===----------------------------------------------------------------------===// - -#include "PPCInstrInfo.h" -#include "PPC.h" -#include "PPCInstrBuilder.h" -#include "PPCTargetMachine.h" -#include "llvm/CodeGen/MachineFunctionPass.h" -#include "llvm/CodeGen/MachineInstrBuilder.h" -#include "llvm/Support/Debug.h" -#include "llvm/Support/raw_ostream.h" - -using namespace llvm; - -#define DEBUG_TYPE "ppc-tls-dynamic-call" - -namespace llvm { - void initializePPCTLSDynamicCallPass(PassRegistry&); -} - -namespace { - // PPCTLSDynamicCall pass - Add copies to and from GPR3 around - // GETtls[ld]ADDR[32] machine instructions. These instructions - // are actually call instructions, so the register choice is - // constrained. We delay introducing these copies as late as - // possible so that TLS variable accesses can be fully commoned. - struct PPCTLSDynamicCall : public MachineFunctionPass { - static char ID; - PPCTLSDynamicCall() : MachineFunctionPass(ID) { - initializePPCTLSDynamicCallPass(*PassRegistry::getPassRegistry()); - } - - const PPCTargetMachine *TM; - const PPCInstrInfo *TII; - -protected: - bool processBlock(MachineBasicBlock &MBB) { - bool Changed = false; - bool Is64Bit = TM->getSubtargetImpl()->isPPC64(); - - for (MachineBasicBlock::iterator I = MBB.begin(), IE = MBB.end(); - I != IE; ++I) { - MachineInstr *MI = I; - - if (MI->getOpcode() != PPC::GETtlsADDR && - MI->getOpcode() != PPC::GETtlsldADDR && - MI->getOpcode() != PPC::GETtlsADDR32 && - MI->getOpcode() != PPC::GETtlsldADDR32) - continue; - - DEBUG(dbgs() << "TLS Dynamic Call Fixup:\n " << *MI;); - - unsigned OutReg = MI->getOperand(0).getReg(); - unsigned InReg = MI->getOperand(1).getReg(); - DebugLoc DL = MI->getDebugLoc(); - unsigned GPR3 = Is64Bit ? PPC::X3 : PPC::R3; - - BuildMI(MBB, I, DL, TII->get(TargetOpcode::COPY), GPR3) - .addReg(InReg); - MI->getOperand(0).setReg(GPR3); - MI->getOperand(1).setReg(GPR3); - BuildMI(MBB, ++I, DL, TII->get(TargetOpcode::COPY), OutReg) - .addReg(GPR3); - - Changed = true; - } - - return Changed; - } - -public: - bool runOnMachineFunction(MachineFunction &MF) override { - TM = static_cast<const PPCTargetMachine *>(&MF.getTarget()); - TII = TM->getSubtargetImpl()->getInstrInfo(); - - bool Changed = false; - - for (MachineFunction::iterator I = MF.begin(); I != MF.end();) { - MachineBasicBlock &B = *I++; - if (processBlock(B)) - Changed = true; - } - - return Changed; - } - - void getAnalysisUsage(AnalysisUsage &AU) const override { - MachineFunctionPass::getAnalysisUsage(AU); - } - }; -} - -INITIALIZE_PASS_BEGIN(PPCTLSDynamicCall, DEBUG_TYPE, - "PowerPC TLS Dynamic Call Fixup", false, false) -INITIALIZE_PASS_END(PPCTLSDynamicCall, DEBUG_TYPE, - "PowerPC TLS Dynamic Call Fixup", false, false) - -char PPCTLSDynamicCall::ID = 0; -FunctionPass* -llvm::createPPCTLSDynamicCallPass() { return new PPCTLSDynamicCall(); } |