mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-12 13:38:21 +00:00
CodeGen: 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) Also, add `Function::getFnStackAlignment()`, and canonicalize: getAttributes().getStackAlignment(AttributeSet::FunctionIndex) => getFnStackAlignment() git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229208 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -90,8 +90,7 @@ bool StackProtector::runOnFunction(Function &Fn) {
|
||||
DT = DTWP ? &DTWP->getDomTree() : nullptr;
|
||||
TLI = TM->getSubtargetImpl(Fn)->getTargetLowering();
|
||||
|
||||
Attribute Attr = Fn.getAttributes().getAttribute(
|
||||
AttributeSet::FunctionIndex, "stack-protector-buffer-size");
|
||||
Attribute Attr = Fn.getFnAttribute("stack-protector-buffer-size");
|
||||
if (Attr.isStringAttribute() &&
|
||||
Attr.getValueAsString().getAsInteger(10, SSPBufferSize))
|
||||
return false; // Invalid integer string
|
||||
@ -201,15 +200,12 @@ bool StackProtector::HasAddressTaken(const Instruction *AI) {
|
||||
bool StackProtector::RequiresStackProtector() {
|
||||
bool Strong = false;
|
||||
bool NeedsProtector = false;
|
||||
if (F->getAttributes().hasAttribute(AttributeSet::FunctionIndex,
|
||||
Attribute::StackProtectReq)) {
|
||||
if (F->hasFnAttribute(Attribute::StackProtectReq)) {
|
||||
NeedsProtector = true;
|
||||
Strong = true; // Use the same heuristic as strong to determine SSPLayout
|
||||
} else if (F->getAttributes().hasAttribute(AttributeSet::FunctionIndex,
|
||||
Attribute::StackProtectStrong))
|
||||
} else if (F->hasFnAttribute(Attribute::StackProtectStrong))
|
||||
Strong = true;
|
||||
else if (!F->getAttributes().hasAttribute(AttributeSet::FunctionIndex,
|
||||
Attribute::StackProtect))
|
||||
else if (!F->hasFnAttribute(Attribute::StackProtect))
|
||||
return false;
|
||||
|
||||
for (const BasicBlock &BB : *F) {
|
||||
|
Reference in New Issue
Block a user