This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch: Support for picoJava
- To: law at cygnus dot com
- Subject: Re: Patch: Support for picoJava
- From: Steve Chamberlain <sac at transmeta dot com>
- Date: Thu, 28 Oct 1999 10:18:27 -0700
- cc: gcc-patches at gcc dot gnu dot org
>
> The code itself looks generally OK, except for numerous formatting and
> convention problems that need to be fixed.
I'll fix them.
>
> Does this machine use reg-stack.c?
>
No. The picoJava opstack isn't as painful to use as the stack in an
8087. The port generates code for a machine with 32 general
registers, and the register numbers are turned into stack references
on the way out. But it's legal to have most operators as a source in
a pj_source_operand, so combine cleans things up:
f (a, b, c, d)
{
return a + b + c + d;
}
->
..
iload_0
iload_1
iadd
iload_2
iadd
iload_3
iadd
write_global1
..
before combine:
(insn 13 12 14 (set (reg:SI 139)
(plus:SI (reg/v:SI 134)
(reg/v:SI 135))) 0 {movsi}
(insn 14 13 15 (set (reg:SI 140)
(plus:SI (reg:SI 139)
(reg/v:SI 136))) 0 {movsi}
(insn 15 14 16 (set (reg:SI 138)
(plus:SI (reg:SI 140)
(reg/v:SI 137))) 0 {movsi}
(insn 16 15 17 (set (reg/i:SI 65 global1)
(reg:SI 138)) 0 {movsi}
after combine:
(insn 16 15 17 (set (reg/i:SI 65 global1)
(plus:SI (plus:SI (plus:SI (reg:SI 32 i0)
(reg:SI 33 i1))
(reg:SI 34 i2))
(reg:SI 35 i3))) 0 {movsi}
When the -mrisc option is used, this behavior is disabled. Deep
expression stacks make the assembly more compact, but because of the
next layer of compilation, they don't increase the performance on the
real target metal, and make the assembly hard to understand for
humans.
>
> Please use prologue/epilogue expanders if possible instead of directly
> generating assembly code. Direct generation of assembly code is highly
> frowned upon for new ports.
>
OK, I'll do this. May I ask why is it frowned upon ? Scheduling
picoJava code is pretty pointless, it will nearly always go into a jit
of some sort.
> The md file looks to be one of the cleanest I've seen in a while, but
> amazingly it's totally incomprehensible at the same time :-) I'm going
> to trust you that it's right.
>
The opstack means that you can do anything in what gcc would consider
to be one instruction, there are very few register constraints, and
reload can never fail. It was very nice to port gcc to an almost
reasonable machine (for a change).
Steve