Commit Graph

26 Commits

Author SHA1 Message Date
J"orn Rennecke
c99f8c2a3e loop.h (loop_insn_first_p): Declare.
* loop.h (loop_insn_first_p): Declare.
	* loop.c (loop_insn_first_p): No longer static.
	* unroll.c (iteration_info) Fix comparison to
	reg_iv_type->num_elements.
	Before accessing reg_biv_class, check index against
	max_reg_before_loop.
	Fix and enable code for giv iterators.
	(loop_iterations): Compare with reg_iv_type->num_elements instead
	of with max_reg_before_loop.

From-SVN: r25401
1999-02-24 11:50:54 +00:00
J"orn Rennecke
4d87f7a77c loop.h (express_from): Declare.
* loop.h (express_from): Declare.
	(struct induction): Replace derived flag with derived_from pointer.
	* loop.c (strength_reduce, record_giv, recombine_givs): Likewise.
	(express_from): No longer static.
	* unroll.c (find_splittable_givs): Replace derived with derived_from.
	When processing an address giv with which another giv has been
	combined that has also been derived from a third giv, handle like
	having combined with the third giv.
	Set splittable_regs_updates appropriately for derived givs.

From-SVN: r25007
1999-02-03 12:48:48 +00:00
Joern Rennecke
5e5c976894 Happy new year.
From-SVN: r24896
1999-01-28 15:36:05 +00:00
J"orn Rennecke
3ec2b59097 rtl.h (insn_first_p): Declare.
* rtl.h (insn_first_p): Declare.
	* rtlanal.c (insn_first_p): New function.
	* loop.h (varray.h): Include.
	(struct induction): Change combined_with to unsigned.
	New members derived, ix and last_use.
	(reg_iv_type, reg_iv_info): Now varray_type.  All references changed.
	(REG_IV_TYPE, REG_IV_INFO): Define.
	(first_increment_giv, last_increment_giv): Declare.
	* loop.c (loop_number_loop_cont): New static variable.
	(loop_number_cont_dominator): Likewise.
	(reg_iv_type, reg_iv_info): Now varray_type.
	(first_increment_giv, last_increment_giv): New variables.
	(compute_luids, verify_dominator, find_life_end): New functions.
	(cmp_recombine_givs_stats, recombine_givs): Likewise.
	(loop_optimize): Allocate loop_number_loop_cont and
	loop_number_cont_dominator.  Use compute_luids.
	(find_and_verify_loops): Initialize loop_number_loop_cont and
	loop_number_cont_dominator.
	(strength_reduce): Try to find bivs that can be expressed as givs
	of another biv, and to convert biv increments into givs.
	Call recombine_givs.  Handle derived givs.
	(record_biv): New argument location.  All callers changed.
	(record_giv): Initialize derived and last_use fields.
	(basic_induction_var): New argument location.  All callers changed.
	(combine_givs): Don't combine a DEST_REG giv with a DEST_ADDR giv.
	Increment combined_with instead of setting to 1.
	* unroll.c (derived_regs): New static variable.
	(unroll_loop): Initialize it.
	Allocate local_regno according to max_reg_num.
	(copy_loop_body): Cope with derived givs.
	(find_splittable_givs): Check for Givs made from biv increments.
	Set derived_regs for givs.
	* Makefile.in (stmt.o, loop.o, unroll.o): Depend on loop.h .

From-SVN: r24889
1999-01-27 15:45:50 +00:00
Michael Hayes
35704c4661 loop.h (loop_info): New field 'vtop'.
* loop.h (loop_info): New field 'vtop'.
	* loop.c (check_dbra_loop):  Use loop_info->vtop rather than
	scanning loop for vtop.
	* unroll.c (subtract_reg_term, find_common_reg_term): New functions.
	(loop_iterations): Use them to determine if loop has a constant
 	number of iterations.  Set loop_info->vtop.  Don't subtract
	common reg term from initial_value and final_value if have a
	do-while loop.

From-SVN: r24333
1998-12-15 20:31:18 +00:00
J"orn Rennecke
4b259e3fd8 loop.h (struct induction): Delete times_used member.
* loop.h (struct induction): Delete times_used member.
	* loop.c (n_times_set): Rename to set_in_loop.  Changed all users.
	(n_times_used): Rename to n_times_set.  Changed all users.
	(scan_loop): Free reg_single_usage before strength reduction.
	(record_giv, combine_givs): Remove handling of times_used member.
	(combine_givs_used_once): Rename to:
	(combine_givs_used_by_other) .  Changed all callers.

From-SVN: r24324
1998-12-15 10:31:52 +00:00
Michael Hayes
e96b4d7a44 loop.h (precondition_loop_p): Added new mode argument.
* loop.h (precondition_loop_p): Added new mode argument.
	* unroll.c (precondition_loop_p): Likewise.
	(approx_final_value): Function deleted and subsumed
 	into loop_iterations.
	(loop_find_equiv_value): New function.
	(loop_iterations): Use loop_find_equiv_value to find increments
	too large to be immediate constants.  Also use it to find terms
	common to initial and final iteration values that can be removed.

From-SVN: r23885
1998-11-25 21:32:27 +00:00
Michael Hayes
302670f3f0 loop.h (struct loop_info): Define new structure.
* loop.h (struct loop_info): Define new structure.
	(precondition_loop_p): Added prototype.
	(unroll_loop): Added new argument loop_info to prototype.
	(final_biv_value, final_giv_value): Added new argument n_iterations
	to prototype.
	* loop.c (strength_reduce): Declare new structure loop_iteration_info
	and new pointer loop_info.
	(loop_n_iterations): Replace global variable by element in
	loop_info structure.
	(check_final_value): New argument n_iterations.
	(insert_bct): New argument loop_info.
	(loop_unroll_factor): Replace global array by element in
	loop_info structure.
	(loop_optimize): Remove code to allocate and initialise
	loop_unroll_factor_array.
	* unroll.c (precondition_loop_p):  No longer static since
	used by branch on count optimization.
	(precondition_loop_p, unroll_loop): New argument loop_info.
	(final_biv_value, final_giv_value, find_splittable_regs): New
	argument n_iterations.
	(loop_iteration_var, loop_initial_value, loop_increment,
	loop_final_value, loop_comparison_code, loop_unroll_factor):
	Replaced global variables by loop_info structure.
	(loop_unroll_factor): Replace global array by element in
	loop_info structure.

From-SVN: r23884
1998-11-25 21:19:21 +00:00
David Edelsohn
cac8ce95a1 unroll.c (loop_iteration_var, [...]): No longer static.
* unroll.c (loop_iteration_var, loop_initial_value, loop_increment
        loop_final_value, loop_comparison_code): No longer static.
        (unroll_loop): Delete loop_start_value update.
        * loop.h (loop_iteration_var, loop_initial_value, loop_increment,
        loop_final_value, loop_comparison_code): Extern.
        (loop_start_value): Delete extern.
        * loop.c (loop_can_insert_bct, loop_increment, loop_start_value,
        loop_comparison_value, loop_comparison_code): Delete.
        (loop_optimize): Remove initialization for deleted variables.
        (strength_reduce): Delete analyze_loop_iterations call.  Only call
        insert_bct if flag_branch_count_on_reg set.
        (analyze_loop_iterations): Delete.
        (insert_bct): Remove iteration count calculation.  Move checks for
        viable BCT optimization to here.  Obtain iteration count from
        loop_iterations and correct for unrolling.  Check for enough
        iteration to be beneficial.  Comment out runtime iteration count
        case.
        (insert_bct): Print iteration count in dump file.  Remove
        loop_var_mode and use word_mode directly.
        * rs6000.h (processor_type): Add PROCESSOR_PPC604e.
        * rs6000.c (rs6000_override_options): Use it.
        (optimization_options): Enable use of flag_branch_on_count_reg.
        * rs6000.md (define_function_unit): Describe 604e.

From-SVN: r22852
1998-10-05 18:03:25 -04:00
Richard Henderson
45f97e2e08 loop.h (struct induction): Add no_const_addval.
* loop.h (struct induction): Add no_const_addval.
        * loop.c (the_movables, reg_address_cost): New variables.
        (init_loop): Init reg_address_cost.
        (loop_optimize): Call end_alias_analysis.
        (scan_loop): Init the_movables.
        (record_giv): Init induction->no_const_addval.
        (basic_induction_var) [PLUS]: Use rtx_equal_p instead of ==.
        [REG]: Rearrange loop search test to catch more cases.
        (general_induction_var): Return success not benefit; take an extra
        argument for that.  Change all callers.
        (simplify_giv_expr) [PLUS]: Always combine invariants.  Use sge_plus.
        [MULT]: Use rtx_equal_p instead of ==.  Combine simple invariants.
        [default]: Search the_movables for additional combinations.
        (sge_plus_constant, sge_plus): New functions.
        (express_from_1): New function.
        (express_from): Always define.  Rewrite using express_from_1.
        (combine_givs_p): Handle more cases.  Ignore address cost.
        (cmp_combine_givs_stats): New function.
        (combine_givs_used_once, combine_givs_benefit_from): New functions.
        (combine_givs): Rewrite to do best-fit combination.
        * fold-const.c (operand_equal_p): Handle RTL_EXPR.
        (fold): Do a complete (A*C)+(B*C) association check.

From-SVN: r21263
1998-07-17 07:46:06 -07:00
Jim Wilson
7e7ca3a1bd Fix hpux loop unrolling bug reported by Tim Prince.
* loop.h (struct induction): Clarify comment for unrolled field.
	* unroll.c (find_splittable_givs): Move set of unrolled field
	after address validity check.

From-SVN: r20598
1998-06-19 11:54:44 -07:00
Jeffrey A Law
37aa45a21d loop.c (loop_number): Delete function.
* loop.c (loop_number): Delete function.  Change all references
        to use uid_loop_num array.
        * loop.h (loop_number): Delete declaration.
        * unroll.c (unroll_loop): Change "loop_number" references to
        use uid_loop_num instead.
Still cleaning up haifa.

From-SVN: r15623
1997-09-21 21:04:36 -06:00
Jeff Law
237a9795cb loop.c (loop_unroll_factor): Move outside #ifdef HAIFA conditional.
* loop.c (loop_unroll_factor): Move outside #ifdef HAIFA
        conditional.
        (loop_unroll_iter): Remove unused variable and all references.
        (loop_optimize): Always allocate and clear space for loop_unroll_factor.
        (insert_bct): Fix minor formatting problems.
        * loop.h (loop_unroll_factor): Move decl outside #ifdef HAIFA.
        (loop_unroll_iter): Removed unused decl.
        * unroll.c (unroll_loop): Remove code to set loop_unroll_iter.
        Always record the unrolling factor.
More haifa cleanup

From-SVN: r15621
1997-09-21 19:49:19 -06:00
Jeffrey A Law
8c660648ca * Integrate Haifa instruction scheduler.
* Integrate regmove pass.
See ChangeLog for deatils.

From-SVN: r14770
1997-08-11 22:07:19 -06:00
Jeffrey A Law
9ae8ffe751 * Integrate alias analysis changes from jfc@mit.edu
* Makefile.in (OBJS): Add alias.o
        (alias.o): Add dependencies.
        * alias.c: New file.
        * sched.c: Remove alias analysis code.  It lives in alias.c now.
        (reg_last_uses_size): Declare.
        (sched_analyze_2): Add new arguments to true_dependence.
        (sched_analyze_insn): Use reg_last_uses_size instead of max_reg.
        (schedule_block): Initialize reg_last_uses_size.
        (schedule_insns): Always call init_alias_analysis.
        * calls.c (expand_call): Note calls to malloc, calloc, and realloc;
        mark return value from such functions as a pointer and keep track of
        them for alias analysis.  If a return value from a function is a
        pointer, mark it as such.
        * combine.c (distribute_notes): Handle REG_NOALIAS.
        * cse.c (struct write_data): Delete.  No longer needed.
        (invalidate): Don't call set_nonvarying_address_components anymore.
        Use true_dependence to decide if an entry should be removed from
        the hash table.
        (invalidate_memory): Remove WRITES argument, simplify appropriately.
        Fix all callers.
        (note_mem_written): Similarly for WRITE_PTR argument.
        (invalidate_from_clobbers): Similarly for W argument.
        (invalidate_for_call): Remove memory elements from the hash table.
        (refers_to_mem_p, cse_rtx_addr_varies_p): Deleted.
        (cse_rtx_varies_p): New function.  Derived from old
        cse_rtx_addr_varies_p.
        (cse_insn): Remove WRITES_MEMORY and INIT variables and all references.
        Don't call note_mem_written anymore.  Stack pushes invalidate the stack
        pointer if PUSH_ROUNDING is defined.  No longer need to call
        cse_rtx_addr_varies_p to decide if a MEM should be invalidated.
        (skipped_writes_memory): Remove variable.
        (invalidate_skipped_set): Simplify and wewrite to use invalidate_memory.
        (invalidate_skipped_block): Simplify for new alias analysis code.
        (cse_set_around_loop): Likewise.
        (cse_main): Call init_alias_analysis.
        * flags.h (flag_alias_check, flag_argument_noalias): Declare.
        * toplev.c (flag_alias_check, flag_argument_noalias): Define.
        (f_options): Add new alias checking arguments.
        (main): Set flag_alias_check when optimizing.
        * local_alloc (validate_equiv_mem_from_store): Add new arguments
        to true_dependence.
        (memref_referenced_p): Likewise.
        * loop.c (NUM_STORES): Increase to 30.
        (prescan_loop): Only non-constant calls set unknown_address_altered.
        (invariant_p): Add new arguments to true_dependence.
        (record_giv): Initialize unrolled and shared fields.
        (emit_iv_add_mult): Call record_base_value as needed.
        * loop.h (struct induction): Add unrolled and shared fields.
        * unroll.c  (unroll_loop): Call record_base_value as needed.
        (copy_loop_body): Likewise.
        (final_biv_value): Likewise.
        (final_giv_value): Likewise.
        (find_splittable_regs): Likewise.  Only create one new pseudo
        if we have multiple address GIVs that were combined with the same
        dst_reg GIV.  Note when a new register is created due to unrolling.
        * rtl.c (reg_note_name): Add REG_NOALIAS.
        * rtl.h (enum reg_note): Similarly.
        (rtx_varies_p, may_trap_p, side_effects_p): Declare.
        (volatile_refs_p, volatile_insn_p, remove_note): Likewise.
        (note_stores, refers_to_regno_p, reg_overlap_mentioned_p): Likewise.
        (true_dependence, read_dependence, anti_dependence): Likewise.
        (output_dependence, init_alias_analysis, end_alias_analysis): Likewise.
        (mark_user_reg, mark_reg_pointer): Likewise.
jfc's alias analysis code.

From-SVN: r14768
1997-08-11 14:07:24 -06:00
Jim Wilson
125e4dcf94 (struct induction): New fields always_executed and
auto_inc_opt.

From-SVN: r11089
1996-01-24 11:54:00 -08:00
Richard Kenner
85ee74529a (loop_number_exit_count): Declare it.
From-SVN: r10129
1995-07-14 08:23:39 -04:00
Richard Kenner
a35311b035 Update FSF address.
From-SVN: r9961
1995-06-15 07:52:21 -04:00
Jim Wilson
09dcbd74f9 (back_branch_in_range_p): Declare.
From-SVN: r9676
1995-05-13 07:57:22 -07:00
Jim Wilson
2a2af11092 (structure induction): Add new field same_insn.
From-SVN: r8784
1995-01-20 18:10:54 -08:00
Jim Wilson
521f2d6fcb Add prototypes.
From-SVN: r3794
1993-03-19 18:17:20 -08:00
Jim Wilson
a6b83e54f5 (loop_number_first_block, loop_number_last_block,
loop_number_block_level): Delete declarations.

From-SVN: r1800
1992-08-11 12:53:15 -07:00
Charles Hannum
3245eea08a entered into RCS
From-SVN: r1466
1992-07-06 19:55:04 +00:00
Richard Stallman
6dc42e49d3 *** empty log message ***
From-SVN: r930
1992-05-07 06:41:23 +00:00
Richard Kenner
8fd297fb3b *** empty log message ***
From-SVN: r601
1992-03-27 18:46:51 -05:00
Richard Stallman
23b2ce5339 Initial revision
From-SVN: r471
1992-03-14 05:04:21 +00:00