23 result.properties.sym_name = StringAttr::get(ctx, funcOp.getName());
24 result.properties.function_type = TypeAttr::get(llvmFuncType);
26 llvm::SmallDenseSet<StringRef> odsAttrNames(
27 LLVM::LLVMFuncOp::getAttributeNames().begin(),
28 LLVM::LLVMFuncOp::getAttributeNames().end());
33 funcOp->getDiscardableAttrDictionary().
getValue()) {
34 StringRef attrName = attr.getName().strref();
36 if (odsAttrNames.contains(attrName)) {
37 LDBG() <<
"LLVM specific attributes: " << attrName
38 <<
"should use llvm.* prefix, discarding it";
42 StringRef inherent = attrName;
43 if (inherent.consume_front(
"llvm.") && odsAttrNames.contains(inherent))
44 inherentAttrs.
set(inherent, attr.getValue());
46 result.discardableAttrs.push_back(attr);
50 if (!inherentAttrs.
empty()) {
53 return funcOp.emitOpError(
"invalid llvm.func property");
55 if (failed(LLVM::LLVMFuncOp::setPropertiesFromAttr(
result.properties, dict,
MLIRContext is the top-level object for a collection of MLIR operations.
FailureOr< LoweredLLVMFuncAttrs > lowerDiscardableAttrsForLLVMFunc(FunctionOpInterface funcOp, Type llvmFuncType)
Partition funcOp's discardables for llvm.func: sym_name, function_type, and typed properties from llv...