================ @@ -4782,6 +4782,30 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, Function *F = CGM.getIntrinsic(Intrinsic::frameaddress, AllocaInt8PtrTy); return RValue::get(Builder.CreateCall(F, Depth)); } + case Builtin::BI__builtin_stack_address: { + IntegerType *SPRegType; + StringRef SPRegName; + switch (getTarget().getTriple().getArch()) { + case Triple::x86: + SPRegType = Int32Ty; + SPRegName = "esp"; + break; + case Triple::x86_64: + SPRegType = Int64Ty; + SPRegName = "rsp"; + break; + default: + llvm_unreachable("Intrinsic __builtin_stack_address is not supported for " + "the target architecture"); + } ---------------- philnik777 wrote:
You should probably make this a target-specific builtin. The compiler shouldn't crash just because someone used an attribute on a platform where it's not supported. https://github.com/llvm/llvm-project/pull/121332 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits