[PING] Refactor genrecog

Paolo Bonzini paolo.bonzini@lu.unisi.ch
Tue Dec 12 09:34:00 GMT 2006


Bernd Schmidt wrote:
> Paolo Bonzini wrote:
> 
>> http://gcc.gnu.org/ml/gcc-patches/2006-08/msg00820.html
> 
> Reviewing this is unnecessarily hard as it combines a lot of code
> movement with functional changes.  Can you split this into two patches,
> one that makes changes and another that just moves stuff?

The attached patch is the same, but the changes to both genrecog.c and 
gendtree.c are based on the "old" genrecog.c.  This should make it 
clearer which functional changes (mostly hookization) are done in 
gendtree.c.

The huge size is because of the many "-" lines: basically, code that is 
moved to gendtree.c appears as deleted in the genrecog.c diff, and code 
that stays in genrecog.c appears as deleted in the gendtree.c diff.  I 
cannot see a better way to handle this; if you want, I can remove these 
huge sections of deleted lines and mail a new patch.

One remark: in write_cond, I removed this assert

-      gcc_assert (subroutine_type == RECOG);

because it was the only usage left of parameter subroutine_type, which I 
could remove from write_cond's caller too.  Furthermore, the assert is 
made redundant by the following line, which is another assertion:

       gcc_assert (p->u.insn.num_clobbers_to_add);

where num_clobbers_to_add can only be set if the subroutine type is RECOG.

Paolo

2006-12-12  Paolo Bonzini  <bonzini@gnu.org>

	* gendtree.c: New, split from genrecog.c.
	(hooks): New.
	(new_deecision): Set max_depth.
	(error_count, process_define_predicate, new_decision,
	new_decision_test, merge_trees): Make global.
	(write_cond, write_action, write_tree_1, write_tree,
	write_subroutine, write_subroutines, process_tree,
	write_node): Remove "enum routine_type" parameter, and hookize.	
	(process_tree): Always emit subroutine.
	* gendtree.h: New.
	* genrecog.c: Remove code moved to gendtree.c and gendtree.h.
	(recog_hooks, split_hooks, peephole2_hooks, print_header_recog,
	print_locals_recog, print_maybe_return_recog,
	print_default_return_recog, print_accept_insn_recog,
	is_uncoditional_recog, print_header_split,
	print_locals_split, print_maybe_return_split,
	print_default_return_split, print_accept_insn_split,
	is_uncoditional_split, print_header_peephole2,
	print_accept_insn_peephole2, is_unconditional_peephole2): New.
	(add_to_sequence): Don't set max_depth.
	(main): Pass hooks to process_tree.  Don't invoke peephole2
	process_tree if the decision tree is empty.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: genrecog-to-gendtree.patch
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20061212/475a97e1/attachment.ksh>


More information about the Gcc-patches mailing list