This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: patch to prevent reg-stack to change insn modes



  In message <19990411000458.A19162@horac.ta.jcu.cz>you write:
  > Hi
  > Here is updated patch. Hope it contain all suggested changes.
  > I've also fixed some other bugs in this patch (created while
  > I was separating it from my reg-stack rewrite) and tested it.
  > It shows no regressions. (there were some nasty bugs in previous
  > version. Sorry. I will run testsuite on all my future patches 
  > now. It is really necesary.)
  > 
  > Good night, nice dreams :)
  > Honza
  > 
  > Sat Apr 10 06:31:48 CEST 1999 Jan Hubicka <hubicka@freesoft.cz>
  > 
  > 	* reg-stack.c: Update comment, include varray.h.
  > 	(stack_regs_mentioned_data): New global variable.
  > 	(check_stack_regs_mentioned): New function.
  > 	(stack_regs_mentioned): New function.
  > 	(reg_to_stack): Initialize and free stack_regs_mentioned_data,
  > 	use stack_regs_mentioned.
  > 	(record_asm_reg_life): Change insn type cache for changed insn.
  > 	(record_reg_life): Do not change the insn mode.
  > 	(emit_pop_insn): Likewise.
  > 	(emit_swap_insn): Likewise.
  > 	(move_for_stack_reg): Likewise.
  > 	(stack_reg_life_analysis): Use stack_regs_mentioned.
  > 	(emit_swap_insn): Likewise.
  > 	(subst_stack_regs): Likewise.
  > 	(convert_regs): Likewise.
  > 
  > 	* jump.c (find_cross_jump): Use stack_regs_mentioned.
I made some changes.

First, I put the prototype for stack_regs_mentioned into rtl.h and surrounded
it with a suitable #ifdef STACK_REGS.  Then I removed the extern prototypes
in reg-stack.c and jump.c

Second, the memory re-allocation was exponential.  Instead of always doubling
until the size of the varray  > uid we size the array with

size = uid + uid / 20;

That should prevent too many re-allocations without going absolutely nuts on
big programs.  This is consistent with how we resize (for example) the register
array.

During the initial insn scan, it's kind of silly to go through all the hair
of stack_regs_mentioned since we know the array is already suitably sized
and all the elements are zero.

Instead we call stack_regs_mentioned_p (like the old code).  If true, then
we just the array entry to one.  Else we set it to two.

I also updated some comments.  Each function needs to have a comment which
describes that function, it's arguments and return value.

I also added comments which describe the values each element in the virtual
array may have.

Finally, your new functions used ANSI prototypes.  We do not use ANSI
prototypes in gcc because it must be compilable with system compilers that
do not support ANSI C (such as hpux and sunos).

I fixed these problems, re-bootstrapped & tested, then installed your patch.

Thanks,
jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]