Commit 9c99a89c authored by Matthias Braun's avatar Matthias Braun
Browse files

rename heights_t to ir_heights_t, improve docu a bit, rename to heights.[ch]

[r27970]
parent 8993beff
......@@ -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"
......
......@@ -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;
......
......@@ -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"
......
......@@ -26,7 +26,7 @@
*/
#include "config.h"
#include "height.h"
#include "heights.h"
#include <stdlib.h>
#include <stdio.h>
......@@ -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,7 +70,7 @@ 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;
ir_heights_t *heights = data;
irn_height_t *h = phase_get_irn_data(&heights->phase, irn);
if (h)
......@@ -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);
......
......@@ -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;
......
......@@ -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.
......
......@@ -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.
......
......@@ -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;
......
......@@ -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;
......
......@@ -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 */
......
......@@ -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)
{
......
......@@ -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,7 +44,7 @@ struct constraint_t {
};
extern ia32_code_gen_t *env_cg;
extern heights_t *heights;
extern ir_heights_t *heights;
extern int no_pic_adjust;
/**
......
......@@ -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"
......
......@@ -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"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment