diff options
Diffstat (limited to 'gcc/cfgloop.h')
-rw-r--r-- | gcc/cfgloop.h | 119 |
1 files changed, 118 insertions, 1 deletions
diff --git a/gcc/cfgloop.h b/gcc/cfgloop.h index e79d39afef1..b00295a91c3 100644 --- a/gcc/cfgloop.h +++ b/gcc/cfgloop.h @@ -168,6 +168,12 @@ struct loop /* The number of LABEL_REFs on exit_labels for this loop and all loops nested inside it. */ int exit_count; + + /* The probable number of times the loop is executed at runtime. + This is either an INTERVAL_CHREC or an INTEGER_CST. Don't access + this field directly: number_of_iterations_in_loop computes and + caches the computed information in this field. */ + tree nb_iterations; }; /* Flags for state of loop structure. */ @@ -246,8 +252,10 @@ extern bool flow_loop_outside_edge_p (const struct loop *, edge); extern bool flow_loop_nested_p (const struct loop *, const struct loop *); extern bool flow_bb_inside_loop_p (const struct loop *, const basic_block); extern struct loop * find_common_loop (struct loop *, struct loop *); +struct loop *superloop_at_depth (struct loop *, unsigned); extern int num_loop_insns (struct loop *); extern int average_num_loop_insns (struct loop *); +extern unsigned get_loop_level (const struct loop *); /* Loops & cfg manipulation. */ extern basic_block *get_loop_body (const struct loop *); @@ -290,7 +298,7 @@ extern bool can_duplicate_loop_p (struct loop *loop); extern int duplicate_loop_to_header_edge (struct loop *, edge, struct loops *, unsigned, sbitmap, edge, edge *, unsigned *, int); -extern struct loop *loopify (struct loops *, edge, edge, basic_block); +extern struct loop *loopify (struct loops *, edge, edge, basic_block, bool); extern void unloop (struct loops *, struct loop *); extern bool remove_path (struct loops *, edge); extern edge split_loop_bb (basic_block, rtx); @@ -403,6 +411,11 @@ simple_loop_desc (struct loop *loop) return loop->aux; } +/* Register pressure estimation for induction variable optimizations & loop + invariant motion. */ +extern void init_set_costs (void); +extern unsigned global_cost_for_size (unsigned, unsigned, unsigned); + /* Loop optimizer initialization. */ extern struct loops *loop_optimizer_init (FILE *); extern void loop_optimizer_finalize (struct loops *, FILE *); @@ -418,3 +431,107 @@ enum }; extern void unroll_and_peel_loops (struct loops *, int); +extern void doloop_optimize_loops (struct loops *); +extern void move_loop_invariants (struct loops *); + +static inline struct loop *loop_from_num (struct loops *, unsigned); +static inline struct loop *outer_loop (struct loop *); +static inline struct loop *inner_loop (struct loop *); +static inline struct loop *next_loop (struct loop *); +static inline unsigned loop_num (struct loop *); +static inline unsigned loop_depth (struct loop *); +static inline basic_block loop_header (struct loop *); +static inline tree loop_nb_iterations (struct loop *); +static inline unsigned loop_num_exits (struct loop *); +static inline edge *loop_exit_edges (struct loop *); +static inline edge loop_exit_edge (struct loop *, unsigned); + +static inline struct loop * +loop_from_num (struct loops *loops, + unsigned num) +{ + return loops->parray[num]; +} + +/* Returns the outer loop. */ + +static inline struct loop * +outer_loop (struct loop *loop) +{ + return loop->outer; +} + +/* Returns the inner loop. */ + +static inline struct loop * +inner_loop (struct loop *loop) +{ + return loop->inner; +} + +/* Returns the next loop. */ + +static inline struct loop * +next_loop (struct loop *loop) +{ + return loop->next; +} + +/* Returns the number of a loop. */ + +static inline unsigned +loop_num (struct loop *loop) +{ + return loop->num; +} + +/* Returns the depth of a loop. */ + +static inline unsigned +loop_depth (struct loop *loop) +{ + return loop->depth; +} + +/* Returns the header basic block of the loop. */ + +static inline basic_block +loop_header (struct loop *loop) +{ + return loop->header; +} + +/* Returns the number of iterations in the loop. Use + number_of_iterations_in_loop () instead of accessing directly this + field. */ + +static inline tree +loop_nb_iterations (struct loop *loop) +{ + return loop->nb_iterations; +} + +/* Returns the number of exit edges of the loop. */ + +static inline unsigned +loop_num_exits (struct loop *loop) +{ + return loop->num_exits; +} + +/* Returns the exit edges of the loop. */ + +static inline edge * +loop_exit_edges (struct loop *loop) +{ + return loop->exit_edges; +} + +/* Returns the n-th exit edge of the loop. */ + +static inline edge +loop_exit_edge (struct loop *loop, unsigned n) +{ + return loop->exit_edges[n]; +} + |