From 9c99a89c18c31f2694cbb00875414a83619ab661 Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Mon, 6 Sep 2010 13:05:04 +0000 Subject: [PATCH] rename heights_t to ir_heights_t, improve docu a bit, rename to heights.[ch] [r27970] --- include/libfirm/firm.h | 2 +- include/libfirm/firm_types.h | 2 +- include/libfirm/{height.h => heights.h} | 21 ++++++++++------- ir/ana/{height.c => heights.c} | 31 +++++++++++++------------ ir/be/beabi.c | 4 ++-- ir/be/beabihelper.c | 4 ++-- ir/be/beilpsched.c | 6 ++--- ir/be/beschedmris.c | 4 ++-- ir/be/beschednormal.c | 8 +++---- ir/be/beschedrss.c | 4 ++-- ir/be/ia32/ia32_common_transform.c | 3 ++- ir/be/ia32/ia32_common_transform.h | 6 ++--- ir/be/ia32/ia32_optimize.c | 2 +- ir/be/ia32/ia32_transform.c | 2 +- 14 files changed, 52 insertions(+), 47 deletions(-) rename include/libfirm/{height.h => heights.h} (76%) rename ir/ana/{height.c => heights.c} (88%) diff --git a/include/libfirm/firm.h b/include/libfirm/firm.h index 71d824efb..56e7ddf2f 100644 --- a/include/libfirm/firm.h +++ b/include/libfirm/firm.h @@ -71,7 +71,7 @@ #include "firm_common.h" #include "firmstat.h" #include "firm_types.h" -#include "height.h" +#include "heights.h" #include "ident.h" #include "interval_analysis.h" #include "irarch.h" diff --git a/include/libfirm/firm_types.h b/include/libfirm/firm_types.h index b58dccb24..438bfdb4f 100644 --- a/include/libfirm/firm_types.h +++ b/include/libfirm/firm_types.h @@ -39,6 +39,7 @@ typedef struct ir_node ir_node, *ir_node_ptr; typedef struct ir_op ir_op, *ir_op_ptr; typedef struct ir_mode ir_mode, *ir_mode_ptr; typedef struct ir_edge_t ir_edge_t, *ir_edge_ptr; +typedef struct ir_heights_t ir_heights_t; typedef struct tarval tarval, *ir_tarval_ptr; typedef struct ir_enum_const ir_enum_const, *ir_enum_const_ptr; typedef struct ir_type ir_type, *ir_type_ptr; @@ -53,7 +54,6 @@ typedef struct ir_exec_freq ir_exec_freq, *ir_exec_freq_ptr; typedef struct ir_cdep ir_cdep, *ir_cdep_ptr; typedef struct sn_entry *seqno_t; typedef struct arch_irn_ops_t arch_irn_ops_t; -typedef struct ident_if_t ident_if_t; typedef struct type_identify_if_t type_identify_if_t; typedef struct ir_graph_pass_t ir_graph_pass_t; typedef struct ir_prog_pass_t ir_prog_pass_t; diff --git a/include/libfirm/height.h b/include/libfirm/heights.h similarity index 76% rename from include/libfirm/height.h rename to include/libfirm/heights.h index acc000e1e..0b0fe7e8d 100644 --- a/include/libfirm/height.h +++ b/include/libfirm/heights.h @@ -23,6 +23,10 @@ * @author Sebastian Hack * @date 19.04.2006 * @version $Id$ + * + * The height is a measure for the longest datadependencies path from a node to + * the end of a basic block. This is usefull for scheduling heuristics and can + * also be used to speedup reachability queries. */ #ifndef FIRM_ANA_HEIGHTS_H #define FIRM_ANA_HEIGHTS_H @@ -30,8 +34,6 @@ #include "firm_types.h" #include "begin.h" -typedef struct heights_t heights_t; - /** * Get the height of a node inside a basic block. * The height of the node is the maximal number of edges between a sink node in @@ -40,16 +42,17 @@ typedef struct heights_t heights_t; * @param irn The node. * @return The height of the node. */ -FIRM_API unsigned get_irn_height(const heights_t *h, const ir_node *irn); +FIRM_API unsigned get_irn_height(const ir_heights_t *h, const ir_node *irn); /** - * Check, if a certain node is reachable according to data dependence edges from another node. + * Check, if a certain node is reachable according to data dependence edges + * from another node. Both nodes must be in the same block. * @param h The heights object. * @param n The first node. * @param m The other node. * @return 1, if n is data dependent on m, 0 if not. */ -FIRM_API int heights_reachable_in_block(heights_t *h, const ir_node *n, +FIRM_API int heights_reachable_in_block(ir_heights_t *h, const ir_node *n, const ir_node *m); /** @@ -57,7 +60,7 @@ FIRM_API int heights_reachable_in_block(heights_t *h, const ir_node *n, * This can be used to recompute the height information if the graph has changed since the last computation. * @param h The heights object. */ -FIRM_API void heights_recompute(heights_t *h); +FIRM_API void heights_recompute(ir_heights_t *h); /** * Recompute the height information for a certain block. @@ -66,20 +69,20 @@ FIRM_API void heights_recompute(heights_t *h); * @param block The block * @return The maximum over all heights in the block. */ -FIRM_API unsigned heights_recompute_block(heights_t *h, ir_node *block); +FIRM_API unsigned heights_recompute_block(ir_heights_t *h, ir_node *block); /** * Make a new heights object. * This also computes the heights for each block in the graph. * @param irg The graph. */ -FIRM_API heights_t *heights_new(ir_graph *irg); +FIRM_API ir_heights_t *heights_new(ir_graph *irg); /** * Free a heights object. * @param h The heights object. */ -FIRM_API void heights_free(heights_t *h); +FIRM_API void heights_free(ir_heights_t *h); #include "end.h" diff --git a/ir/ana/height.c b/ir/ana/heights.c similarity index 88% rename from ir/ana/height.c rename to ir/ana/heights.c index bfe19bfc3..a750f6cc2 100644 --- a/ir/ana/height.c +++ b/ir/ana/heights.c @@ -26,7 +26,7 @@ */ #include "config.h" -#include "height.h" +#include "heights.h" #include #include @@ -39,7 +39,7 @@ #include "irphase_t.h" #include "iredges_t.h" -struct heights_t { +struct ir_heights_t { ir_phase phase; unsigned visited; void *dump_handle; @@ -70,8 +70,8 @@ static void *irn_height_reinit(ir_phase *phase, const ir_node *node, static void height_dump_cb(void *data, FILE *f, const ir_node *irn) { - heights_t *heights = data; - irn_height_t *h = phase_get_irn_data(&heights->phase, irn); + ir_heights_t *heights = data; + irn_height_t *h = phase_get_irn_data(&heights->phase, irn); if (h) fprintf(f, "height: %u\n", h->height); @@ -84,7 +84,8 @@ static void height_dump_cb(void *data, FILE *f, const ir_node *irn) * @param tgt The node we try to reach. * @return 1, one of tgt can be reached from curr, 0 else. */ -static bool search(const heights_t *h, const ir_node *curr, const ir_node *tgt) +static bool search(const ir_heights_t *h, const ir_node *curr, + const ir_node *tgt) { irn_height_t *h_curr; irn_height_t *h_tgt; @@ -127,7 +128,7 @@ static bool search(const heights_t *h, const ir_node *curr, const ir_node *tgt) * Check, if one node can be reached from another one, according to data * dependence. */ -int heights_reachable_in_block(heights_t *h, const ir_node *n, +int heights_reachable_in_block(ir_heights_t *h, const ir_node *n, const ir_node *m) { int res = 0; @@ -151,7 +152,7 @@ int heights_reachable_in_block(heights_t *h, const ir_node *n, * @param irn The node. * @param bl The block. */ -static unsigned compute_height(heights_t *h, ir_node *irn, const ir_node *bl) +static unsigned compute_height(ir_heights_t *h, ir_node *irn, const ir_node *bl) { irn_height_t *ih = phase_get_or_set_irn_data(&h->phase, irn); @@ -190,7 +191,7 @@ static unsigned compute_height(heights_t *h, ir_node *irn, const ir_node *bl) return ih->height; } -static unsigned compute_heights_in_block(ir_node *bl, heights_t *h) +static unsigned compute_heights_in_block(ir_node *bl, ir_heights_t *h) { int max_height = -1; const ir_edge_t *edge; @@ -216,18 +217,18 @@ static unsigned compute_heights_in_block(ir_node *bl, heights_t *h) static void compute_heights_in_block_walker(ir_node *block, void *data) { - heights_t *h = data; + ir_heights_t *h = data; compute_heights_in_block(block, h); } -unsigned get_irn_height(const heights_t *heights, const ir_node *irn) +unsigned get_irn_height(const ir_heights_t *heights, const ir_node *irn) { const irn_height_t *h = phase_get_irn_data(&heights->phase, irn); assert(h && "No height information for node"); return h->height; } -unsigned heights_recompute_block(heights_t *h, ir_node *block) +unsigned heights_recompute_block(ir_heights_t *h, ir_node *block) { const ir_edge_t *edge; @@ -244,7 +245,7 @@ unsigned heights_recompute_block(heights_t *h, ir_node *block) return compute_heights_in_block(block, h); } -void heights_recompute(heights_t *h) +void heights_recompute(ir_heights_t *h) { ir_graph *irg = phase_get_irg(&h->phase); @@ -254,9 +255,9 @@ void heights_recompute(heights_t *h) irg_block_walk_graph(irg, compute_heights_in_block_walker, NULL, h); } -heights_t *heights_new(ir_graph *irg) +ir_heights_t *heights_new(ir_graph *irg) { - heights_t *res = XMALLOC(heights_t); + ir_heights_t *res = XMALLOC(ir_heights_t); phase_init(&res->phase, irg, irn_height_init); res->dump_handle = dump_add_node_info_callback(height_dump_cb, res); heights_recompute(res); @@ -264,7 +265,7 @@ heights_t *heights_new(ir_graph *irg) return res; } -void heights_free(heights_t *h) +void heights_free(ir_heights_t *h) { phase_deinit(&h->phase); dump_remove_node_info_callback(h->dump_handle); diff --git a/ir/be/beabi.c b/ir/be/beabi.c index a41be6dcd..984df6b55 100644 --- a/ir/be/beabi.c +++ b/ir/be/beabi.c @@ -39,7 +39,7 @@ #include "irgopt.h" #include "irbitset.h" #include "iropt_t.h" -#include "height.h" +#include "heights.h" #include "pdeq.h" #include "irtools.h" #include "raw_bitset.h" @@ -109,7 +109,7 @@ struct be_abi_irg_t { arch_register_req_t *sp_req; }; -static heights_t *ir_heights; +static ir_heights_t *ir_heights; /** Flag: if set, try to omit the frame pointer in all routines. */ static int be_omit_fp = 1; diff --git a/ir/be/beabihelper.c b/ir/be/beabihelper.c index ce6f98a75..97547e365 100644 --- a/ir/be/beabihelper.c +++ b/ir/be/beabihelper.c @@ -34,7 +34,7 @@ #include "iredges.h" #include "irgwalk.h" #include "irphase_t.h" -#include "height.h" +#include "heights.h" typedef struct reg_flag_t { const arch_register_t *reg; /**< register at an input position. @@ -497,7 +497,7 @@ static void link_ops_in_block_walker(ir_node *node, void *data) } } -static heights_t *heights; +static ir_heights_t *heights; /** * Check if a node is somehow data dependent on another one. diff --git a/ir/be/beilpsched.c b/ir/be/beilpsched.c index 5891902d1..e5e680a6e 100644 --- a/ir/be/beilpsched.c +++ b/ir/be/beilpsched.c @@ -43,7 +43,7 @@ #include "irgwalk.h" #include "irbitset.h" #include "irphase_t.h" -#include "height.h" +#include "heights.h" #include "iredges.h" #include "pdeq.h" #include "debug.h" @@ -146,7 +146,7 @@ typedef struct { typedef struct { ir_phase ph; /**< The phase */ ir_graph *irg; /**< The current irg */ - heights_t *height; /**< The heights object of the irg */ + ir_heights_t *height; /**< The heights object of the irg */ void *irg_env; /**< An environment for the irg scheduling, provided by the backend */ void *block_env; /**< An environment for scheduling a block, provided by the backend */ const arch_env_t *arch_env; @@ -208,7 +208,7 @@ static const lc_opt_table_entry_t ilpsched_option_table[] = { We need this global variable as we compare nodes dependent on heights, but we cannot pass any information to the qsort compare function. */ -static heights_t *glob_heights; +static ir_heights_t *glob_heights; /** * Check if irn is a Proj, which has no execution units assigned. diff --git a/ir/be/beschedmris.c b/ir/be/beschedmris.c index 2c7a5bbf5..6239ffeb7 100644 --- a/ir/be/beschedmris.c +++ b/ir/be/beschedmris.c @@ -46,7 +46,7 @@ #include "irtools.h" #include "irbitset.h" #include "irnodeset.h" -#include "height.h" +#include "heights.h" #include "benode.h" #include "besched.h" @@ -55,7 +55,7 @@ struct mris_env_t { ir_phase ph; - heights_t *heights; + ir_heights_t *heights; ir_graph *irg; ir_node *bl; int visited; diff --git a/ir/be/beschednormal.c b/ir/be/beschednormal.c index 68a6a55c9..9e095dfa2 100644 --- a/ir/be/beschednormal.c +++ b/ir/be/beschednormal.c @@ -30,7 +30,7 @@ #include "belistsched.h" #include "belive_t.h" #include "beutil.h" -#include "height.h" +#include "heights.h" #include "irtools.h" #include "irgwalk.h" #include "benode.h" @@ -312,7 +312,7 @@ static int root_cmp(const void* a, const void* b) static void normal_sched_block(ir_node* block, void* env) { ir_node** roots = get_irn_link(block); - heights_t* heights = env; + ir_heights_t* heights = env; int root_count; irn_cost_pair* root_costs; int i; @@ -379,8 +379,8 @@ static void normal_sched_block(ir_node* block, void* env) static void *normal_init_graph(const list_sched_selector_t *vtab, ir_graph *irg) { - instance_t* inst = XMALLOC(instance_t); - heights_t* heights; + instance_t *inst = XMALLOC(instance_t); + ir_heights_t *heights; (void)vtab; diff --git a/ir/be/beschedrss.c b/ir/be/beschedrss.c index 742e0d41a..dec645331 100644 --- a/ir/be/beschedrss.c +++ b/ir/be/beschedrss.c @@ -53,7 +53,7 @@ #include "plist.h" #include "array_t.h" -#include "height.h" +#include "heights.h" #include "beabi.h" #include "bemodule.h" @@ -149,7 +149,7 @@ typedef struct serialization { typedef struct rss { ir_phase ph; /**< Phase to hold some data */ - heights_t *h; /**< The current height object */ + ir_heights_t *h; /**< The current height object */ ir_graph *irg; /**< The irg to preprocess */ plist_t *nodes; /**< The list of interesting nodes */ const arch_env_t *arch_env; /**< The architecture environment */ diff --git a/ir/be/ia32/ia32_common_transform.c b/ir/be/ia32/ia32_common_transform.c index d48535e99..ddcb1af49 100644 --- a/ir/be/ia32/ia32_common_transform.c +++ b/ir/be/ia32/ia32_common_transform.c @@ -31,6 +31,7 @@ #include "irprintf.h" #include "typerep.h" #include "bitset.h" +#include "heights.h" #include "../betranshlp.h" #include "../beirg.h" @@ -46,7 +47,7 @@ /** hold the current code generator during transformation */ ia32_code_gen_t *env_cg = NULL; -heights_t *heights = NULL; +ir_heights_t *heights = NULL; static int check_immediate_constraint(long val, char immediate_constraint_type) { diff --git a/ir/be/ia32/ia32_common_transform.h b/ir/be/ia32/ia32_common_transform.h index 0915fd070..21c2ac382 100644 --- a/ir/be/ia32/ia32_common_transform.h +++ b/ir/be/ia32/ia32_common_transform.h @@ -27,8 +27,8 @@ #ifndef FIRM_BE_IA32_IA32_COMMON_TRANSFORM_H #define FIRM_BE_IA32_IA32_COMMON_TRANSFORM_H +#include "firm_types.h" #include "bearch_ia32_t.h" -#include "height.h" /** * An assembler constraint. @@ -44,8 +44,8 @@ struct constraint_t { }; extern ia32_code_gen_t *env_cg; -extern heights_t *heights; -extern int no_pic_adjust; +extern ir_heights_t *heights; +extern int no_pic_adjust; /** * Get an atomic entity that is initialized with a tarval forming diff --git a/ir/be/ia32/ia32_optimize.c b/ir/be/ia32/ia32_optimize.c index acef65d15..1e5dac666 100644 --- a/ir/be/ia32/ia32_optimize.c +++ b/ir/be/ia32/ia32_optimize.c @@ -34,7 +34,7 @@ #include "tv.h" #include "irgmod.h" #include "irgwalk.h" -#include "height.h" +#include "heights.h" #include "irbitset.h" #include "irprintf.h" #include "irdump.h" diff --git a/ir/be/ia32/ia32_transform.c b/ir/be/ia32/ia32_transform.c index 12e844f69..52bb6e877 100644 --- a/ir/be/ia32/ia32_transform.c +++ b/ir/be/ia32/ia32_transform.c @@ -45,7 +45,7 @@ #include "irdom.h" #include "error.h" #include "array_t.h" -#include "height.h" +#include "heights.h" #include "../benode.h" #include "../besched.h" -- 2.20.1