mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 19:12:56 +02:00
Mips: 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) llvm-svn: 229221
This commit is contained in:
parent
645aebde47
commit
9bf6adbe7c
@ -358,10 +358,7 @@ void MipsAsmPrinter::EmitFunctionBodyStart() {
|
|||||||
|
|
||||||
MCInstLowering.Initialize(&MF->getContext());
|
MCInstLowering.Initialize(&MF->getContext());
|
||||||
|
|
||||||
bool IsNakedFunction =
|
bool IsNakedFunction = MF->getFunction()->hasFnAttribute(Attribute::Naked);
|
||||||
MF->getFunction()->
|
|
||||||
getAttributes().hasAttribute(AttributeSet::FunctionIndex,
|
|
||||||
Attribute::Naked);
|
|
||||||
if (!IsNakedFunction)
|
if (!IsNakedFunction)
|
||||||
emitFrameDirective();
|
emitFrameDirective();
|
||||||
|
|
||||||
|
@ -121,11 +121,8 @@ MipselTargetMachine(const Target &T, StringRef TT,
|
|||||||
|
|
||||||
const MipsSubtarget *
|
const MipsSubtarget *
|
||||||
MipsTargetMachine::getSubtargetImpl(const Function &F) const {
|
MipsTargetMachine::getSubtargetImpl(const Function &F) const {
|
||||||
AttributeSet FnAttrs = F.getAttributes();
|
Attribute CPUAttr = F.getFnAttribute("target-cpu");
|
||||||
Attribute CPUAttr =
|
Attribute FSAttr = F.getFnAttribute("target-features");
|
||||||
FnAttrs.getAttribute(AttributeSet::FunctionIndex, "target-cpu");
|
|
||||||
Attribute FSAttr =
|
|
||||||
FnAttrs.getAttribute(AttributeSet::FunctionIndex, "target-features");
|
|
||||||
|
|
||||||
std::string CPU = !CPUAttr.hasAttribute(Attribute::None)
|
std::string CPU = !CPUAttr.hasAttribute(Attribute::None)
|
||||||
? CPUAttr.getValueAsString().str()
|
? CPUAttr.getValueAsString().str()
|
||||||
@ -134,19 +131,16 @@ MipsTargetMachine::getSubtargetImpl(const Function &F) const {
|
|||||||
? FSAttr.getValueAsString().str()
|
? FSAttr.getValueAsString().str()
|
||||||
: TargetFS;
|
: TargetFS;
|
||||||
bool hasMips16Attr =
|
bool hasMips16Attr =
|
||||||
!FnAttrs.getAttribute(AttributeSet::FunctionIndex, "mips16")
|
!F.getFnAttribute("mips16").hasAttribute(Attribute::None);
|
||||||
.hasAttribute(Attribute::None);
|
|
||||||
bool hasNoMips16Attr =
|
bool hasNoMips16Attr =
|
||||||
!FnAttrs.getAttribute(AttributeSet::FunctionIndex, "nomips16")
|
!F.getFnAttribute("nomips16").hasAttribute(Attribute::None);
|
||||||
.hasAttribute(Attribute::None);
|
|
||||||
|
|
||||||
// FIXME: This is related to the code below to reset the target options,
|
// FIXME: This is related to the code below to reset the target options,
|
||||||
// we need to know whether or not the soft float flag is set on the
|
// we need to know whether or not the soft float flag is set on the
|
||||||
// function before we can generate a subtarget. We also need to use
|
// 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
|
// it as a key for the subtarget since that can be the only difference
|
||||||
// between two functions.
|
// between two functions.
|
||||||
Attribute SFAttr =
|
Attribute SFAttr = F.getFnAttribute("use-soft-float");
|
||||||
FnAttrs.getAttribute(AttributeSet::FunctionIndex, "use-soft-float");
|
|
||||||
bool softFloat = !SFAttr.hasAttribute(Attribute::None)
|
bool softFloat = !SFAttr.hasAttribute(Attribute::None)
|
||||||
? SFAttr.getValueAsString() == "true"
|
? SFAttr.getValueAsString() == "true"
|
||||||
: Options.UseSoftFloat;
|
: Options.UseSoftFloat;
|
||||||
|
Loading…
Reference in New Issue
Block a user