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. An

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 func

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 ass

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 compi

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 clob

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

2023-06-21 Thread Wang, Yanzhang via Gcc-patches
-- > From: Jeff Law > Sent: 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:5

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 a

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

2023-06-06 Thread Wang, Yanzhang via Gcc-patches
- > From: Jeff Law > Sent: Wednesday, June 7, 2023 10:13 AM > 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, W

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 n

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

2023-06-04 Thread Wang, Yanzhang via Gcc-patches
day, June 5, 2023 9:04 AM > To: 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_pointe

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

2023-06-04 Thread Wang, Yanzhang via Gcc-patches
t: Re: [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-

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

2023-06-04 Thread Li, Pan2 via Gcc-patches
Some nit comments. +static bool +riscv_frame_pointer_required (void) +{ + if (riscv_save_frame_pointer && !crtl->is_leaf) +return true; + + return false; +} Can be simplified to return riscv_save_frame_pointer && !crtl->is_leaf; + riscv_save_frame_pointer = false; + if (TARGET_OMIT_LEAF_

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. (riscv_