[clang] [CIR] Implement __builtin_return_address and __builtin_frame_address (PR #153698)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 14 15:56:14 PDT 2025
================
@@ -2210,6 +2210,67 @@ def CIR_CallOp : CIR_CallOpBase<"call", [NoRegionArguments]> {
];
}
+//===----------------------------------------------------------------------===//
+// ReturnAddrOp and FrameAddrOp
+//===----------------------------------------------------------------------===//
+
+class CIR_FuncAddrBuiltinOp<string mnemonic> : CIR_Op<mnemonic, []> {
+ let arguments = (ins CIR_UInt32:$level);
+ let results = (outs CIR_VoidPtrType:$result);
+ let assemblyFormat = [{
+ `(` $level `)` attr-dict
+ }];
+}
+
+def CIR_ReturnAddrOp : CIR_FuncAddrBuiltinOp<"return_address"> {
+ let summary =
+ "The return address of the current function, or of one of its callers";
+
+ let description = [{
+ Represents call to builtin function ` __builtin_return_address` in CIR.
----------------
andykaylor wrote:
```suggestion
Represents a call to builtin function ` __builtin_return_address` in CIR.
```
https://github.com/llvm/llvm-project/pull/153698
More information about the cfe-commits
mailing list