mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-08 21:32:39 +00:00
Remove isProfitableToDuplicateIndirectBranch target hook. It is profitable
for all the processors where I have tried it, and even when it might not help performance, the cost is quite low. The opportunities for duplicating indirect branches are limited by other factors so code size does not change much due to tail duplicating indirect branches aggressively. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90144 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
afa1df467b
commit
15217e63bc
@ -543,10 +543,6 @@ public:
|
|||||||
/// length.
|
/// length.
|
||||||
virtual unsigned getInlineAsmLength(const char *Str,
|
virtual unsigned getInlineAsmLength(const char *Str,
|
||||||
const MCAsmInfo &MAI) const;
|
const MCAsmInfo &MAI) const;
|
||||||
|
|
||||||
/// isProfitableToDuplicateIndirectBranch - Returns true if tail duplication
|
|
||||||
/// is especially profitable for indirect branches.
|
|
||||||
virtual bool isProfitableToDuplicateIndirectBranch() const { return false; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// TargetInstrInfoImpl - This is the default implementation of
|
/// TargetInstrInfoImpl - This is the default implementation of
|
||||||
|
@ -118,8 +118,7 @@ bool TailDuplicatePass::TailDuplicate(MachineBasicBlock *TailBB,
|
|||||||
unsigned MaxDuplicateCount;
|
unsigned MaxDuplicateCount;
|
||||||
if (MF.getFunction()->hasFnAttr(Attribute::OptimizeForSize))
|
if (MF.getFunction()->hasFnAttr(Attribute::OptimizeForSize))
|
||||||
MaxDuplicateCount = 1;
|
MaxDuplicateCount = 1;
|
||||||
else if (TII->isProfitableToDuplicateIndirectBranch() &&
|
else if (!TailBB->empty() && TailBB->back().getDesc().isIndirectBranch())
|
||||||
!TailBB->empty() && TailBB->back().getDesc().isIndirectBranch())
|
|
||||||
// If the target has hardware branch prediction that can handle indirect
|
// If the target has hardware branch prediction that can handle indirect
|
||||||
// branches, duplicating them can often make them predictable when there
|
// branches, duplicating them can often make them predictable when there
|
||||||
// are common paths through the code. The limit needs to be high enough
|
// are common paths through the code. The limit needs to be high enough
|
||||||
|
@ -1027,12 +1027,6 @@ bool ARMBaseInstrInfo::isIdentical(const MachineInstr *MI0,
|
|||||||
return TargetInstrInfoImpl::isIdentical(MI0, MI1, MRI);
|
return TargetInstrInfoImpl::isIdentical(MI0, MI1, MRI);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ARMBaseInstrInfo::isProfitableToDuplicateIndirectBranch() const {
|
|
||||||
// If the target processor can predict indirect branches, it is highly
|
|
||||||
// desirable to duplicate them, since it can often make them predictable.
|
|
||||||
return getSubtarget().hasBranchTargetBuffer();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// getInstrPredicate - If instruction is predicated, returns its predicate
|
/// getInstrPredicate - If instruction is predicated, returns its predicate
|
||||||
/// condition, otherwise returns AL. It also returns the condition code
|
/// condition, otherwise returns AL. It also returns the condition code
|
||||||
/// register by reference.
|
/// register by reference.
|
||||||
|
@ -290,8 +290,6 @@ public:
|
|||||||
|
|
||||||
virtual bool isIdentical(const MachineInstr *MI, const MachineInstr *Other,
|
virtual bool isIdentical(const MachineInstr *MI, const MachineInstr *Other,
|
||||||
const MachineRegisterInfo *MRI) const;
|
const MachineRegisterInfo *MRI) const;
|
||||||
|
|
||||||
virtual bool isProfitableToDuplicateIndirectBranch() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
|
@ -114,8 +114,6 @@ ARMSubtarget::ARMSubtarget(const std::string &TT, const std::string &FS,
|
|||||||
if (UseNEONFP.getPosition() == 0)
|
if (UseNEONFP.getPosition() == 0)
|
||||||
UseNEONForSinglePrecisionFP = true;
|
UseNEONForSinglePrecisionFP = true;
|
||||||
}
|
}
|
||||||
HasBranchTargetBuffer = (CPUString == "cortex-a8" ||
|
|
||||||
CPUString == "cortex-a9");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// GVIsIndirectSymbol - true if the GV will be accessed via an indirect symbol.
|
/// GVIsIndirectSymbol - true if the GV will be accessed via an indirect symbol.
|
||||||
|
@ -50,9 +50,6 @@ protected:
|
|||||||
/// determine if NEON should actually be used.
|
/// determine if NEON should actually be used.
|
||||||
bool UseNEONForSinglePrecisionFP;
|
bool UseNEONForSinglePrecisionFP;
|
||||||
|
|
||||||
/// HasBranchTargetBuffer - True if processor can predict indirect branches.
|
|
||||||
bool HasBranchTargetBuffer;
|
|
||||||
|
|
||||||
/// IsThumb - True if we are in thumb mode, false if in ARM mode.
|
/// IsThumb - True if we are in thumb mode, false if in ARM mode.
|
||||||
bool IsThumb;
|
bool IsThumb;
|
||||||
|
|
||||||
@ -130,8 +127,6 @@ protected:
|
|||||||
bool isThumb2() const { return IsThumb && (ThumbMode == Thumb2); }
|
bool isThumb2() const { return IsThumb && (ThumbMode == Thumb2); }
|
||||||
bool hasThumb2() const { return ThumbMode >= Thumb2; }
|
bool hasThumb2() const { return ThumbMode >= Thumb2; }
|
||||||
|
|
||||||
bool hasBranchTargetBuffer() const { return HasBranchTargetBuffer; }
|
|
||||||
|
|
||||||
bool isR9Reserved() const { return IsR9Reserved; }
|
bool isR9Reserved() const { return IsR9Reserved; }
|
||||||
|
|
||||||
bool useMovt() const { return UseMovt && hasV6T2Ops(); }
|
bool useMovt() const { return UseMovt && hasV6T2Ops(); }
|
||||||
|
@ -151,8 +151,6 @@ public:
|
|||||||
/// instruction may be. This returns the maximum number of bytes.
|
/// instruction may be. This returns the maximum number of bytes.
|
||||||
///
|
///
|
||||||
virtual unsigned GetInstSizeInBytes(const MachineInstr *MI) const;
|
virtual unsigned GetInstSizeInBytes(const MachineInstr *MI) const;
|
||||||
|
|
||||||
virtual bool isProfitableToDuplicateIndirectBranch() const { return true; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -632,8 +632,6 @@ public:
|
|||||||
///
|
///
|
||||||
unsigned getGlobalBaseReg(MachineFunction *MF) const;
|
unsigned getGlobalBaseReg(MachineFunction *MF) const;
|
||||||
|
|
||||||
virtual bool isProfitableToDuplicateIndirectBranch() const { return true; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MachineInstr* foldMemoryOperandImpl(MachineFunction &MF,
|
MachineInstr* foldMemoryOperandImpl(MachineFunction &MF,
|
||||||
MachineInstr* MI,
|
MachineInstr* MI,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user