Making rtxes use less memory (sometimes!)
Zack Weinberg
zack@codesourcery.com
Sat Oct 18 18:17:00 GMT 2003
Richard Sandiford <rsandifo@redhat.com> writes:
> Here's the sort of speed-up I get when compiling mips.i
> using a mips64-linux-gnu native:
>
> -O0
> before after
> real 0m31.478s 0m29.830s
> user 0m31.270s 0m29.670s
> sys 0m0.200s 0m0.130s
>
> -O1
> before after
> real 0m16.364s 0m15.465s
> user 0m16.220s 0m15.270s
> sys 0m0.140s 0m0.190s
>
> -O2
> before after
> real 0m7.804s 0m7.104s
> user 0m7.690s 0m7.030s
> sys 0m0.100s 0m0.070s
>
> (these are reproducable to within ~0.1s).
Do you have the -O numbers backward? It seems odd that -O0 would be
four times slower than -O2.
Still, the trend is clear. I'm impressed that a small data layout
change like this can make that much difference.
> * rtl.h (rtl_size): Declare.
> (rtunion): Remove rtwint.
> (rtx_def): Replace 'fld' with a union of an rtunion or a HOST_WIDE_INT.
> (RTX_HDR_SIZE, RTX_SIZE): New macros.
> (RTL_CHECK1): Adjust for new rtx_def layout.
> (RTL_CHECK2, RTL_CHECKC1, RTL_CHECKC2): Likewise.
> (XWINT, XCWINT): Likewise. Access the rtx structure directly.
> (X0WINT): Remove.
> (X0ANY): New macro.
> * rtl.def: Adjust comments for new rtx_def layout.
> * ggc.h (ggc_alloc_rtx): Take the rtx code as argument, not the
> number of slots.
> * rtl.c (rtx_size): New array.
> (rtx_alloc): Adjust call to ggc_alloc_rtx. Use RTX_HDR_SIZE.
> (copy_rtx): Use RTX_HDR_SIZE. Adjust for new rtx_def layout.
> (shallow_copy_rtx): Adjust call to ggc_alloc_rtx. Use RTX_SIZE.
> * integrate.c (copy_rtx_and_substitute): Use X0ANY to copy '0' fields.
> * emit-rtl.c (copy_most_rtx): Likewise.
> (copy_rtx_if_shared): Use RTX_SIZE.
> (copy_insn_1): Use RTX_HDR_SIZE. Adjust for new rtx_def layout.
> * gengenrtl.c (gendef): Adjust ggc_alloc_rtx call. Use RTX_HDR_SIZE.
> * gengtype.c (write_rtx_next): Use RTX_HDR_SIZE.
> (adjust_field_rtx_def): Expect "rtx_def" to be a union rather than
> an array. Adjust output for new rtx_def layout.
> * ggc-page.c (RTL_SIZE): Use RTX_HDR_SIZE.
> * reload1.c (eliminate_regs): Use RTX_SIZE.
> * rtlanal.c (loc_mentioned_in_p): Adjust for new rtx_def layout.
> * gdbinit.in (pi): Likewise.
This is OK.
In general, I agree with Gerald; patches whose sole effect is to speed
up the compiler (as long as they're not too invasive) are acceptable for
stage 3.
zw
More information about the Gcc-patches
mailing list