#include "irnode_t.h"
#include "irloop.h"
#include "irgwalk.h"
-#include "irouts.h"
+#include "iredges.h"
#include "irprintf.h"
#include "irhooks.h"
static double
get_cf_probability(ir_node *bb, int pos, double loop_weight)
{
- double sum = 0.0;
- double cur = 0.0;
- int i;
- ir_node *pred = get_Block_cfgpred_block(bb, pos);
-
- cur = get_loop_depth(get_irn_loop(bb)) < get_loop_depth(get_irn_loop(pred)) ? 1.0 : loop_weight;
-
- for(i = get_Block_n_cfg_outs(pred) - 1; i >= 0; --i) {
- ir_node *succ = get_Block_cfg_out(pred, i);
-
- sum += get_loop_depth(get_irn_loop(succ)) < get_loop_depth(get_irn_loop(pred)) ? 1.0 : loop_weight;
- }
+ double sum = 0.0;
+ double cur = 0.0;
+ const ir_node *pred = get_Block_cfgpred_block(bb, pos);
+ const ir_loop *pred_loop = get_irn_loop(pred);
+ int pred_depth = get_loop_depth(pred_loop);
+ const ir_edge_t *edge;
+
+ cur = get_loop_depth(get_irn_loop(bb)) < get_loop_depth(get_irn_loop(pred)) ? 1.0 : loop_weight;
+
+ foreach_block_succ(pred, edge) {
+ const ir_node *block = get_edge_src_irn(edge);
+ const ir_loop *loop = get_irn_loop(block);
+ int depth = get_loop_depth(loop);
+ sum += depth < pred_depth ? 1.0 : loop_weight;
+ }
- return cur/sum;
+ return cur/sum;
}
static void exec_freq_node_info(void *ctx, FILE *f, const ir_node *irn)
freqs = ef->set = new_set(cmp_freq, 32);
construct_cf_backedges(irg);
+ edges_assure(irg);
wd.idx = 0;
wd.set = freqs;
#ifndef _IREXTBB_T_H_
#define _IREXTBB_T_H_
-#include "firm_config.h"
#include "irgraph_t.h"
#include "irextbb.h"
#include "irtools.h"
/** Accessing the out datastructures **/
/*--------------------------------------------------------------------*/
+#ifdef DEBUG_libfirm
/** Clear the outs of a node */
static void reset_outs (ir_node *node, void *unused)
{
node->out = NULL;
-#ifdef DEBUG_libfirm
node->out_valid = 0;
-#endif /* defined DEBUG_libfirm */
}
+#endif
/* returns the number of successors of the node: */
int get_irn_n_outs (ir_node *node) {
*/
void rta_init (int do_verbose)
{
- int i, n, n_runs = 0;
+ int n_runs = 0;
int rem_vpi = get_visit_pseudo_irgs();
set_visit_pseudo_irgs(1);
# ifdef DEBUG_libfirm
+ {
+ int i, n;
n = get_irp_n_irgs();
for (i = 0; i < n; i++) {
irg_vrfy (get_irp_irg(i));
}
tr_vrfy ();
+ }
# endif /* defined DEBUG_libfirm */
verbose = do_verbose;
}
# ifdef DEBUG_libfirm
+ {
+ int n, i;
for (i = 0; i < n; i++) {
irg_vrfy (get_irp_irg(i));
}
tr_vrfy ();
+ }
# endif /* defined DEBUG_libfirm */
set_visit_pseudo_irgs(rem_vpi);
/*
* $Log$
+ * Revision 1.37 2006/12/11 15:28:48 matze
+ * - Several warning fixes
+ * - Fixes for compilation without DEBUG_libfirm
+ * - Fixed for compilation without WITH_LIBCORE (but it's still broken)
+ *
* Revision 1.36 2006/06/05 15:58:12 beck
* added support for Thread local storage
* added more doxygen docu
firm_archops_init(def_params.arch_op_settings);
-#ifndef NDEBUG
+#ifdef DEBUG_libfirm
/* integrated debugger extension */
firm_init_debugger();
#endif
*/
static int tv_ld2(tarval *tv, int bits)
{
- int i, k, num;
+ int i, k = 0, num;
for (num = i = 0; i < bits; ++i) {
unsigned char v = get_tarval_sub_bits(tv, i);
ir_node *nn, *block;
int new_arity;
ir_op *op = get_irn_op(n);
- int copy_node_nr = env != NULL;
/* The end node looses it's flexible in array. This doesn't matter,
as dead node elimination builds End by hand, inlineing doesn't use
new_backedge_info(nn);
#if DEBUG_libfirm
+ {
+ int copy_node_nr = env != NULL;
if (copy_node_nr) {
/* for easier debugging, we want to copy the node numbers too */
nn->node_nr = n->node_nr;
}
+ }
#endif
set_new_node(n, nn);
{
entity *ent = get_irg_entity(irg);
ir_type *mtp, *lowered_mtp, *tp, *ft;
- int i, j, k, n_ress, n_ret_com, n_cr_opt;
+ int i, j, k, n_ress = 0, n_ret_com = 0, n_cr_opt;
ir_node **new_in, *ret, *endbl, *bl, *mem, *copy;
cr_pair *cr_opt;
wlk_env env;
* Create two intrinsic Calls.
*/
static void lower_DivMod(ir_node *node, ir_mode *mode, lower_env_t *env) {
- ir_node *block, *proj, *irn, *mem, *callDiv, *callMod, *resDiv, *resMod;
+ ir_node *block, *proj, *irn, *mem, *callDiv, *callMod;
+ ir_node *resDiv = NULL;
+ ir_node *resMod = NULL;
ir_node *in[4];
ir_mode *opmode;
dbg_info *dbg;
if (n_res > 0)
res_proj = new_r_Proj(irg, bl, call, mode_T, pn_Call_T_result);
+ else
+ res_proj = NULL;
if (n_proj > 0) {
n_proj += n_res - 1;
if (path)
SET_VNUM(sel, path->vnum);
else {
- unsigned i;
-
key->vnum = vnum++;
set_insert(pathes, key, PATH_SIZE(key), path_hash(key));
#ifdef DEBUG_libfirm
/* Debug output */
if (get_opt_scalar_replacement_verbose() && get_firm_verbosity() > 1) {
+ unsigned i;
printf(" %s", get_entity_name(key->path[0].ent));
for (i = 1; i < key->path_len; ++i) {
if (is_entity(key->path[i].ent))
void *env)
{
int i, n_types, n_mem;
- entity *ent;
- ir_type *tp;
+ entity *ent = NULL;
+ ir_type *tp = NULL;
ir_node *n;
/* marked? */