mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-14 14:24:05 +00:00
Simplify and rename function overrideFunctionAttributes. NFC.
This is in preparation to making changes needed to stop resetting NoFramePointerElim in resetTargetOptions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238079 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -51,3 +51,23 @@ bool TargetOptions::HonorSignDependentRoundingFPMath() const {
|
||||
StringRef TargetOptions::getTrapFunctionName() const {
|
||||
return TrapFuncName;
|
||||
}
|
||||
|
||||
|
||||
void llvm::setFunctionAttributes(StringRef CPU, StringRef Features, Module &M) {
|
||||
for (auto &F : M) {
|
||||
auto &Ctx = F.getContext();
|
||||
AttributeSet Attrs = F.getAttributes(), NewAttrs;
|
||||
|
||||
if (!CPU.empty())
|
||||
NewAttrs = NewAttrs.addAttribute(Ctx, AttributeSet::FunctionIndex,
|
||||
"target-cpu", CPU);
|
||||
|
||||
if (!Features.empty())
|
||||
NewAttrs = NewAttrs.addAttribute(Ctx, AttributeSet::FunctionIndex,
|
||||
"target-features", Features);
|
||||
|
||||
// Let NewAttrs override Attrs.
|
||||
NewAttrs = Attrs.addAttributes(Ctx, AttributeSet::FunctionIndex, NewAttrs);
|
||||
F.setAttributes(NewAttrs);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user