Commit 39f3a8db authored by Christian Würdig's avatar Christian Würdig
Browse files

unified mein file comments

unified .h #ifndef ... #define ...
changed some indenting
removed some unused code
removed beuses_t.h as unused header

[r13559]
parent 5ebb1e64
......@@ -48,6 +48,7 @@
#include "irtools.h"
#include "debug.h"
#include "xmalloc.h"
#include "iredges.h"
#include "beutil.h"
#include "besched.h"
......
......@@ -57,6 +57,7 @@
#include "debug.h"
#include "xmalloc.h"
#include "execfreq.h"
#include "iredges_t.h"
#include "bechordal_t.h"
#include "beabi.h"
......
......@@ -17,11 +17,12 @@
* PURPOSE.
*/
/*
* Author: Matthias Braun
* Date: 12.03.2007
* Copyright: (c) Universitaet Karlsruhe
* License: This file is protected by GPL - GNU GENERAL PUBLIC LICENSE.
/**
* @file
* @brief Interface for assembler output.
* @author Matthias Braun
* @date 12.03.2007
* @version $Id$
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
......
......@@ -17,11 +17,12 @@
* PURPOSE.
*/
/*
* Author: Matthias Braun
* Date: 12.03.2007
* Copyright: (c) Universitaet Karlsruhe
* License: This file is protected by GPL - GNU GENERAL PUBLIC LICENSE.
/**
* @file
* @brief Interface for assembler output.
* @author Matthias Braun
* @date 12.03.2007
* @version $Id$
*/
#ifndef FIRM_BE_BEEMITTER_H
#define FIRM_BE_BEEMITTER_H
......
......@@ -18,10 +18,11 @@
*/
/**
* Dumps global variables and constants as gas assembler.
* @author Christian Wuerdig, Matthias Braun
* @date 04.11.2005
* @version $Id$
* @file
* @brief Dumps global variables and constants as gas assembler.
* @author Christian Wuerdig, Matthias Braun
* @date 04.11.2005
* @version $Id$
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
......
......@@ -18,12 +18,14 @@
*/
/**
* Header for ia32 assembler declarations dumper.
* @author Christian Wuerdig, Matthias Braun
* $Id$
* @file
* @brief Dumps global variables and constants as gas assembler.
* @author Christian Wuerdig, Matthias Braun
* @date 04.11.2005
* @version $Id$
*/
#ifndef _BE_GEN_DECLS_H_
#define _BE_GEN_DECLS_H_
#ifndef FIRM_BE_BEGNUAS_H
#define FIRM_BE_BEGNUAS_H
#include "be.h"
#include "beemitter.h"
......@@ -58,4 +60,4 @@ void be_gas_emit_decls(be_emit_env_t *env, const be_main_env_t *main_env,
void be_gas_emit_switch_section(be_emit_env_t *env, be_gas_section_t section);
#endif
#endif /* FIRM_BE_BEGNUAS_H */
......@@ -18,12 +18,11 @@
*/
/**
* @file beifg.c
* @date 18.11.2005
* @author Sebastian Hack
*
* Copyright (C) 2005 Universitaet Karlsruhe
* Released under the GPL
* @file
* @brief Interface for interference graphs.
* @author Sebastian Hack
* @date 18.11.2005
* @version $Id$
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
......
......@@ -18,16 +18,14 @@
*/
/**
* @file beifg.h
* @date 18.11.2005
* @author Sebastian Hack
*
* Copyright (C) 2005 Universitaet Karlsruhe
* Released under the GPL
* @file
* @brief Interface for interference graphs.
* @author Sebastian Hack
* @date 18.11.2005
* @version $Id$
*/
#ifndef _BEIFG_H
#define _BEIFG_H
#ifndef FIRM_BE_BEIFG_H
#define FIRM_BE_BEIFG_H
#include <stdio.h>
......@@ -104,4 +102,4 @@ void be_ifg_check_sorted_to_file(const be_ifg_t *ifg, FILE *f);
void be_ifg_check_performance(be_chordal_env_t *chordal_env);
#endif /* _BEIFG_H */
#endif /* FIRM_BE_BEIFG_H */
......@@ -46,32 +46,32 @@
#include "benodesets.h"
typedef struct _cli_head_t {
struct list_head list;
struct list_head list;
struct _cli_head_t *next_cli_head;
ir_node *min;
ir_node *max;
ir_node *min;
ir_node *max;
} cli_head_t;
typedef struct _ifg_clique_t {
const be_ifg_impl_t *impl;
const be_ifg_impl_t *impl;
const be_chordal_env_t *env;
cli_head_t *cli_root;
struct obstack obst;
cli_head_t *curr_cli_head;
cli_head_t *cli_root;
struct obstack obst;
cli_head_t *curr_cli_head;
} ifg_clique_t;
typedef struct _cli_element_t {
struct list_head list;
ir_node *irn;
ir_node *irn;
} cli_element_t;
typedef struct _cli_iter_t {
const ifg_clique_t *ifg;
cli_head_t *curr_cli_head;
cli_element_t *curr_cli_element;
const ir_node *curr_irn;
bitset_t *visited_neighbours;
bitset_t *visited_nodes;
cli_head_t *curr_cli_head;
cli_element_t *curr_cli_element;
const ir_node *curr_irn;
bitset_t *visited_neighbours;
bitset_t *visited_nodes;
} cli_iter_t;
/* PRIVATE FUNCTIONS */
......@@ -196,9 +196,11 @@ static cli_head_t *get_next_cli_head(const ir_node *irn, cli_iter_t *it) /* ...c
if (&element->list != &head->list)
{
if (element->irn == irn)
{ /* node is in clique */
{
/* node is in clique */
it->curr_cli_head = head;
it->curr_cli_element = (void *) head; /* needed because the next element is searched with list.next of it->curr_cli_element */
/* needed because the next element is searched with list.next of it->curr_cli_element */
it->curr_cli_element = (void *) head;
break;
}
}
......@@ -218,10 +220,11 @@ static cli_head_t *get_next_cli_head(const ir_node *irn, cli_iter_t *it) /* ...c
return head;
}
static cli_element_t *get_next_element(const ir_node *irn, cli_iter_t *it) /* ... of the current clique, returns NULL if there were no more elements ..*/
/* ... of the current clique, returns NULL if there were no more elements ..*/
static cli_element_t *get_next_element(const ir_node *irn, cli_iter_t *it)
{
cli_element_t *element = it->curr_cli_element;
cli_head_t *head = it->curr_cli_head;
cli_head_t *head = it->curr_cli_head;
if (!head || it->curr_cli_element == NULL) /* way back of recursion or there are no more heads */
{
......@@ -357,9 +360,9 @@ static void find_neighbour_walker(ir_node *bl, void *data)
static void find_first_neighbour(const ifg_clique_t *ifg, cli_iter_t *it, const ir_node *irn)
{
cli_head_t *cli_head = ifg->cli_root;
cli_head_t *cli_head = ifg->cli_root;
cli_element_t *element;
bitset_t *bitset_visneighbours = bitset_malloc(get_irg_last_idx(ifg->env->irg));
bitset_t *bitset_visneighbours = bitset_malloc(get_irg_last_idx(ifg->env->irg));
int is_dominated_by_max = 0;
int dominates_min = 0;
......
......@@ -18,25 +18,21 @@
*/
/**
* @file beifg_impl.h
* @date 01.12.2005
* @author Sebastian Hack
*
* Copyright (C) 2005 Universitaet Karlsruhe
* Released under the GPL
*
* Constructors for different implementations of
* chordal interference graphs.
* @file
* @brief Constructors for different implementations of chordal interference graphs.
* @author Sebastian Hack
* @date 01.12.2005
* @version $Id$
*/
#ifndef FIRM_BE_BEIFG_IMPL_H
#define FIRM_BE_BEIFG_IMPL_H
#ifndef _BEIFG_IMPL_H
#define _BEIFG_IMPL_H
#include "bechordal_t.h"
#include "beifg.h"
#include "bechordal.h"
be_ifg_t *be_ifg_std_new(const be_chordal_env_t *env);
be_ifg_t *be_ifg_list_new(const be_chordal_env_t *env);
be_ifg_t *be_ifg_clique_new(const be_chordal_env_t *env);
be_ifg_t *be_ifg_pointer_new(const be_chordal_env_t *env);
#endif /* _BEIFG_IMPL_H */
#endif /* FIRM_BE_BEIFG_IMPL_H */
......@@ -18,14 +18,12 @@
*/
/**
* @file beifg_list.c
* @date 18.11.2005
* @author Sebastian Hack
*
* Copyright (C) 2005 Universitaet Karlsruhe
* Released under the GPL
* @file
* @brief List based implementation of chordal interference graphs.
* @author Sebastian Hack
* @date 18.11.2005
* @version $Id$
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
......@@ -49,38 +47,39 @@
typedef struct _adj_head_t adj_head_t;
typedef struct _ifg_list_t {
const be_ifg_impl_t *impl;
const be_ifg_impl_t *impl;
const be_chordal_env_t *env;
struct obstack obst;
adj_head_t **adj_heads;
struct obstack obst;
adj_head_t **adj_heads;
} ifg_list_t;
typedef struct _adj_element_t adj_element_t;
struct _adj_element_t {
adj_element_t *next_adj_element;
ir_node *neighbour;
ir_node *neighbour;
};
struct _adj_head_t {
ir_node *irn; /* the node you search neighbours for */
ir_node *irn; /* the node you search neighbours for */
adj_element_t *first_adj_element;
int degree;
int degree;
};
typedef struct _nodes_iter_t {
const ifg_list_t *ifg;
unsigned int curr_node_idx;
unsigned int curr_node_idx;
} nodes_iter_t;
typedef struct _adj_iter_t {
const ifg_list_t *ifg;
adj_element_t *curr_adj_element;
adj_element_t *curr_adj_element;
} adj_iter_t;
/* PRIVATE FUNCTIONS */
static void create_node (ifg_list_t *ifg, ir_node *irn) /* add node to the array of all nodes in this ifg implementation, if the node isn't already in the ifg */
/* add node to the array of all nodes in this ifg implementation, if the node isn't already in the ifg */
static void create_node(ifg_list_t *ifg, ir_node *irn)
{
adj_head_t *adj_head = NULL;
......@@ -106,11 +105,12 @@ static adj_element_t *create_adj_element(ifg_list_t *ifg, ir_node *irn)
return element;
}
static void add_edge(ifg_list_t *ifg, ir_node *node_a, ir_node *node_b) /* write the information about the edge between a and b */
/* write the information about the edge between a and b */
static void add_edge(ifg_list_t *ifg, ir_node *node_a, ir_node *node_b)
{
adj_head_t *adj_head = NULL;
adj_head_t *adj_head = NULL;
adj_element_t *curr_element = NULL;
adj_element_t *new_element = NULL;
adj_element_t *new_element = NULL;
adj_head = ifg->adj_heads[node_a->node_idx]; /* find the neighbours list of a */
......@@ -166,16 +166,16 @@ static void add_edge(ifg_list_t *ifg, ir_node *node_a, ir_node *node_b) /* write
}
}
static void find_neighbour_walker(ir_node *bl, void *data) /* find all adjacent nodes in the irg */
/* find all adjacent nodes in the irg */
static void find_neighbour_walker(ir_node *bl, void *data)
{
ifg_list_t *ifg = data;
struct list_head *head = get_block_border_head(ifg->env, bl);
ifg_list_t *ifg = data;
struct list_head *head = get_block_border_head(ifg->env, bl);
nodeset *live = new_nodeset(ifg->env->cls->n_regs);
ir_node *live_irn = NULL;
border_t *b = NULL;
nodeset *live = new_nodeset(ifg->env->cls->n_regs);
ir_node *live_irn = NULL;
border_t *b = NULL;
assert (is_Block(bl) && "There is no block to work on");
assert(is_Block(bl) && "There is no block to work on");
foreach_border_head(head, b) /* follow the borders of each block */
{
......@@ -205,9 +205,9 @@ static void find_neighbour_walker(ir_node *bl, void *data) /* find all adjacent
static ir_node *get_first_node(const ifg_list_t *ifg, nodes_iter_t *it)
{
ir_node *res = NULL;
adj_head_t *adj_head= NULL;
int curr_idx = -1;
ir_node *res = NULL;
adj_head_t *adj_head = NULL;
int curr_idx = -1;
it->ifg = ifg;
it->curr_node_idx = 0;
......@@ -231,10 +231,10 @@ static ir_node *get_first_node(const ifg_list_t *ifg, nodes_iter_t *it)
static ir_node *get_next_node(nodes_iter_t *it)
{
const ifg_list_t *ifg = it->ifg;
ir_node *res = NULL;
adj_head_t *adj_head= NULL;
unsigned int curr_idx = it->curr_node_idx;
const ifg_list_t *ifg = it->ifg;
ir_node *res = NULL;
adj_head_t *adj_head = NULL;
unsigned int curr_idx = it->curr_node_idx;
while (adj_head == NULL && curr_idx < it->ifg->env->irg->last_node_idx - 1)
{
......@@ -255,11 +255,11 @@ static ir_node *get_next_node(nodes_iter_t *it)
static ir_node *get_first_neighbour(const ifg_list_t *ifg, adj_iter_t *it, const ir_node *curr_irn)
{
ir_node *res = NULL;
ir_node *res = NULL;
adj_head_t *adj_head = NULL;
adj_head = ifg->adj_heads[curr_irn->node_idx];
assert (adj_head && "There is no entry for this node");
assert(adj_head && "There is no entry for this node");
it->curr_adj_element = NULL;
it->ifg = ifg;
......@@ -277,7 +277,7 @@ static ir_node *get_first_neighbour(const ifg_list_t *ifg, adj_iter_t *it, const
static ir_node *get_next_neighbour(adj_iter_t *it)
{
ir_node *res = NULL;
ir_node *res = NULL;
adj_element_t *element = it->curr_adj_element;
if (element->next_adj_element) /* return next neighbour */
......@@ -303,10 +303,10 @@ static void ifg_list_free(void *self)
static int ifg_list_connected(const void *self, const ir_node *a, const ir_node *b)
{
const ifg_list_t *ifg = self;
int res = -1;
adj_head_t *adj_head = NULL;
adj_element_t *curr_element = NULL;
const ifg_list_t *ifg = self;
int res = -1;
adj_head_t *adj_head = NULL;
adj_element_t *curr_element = NULL;
/* first try: find b in the neigbours of a */
adj_head = ifg->adj_heads[a->node_idx];
......@@ -314,7 +314,7 @@ static int ifg_list_connected(const void *self, const ir_node *a, const ir_node
assert(adj_head && "There is no entry for the node a");
curr_element = adj_head->first_adj_element;
if(curr_element)
if (curr_element)
{
while (curr_element->neighbour != b && curr_element->next_adj_element)
{
......@@ -334,7 +334,7 @@ static int ifg_list_connected(const void *self, const ir_node *a, const ir_node
assert(adj_head && "There is no entry for the node b");
curr_element = adj_head->first_adj_element;
if(curr_element)
if (curr_element)
{
while (curr_element->neighbour != a && curr_element->next_adj_element)
{
......
......@@ -18,14 +18,12 @@
*/
/**
* @file beifg_pointer.c
* @date 18.11.2005
* @author Sebastian Hack
*
* Copyright (C) 2005 Universitaet Karlsruhe
* Released under the GPL
* @file
* @brief Pointer based implementation of chordal interference graphs.
* @author Sebastian Hack
* @date 18.11.2005
* @version $Id$
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
......@@ -49,7 +47,7 @@
typedef struct _ptr_element_t ptr_element_t;
typedef union element_content {
ir_node *irn;
ir_node *irn;
ptr_element_t *element;
} element_content;
......@@ -61,29 +59,28 @@ struct _ptr_element_t {
typedef struct _ptr_head_t {
struct list_head list;
ptr_element_t *element;
ptr_element_t *element;
} ptr_head_t;
typedef struct _ifg_pointer_t {
const be_ifg_impl_t *impl;
const be_ifg_impl_t *impl;
const be_chordal_env_t *env;
ir_phase ph;
struct obstack obst;
ptr_head_t *curr_ptr_head;
ptr_element_t *curr_element;
pmap *node_map;
ir_phase ph;
struct obstack obst;
ptr_head_t *curr_ptr_head;
ptr_element_t *curr_element;
} ifg_pointer_t;
typedef struct _ptr_iter_t {
const ifg_pointer_t *ifg;
const ir_node *irn;
ptr_head_t *curr_ptr_head;
ptr_head_t *first_head;
ptr_element_t *curr_element_t;
ir_node *curr_irn;
int get_first;
int sub_call;
bitset_t *visited_neighbours;
const ir_node *irn;
ptr_head_t *curr_ptr_head;
ptr_head_t *first_head;
ptr_element_t *curr_element_t;
ir_node *curr_irn;
int get_first;
int sub_call;
bitset_t *visited_neighbours;
} ptr_iter_t;
/* PRIVATE FUNCTIONS */
......@@ -111,28 +108,16 @@ static ptr_head_t *ptr_get_new_head(ifg_pointer_t *ifg)
static void write_pointers(bitset_t *live, ifg_pointer_t *ifg)
{
ir_node *live_irn;
ir_node *live_irn;
bitset_pos_t elm;
bitset_foreach_irn(ifg->env->irg, live, elm, live_irn)
{
ptr_head_t *head = phase_get_or_set_irn_data(&ifg->ph, live_irn);
ptr_head_t *head = phase_get_or_set_irn_data(&ifg->ph, live_irn);
ptr_head_t *element = ptr_get_new_head(ifg);
ir_node *irn = NULL;
#if 0
// Matze: huh, what is this?!? node numbers aren't in any way deterministic AFAIK
if (live_irn->node_nr == 1883 || live_irn->node_nr == 1858)
irn = NULL;
#endif
element->element = ifg->curr_element; /* write current highest sub-clique for each node */
list_add(&element->list, &head->list);
/* the following code is to find all nodes, it should be replaced by a "keywalker" of irphase */
irn = pmap_get(ifg->node_map, live_irn);
if (!irn)
pmap_insert(ifg->node_map, live_irn, live_irn);
}
}
......@@ -191,35 +176,29 @@ static ptr_element_t *get_last_sub_clique(ifg_pointer_t *ifg, bitset_t *live, bi
static void find_neighbour_walker(ir_node *bl, void *data)
{
ifg_pointer_t *ifg = data;
struct list_head *head = get_block_border_head(ifg->env, bl);
border_t *b;
bitset_t *live = bitset_malloc(get_irg_last_idx(ifg->env->irg));
bitset_t *my_live;
bitset_pos_t my_elm;
ir_node *my_irn;
element_content last_irn;
element_content last_element;
int was_def = 0;
ir_node *first = NULL;
int was_first = 0;
last_irn.irn = NULL;
ifg_pointer_t *ifg = data;
struct list_head *head = get_block_border_head(ifg->env, bl);
int was_def = 0;
int was_first = 0;
ir_node *first = NULL;
bitset_t *live = bitset_malloc(get_irg_last_idx(ifg->env->irg));
bitset_t *my_live;
bitset_pos_t my_elm;
border_t *b;
ir_node *my_irn;
element_content last_irn;
element_content last_element;
last_irn.irn = NULL;
last_element.element = NULL;
assert(is_Block(bl) && "There is no block to work on.");
foreach_border_head(head, b) /* follow the borders of the block */
{
ir_node *irn = b->irn;
ir_node *irn = b->irn;
ptr_element_t *element = NULL;
#if 0
// ?!?
if (irn->node_nr == 1883 || irn->node_nr == 1858)
i=1;
#endif
if (b->is_def) /* b is a new node */
{
bitset_set(live, get_irn_idx(irn));
......@@ -242,16 +221,9 @@ static void find_neighbour_walker(ir_node *bl, void *data)
element->content_second.irn = b->irn;
element->kind = 8888; /* both are ir_nodes */
#if 0
// ?!?
if (irn->node_nr == 1883 || irn->node_nr == 1858 || irn->node_nr == 1936)
i=1;
#endif
last_element.element = element;
ifg->curr_element = element;
last_irn.irn = NULL;
ifg->curr_element = element;
last_irn.irn = NULL;
}
else
{
......@@ -285,7 +257,6 @@ static void find_neighbour_walker(ir_node *bl, void *data)
last_element.element = get_last_sub_clique(ifg, live, my_live