return getAttributes().getAttribute(i, Kind);
}
+ /// Get the attribute of a given kind for the function.
+ Attribute getFnAttr(StringRef Kind) const {
+ return getAttributes().getFnAttr(Kind);
+ }
+
+ /// Get the attribute of a given kind for the function.
+ Attribute getFnAttr(Attribute::AttrKind Kind) const {
+ return getAttributes().getFnAttr(Kind);
+ }
+
/// Get the attribute of a given kind from a given arg
Attribute getParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) const {
assert(ArgNo < getNumArgOperands() && "Out of bounds");
void VFABI::getVectorVariantNames(
const CallInst &CI, SmallVectorImpl<std::string> &VariantMappings) {
- const StringRef S =
- CI.getAttribute(AttributeList::FunctionIndex, VFABI::MappingsAttrName)
- .getValueAsString();
+ const StringRef S = CI.getFnAttr(VFABI::MappingsAttrName).getValueAsString();
if (S.empty())
return;
Value *AllocaReplacement = ArgAllocas[AllocArgIndex];
if (!AllocaReplacement) {
auto AddressSpace = UseCall->getType()->getPointerAddressSpace();
- auto *ArgType = UseCall
- ->getAttribute(AttributeList::FunctionIndex,
- Attribute::Preallocated)
- .getValueAsType();
+ auto *ArgType =
+ UseCall->getFnAttr(Attribute::Preallocated).getValueAsType();
auto *InsertBefore = PreallocatedSetup->getNextNonDebugInstruction();
Builder.SetInsertPoint(InsertBefore);
auto *Alloca =
Mappings.push_back("_ZGVnN8v_g");
Mappings.push_back("_ZGVnN2v_g(custom_vg)");
VFABI::setVectorVariantNames(CI, Mappings);
- const StringRef S = CI->getAttribute(AttributeList::FunctionIndex,
- "vector-function-abi-variant")
- .getValueAsString();
+ const StringRef S =
+ CI->getFnAttr("vector-function-abi-variant").getValueAsString();
EXPECT_EQ(S, "_ZGVnN8v_g,_ZGVnN2v_g(custom_vg)");
}