diff options
author | Alkis Evlogimenos <alkis@evlogimenos.com> | 2003-12-20 16:22:59 +0000 |
---|---|---|
committer | Alkis Evlogimenos <alkis@evlogimenos.com> | 2003-12-20 16:22:59 +0000 |
commit | e0bb3e766d977d129da6add3bad6793ca20ab151 (patch) | |
tree | 4b5f16e3ece7d311d0c937d52bb3b3bfbbf978db /lib/Target/X86/FloatingPoint.cpp | |
parent | ef56a197edf546d320b33577b128e803e86f7e0d (diff) |
Remove floating point killer pass. This is now implemented in the
instruction selector by adding a new pseudo-instruction
FP_REG_KILL. This instruction implicitly defines all x86 fp registers
and is a terminator so that passes which add machine code at the end
of basic blocks (like phi elimination) do not add instructions between
it and the branch or return instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10562 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/FloatingPoint.cpp')
-rw-r--r-- | lib/Target/X86/FloatingPoint.cpp | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/lib/Target/X86/FloatingPoint.cpp b/lib/Target/X86/FloatingPoint.cpp index b893476996..8673fd61cd 100644 --- a/lib/Target/X86/FloatingPoint.cpp +++ b/lib/Target/X86/FloatingPoint.cpp @@ -603,55 +603,3 @@ void FPS::handleSpecialFP(MachineBasicBlock::iterator &I) { I = MBB->erase(I)-1; // Remove the pseudo instruction delete MI; } - -namespace { - struct FPK : public MachineFunctionPass { - virtual const char *getPassName() const { return "X86 FP Killer"; } - virtual bool runOnMachineFunction(MachineFunction &MF); - virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.addPreserved<LiveVariables>(); - AU.addRequired<LiveVariables>(); - AU.addPreservedID(PHIEliminationID); - AU.addRequiredID(PHIEliminationID); - MachineFunctionPass::getAnalysisUsage(AU); - } - }; -} - -FunctionPass *llvm::createX86FloatingPointKillerPass() { return new FPK(); } - -bool FPK::runOnMachineFunction(MachineFunction &MF) { - const TargetInstrInfo& tii = MF.getTarget().getInstrInfo();; - LiveVariables &LV = getAnalysis<LiveVariables>(); - - for (MachineFunction::iterator - mbbi = MF.begin(), mbbe = MF.end(); mbbi != mbbe; ++mbbi) { - MachineBasicBlock& mbb = *mbbi; - MachineBasicBlock::reverse_iterator mii = mbb.rbegin(); - // rewind to the last non terminating instruction - while (mii != mbb.rend() && tii.isTerminatorInstr((*mii)->getOpcode())) - ++mii; - - // add implicit def for all virtual floating point registers so that - // they are spilled at the end of each basic block, since our - // register stackifier doesn't handle them otherwise. - MachineInstr* instr = BuildMI(X86::IMPLICIT_DEF, 7) - .addReg(X86::FP6, MOTy::Def) - .addReg(X86::FP5, MOTy::Def) - .addReg(X86::FP4, MOTy::Def) - .addReg(X86::FP3, MOTy::Def) - .addReg(X86::FP2, MOTy::Def) - .addReg(X86::FP1, MOTy::Def) - .addReg(X86::FP0, MOTy::Def); - - mbb.insert(mii.base(), instr); - - for (unsigned i = 0; i < instr->getNumOperands(); ++i) { - LV.HandlePhysRegDef(instr->getOperand(i).getAllocatedRegNum(), instr); - - // force live variables to compute that these registers are dead - LV.HandlePhysRegDef(instr->getOperand(i).getAllocatedRegNum(), 0); - } - } - return true; -} |