Commit 710d1f40 authored by Matthias Braun's avatar Matthias Braun
Browse files

benumb is old and unused

parent 423c8595
......@@ -20,8 +20,8 @@ INSTALL_HEADERS = be.h bearch.h
SOURCES = $(INSTALL_HEADERS)
SOURCES += Makefile.in besched.h belistsched.h belistsched.c \
beutil.h bemain.c besched.c bemain.c belive.c belive.h benumb.h \
benumb_t.h benumb.c bechordal.c bera.c beutil.c \
beutil.h bemain.c besched.c bemain.c belive.c belive.h \
bechordal.c bera.c beutil.c \
bera.h bechordal_main.c beschedregpress.c beschedtrace.c beschedtrivial.c \
beschedrand.c becopyopt.c becopyheur.c becopyheur2.c becopyilp.c becopyilp1.c \
becopyilp2.c beifg.c becopystat.c bearch.c bechordal_draw.c \
......
/**
* Numbering implementation.
* @author Sebastian Hack
* @date 8.12.2004
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
#include "impl.h"
#include "irnode_t.h"
#include "irgwalk.h"
#include "xmalloc.h"
#include "be_t.h"
#include "benumb_t.h"
int numbering_irn_data_offset = 0;
int numbering_irg_data_offset = 0;
FIRM_IMPL1(get_irn_graph_nr, int, const ir_node *)
FIRM_IMPL1(get_irn_block_nr, int, const ir_node *)
FIRM_IMPL1(get_block_graph_nr, int, const ir_node *)
FIRM_IMPL1(get_block_node_count, int, const ir_node *)
FIRM_IMPL1(get_graph_block_count, int, const ir_graph *)
FIRM_IMPL2(get_irn_for_graph_nr, ir_node *, const ir_graph *, int)
static void numbering_walker(ir_node *irn, void *env)
{
irg_numbering_t *graph_nr = get_irg_numbering(get_irn_irg(irn));
numbering_t *irn_nr = get_irn_numbering(irn);
if(is_Block(irn))
irn_nr->global_nr = graph_nr->local_nr++;
else {
numbering_t *block_nr = get_irn_numbering(get_nodes_block(irn));
irn_nr->local_nr = block_nr->local_nr++;
irn_nr->global_nr = graph_nr->global_nr++;
}
}
static void reverse_walker(ir_node *irn, void *env)
{
if(!is_Block(irn)) {
ir_node **map = env;
map[get_irn_graph_nr(irn)] = irn;
}
}
void be_numbering(ir_graph *irg)
{
ir_node **reverse_map;
irg_walk_graph(irg, numbering_walker, NULL, NULL);
reverse_map = xcalloc(get_graph_node_count(irg), sizeof(reverse_map[0]));
irg_walk_graph(irg, reverse_walker, NULL, reverse_map);
get_irg_numbering(irg)->reverse_map = reverse_map;
}
void be_numbering_done(ir_graph *irg)
{
free(get_irg_numbering(irg)->reverse_map);
}
void be_numbering_init(void)
{
numbering_irn_data_offset = register_additional_node_data(sizeof(numbering_t));
numbering_irg_data_offset = register_additional_graph_data(sizeof(irg_numbering_t));
}
/**
* Numbering for nodes.
* @author Sebastian Hack
* @date 8.11.2004
*/
#ifndef _BENUMB_H
#define _BENUMB_H
#include "irgraph.h"
#include "be_t.h"
int (get_irn_graph_nr)(const ir_node *irn);
int (get_irn_block_nr)(const ir_node *irn);
int (get_block_graph_nr)(const ir_node *irn);
int (get_block_node_count)(const ir_node *irn);
int (get_graph_block_count)(const ir_graph *irn);
ir_node *(get_irn_for_graph_nr)(const ir_graph *irg, int nr);
#if 0
extern const phase_t *phase_numbering;
#endif
void be_numbering(ir_graph *irg);
void be_numbering_done(ir_graph *irg);
void be_numbering_init(void);
#endif
/**
* Numbering for nodes.
* @author Sebastian Hack
* @date 8.11.2004
*/
#ifndef _BENUMB_T_H
#define _BENUMB_T_H
#include "firm_config.h"
#include "irnode.h"
#include "benumb.h"
typedef struct _numbering_t {
int local_nr;
int global_nr;
} numbering_t;
typedef struct _irg_numbering_t {
int local_nr;
int global_nr;
ir_node **reverse_map;
} irg_numbering_t;
extern int numbering_irn_data_offset;
extern int numbering_irg_data_offset;
#define _get_irn_numbering(type,irn) get_irn_data(irn, type, numbering_irn_data_offset)
#define _get_irg_numbering(type,irg) get_irg_data(irg, type, numbering_irg_data_offset)
#define get_irn_numbering_const(irn) _get_irn_numbering(const numbering_t, irn)
#define get_irg_numbering_const(irg) _get_irg_numbering(const irg_numbering_t, irg)
#define get_irn_numbering(irn) _get_irn_numbering(numbering_t, irn)
#define get_irg_numbering(irg) _get_irg_numbering(irg_numbering_t, irg)
static INLINE int _get_irn_graph_nr(const ir_node *irn)
{
assert(!is_Block(irn) && "No block expected here");
return get_irn_numbering_const(irn)->global_nr;
}
static INLINE int _get_irn_block_nr(const ir_node *irn)
{
assert(!is_Block(irn) && "No block expected here");
return get_irn_numbering_const(irn)->local_nr;
}
static INLINE int _get_block_graph_nr(const ir_node *irn)
{
assert(is_Block(irn) && "Block expected here");
return get_irn_numbering_const(irn)->global_nr;
}
static INLINE int _get_block_node_count(const ir_node *irn)
{
assert(is_Block(irn) && "Block expected here");
return get_irn_numbering_const(irn)->local_nr;
}
static INLINE int _get_graph_block_count(const ir_graph *irg)
{
return get_irg_numbering_const(irg)->local_nr;
}
static INLINE int _get_graph_node_count(const ir_graph *irg)
{
return get_irg_numbering_const(irg)->global_nr;
}
static INLINE ir_node *_get_irn_for_graph_nr(const ir_graph *irg, int nr)
{
ir_node **map = get_irg_numbering_const(irg)->reverse_map;
assert(nr >= 0 && nr <= _get_graph_node_count(irg) && map[nr] != NULL);
return map[nr];
}
#define get_irn_graph_nr(irn) _get_irn_graph_nr(irn)
#define get_irn_block_nr(irn) _get_irn_block_nr(irn)
#define get_block_graph_nr(irn) _get_block_graph_nr(irn)
#define get_block_node_count(irn) _get_block_node_count(irn)
#define get_graph_block_count(irg) _get_graph_block_count(irg)
#define get_graph_node_count(irg) _get_graph_node_count(irg)
#define get_irn_for_graph_nr(irg,nr) _get_irn_for_graph_nr(irg,nr)
#endif
Supports Markdown
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