diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:41:05 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:41:05 +0000 |
commit | 01095a5d43bbfde13731688ddcf6048ebb8b7721 (patch) | |
tree | 4def12e759965de927d963ac65840d663ef9d1ea /lib/Target/Sparc/DelaySlotFiller.cpp | |
parent | f0f4822ed4b66e3579e92a89f368f8fb860e218e (diff) | |
download | src-01095a5d43bbfde13731688ddcf6048ebb8b7721.tar.gz src-01095a5d43bbfde13731688ddcf6048ebb8b7721.zip |
Vendor import of llvm release_39 branch r276489:vendor/llvm/llvm-release_39-r276489
Notes
Notes:
svn path=/vendor/llvm/dist/; revision=303231
svn path=/vendor/llvm/llvm-release_39-r276489/; revision=303232; tag=vendor/llvm/llvm-release_39-r276489
Diffstat (limited to 'lib/Target/Sparc/DelaySlotFiller.cpp')
-rw-r--r-- | lib/Target/Sparc/DelaySlotFiller.cpp | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/lib/Target/Sparc/DelaySlotFiller.cpp b/lib/Target/Sparc/DelaySlotFiller.cpp index c689b7f7201e..944f3551279e 100644 --- a/lib/Target/Sparc/DelaySlotFiller.cpp +++ b/lib/Target/Sparc/DelaySlotFiller.cpp @@ -38,14 +38,10 @@ static cl::opt<bool> DisableDelaySlotFiller( namespace { struct Filler : public MachineFunctionPass { - /// Target machine description which we query for reg. names, data - /// layout, etc. - /// - TargetMachine &TM; const SparcSubtarget *Subtarget; static char ID; - Filler(TargetMachine &tm) : MachineFunctionPass(ID), TM(tm) {} + Filler() : MachineFunctionPass(ID) {} const char *getPassName() const override { return "SPARC Delay Slot Filler"; @@ -66,6 +62,11 @@ namespace { return Changed; } + MachineFunctionProperties getRequiredProperties() const override { + return MachineFunctionProperties().set( + MachineFunctionProperties::Property::AllVRegsAllocated); + } + void insertCallDefsUses(MachineBasicBlock::iterator MI, SmallSet<unsigned, 32>& RegDefs, SmallSet<unsigned, 32>& RegUses); @@ -98,7 +99,7 @@ namespace { /// slots in Sparc MachineFunctions /// FunctionPass *llvm::createSparcDelaySlotFillerPass(TargetMachine &tm) { - return new Filler(tm); + return new Filler; } @@ -268,6 +269,22 @@ bool Filler::delayHasHazard(MachineBasicBlock::iterator candidate, return true; } } + + unsigned Opcode = candidate->getOpcode(); + // LD and LDD may have NOPs inserted afterwards in the case of some LEON + // processors, so we can't use the delay slot if this feature is switched-on. + if (Subtarget->insertNOPLoad() + && + Opcode >= SP::LDDArr && Opcode <= SP::LDrr) + return true; + + // Same as above for FDIV and FSQRT on some LEON processors. + if (Subtarget->fixAllFDIVSQRT() + && + Opcode >= SP::FDIVD && Opcode <= SP::FSQRTD) + return true; + + return false; } @@ -290,12 +307,12 @@ void Filler::insertCallDefsUses(MachineBasicBlock::iterator MI, assert(Reg.isUse() && "CALL first operand is not a use."); RegUses.insert(Reg.getReg()); - const MachineOperand &RegOrImm = MI->getOperand(1); - if (RegOrImm.isImm()) + const MachineOperand &Operand1 = MI->getOperand(1); + if (Operand1.isImm() || Operand1.isGlobal()) break; - assert(RegOrImm.isReg() && "CALLrr second operand is not a register."); - assert(RegOrImm.isUse() && "CALLrr second operand is not a use."); - RegUses.insert(RegOrImm.getReg()); + assert(Operand1.isReg() && "CALLrr second operand is not a register."); + assert(Operand1.isUse() && "CALLrr second operand is not a use."); + RegUses.insert(Operand1.getReg()); break; } } |