[Mlir-commits] [mlir] [MLIR] Add support for frame pointers in MLIR (PR #72145)

Radu Salavat llvmlistbot at llvm.org
Fri Nov 24 01:38:40 PST 2023


================
@@ -47,6 +47,15 @@ def LinkageAttr : LLVM_Attr<"Linkage", "linkage"> {
   let assemblyFormat = "`<` $linkage `>`";
 }
 
+//===----------------------------------------------------------------------===//
+// FramePointerKindAttr
+//===----------------------------------------------------------------------===//
+
+def FramePointerKindAttr : LLVM_Attr<"FramePointerKind", ""> {
+  let parameters = (ins "framePointerKind::FramePointerKind":$framePointerKind);
+  let assemblyFormat = "$framePointerKind";
----------------
Radu2k wrote:

Thanks for the suggestion, @joker-eph!

As mentioned above, even if the mnemonic is set to either 'fp' or 'framePointerKind', the results is still `#llvm.[mnemonic]<[value]> `, repectively (#llvm.fp<"non-leaf">, #llvm.framePointerKind<"non-leaf">). 

Setting the mnemonic to `framePointerKind` and adding `'<' '>'` makes lowering from MLIR to LLVM IR to work appropriately but in MLIR the parameter has to be assigned as `llvm.func @frame_pointer_func() attributes {frame_pointer = #llvm.framePointerKind<"non-leaf">} `. 

is this the right behaviour? If so, I will go ahead and update the patch. 


https://github.com/llvm/llvm-project/pull/72145


More information about the Mlir-commits mailing list