patch to prevent reg-stack to change insn modes

Jeffrey A Law law@cygnus.com
Sat Apr 10 04:49:00 GMT 1999


  In message < 19990406003046.A14219@horac.ta.jcu.cz >you write:
  > Mon Apr  5 04:42:43 CEST 1999 Jan Hubicka <hubicka@freesoft.cz>
  > 	* reg-stack.c: Update comment.
  > 	(stack_regs_mentioned_data): New global variable.
  > 	(stack_regs_mentioned_size): New global variable.
  > 	(stack_regs_mentioned: New function.
  > 	(check_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.
At a high level, it seems to me you should be using our virtual array support
for this.  I'd prefer to see us use routines we've already got rather than
build new (and subtly different) routines that are meant to perform the same
basic function.


jump.c:
  >   #ifdef STACK_REGS
  > +       {
  > + 	extern int stack_regs_mentioned PROTO((rtx insn));

Avoid external decls like this (inside functions).  It seems to me you could
put the decl in a header file somewhere.  At the least, it belongs at the
start of the jump.c file (inside an #ifdef STACK_REGS block).

In addition to being cleaner, our existing varray implementation is probably
more efficient, particularly in how it handles re-allocation of the array.

By doing this you also avoid gratutious re-indention of code which makes my
life a little easier.

It also seems to me that you can initialize the data during the initial scan
over all the insns where we currently set the insn's mode.  You already have
to compute whether or not the instructions use stack regs during that scan,
you might as well record information for those insns.

jeff


More information about the Gcc-patches mailing list