moorabbit wrote: > I'm not sure if there is any expected difference in behavior between > STACKSAVE and STACKADDRESS
On most targets, the behavior is the same. SPARC is an exception. `STACKADDRESS` needs to be expanded so it returns the starting address of the stack region that's available to callees. On 64-bit SPARCv9, this isn't just the value of a physical register. Based on GCC's source code, it should be calculated as `%sp + BIAS + register save area` If you used `STACKSAVE`, you'd end up with the wrong value. > but we should at least be able to reuse something here. Could we add a check for SPARC (i.e. an `if (DAG.getTarget().getTargetTriple().isSPARC()` inside a `case ISD::STACKADDRESS`) when handling the `llvm.stackaddress` intrinsic in `visitIntrinsicCall()`? https://github.com/llvm/llvm-project/blob/2bbc6147138187946616c1b30743e09825fb61b8/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp#L6500 That way, we could emit/reuse the `STACKSAVE` opcode on most targets, and do the right arithmetic operations for SPARC. https://github.com/llvm/llvm-project/pull/148281 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits