[PATCH] RISCV: Add -m(no)-omit-leaf-frame-pointer support.

2023-07-13 Thread yanzhang.wang--- via Gcc-patches
From: Yanzhang Wang gcc/ChangeLog: * config/riscv/riscv.cc (riscv_save_reg_p): Save ra for leaf when enabling -mno-omit-leaf-frame-pointer (riscv_option_override): Override omit-frame-pointer. (riscv_frame_pointer_required): Save s0 for non-leaf function

Re: [PATCH] RISCV: Add -m(no)-omit-leaf-frame-pointer support.

2023-06-26 Thread Jeff Law via Gcc-patches
On 6/26/23 08:50, Kito Cheng wrote: LLVM will try to find scratch register even after RA to resolve the long jump issue. so maybe we could consider similar approach? And I guess the most complicate part would be the scratch register is not found, and require spill/reload after RA. Right.

Re: [PATCH] RISCV: Add -m(no)-omit-leaf-frame-pointer support.

2023-06-26 Thread Kito Cheng via Gcc-patches
LLVM will try to find scratch register even after RA to resolve the long jump issue. so maybe we could consider similar approach? And I guess the most complicate part would be the scratch register is not found, and require spill/reload after RA. Jeff Law via Gcc-patches 於 2023年6月26日 週一,22:31寫道:

Re: [PATCH] RISCV: Add -m(no)-omit-leaf-frame-pointer support.

2023-06-26 Thread Jeff Law via Gcc-patches
On 6/25/23 12:45, Stefan O'Rear wrote: To clarify: are you proposing to make ra (or t1 in the hypothetical) a fixed register for all functions, or only those heuristically identified as potentially larger than 1MiB? And would this extend to forcing the creation of stack frames for all

Re: [PATCH] RISCV: Add -m(no)-omit-leaf-frame-pointer support.

2023-06-25 Thread Stefan O'Rear via Gcc-patches
On Sun, Jun 25, 2023, at 8:49 AM, Jeff Law wrote: > On 6/24/23 19:40, Stefan O'Rear wrote: >> On Sat, Jun 24, 2023, at 11:01 AM, Jeff Law via Gcc-patches wrote: >>> On 6/21/23 02:14, Wang, Yanzhang wrote: Hi Jeff, sorry for the late reply. > The long branch handling is done at the

Re: [PATCH] RISCV: Add -m(no)-omit-leaf-frame-pointer support.

2023-06-25 Thread Jeff Law via Gcc-patches
On 6/24/23 19:40, Stefan O'Rear wrote: On Sat, Jun 24, 2023, at 11:01 AM, Jeff Law via Gcc-patches wrote: On 6/21/23 02:14, Wang, Yanzhang wrote: Hi Jeff, sorry for the late reply. The long branch handling is done at the assembler level. So the clobbering of $ra isn't visible to the

Re: [PATCH] RISCV: Add -m(no)-omit-leaf-frame-pointer support.

2023-06-24 Thread Stefan O'Rear via Gcc-patches
On Sat, Jun 24, 2023, at 11:01 AM, Jeff Law via Gcc-patches wrote: > On 6/21/23 02:14, Wang, Yanzhang wrote: >> Hi Jeff, sorry for the late reply. >> >>> The long branch handling is done at the assembler level. So the clobbering >>> of $ra isn't visible to the compiler. Thus the compiler has to

Re: [PATCH] RISCV: Add -m(no)-omit-leaf-frame-pointer support.

2023-06-24 Thread Jeff Law via Gcc-patches
On 6/21/23 02:14, Wang, Yanzhang wrote: Hi Jeff, sorry for the late reply. The long branch handling is done at the assembler level. So the clobbering of $ra isn't visible to the compiler. Thus the compiler has to be extremely careful to not hold values in $ra because the assembler may

RE: [PATCH] RISCV: Add -m(no)-omit-leaf-frame-pointer support.

2023-06-21 Thread Wang, Yanzhang via Gcc-patches
Thursday, June 8, 2023 11:05 PM > To: Wang, Yanzhang ; gcc-patches@gcc.gnu.org > Cc: juzhe.zh...@rivai.ai; kito.ch...@sifive.com; Li, Pan2 > > Subject: Re: [PATCH] RISCV: Add -m(no)-omit-leaf-frame-pointer support. > > > > On 6/6/23 21:50, Wang, Yanzhang wrote: > >

Re: [PATCH] RISCV: Add -m(no)-omit-leaf-frame-pointer support.

2023-06-08 Thread Jeff Law via Gcc-patches
On 6/6/23 21:50, Wang, Yanzhang wrote: Hi Jeff, Thanks your comments. I have few questions that I don't quite understand. One of the things that needs to be upstreamed is long jump support within a function. Essentially once a function reaches 1M in size we have the real possibility that

RE: [PATCH] RISCV: Add -m(no)-omit-leaf-frame-pointer support.

2023-06-06 Thread Wang, Yanzhang via Gcc-patches
> To: Wang, Yanzhang ; gcc-patches@gcc.gnu.org > Cc: juzhe.zh...@rivai.ai; kito.ch...@sifive.com; Li, Pan2 > > Subject: Re: [PATCH] RISCV: Add -m(no)-omit-leaf-frame-pointer support. > > > > On 6/4/23 20:49, Wang, Yanzhang wrote: > > Hi Jeff, > > > > Yes

Re: [PATCH] RISCV: Add -m(no)-omit-leaf-frame-pointer support.

2023-06-06 Thread Jeff Law via Gcc-patches
On 6/4/23 20:49, Wang, Yanzhang wrote: Hi Jeff, Yes, there's a requirement to support backtrace based on the fp+ra. And the unwind/cfa is not acceptable because it will add additional sections to the binary. Currently, -fno-omit-frame-pointer can not save the ra for the leaf function. So we

RE: [PATCH] RISCV: Add -m(no)-omit-leaf-frame-pointer support.

2023-06-04 Thread Wang, Yanzhang via Gcc-patches
Wang, Yanzhang ; gcc-patches@gcc.gnu.org > Cc: juzhe.zh...@rivai.ai; kito.ch...@sifive.com > Subject: RE: [PATCH] RISCV: Add -m(no)-omit-leaf-frame-pointer support. > > Some nit comments. > > +static bool > +riscv_frame_pointer_required (void) > +{ > + i

Re: [PATCH] RISCV: Add -m(no)-omit-leaf-frame-pointer support.

2023-06-04 Thread Wang, Yanzhang via Gcc-patches
: [PATCH] RISCV: Add -m(no)-omit-leaf-frame-pointer support. On 6/2/23 01:07, yanzhang.wang--- via Gcc-patches wrote: > From: Yanzhang Wang > > gcc/ChangeLog: > >* config/riscv/riscv.cc (riscv_save_reg_p): Save ra for leaf > when enabling -mno-omit-

RE: [PATCH] RISCV: Add -m(no)-omit-leaf-frame-pointer support.

2023-06-04 Thread Li, Pan2 via Gcc-patches
me_pointer implicitly? Pan -Original Message- From: Wang, Yanzhang Sent: Friday, June 2, 2023 3:07 PM To: gcc-patches@gcc.gnu.org Cc: juzhe.zh...@rivai.ai; kito.ch...@sifive.com; Li, Pan2 ; Wang, Yanzhang Subject: [PATCH] RISCV: Add -m(no)-omit-leaf-frame-pointer support. From: Yanzhan

Re: [PATCH] RISCV: Add -m(no)-omit-leaf-frame-pointer support.

2023-06-02 Thread Jeff Law via Gcc-patches
On 6/2/23 01:07, yanzhang.wang--- via Gcc-patches wrote: From: Yanzhang Wang gcc/ChangeLog: * config/riscv/riscv.cc (riscv_save_reg_p): Save ra for leaf when enabling -mno-omit-leaf-frame-pointer (riscv_option_override): Override omit-frame-pointer.

[PATCH] RISCV: Add -m(no)-omit-leaf-frame-pointer support.

2023-06-02 Thread yanzhang.wang--- via Gcc-patches
From: Yanzhang Wang gcc/ChangeLog: * config/riscv/riscv.cc (riscv_save_reg_p): Save ra for leaf when enabling -mno-omit-leaf-frame-pointer (riscv_option_override): Override omit-frame-pointer. (riscv_frame_pointer_required): Save s0 for non-leaf function