mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-01 15:11:24 +00:00
ARM: Canonicalize access to function attributes, NFC
Canonicalize access to function attributes to use the simpler API. getAttributes().getAttribute(AttributeSet::FunctionIndex, Kind) => getFnAttribute(Kind) getAttributes().hasAttribute(AttributeSet::FunctionIndex, Kind) => hasFnAttribute(Kind) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229220 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6a1927d2c1
commit
f38384bcf1
@ -1991,8 +1991,7 @@ bool llvm::tryFoldSPUpdateIntoPushPop(const ARMSubtarget &Subtarget,
|
||||
unsigned NumBytes) {
|
||||
// This optimisation potentially adds lots of load and store
|
||||
// micro-operations, it's only really a great benefit to code-size.
|
||||
if (!MF.getFunction()->getAttributes().hasAttribute(
|
||||
AttributeSet::FunctionIndex, Attribute::MinSize))
|
||||
if (!MF.getFunction()->hasFnAttribute(Attribute::MinSize))
|
||||
return false;
|
||||
|
||||
// If only one register is pushed/popped, LLVM can use an LDR/STR
|
||||
@ -3665,9 +3664,7 @@ ARMBaseInstrInfo::getOperandLatency(const InstrItineraryData *ItinData,
|
||||
// instructions).
|
||||
if (Latency > 0 && Subtarget.isThumb2()) {
|
||||
const MachineFunction *MF = DefMI->getParent()->getParent();
|
||||
if (MF->getFunction()->getAttributes().
|
||||
hasAttribute(AttributeSet::FunctionIndex,
|
||||
Attribute::OptimizeForSize))
|
||||
if (MF->getFunction()->hasFnAttribute(Attribute::OptimizeForSize))
|
||||
--Latency;
|
||||
}
|
||||
return Latency;
|
||||
|
@ -367,10 +367,8 @@ needsStackRealignment(const MachineFunction &MF) const {
|
||||
const Function *F = MF.getFunction();
|
||||
unsigned StackAlign =
|
||||
MF.getSubtarget().getFrameLowering()->getStackAlignment();
|
||||
bool requiresRealignment =
|
||||
((MFI->getMaxAlignment() > StackAlign) ||
|
||||
F->getAttributes().hasAttribute(AttributeSet::FunctionIndex,
|
||||
Attribute::StackAlignment));
|
||||
bool requiresRealignment = ((MFI->getMaxAlignment() > StackAlign) ||
|
||||
F->hasFnAttribute(Attribute::StackAlignment));
|
||||
|
||||
return requiresRealignment && canRealignStack(MF);
|
||||
}
|
||||
|
@ -1467,8 +1467,7 @@ static void checkNumAlignedDPRCS2Regs(MachineFunction &MF) {
|
||||
return;
|
||||
|
||||
// Naked functions don't spill callee-saved registers.
|
||||
if (MF.getFunction()->getAttributes().hasAttribute(AttributeSet::FunctionIndex,
|
||||
Attribute::Naked))
|
||||
if (MF.getFunction()->hasFnAttribute(Attribute::Naked))
|
||||
return;
|
||||
|
||||
// We are planning to use NEON instructions vst1 / vld1.
|
||||
|
@ -1785,8 +1785,7 @@ ARMTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
|
||||
|
||||
// FIXME: handle tail calls differently.
|
||||
unsigned CallOpc;
|
||||
bool HasMinSizeAttr = MF.getFunction()->getAttributes().hasAttribute(
|
||||
AttributeSet::FunctionIndex, Attribute::MinSize);
|
||||
bool HasMinSizeAttr = MF.getFunction()->hasFnAttribute(Attribute::MinSize);
|
||||
if (Subtarget->isThumb()) {
|
||||
if ((!isDirect || isARMFunc) && !Subtarget->hasV5TOps())
|
||||
CallOpc = ARMISD::CALL_NOLINK;
|
||||
@ -7151,9 +7150,7 @@ ARMTargetLowering::EmitStructByval(MachineInstr *MI,
|
||||
UnitSize = 2;
|
||||
} else {
|
||||
// Check whether we can use NEON instructions.
|
||||
if (!MF->getFunction()->getAttributes().
|
||||
hasAttribute(AttributeSet::FunctionIndex,
|
||||
Attribute::NoImplicitFloat) &&
|
||||
if (!MF->getFunction()->hasFnAttribute(Attribute::NoImplicitFloat) &&
|
||||
Subtarget->hasNEON()) {
|
||||
if ((Align % 16 == 0) && SizeVal >= 16)
|
||||
UnitSize = 16;
|
||||
@ -9931,10 +9928,8 @@ EVT ARMTargetLowering::getOptimalMemOpType(uint64_t Size,
|
||||
const Function *F = MF.getFunction();
|
||||
|
||||
// See if we can use NEON instructions for this...
|
||||
if ((!IsMemset || ZeroMemset) &&
|
||||
Subtarget->hasNEON() &&
|
||||
!F->getAttributes().hasAttribute(AttributeSet::FunctionIndex,
|
||||
Attribute::NoImplicitFloat)) {
|
||||
if ((!IsMemset || ZeroMemset) && Subtarget->hasNEON() &&
|
||||
!F->hasFnAttribute(Attribute::NoImplicitFloat)) {
|
||||
bool Fast;
|
||||
if (Size >= 16 &&
|
||||
(memOpAlign(SrcAlign, DstAlign, 16) ||
|
||||
|
@ -348,6 +348,5 @@ bool ARMSubtarget::useMovt(const MachineFunction &MF) const {
|
||||
// immediates as it is inherently position independent, and may be out of
|
||||
// range otherwise.
|
||||
return UseMovt && (isTargetWindows() ||
|
||||
!MF.getFunction()->getAttributes().hasAttribute(
|
||||
AttributeSet::FunctionIndex, Attribute::MinSize));
|
||||
!MF.getFunction()->hasFnAttribute(Attribute::MinSize));
|
||||
}
|
||||
|
@ -180,11 +180,8 @@ ARMBaseTargetMachine::~ARMBaseTargetMachine() {}
|
||||
|
||||
const ARMSubtarget *
|
||||
ARMBaseTargetMachine::getSubtargetImpl(const Function &F) const {
|
||||
AttributeSet FnAttrs = F.getAttributes();
|
||||
Attribute CPUAttr =
|
||||
FnAttrs.getAttribute(AttributeSet::FunctionIndex, "target-cpu");
|
||||
Attribute FSAttr =
|
||||
FnAttrs.getAttribute(AttributeSet::FunctionIndex, "target-features");
|
||||
Attribute CPUAttr = F.getFnAttribute("target-cpu");
|
||||
Attribute FSAttr = F.getFnAttribute("target-features");
|
||||
|
||||
std::string CPU = !CPUAttr.hasAttribute(Attribute::None)
|
||||
? CPUAttr.getValueAsString().str()
|
||||
@ -198,8 +195,7 @@ ARMBaseTargetMachine::getSubtargetImpl(const Function &F) const {
|
||||
// function before we can generate a subtarget. We also need to use
|
||||
// it as a key for the subtarget since that can be the only difference
|
||||
// between two functions.
|
||||
Attribute SFAttr =
|
||||
FnAttrs.getAttribute(AttributeSet::FunctionIndex, "use-soft-float");
|
||||
Attribute SFAttr = F.getFnAttribute("use-soft-float");
|
||||
bool SoftFloat = !SFAttr.hasAttribute(Attribute::None)
|
||||
? SFAttr.getValueAsString() == "true"
|
||||
: Options.UseSoftFloat;
|
||||
|
@ -1005,11 +1005,8 @@ bool Thumb2SizeReduce::runOnMachineFunction(MachineFunction &MF) {
|
||||
TII = static_cast<const Thumb2InstrInfo *>(STI->getInstrInfo());
|
||||
|
||||
// Optimizing / minimizing size?
|
||||
AttributeSet FnAttrs = MF.getFunction()->getAttributes();
|
||||
OptimizeSize = FnAttrs.hasAttribute(AttributeSet::FunctionIndex,
|
||||
Attribute::OptimizeForSize);
|
||||
MinimizeSize =
|
||||
FnAttrs.hasAttribute(AttributeSet::FunctionIndex, Attribute::MinSize);
|
||||
OptimizeSize = MF.getFunction()->hasFnAttribute(Attribute::OptimizeForSize);
|
||||
MinimizeSize = MF.getFunction()->hasFnAttribute(Attribute::MinSize);
|
||||
|
||||
BlockInfo.clear();
|
||||
BlockInfo.resize(MF.getNumBlockIDs());
|
||||
|
Loading…
Reference in New Issue
Block a user