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 StringRef attrName = attr.getName().strref();
35 if (odsAttrNames.contains(attrName)) {
36 LDBG() <<
"LLVM specific attributes: " << attrName
37 <<
"should use llvm.* prefix, discarding it";
41 StringRef inherent = attrName;
42 if (inherent.consume_front(
"llvm.") && odsAttrNames.contains(inherent))
43 inherentAttrs.
set(inherent, attr.getValue());
45 result.discardableAttrs.push_back(attr);
49 if (!inherentAttrs.
empty()) {
52 return funcOp.emitOpError(
"invalid llvm.func property");
54 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...