On 10/02/2013 10:11 PM, Andrew MacLeod wrote:
this patch consolidates tree-ssa-loop*.c files with new .h files as
required (8 in total)
A number of the prototypes were in tree-flow.h, but there were also a
few in cfgloop.h. tree-ssa-loop.h was created to contain a couple of
common structs and act as the gathering file for any generally
applicable tree-ssa-loop includes. tree-flow.h includes this file for
now.
There is a bit of a criss-cross mess between the cfg-* and
tree-ssa-loop* routines, but I'm not touching that for now. Some of
that might have to get resolved when I try to remove tree-flow.h as a
standard include file from the .c files.. we'll see.
In particular, tree-ssa-loop-niter.h exports a lot of more generally
used routines. loop-iv.c, loop-unroll.c and loop-unswitch.c needed to
include it.
A few routines werent referenced outside their file so I made those
static, and there was one routine stmt_invariant_in_loop_p wich was
actually unused.
bootstraps on x86_64-unknown-linux-gnu and passes with no new
regressions. OK?
Andrew
And a quick followup to that patch which does 2 things..
1 - Moves loop_containing_stmt() from tree-flow-inline.h into the new
tree-ssa-loop.h
2 - I hated the #includes at the bottom of tree-ssa-loop.h, so I tweaked
the definition of affinve_iv. tree-scalar-evolution.h prototypes do not
use the affine_iv typedef now, and then I moved the #includes to the
top of the file.
bootstrapped on x86_64-unknown-linux-gnu and now new regressions. OK?
Andrew
* tree-flow-inline.h (loop_containing_stmt): Move to tree-ssa-loop.h.
* tree-scalar-evolution.h (simple_iv): Don't use affive_iv typedef.
* tree-ssa-loop.h: Move includes to top of file.
(loop_containing_stmt): Relocate from tree-flow-inline.h.
diff -cp G/tree-flow-inline.h ./tree-flow-inline.h
*** G/tree-flow-inline.h 2013-10-03 10:33:35.147370376 -0400
--- ./tree-flow-inline.h 2013-10-03 10:36:19.820409453 -0400
*************** may_be_aliased (const_tree var)
*** 107,127 ****
|| TREE_ADDRESSABLE (var)));
}
-
- /* Returns the loop of the statement STMT. */
-
- static inline struct loop *
- loop_containing_stmt (gimple stmt)
- {
- basic_block bb = gimple_bb (stmt);
- if (!bb)
- return NULL;
-
- return bb->loop_father;
- }
-
-
-
/* Return true if VAR cannot be modified by the program. */
static inline bool
--- 107,112 ----
diff -cp G/tree-scalar-evolution.h ./tree-scalar-evolution.h
*** G/tree-scalar-evolution.h 2013-10-03 10:33:35.147370376 -0400
--- ./tree-scalar-evolution.h 2013-10-03 10:25:12.036251172 -0400
*************** extern tree resolve_mixers (struct loop
*** 36,42 ****
extern void gather_stats_on_scev_database (void);
extern unsigned int scev_const_prop (void);
extern bool expression_expensive_p (tree);
! extern bool simple_iv (struct loop *, struct loop *, tree, affine_iv *, bool);
extern tree compute_overall_effect_of_inner_loop (struct loop *, tree);
/* Returns the basic block preceding LOOP or ENTRY_BLOCK_PTR when the
--- 36,43 ----
extern void gather_stats_on_scev_database (void);
extern unsigned int scev_const_prop (void);
extern bool expression_expensive_p (tree);
! extern bool simple_iv (struct loop *, struct loop *, tree, struct affine_iv_d *,
! bool);
extern tree compute_overall_effect_of_inner_loop (struct loop *, tree);
/* Returns the basic block preceding LOOP or ENTRY_BLOCK_PTR when the
diff -cp G/tree-ssa-loop.h ./tree-ssa-loop.h
*** G/tree-ssa-loop.h 2013-10-03 10:33:48.299373496 -0400
--- ./tree-ssa-loop.h 2013-10-03 10:26:03.971263458 -0400
*************** along with GCC; see the file COPYING3.
*** 20,28 ****
#ifndef GCC_TREE_SSA_LOOP_H
#define GCC_TREE_SSA_LOOP_H
/* Affine iv. */
! typedef struct
{
/* Iv = BASE + STEP * i. */
tree base, step;
--- 20,34 ----
#ifndef GCC_TREE_SSA_LOOP_H
#define GCC_TREE_SSA_LOOP_H
+ #include "tree-ssa-loop-im.h"
+ #include "tree-ssa-loop-ivcanon.h"
+ #include "tree-ssa-loop-ivopts.h"
+ #include "tree-ssa-loop-manip.h"
+ #include "tree-ssa-loop-niter.h"
+
/* Affine iv. */
! typedef struct affine_iv_d
{
/* Iv = BASE + STEP * i. */
tree base, step;
*************** struct tree_niter_desc
*** 62,71 ****
enum tree_code cmp;
};
! #include "tree-ssa-loop-im.h"
! #include "tree-ssa-loop-ivcanon.h"
! #include "tree-ssa-loop-ivopts.h"
! #include "tree-ssa-loop-manip.h"
! #include "tree-ssa-loop-niter.h"
#endif /* GCC_TREE_SSA_LOOP_H */
--- 68,83 ----
enum tree_code cmp;
};
! /* Returns the loop of the statement STMT. */
!
! static inline struct loop *
! loop_containing_stmt (gimple stmt)
! {
! basic_block bb = gimple_bb (stmt);
! if (!bb)
! return NULL;
!
! return bb->loop_father;
! }
#endif /* GCC_TREE_SSA_LOOP_H */