X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;ds=sidebyside;f=ir%2Fbe%2Fbeschedrand.c;h=3388907a3f7033ba24b7096c92f28697c5df4cd6;hb=2669742071b00949c6a5102f39b7df7fd7d3e3fb;hp=5162eec0d929926a434057f5d27e30505494d9ba;hpb=4d5c3365a58cba59993045a9e08e686d8ae079a7;p=libfirm diff --git a/ir/be/beschedrand.c b/ir/be/beschedrand.c index 5162eec0d..3388907a3 100644 --- a/ir/be/beschedrand.c +++ b/ir/be/beschedrand.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -18,10 +18,11 @@ */ /** - * Trivial node selector. - * @author Matthias Braun - * @date 29.08.2006 - * @cvs-id $Id$ + * @file + * @brief Random node selector. + * @author Matthias Braun + * @date 29.08.2006 + * @version $Id$ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -43,6 +44,7 @@ static ir_node *random_select(void *block_env, ir_nodeset_t *ready_set, const arch_env_t *arch_env = block_env; ir_node *irn = NULL; int only_branches_left = 1; + (void) live_set; /* assure that branches and constants are executed last */ ir_nodeset_iterator_init(&iter, ready_set); @@ -53,17 +55,17 @@ static ir_node *random_select(void *block_env, ir_nodeset_t *ready_set, } } - if(only_branches_left) { + if (only_branches_left) { /* at last: schedule branches */ ir_nodeset_iterator_init(&iter, ready_set); irn = ir_nodeset_iterator_next(&iter); } else { do { - // take 1 random node + /* take 1 random node */ int n = rand() % ir_nodeset_size(ready_set); int i = 0; ir_nodeset_iterator_init(&iter, ready_set); - while( (irn = ir_nodeset_iterator_next(&iter)) != NULL) { + while ((irn = ir_nodeset_iterator_next(&iter)) != NULL) { if(i == n) { break; } @@ -75,21 +77,23 @@ static ir_node *random_select(void *block_env, ir_nodeset_t *ready_set, return irn; } -static void *random_init_graph(const list_sched_selector_t *vtab, const arch_env_t *arch_env, ir_graph *irg) +static void *random_init_graph(const list_sched_selector_t *vtab, const be_irg_t *birg) { + (void) vtab; /* Using time(NULL) as a seed here gives really random results, but is NOT deterministic which makes debugging impossible. Moreover no-one want non-deterministic compilers ... */ srand(0x4711); - return (void *)arch_env; + return (void *) be_get_birg_arch_env(birg); } -static void *random_init_block(void *graph_env, ir_node *bl) +static void *random_init_block(void *graph_env, ir_node *block) { + (void) block; return graph_env; } -static const list_sched_selector_t random_selector_struct = { +const list_sched_selector_t random_selector = { random_init_graph, random_init_block, random_select, @@ -101,5 +105,3 @@ static const list_sched_selector_t random_selector_struct = { NULL, /* finish_block */ NULL /* finish_graph */ }; - -const list_sched_selector_t *random_selector = &random_selector_struct;