File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
include/mlir/Dialect/LLVMIR Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -787,6 +787,7 @@ def LLVM_LLVMFuncOp
787787 Arguments<(ins DefaultValuedAttr<Linkage,
788788 "Linkage::External">:$linkage,
789789 OptionalAttr<FlatSymbolRefAttr>:$personality,
790+ OptionalAttr<StrAttr>:$gc,
790791 OptionalAttr<ArrayAttr>:$passthrough)> {
791792 let summary = "LLVM dialect function, has wrapped LLVM IR function type";
792793
Original file line number Diff line number Diff line change @@ -940,6 +940,15 @@ LogicalResult ModuleTranslation::convertOneFunction(LLVMFuncOp func) {
940940 llvmFunc->setPersonalityFn (pfunc);
941941 }
942942
943+ // Check the gc strategy and set it
944+ auto gcStrategy = func.gc ();
945+ if (gcStrategy.hasValue ()) {
946+ llvmFunc->setGC (gcStrategy.getValue ().str ());
947+ }
948+ auto gcLeafAttr = func.getAttrOfType <BoolAttr>(" gc-leaf-function" );
949+ if (gcLeafAttr && gcLeafAttr.getValue ())
950+ llvmFunc->addFnAttr (" gc-leaf-function" , " 1" );
951+
943952 // First, create all blocks so we can jump to them; (in topological order
944953 // to ensure defs are converted before uses)
945954 auto blocks = topologicalSort (func);
You can’t perform that action at this time.
0 commit comments