================
@@ -1706,7 +1706,12 @@ CIRGenFunction::emitX86BuiltinExpr(unsigned builtinID, 
const CallExpr *expr) {
                                     cir::SyncScopeKind::SingleThread));
     return mlir::Value{};
   }
-  case X86::BI_AddressOfReturnAddress:
+  case X86::BI_AddressOfReturnAddress: {
+    mlir::Location loc = getLoc(expr->getExprLoc());
+    mlir::Value addr = emitIntrinsicCallOp(
+        builder, loc, "addressofreturnaddress", allocaInt8PtrTy);
----------------
Luhaocong wrote:

Done, but I have a question about do we need to consider the address space for 
the returned pointer? I see CIR lowering for `__builtin_frame_address` ignores 
address space completely:

**CIR CodeGen&Lowering:**
https://github.com/llvm/llvm-project/blob/9a03a30706cca40b93146f379fb5faa75d417af5/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp#L882-L884

https://github.com/llvm/llvm-project/blob/9a03a30706cca40b93146f379fb5faa75d417af5/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp#L1647-L1654

**Clang CodeGen:**
https://github.com/llvm/llvm-project/blob/c24f66e33bcbc82e40f5dd94cda12430dc819638/clang/lib/CodeGen/CGBuiltin.cpp#L4709-L4714

https://github.com/llvm/llvm-project/pull/171974
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to