* Adding log files to gcc dump and adding testcase-rtl
@ 2022-05-25 4:55 RICHU NORMAN
2022-05-25 10:44 ` David Malcolm
0 siblings, 1 reply; 5+ messages in thread
From: RICHU NORMAN @ 2022-05-25 4:55 UTC (permalink / raw)
To: gcc
[-- Attachment #1: Type: text/plain, Size: 650 bytes --]
Hi,
I am a beginner in gcc. I am trying to add an instruction to riscv-gcc.It
would be helpful could help with a few tips .
1.How to write comments to rtl or create a custom log file to log comments
to rtl dump?
2.How to run testsuite ?
3.Is there a way to directly run an rtl test case? Like giving rtl input
and checking the generated asm.(Like in the attachment which is posted in
bugzilla[ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82815 ])
Please suggest a way to run the gcc-testsuite with these cases. Pfa
--
Richu Norman
Research Scholar
Department of Computer Science
Cochin University of Science and Technology
Ph : (+91)-8848455627
[-- Attachment #2: testcase_read-rtl.c --]
[-- Type: text/x-c-code, Size: 3109 bytes --]
/* { dg-do compile } */
/* { dg-options "-march=armv7e-m -mfloat-abi=hard -mfpu=fpv5-d16" } */
double __RTL (startwith ("mach")) foo (void)
{
(function "foo"
(insn-chain
(cnote 1 NOTE_INSN_DELETED)
(cnote 3 [bb 2] NOTE_INSN_BASIC_BLOCK)
(cinsn/f 16 (parallel [
(set (mem/c:BLK (pre_modify:SI (reg/f:SI sp)
(plus:SI (reg/f:SI sp)
(const_int -8))) [1 A8])
(unspec:BLK [
(reg:SI r4)
] UNSPEC_PUSH_MULT))
(use (reg/f:SI r7))
]) "foo.c":2
(expr_list:REG_FRAME_RELATED_EXPR (sequence [
(set/f (reg/f:SI sp)
(plus:SI (reg/f:SI sp)
(const_int -8)))
(set/f (mem/c:SI (reg/f:SI sp) [1 S4 A32])
(reg:SI r4))
(set/f (mem/c:SI (plus:SI (reg/f:SI sp)
(const_int 4)) [1 S4 A32])
(reg/f:SI r7))
])))
(cinsn/f 17 (set (reg/f:SI r7)
(plus:SI (reg/f:SI sp)
(const_int 0))) "foo.c":2)
(cnote 18 NOTE_INSN_PROLOGUE_END)
(cnote 2 NOTE_INSN_FUNCTION_BEG)
(cinsn 5 (set (reg:DF r3 [orig:110 _1 ] [110])
(const_double:DF 1.0e+0 [0x0.8p+1])) "foo.c":3)
(cinsn 8 (set (reg:DF s14 [orig:111 <retval> ] [111])
(reg:DF r3 [orig:110 _1 ] [110])) "foo.c":3)
(cinsn 12 (set (reg/i:DF s0)
(reg:DF s14 [orig:111 <retval> ] [111])) "foo.c":4)
(cinsn 13 (use (reg/i:DF s0)) "foo.c":4)
(cnote 19 NOTE_INSN_EPILOGUE_BEG)
(cinsn 20 (unspec_volatile [
(const_int 0)
] VUNSPEC_BLOCKAGE) "foo.c":4)
(cinsn/f 21 (set (reg/f:SI sp)
(reg/f:SI r7)) "foo.c":4
(expr_list:REG_CFA_ADJUST_CFA (set (reg/f:SI sp)
(reg/f:SI r7))))
(cinsn 22 (unspec:SI [
(reg/f:SI sp)
] UNSPEC_REGISTER_USE) "foo.c":4)
(cinsn/f 23 (parallel [
(set/f (reg/f:SI sp)
(plus:SI (reg/f:SI sp)
(const_int 8)))
(set/f (reg:SI r4)
(mem/c:SI (reg/f:SI sp) [1 S4 A32]))
(set/f (reg/f:SI r7)
(mem/c:SI (plus:SI (reg/f:SI sp)
(const_int 4)) [1 S4 A32]))
]) "foo.c":4
(expr_list:REG_CFA_ADJUST_CFA (set (reg/f:SI sp)
(plus:SI (reg/f:SI sp)
(const_int 8)))
(expr_list:REG_CFA_RESTORE (reg/f:SI r7)
(expr_list:REG_CFA_RESTORE (reg:SI r4)))))
(cjump_insn 24 (simple_return) "foo.c":4)
(cbarrier 25)
(cnote 15 NOTE_INSN_DELETED)
) ;; insn-chain
(crtl
(return_rtx
(reg/i:DF s0)
) ;; return_rtx
) ;; crtl
) ;; function "foo"
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Adding log files to gcc dump and adding testcase-rtl
2022-05-25 4:55 Adding log files to gcc dump and adding testcase-rtl RICHU NORMAN
@ 2022-05-25 10:44 ` David Malcolm
2022-05-25 10:54 ` David Malcolm
2022-05-25 11:02 ` RICHU NORMAN
0 siblings, 2 replies; 5+ messages in thread
From: David Malcolm @ 2022-05-25 10:44 UTC (permalink / raw)
To: RICHU NORMAN, gcc
On Wed, 2022-05-25 at 10:25 +0530, RICHU NORMAN wrote:
> Hi,
> I am a beginner in gcc. I am trying to add an instruction to riscv-
> gcc.It
> would be helpful could help with a few tips .
Hi Richu - welcome to GCC development.
FWIW I've written a guide for new GCC contributors which you might find
helpful:
https://gcc-newbies-guide.readthedocs.io/en/latest/index.html
Caveat: I'm much more familiar with the frontends/diagnostics, rather
than the backends/RTL, so there may be a "frontend" bias in that guide.
> 1.How to write comments to rtl or create a custom log file to log
> comments
> to rtl dump?
> 2.How to run testsuite ?
> 3.Is there a way to directly run an rtl test case? Like giving rtl
> input
> and checking the generated asm.(Like in the attachment which is
> posted in
> bugzilla[ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82815 ])
> Please suggest a way to run the gcc-testsuite with these cases. Pfa
I wrote some notes on dealing with the testsuite, and on running
individual cases here:
https://gcc-newbies-guide.readthedocs.io/en/latest/working-with-the-testsuite.html
Hope this is helpful; good luck
Dave
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Adding log files to gcc dump and adding testcase-rtl
2022-05-25 10:44 ` David Malcolm
@ 2022-05-25 10:54 ` David Malcolm
2022-05-25 11:02 ` RICHU NORMAN
1 sibling, 0 replies; 5+ messages in thread
From: David Malcolm @ 2022-05-25 10:54 UTC (permalink / raw)
To: RICHU NORMAN, gcc
On Wed, 2022-05-25 at 06:44 -0400, David Malcolm wrote:
> On Wed, 2022-05-25 at 10:25 +0530, RICHU NORMAN wrote:
> > Hi,
> > I am a beginner in gcc. I am trying to add an instruction to riscv-
> > gcc.It
> > would be helpful could help with a few tips .
>
> Hi Richu - welcome to GCC development.
>
> FWIW I've written a guide for new GCC contributors which you might find
> helpful:
> https://gcc-newbies-guide.readthedocs.io/en/latest/index.html
>
> Caveat: I'm much more familiar with the frontends/diagnostics, rather
> than the backends/RTL, so there may be a "frontend" bias in that guide.
>
> > 1.How to write comments to rtl or create a custom log file to log
> > comments
> > to rtl dump?
> > 2.How to run testsuite ?
> > 3.Is there a way to directly run an rtl test case? Like giving rtl
> > input
> > and checking the generated asm.(Like in the attachment which is
> > posted in
> > bugzilla[ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82815 ])
> > Please suggest a way to run the gcc-testsuite with these cases. Pfa
>
> I wrote some notes on dealing with the testsuite, and on running
> individual cases here:
> https://gcc-newbies-guide.readthedocs.io/en/latest/working-with-the-testsuite.html
Looks like that bug relates to a bug in the __RTL reading code (which I
wrote; sorry!). There are some notes on running cc1 under the debugger
in my guide here:
https://gcc-newbies-guide.readthedocs.io/en/latest/debugging.html
which should let you put a breakpoint on the relevant code and step
through it.
Some note on __RTL testcases: you will generally want to have a
"startswith" clause on the __RTL to indicate which compilation pass the
RTL was saved at, since RTL goes through several stages in the backend.
"git grep __RTL" should show some examples of existing __RTL-based
testcases.
See also:
https://gcc.gnu.org/onlinedocs/gccint/RTL-Tests.html
Dave
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Adding log files to gcc dump and adding testcase-rtl
2022-05-25 10:44 ` David Malcolm
2022-05-25 10:54 ` David Malcolm
@ 2022-05-25 11:02 ` RICHU NORMAN
2022-05-25 12:39 ` David Malcolm
1 sibling, 1 reply; 5+ messages in thread
From: RICHU NORMAN @ 2022-05-25 11:02 UTC (permalink / raw)
To: David Malcolm; +Cc: gcc
This is great, thank you so much!
I am also looking for support regarding adding instructions for the target
machine.
On Wed, May 25, 2022 at 4:14 PM David Malcolm <dmalcolm@redhat.com> wrote:
> On Wed, 2022-05-25 at 10:25 +0530, RICHU NORMAN wrote:
> > Hi,
> > I am a beginner in gcc. I am trying to add an instruction to riscv-
> > gcc.It
> > would be helpful could help with a few tips .
>
> Hi Richu - welcome to GCC development.
>
> FWIW I've written a guide for new GCC contributors which you might find
> helpful:
> https://gcc-newbies-guide.readthedocs.io/en/latest/index.html
>
> Caveat: I'm much more familiar with the frontends/diagnostics, rather
> than the backends/RTL, so there may be a "frontend" bias in that guide.
>
> > 1.How to write comments to rtl or create a custom log file to log
> > comments
> > to rtl dump?
> > 2.How to run testsuite ?
> > 3.Is there a way to directly run an rtl test case? Like giving rtl
> > input
> > and checking the generated asm.(Like in the attachment which is
> > posted in
> > bugzilla[ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82815 ])
> > Please suggest a way to run the gcc-testsuite with these cases. Pfa
>
> I wrote some notes on dealing with the testsuite, and on running
> individual cases here:
>
> https://gcc-newbies-guide.readthedocs.io/en/latest/working-with-the-testsuite.html
>
> Hope this is helpful; good luck
> Dave
>
>
--
Richu Norman
Research Scholar
Department of Computer Science
Cochin University of Science and Technology
Ph : (+91)-8848455627
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Adding log files to gcc dump and adding testcase-rtl
2022-05-25 11:02 ` RICHU NORMAN
@ 2022-05-25 12:39 ` David Malcolm
0 siblings, 0 replies; 5+ messages in thread
From: David Malcolm @ 2022-05-25 12:39 UTC (permalink / raw)
To: RICHU NORMAN; +Cc: gcc
On Wed, 2022-05-25 at 16:32 +0530, RICHU NORMAN wrote:
> This is great, thank you so much!
You're welcome.
> I am also looking for support regarding adding instructions for the
> target
> machine.
That's something I've not done (my expertise is mostly in the frontends
and diagnostics).
With that caveat, I believe the official documentation is here:
https://gcc.gnu.org/onlinedocs/gccint/Machine-Desc.html
FWIW one of my colleagues wrote a series of posts about how to add an
entirely new CPU to the GNU toolchain here (originally called "ggx",
but now "moxie"):
http://atgreen.github.io/ggx/
though that's from 2008 so might be out-of-date, and covers the whole
toolchain, not just GCC, so might be overwhelming.
Hope this is helpful
Dave
>
>
>
> On Wed, May 25, 2022 at 4:14 PM David Malcolm <dmalcolm@redhat.com>
> wrote:
>
> > On Wed, 2022-05-25 at 10:25 +0530, RICHU NORMAN wrote:
> > > Hi,
> > > I am a beginner in gcc. I am trying to add an instruction to riscv-
> > > gcc.It
> > > would be helpful could help with a few tips .
> >
> > Hi Richu - welcome to GCC development.
> >
> > FWIW I've written a guide for new GCC contributors which you might
> > find
> > helpful:
> > https://gcc-newbies-guide.readthedocs.io/en/latest/index.html
> >
> > Caveat: I'm much more familiar with the frontends/diagnostics, rather
> > than the backends/RTL, so there may be a "frontend" bias in that
> > guide.
> >
> > > 1.How to write comments to rtl or create a custom log file to log
> > > comments
> > > to rtl dump?
> > > 2.How to run testsuite ?
> > > 3.Is there a way to directly run an rtl test case? Like giving rtl
> > > input
> > > and checking the generated asm.(Like in the attachment which is
> > > posted in
> > > bugzilla[ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82815 ])
> > > Please suggest a way to run the gcc-testsuite with these cases. Pfa
> >
> > I wrote some notes on dealing with the testsuite, and on running
> > individual cases here:
> >
> >
> > https://gcc-newbies-guide.readthedocs.io/en/latest/working-with-the-testsuite.html
> >
> > Hope this is helpful; good luck
> > Dave
> >
> >
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-05-25 12:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-25 4:55 Adding log files to gcc dump and adding testcase-rtl RICHU NORMAN
2022-05-25 10:44 ` David Malcolm
2022-05-25 10:54 ` David Malcolm
2022-05-25 11:02 ` RICHU NORMAN
2022-05-25 12:39 ` David Malcolm
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).