[rebranch][IRGen] Update uses of AttributeList functions

The functions in llvm-project `AttributeList` have been
renamed/refactored to help remove uses of `AttributeList::*Index`.

Update to use these new functions where possible. There's one use of
`AttrIndex` remaining as `replaceAttributeTypeAtIndex` still takes the
index and there is no `param` equivalent. We could add one locally, but
presumably that will be added eventually.
This commit is contained in:
Ben Barham
2021-11-13 11:29:19 +10:00
parent a6f99a08c4
commit 30be5117d2
21 changed files with 96 additions and 153 deletions

View File

@@ -942,8 +942,8 @@ llvm::Constant *swift::getRuntimeFn(llvm::Module &Module,
else
buildFnAttr.addAttribute(Attr);
}
fn->addAttributes(llvm::AttributeList::FunctionIndex, buildFnAttr);
fn->addAttributes(llvm::AttributeList::ReturnIndex, buildRetAttr);
fn->addFnAttrs(buildFnAttr);
fn->addRetAttrs(buildRetAttr);
fn->addParamAttrs(0, buildFirstParamAttr);
}
@@ -1181,14 +1181,10 @@ void IRGenerator::addBackDeployedObjCActorInitialization(ClassDecl *ClassDecl) {
llvm::AttributeList IRGenModule::getAllocAttrs() {
if (AllocAttrs.isEmpty()) {
AllocAttrs = llvm::AttributeList().addRetAttribute(
getLLVMContext(), llvm::Attribute::NoAlias);
AllocAttrs =
llvm::AttributeList::get(getLLVMContext(),
llvm::AttributeList::ReturnIndex,
llvm::Attribute::NoAlias);
AllocAttrs =
AllocAttrs.addAttribute(getLLVMContext(),
llvm::AttributeList::FunctionIndex,
llvm::Attribute::NoUnwind);
AllocAttrs.addFnAttribute(getLLVMContext(), llvm::Attribute::NoUnwind);
}
return AllocAttrs;
}
@@ -1205,7 +1201,7 @@ void IRGenModule::setHasNoFramePointer(llvm::AttrBuilder &Attrs) {
void IRGenModule::setHasNoFramePointer(llvm::Function *F) {
llvm::AttrBuilder b;
setHasNoFramePointer(b);
F->addAttributes(llvm::AttributeList::FunctionIndex, b);
F->addFnAttrs(b);
}
/// Construct initial function attributes from options.
@@ -1229,8 +1225,7 @@ void IRGenModule::constructInitialFnAttributes(llvm::AttrBuilder &Attrs,
llvm::AttributeList IRGenModule::constructInitialAttributes() {
llvm::AttrBuilder b;
constructInitialFnAttributes(b);
return llvm::AttributeList::get(getLLVMContext(),
llvm::AttributeList::FunctionIndex, b);
return llvm::AttributeList().addFnAttributes(getLLVMContext(), b);
}
llvm::ConstantInt *IRGenModule::getInt32(uint32_t value) {