unified header
authorChristian Würdig <chriswue@ipd.info.uni-karlsruhe.de>
Fri, 27 Apr 2007 13:23:13 +0000 (13:23 +0000)
committerChristian Würdig <chriswue@ipd.info.uni-karlsruhe.de>
Fri, 27 Apr 2007 13:23:13 +0000 (13:23 +0000)
fixed include structure (files should include all needed headers - not more and not less)

[r13523]

56 files changed:
ir/be/be.h
ir/be/be_dbgout.h
ir/be/be_t.h
ir/be/beabi.c
ir/be/beabi.h
ir/be/beabi_t.h
ir/be/bearch.c
ir/be/bearch.h
ir/be/bearch_t.h
ir/be/beblocksched.c
ir/be/beblocksched.h
ir/be/bechordal.c
ir/be/bechordal.h
ir/be/bechordal_draw.c
ir/be/bechordal_draw.h
ir/be/bechordal_main.c
ir/be/bechordal_t.h
ir/be/becopyheur.c
ir/be/becopyheur2.c
ir/be/becopyheur3.c
ir/be/becopyheur4.c
ir/be/becopyilp.c
ir/be/becopyilp2.c
ir/be/becopyilp_t.h
ir/be/becopyopt.c
ir/be/becopyopt.h
ir/be/becopyopt_t.h
ir/be/becopystat.c
ir/be/becopystat.h
ir/be/bedomfront.c
ir/be/bedomfront.h
ir/be/beifg.c
ir/be/beifg.h
ir/be/beifg_clique.c
ir/be/beifg_list.c
ir/be/beifg_std.c
ir/be/beifg_t.h
ir/be/beilpsched.c
ir/be/beirgmod.c
ir/be/belower.c
ir/be/bemain.c
ir/be/bepressurestat.c
ir/be/bespill.c
ir/be/bespill.h
ir/be/bespillbelady.c
ir/be/bespillbelady.h
ir/be/bespillmorgan.c
ir/be/bespillmorgan.h
ir/be/bespilloptions.h
ir/be/bespillremat.c
ir/be/bespillremat.h
ir/be/bespillslots.c
ir/be/bessadestr.c
ir/be/bestat.h
ir/be/beverify.c
ir/be/beverify.h

index a1b3dd9..a0877a1 100644 (file)
  * PURPOSE.
  */
 
-#ifndef _BE_MAIN_H
-#define _BE_MAIN_H
+/**
+ * @file
+ * @brief       Generic backend types and interfaces.
+ * @author      Sebastian Hack
+ * @version     $Id$
+ */
+#ifndef FIRM_BE_MAIN_H
+#define FIRM_BE_MAIN_H
 
 #include <stdio.h>
 #include "irarch.h"
@@ -96,4 +102,4 @@ const char *be_retrieve_dbg_info(const dbg_info *dbg, unsigned *line);
 typedef struct be_main_env_t be_main_env_t;
 typedef struct be_options_t  be_options_t;
 
-#endif /* _BE_MAIN_H */
+#endif /* FIRM_BE_MAIN_H */
index 64322b0..609b4bd 100644 (file)
@@ -24,8 +24,8 @@
  * @date    11.9.2006
  * @version $Id$
  */
-#ifndef __BE_DBGOUT_H__
-#define __BE_DBGOUT_H__
+#ifndef FIRM_BE_BE_DBGOUT_H
+#define FIRM_BE_BE_DBGOUT_H
 
 #include "obst.h"
 #include "beabi_t.h"
@@ -109,4 +109,4 @@ dbg_handle *be_nulldbg_open(void);
 /** Opens a stabs handler. */
 dbg_handle *be_stabs_open(FILE *out);
 
-#endif /* __BE_DBGOUT_H__ */
+#endif /* FIRM_BE_BE_DBGOUT_H */
index 6af81ff..3e80596 100644 (file)
  */
 
 /**
- * Internal backend global data structures.
- * @author Sebastian Hack
- * @date 8.12.2004
+ * @file
+ * @brief   Internal backend global data structures.
+ * @author  Sebastian Hack
+ * @version $Id$
  */
-
-#ifndef FIRM_BE_T_H
-#define FIRM_BE_T_H
+#ifndef FIRM_BE_BE_T_H
+#define FIRM_BE_BE_T_H
 
 #include "firm_types.h"
 #include "obst.h"
@@ -94,4 +94,4 @@ struct be_main_env_t {
 int be_put_ignore_regs(const be_irg_t *birg, const arch_register_class_t *cls,
                        bitset_t *bs);
 
-#endif
+#endif /* FIRM_BE_BE_T_H */
index d692cd9..7498800 100644 (file)
@@ -1,12 +1,5 @@
-/**
- * @file       becopyheur4.c
- * @brief      ABI lowering
- * @author     Sebastian Hack
- * @date       7.3.2005
- * @version    $Id$
- * @license
- *
- * Copyrigth (C) 1995-2007 University of Karlsruhe.  All right reserved.
+/*
+ * Copyright (C) 1995-2007 University of Karlsruhe.  All right reserved.
  *
  * This file is part of libFirm.
  *
  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  * PURPOSE.
- *
+ */
+
+/**
+ * @file
+ * @brief       Backend ABI implementation.
+ * @author      Sebastian Hack
+ * @version     $Id$
  */
 #ifdef HAVE_CONFIG_H
 # include "config.h"
index 60a313b..144b1b3 100644 (file)
  */
 
 /**
- * Backend ABI implementation.
+ * @file
+ * @brief       Backend ABI implementation.
+ * @author      Sebastian Hack
+ * @version     $Id$
  */
-#ifndef FIRM_BEABI_H
-#define FIRM_BEABI_H
+#ifndef FIRM_BE_BEABI_H
+#define FIRM_BE_BEABI_H
 
 #include "firm_types.h"
 
@@ -195,4 +198,4 @@ const be_stack_layout_t *be_abi_get_stack_layout(const be_abi_irg_t *abi);
  */
 int be_abi_omit_fp(const be_abi_irg_t *abi);
 
-#endif /* _BEABI_H */
+#endif /* FIRM_BE_BEABI_H */
index 9b382d5..2491328 100644 (file)
  */
 
 /**
- * Type declarations for the ABI module.
+ * @file
+ * @brief       Type declarations for the ABI module.
+ * @author      Sebastian Hack
+ * @version     $Id$
  */
-
-#ifndef _BEABI_T_H_
-#define _BEABI_T_H_
+#ifndef FIRM_BE_BEABI_T_H
+#define FIRM_BE_BEABI_T_H
 
 typedef struct _be_abi_call_flags_bits_t be_abi_call_flags_bits_t;
 typedef union  _be_abi_call_flags_t      be_abi_call_flags_t;
@@ -31,4 +33,4 @@ typedef struct _be_abi_call_t            be_abi_call_t;
 typedef struct _be_abi_irg_t             be_abi_irg_t;
 typedef struct _be_stack_layout_t        be_stack_layout_t;
 
-#endif /* _BEABI_T_H_ */
+#endif /* FIRM_BE_BEABI_T_H */
index 62fb8f8..3fe1504 100644 (file)
  */
 
 /**
- * Processor architecture specification.
- * @author Sebastian Hack
- * @date 11.2.2005
- *
- * $Id$
+ * @file
+ * @brief       Processor architecture specification.
+ * @author      Sebastian Hack
+ * @version     $Id$
  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
index 3bac389..6bce3a2 100644 (file)
  * PURPOSE.
  */
 
-#ifndef _FIRM_BEARCH_H_
-#define _FIRM_BEARCH_H_
+/**
+ * @file
+ * @brief       Processor architecture specification.
+ * @author      Sebastian Hack
+ * @version     $Id$
+ */
+#ifndef FIRM_BE_BEARCH_H
+#define FIRM_BE_BEARCH_H
 
 #include "firm_types.h"
 #include "bitset.h"
@@ -287,4 +293,4 @@ extern const arch_irn_handler_t *arch_env_pop_irn_handler(arch_env_t *env);
  */
 void be_register_isa_if(const char *name, const arch_isa_if_t *isa);
 
-#endif /* _FIRM_BEARCH_H_ */
+#endif /* FIRM_BE_BEARCH_H */
index 2ac0e37..4402cc4 100644 (file)
  * PURPOSE.
  */
 
-#ifndef FIRM_BEARCH_T_H
-#define FIRM_BEARCH_T_H
+/**
+ * @file
+ * @brief       Processor architecture specification - internal data structures.
+ * @author      Sebastian Hack
+ * @version     $Id$
+ */
+#ifndef FIRM_BE_BEARCH_T_H
+#define FIRM_BE_BEARCH_T_H
 
 #include "bearch.h"
 
@@ -557,4 +563,4 @@ struct arch_env_t {
  */
 #define arch_env_get_isa(env)   ((env)->isa)
 
-#endif
+#endif /* FIRM_BE_BEARCH_T_H */
index 063befc..b936c60 100644 (file)
  * PURPOSE.
  */
 
-/*
- * Author:      Matthias Braun, Christoph Mallon
- * Date:               27.09.2006
- * Copyright:   (c) Universitaet Karlsruhe
- * License:     This file is protected by GPL -  GNU GENERAL PUBLIC LICENSE.
- * CVS-Id:      $Id$
+/**
+ * @file
+ * @brief       Block-scheduling strategies.
+ * @author      Matthias Braun, Christoph Mallon
+ * @date        27.09.2006
+ * @version     $Id$
  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
index 5026075..998488c 100644 (file)
  * PURPOSE.
  */
 
-/*
- * Block schedule calculator
- *
- * $Id$
+/**
+ * @file
+ * @brief       Block schedule calculation.
+ * @author      Matthias Braun, Christoph Mallon
+ * @date        27.09.2006
+ * @version     $Id$
  */
-#ifndef _BEBLOCKSCHED_H
-#define _BEBLOCKSCHED_H
-
-#include "firm_config.h"
+#ifndef FIRM_BE_BEBLOCKSCHED_H
+#define FIRM_BE_BEBLOCKSCHED_H
 
-#include "obst.h"
 #include "execfreq.h"
 #include "irnode.h"
 #include "irgraph.h"
 
 ir_node **be_create_block_schedule(ir_graph *irg, ir_exec_freq *execfreqs);
 
-#endif /* _BEBLOCKSCHED_H */
+#endif /* FIRM_BE_BEBLOCKSCHED_H */
index e907498..f4638e0 100644 (file)
  */
 
 /**
- * Chordal register allocation.
- * @author Sebastian Hack
- * @date   8.12.2004
- * @cvs-id $Id$
- *
- * Copyright (C) Universitaet Karlsruhe
- * Released under the GPL
+ * @file
+ * @brief       Chordal register allocation.
+ * @author      Sebastian Hack
+ * @date        08.12.2004
+ * @version     $Id$
  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #include "beinsn_t.h"
 #include "bestatevent.h"
 #include "beirg_t.h"
-
+#include "bera.h"
 #include "bechordal_t.h"
 #include "bechordal_draw.h"
+#include "bemodule.h"
 
 DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;)
 
index b30b770..d3434f9 100644 (file)
  * PURPOSE.
  */
 
-
 /**
- * Chordal register allocation.
- * @author Sebastian Hack
- * @date 14.12.2004
+ * @file
+ * @brief       Chordal register allocation.
+ * @author      Sebastian Hack
+ * @date        14.12.2004
+ * @version     $Id$
  */
+#ifndef FIRM_BE_BECHORDAL_H
+#define FIRM_BE_BECHORDAL_H
 
-#ifndef __BECHORDAL_H
-#define __BECHORDAL_H
-
-#include "bearch_t.h"
-#include "bera.h"
-
-typedef struct be_chordal_env_t  be_chordal_env_t;
+typedef struct be_chordal_env_t     be_chordal_env_t;
+typedef struct be_ra_chordal_opts_t be_ra_chordal_opts_t;
+typedef struct border_t             border_t;
 
-#endif
+#endif /* FIRM_BE_BECHORDAL_H */
index 47c89ad..ab646be 100644 (file)
  * PURPOSE.
  */
 
-
 /**
- * @file   bechordal_draw.c
- * @date   12.05.2005
- * @author Sebastian Hack
- *
- * Paint chordal graphs.
- *
- * Copyright (C) 2005 Universitaet Karlsruhe
- * Released under the GPL
+ * @file
+ * @brief       Paint chordal graphs.
+ * @author      Sebastian Hack
+ * @date        12.05.2005
+ * @version     $Id$
  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #include "irgwalk.h"
 #include "irprintf.h"
 #include "iredges_t.h"
+#include "irtools.h"
 
 #include "belive_t.h"
 #include "bechordal_t.h"
 #include "besched_t.h"
 #include "bechordal_draw.h"
+#include "beirg_t.h"
 
 typedef struct {
-  be_chordal_env_t *env;
-  plotter_t inh;
-  const color_t *color;
-  int width;
+       be_chordal_env_t *env;
+       plotter_t inh;
+       const color_t *color;
+       int width;
 } base_plotter_t;
 
 #define decl_self(type, from) \
   type *self = (type *) from
 
-static void set_color(plotter_t *_self, const color_t *color)
-{
-  decl_self(base_plotter_t, _self);
-  self->color = color;
+static void set_color(plotter_t *_self, const color_t *color) {
+       decl_self(base_plotter_t, _self);
+       self->color = color;
 }
 
-static const color_t *get_color(const plotter_t *_self)
-{
-  decl_self(const base_plotter_t, _self);
-  return self->color;
+static const color_t *get_color(const plotter_t *_self) {
+       decl_self(const base_plotter_t, _self);
+       return self->color;
 }
 
-static void set_width(plotter_t *_self, int width)
-{
-  decl_self(base_plotter_t, _self);
-  self->width = width;
+static void set_width(plotter_t *_self, int width) {
+       decl_self(base_plotter_t, _self);
+       self->width = width;
 }
 
-static int get_width(const plotter_t *_self)
-{
-  decl_self(const base_plotter_t, _self);
-  return self->width;
+static int get_width(const plotter_t *_self) {
+       decl_self(const base_plotter_t, _self);
+       return self->width;
 }
 
-static void plotter_default_free(plotter_t *self)
-{
+static void plotter_default_free(plotter_t *self) {
 }
 
 typedef struct {
-  base_plotter_t inh;
-  const char *filename;
-  FILE *f;
+       base_plotter_t inh;
+       const char     *filename;
+       FILE           *f;
 } ps_plotter_t;
 
 
@@ -102,79 +95,79 @@ typedef struct {
 
 static void ps_begin(plotter_t *_self, const rect_t *vis)
 {
-  FILE *f;
-  decl_self(ps_plotter_t, _self);
+       FILE *f;
+       decl_self(ps_plotter_t, _self);
 
-  f = self->f = fopen(self->filename, "wt");
-  fprintf(f, "%%!PS-Adobe-2.0\n");
-  fprintf(f, "%%%%BoundingBox: %d %d %d %d\n", vis->x, vis->y, vis->w, vis->h);
+       f = self->f = fopen(self->filename, "wt");
+       fprintf(f, "%%!PS-Adobe-2.0\n");
+       fprintf(f, "%%%%BoundingBox: %d %d %d %d\n", vis->x, vis->y, vis->w, vis->h);
 #if 0
-  fprintf(f, "/mainfont /Courier findfont %f scalefont def\n", 10.0);
-  fprintf(f, "mainfont setfont\n");
-#endif
+       fprintf(f, "/mainfont /Courier findfont %f scalefont def\n", 10.0);
+       fprintf(f, "mainfont setfont\n");
+#endif /* if 0 */
 }
 
 static void ps_setcolor(plotter_t *_self, const color_t *color)
 {
-  decl_self(ps_plotter_t, _self);
-  set_color(_self, color);
+       decl_self(ps_plotter_t, _self);
+       set_color(_self, color);
 
-  fprintf(self->f, "%.2f %.2f %.2f setrgbcolor\n",
-      color->r, color->g, color->b);
+       fprintf(self->f, "%.2f %.2f %.2f setrgbcolor\n",
+               color->r, color->g, color->b);
 }
 
 static void ps_line(plotter_t *_self, int x1, int y1, int x2, int y2)
 {
-  decl_self(ps_plotter_t, _self);
+       decl_self(ps_plotter_t, _self);
 
-  fprintf(self->f, "%d %d moveto\n", x1, y1);
-  fprintf(self->f, "%d %d lineto\n", x2, y2);
-  fprintf(self->f, "stroke\n");
+       fprintf(self->f, "%d %d moveto\n", x1, y1);
+       fprintf(self->f, "%d %d lineto\n", x2, y2);
+       fprintf(self->f, "stroke\n");
 }
 
 static void ps_box(plotter_t *_self, const rect_t *rect)
 {
-  decl_self(ps_plotter_t, _self);
+       decl_self(ps_plotter_t, _self);
 
-  fprintf(self->f, "%d %d %d %d rectstroke\n",
-      rect->x, rect->y, rect->w, rect->h);
+       fprintf(self->f, "%d %d %d %d rectstroke\n",
+               rect->x, rect->y, rect->w, rect->h);
 }
 
 void ps_text(plotter_t *_self, int x, int y, const char *str)
 {
-  decl_self(ps_plotter_t, _self);
+       decl_self(ps_plotter_t, _self);
 
-  fprintf(self->f, "%d %d moveto\n", x, y);
-  fprintf(self->f, "(%s) show\n", str);
+       fprintf(self->f, "%d %d moveto\n", x, y);
+       fprintf(self->f, "(%s) show\n", str);
 }
 
 static void ps_finish(plotter_t *_self)
 {
-  decl_self(ps_plotter_t, _self);
-  fclose(self->f);
+       decl_self(ps_plotter_t, _self);
+       fclose(self->f);
 }
 
 const plotter_if_t ps_plotter_vtab = {
-  ps_begin,
-  ps_setcolor,
-  get_color,
-  set_width,
-  get_width,
-  ps_line,
-  ps_box,
-  ps_text,
-  ps_finish,
-  plotter_default_free
+       ps_begin,
+       ps_setcolor,
+       get_color,
+       set_width,
+       get_width,
+       ps_line,
+       ps_box,
+       ps_text,
+       ps_finish,
+       plotter_default_free
 };
 
 plotter_t *new_plotter_ps(const char *filename)
 {
-  ps_plotter_t *ps_plotter = xmalloc(sizeof(*ps_plotter));
-  plotter_t *p = (plotter_t *) ps_plotter;
+       ps_plotter_t *ps_plotter = xmalloc(sizeof(*ps_plotter));
+       plotter_t *p = (plotter_t *) ps_plotter;
 
-  ps_plotter->filename = filename;
-  p->vtab = &ps_plotter_vtab;
-  return p;
+       ps_plotter->filename = filename;
+       p->vtab = &ps_plotter_vtab;
+       return p;
 }
 
 /*
@@ -186,223 +179,210 @@ plotter_t *new_plotter_ps(const char *filename)
 
 */
 
+/* chriswue: the following seems to be unused and can be deleted? */
 #if 0
 typedef struct {
-  base_plotter_t inh;
-  const char *filename;
-  FILE *f;
+       base_plotter_t inh;
+       const char *filename;
+       FILE *f;
 } tikz_plotter_t;
 
 static void tikz_begin(plotter_t *_self, const rect_t *vis)
 {
-  FILE *f;
-  decl_self(tikz_plotter_t, _self);
+       FILE *f;
+       decl_self(tikz_plotter_t, _self);
 
-  f = self->f = fopen(self->filename, "wt");
-  fprintf(f, "\\begin{tikzpicture}\n");
+       f = self->f = fopen(self->filename, "wt");
+       fprintf(f, "\\begin{tikzpicture}\n");
 }
 
 static void tikz_setcolor(plotter_t *_self, const color_t *color)
 {
-  set_color(_self, color);
+       set_color(_self, color);
 }
 
 static void tikz_line(plotter_t *_self, int x1, int y1, int x2, int y2)
 {
-  decl_self(tikz_plotter_t, _self);
-  fprintf(self->f, "\t\\draw (%d,%d) -- (%d,%d);\n", x1, y1, x2, y2);
+       decl_self(tikz_plotter_t, _self);
+       fprintf(self->f, "\t\\draw (%d,%d) -- (%d,%d);\n", x1, y1, x2, y2);
 }
 
 static void tikz_box(plotter_t *_self, const rect_t *rect)
 {
-  decl_self(tikz_plotter_t, _self);
+       decl_self(tikz_plotter_t, _self);
 
-  fprintf(self->f, "\t\\draw (%d,%d) rectangle (%d, %d)\n",
-         rect->x, rect->y, rect->x + rect->w, rect->y + rect->h);
+       fprintf(self->f, "\t\\draw (%d,%d) rectangle (%d, %d)\n",
+               rect->x, rect->y, rect->x + rect->w, rect->y + rect->h);
 }
 
 void tikz_text(plotter_t *_self, int x, int y, const char *str)
 {
-  decl_self(tikz_plotter_t, _self);
-  fprintf(self->f, "\t\\draw (%d,%d) node {%s};\n", x, y, str);
+       decl_self(tikz_plotter_t, _self);
+       fprintf(self->f, "\t\\draw (%d,%d) node {%s};\n", x, y, str);
 }
 
 static void tikz_finish(plotter_t *_self)
 {
-  decl_self(tikz_plotter_t, _self);
-  fclose(self->f);
+       decl_self(tikz_plotter_t, _self);
+       fclose(self->f);
 }
-#endif
+#endif /* if 0 */
 
 
 extern void plotter_free(plotter_t *self)
 {
-  self->vtab->free(self);
-  free(self);
+       self->vtab->free(self);
+       free(self);
 }
 
 const draw_chordal_opts_t draw_chordal_def_opts = {
-  10, 10, 30, 8, 10, 10
+       10, 10, 30, 8, 10, 10
 };
 
 typedef struct _draw_chordal_env_t {
-  const be_chordal_env_t *chordal_env;
-  const arch_env_t *arch_env;
-  const arch_register_class_t *cls;
-  pmap *block_dims;
-  plotter_t *plotter;
-  const draw_chordal_opts_t *opts;
-
-  struct obstack obst;
-  int max_color;
+       const be_chordal_env_t      *chordal_env;
+       const arch_env_t            *arch_env;
+       const arch_register_class_t *cls;
+       pmap                        *block_dims;
+       plotter_t                   *plotter;
+       const draw_chordal_opts_t   *opts;
+       struct obstack              obst;
+       int                         max_color;
 } draw_chordal_env_t;
 
 struct block_dims {
-  int max_step;
-  int min_step;
-  int max_color;
-  rect_t box;
-  rect_t subtree_box;
+       int    max_step;
+       int    min_step;
+       int    max_color;
+       rect_t box;
+       rect_t subtree_box;
 };
 
-#undef min
-static INLINE int min(int a, int b)
-{
-  return a < b ? a : b;
-}
-
-#undef max
-static INLINE int max(int a, int b)
-{
-  return a > b ? a : b;
-}
-
-#define doz(a, b) max((a) - (b), 0)
+#define doz(a, b) MAX((a) - (b), 0)
 
 static void block_dims_walker(ir_node *block, void *data)
 {
-  draw_chordal_env_t *env = data;
-  border_t *b;
-       struct list_head *head = get_block_border_head(env->chordal_env, block);
-  const draw_chordal_opts_t *opts = env->opts;
-  struct block_dims *dims = obstack_alloc(&env->obst, sizeof(*dims));
+       draw_chordal_env_t        *env  = data;
+       struct list_head          *head = get_block_border_head(env->chordal_env, block);
+       const draw_chordal_opts_t *opts = env->opts;
+       struct block_dims         *dims = obstack_alloc(&env->obst, sizeof(*dims));
+       border_t                  *b;
 
-  memset(dims, 0, sizeof(*dims));
-  dims->min_step = INT_MAX;
+       memset(dims, 0, sizeof(*dims));
+       dims->min_step = INT_MAX;
 
        list_for_each_entry_reverse(border_t, b, head, list) {
-    ir_node *irn = b->irn;
-    const arch_register_t *reg = arch_get_irn_register(env->arch_env, irn);
-    int col = arch_register_get_index(reg);
+               ir_node               *irn = b->irn;
+               const arch_register_t *reg = arch_get_irn_register(env->arch_env, irn);
+               int                   col  = arch_register_get_index(reg);
 
-    dims->max_step = max(dims->max_step, b->step);
-    dims->max_color = max(dims->max_color, col);
-    env->max_color = max(env->max_color, col);
-  }
+               dims->max_step  = MAX(dims->max_step, b->step);
+               dims->max_color = MAX(dims->max_color, col);
+               env->max_color  = MAX(env->max_color, col);
+       }
 
-  dims->min_step = 1;
+       dims->min_step = 1;
 
 #if 1
-  dims->box.w = (dims->max_color + 2) * opts->h_inter_gap;
-  dims->box.h = dims->max_step * opts->v_inter_gap;
-#else
-  dims->box.w = dims->box.h = 10;
-#endif
+       dims->box.w = (dims->max_color + 2) * opts->h_inter_gap;
+       dims->box.h = dims->max_step * opts->v_inter_gap;
+#else /* ! if 1 */
+       dims->box.w = dims->box.h = 10;
+#endif /* if 1 */
 
-  pmap_insert(env->block_dims, block, dims);
+       pmap_insert(env->block_dims, block, dims);
 }
 
 static void layout(const draw_chordal_env_t *env, ir_node *bl, int x)
 {
-  const draw_chordal_opts_t *opts = env->opts;
-  struct block_dims *dims = pmap_get(env->block_dims, bl);
-  ir_node *sub;
-  rect_t *rect = &dims->subtree_box;
-  int h_space = 0, v_space = 0;
+       const draw_chordal_opts_t *opts   = env->opts;
+       struct block_dims         *dims   = pmap_get(env->block_dims, bl);
+       rect_t                    *rect   = &dims->subtree_box;
+       int                       h_space = 0;
+       int                       v_space = 0;
+       ir_node                   *sub;
 
-  memset(rect, 0, sizeof(*rect));
-  rect->x = x;
+       memset(rect, 0, sizeof(*rect));
+       rect->x = x;
 
-  dominates_for_each(bl, sub) {
-    struct block_dims *bl_dim = pmap_get(env->block_dims, sub);
+       dominates_for_each(bl, sub) {
+               struct block_dims *bl_dim = pmap_get(env->block_dims, sub);
 
-    layout(env, sub, rect->x + rect->w);
+               layout(env, sub, rect->x + rect->w);
 
-    rect->w += h_space + bl_dim->subtree_box.w;
-    rect->h = max(rect->h, bl_dim->subtree_box.h);
+               rect->w += h_space + bl_dim->subtree_box.w;
+               rect->h  = MAX(rect->h, bl_dim->subtree_box.h);
 
-    h_space = opts->h_gap;
-    v_space = opts->v_gap;
-  }
+               h_space = opts->h_gap;
+               v_space = opts->v_gap;
+       }
 
-  rect->w = max(rect->w, dims->box.w + opts->h_gap);
+       rect->w = MAX(rect->w, dims->box.w + opts->h_gap);
 
-  dims->box.x = x + doz(rect->w, dims->box.w) / 2;
-  dims->box.y = rect->h + v_space;
+       dims->box.x = x + doz(rect->w, dims->box.w) / 2;
+       dims->box.y = rect->h + v_space;
 
-  rect->h += dims->box.h + v_space;
+       rect->h += dims->box.h + v_space;
 }
 
 static void set_y(const draw_chordal_env_t *env, ir_node *bl, int up)
 {
-  const draw_chordal_opts_t *opts = env->opts;
-  struct block_dims *dims = pmap_get(env->block_dims, bl);
-  int max_height = dims->subtree_box.h - dims->box.h - opts->v_gap;
-  ir_node *sub;
+       const draw_chordal_opts_t *opts      = env->opts;
+       struct block_dims         *dims      = pmap_get(env->block_dims, bl);
+       int                       max_height = dims->subtree_box.h - dims->box.h - opts->v_gap;
+       ir_node                   *sub;
 
-  dominates_for_each(bl, sub) {
-    struct block_dims *bl_dim = pmap_get(env->block_dims, sub);
-    int height_diff = max_height - bl_dim->subtree_box.h;
+       dominates_for_each(bl, sub) {
+               struct block_dims *bl_dim = pmap_get(env->block_dims, sub);
+               int height_diff = max_height - bl_dim->subtree_box.h;
 
-    set_y(env, sub, up + height_diff);
-  }
+               set_y(env, sub, up + height_diff);
+       }
 
-  dims->subtree_box.y += up;
-  dims->box.y += up;
+       dims->subtree_box.y += up;
+       dims->box.y         += up;
 }
 
 static color_t *reg_to_color(const draw_chordal_env_t *env,
-    ir_node *rel_bl, ir_node *irn, color_t *color)
+                                                        ir_node *rel_bl, ir_node *irn, color_t *color)
 {
-  int phi_arg = 0;
-  const ir_edge_t *edge;
+       int             phi_arg = 0;
+       const ir_edge_t *edge;
 
-  foreach_out_edge(irn, edge)
-    phi_arg |= is_Phi(edge->src);
+       foreach_out_edge(irn, edge)
+               phi_arg |= is_Phi(edge->src);
 
 #if 1
-  color->r = is_Phi(irn) ? 0.5 : 0.0;
-  color->g = phi_arg ? 0.5 : 0.0;
-  color->b = 0.0;
-#else
-  {
-    int live_in = is_live_in(rel_bl, irn);
-    int live_out = is_live_out(rel_bl, irn);
-
-    color->r = live_in;
-    color->g = live_out;
-    color->b = 0.0;
-  }
-#endif
-
-  return color;
-
+       color->r = is_Phi(irn) ? 0.5 : 0.0;
+       color->g = phi_arg ? 0.5 : 0.0;
+       color->b = 0.0;
+#else /* ! if 1 */
+       {
+               int live_in  = is_live_in(rel_bl, irn);
+               int live_out = is_live_out(rel_bl, irn);
+
+               color->r = live_in;
+               color->g = live_out;
+               color->b = 0.0;
+       }
+#endif /* if 1 */
+
+       return color;
 }
 
 static void draw_block(ir_node *bl, void *data)
 {
-       static const color_t black = { 0, 0, 0 };
-
-       const draw_chordal_env_t *env = data;
-       const be_lv_t *lv = be_get_birg_liveness(env->chordal_env->birg);
-       pset *live_in = be_lv_pset_put_in(lv, bl, pset_new_ptr_default());
-       ir_node *irn;
-       border_t *b;
-       struct list_head *head = get_block_border_head(env->chordal_env, bl);
-       ir_node *dom = get_Block_idom(bl);
-       const draw_chordal_opts_t *opts = env->opts;
-       struct block_dims *dims = pmap_get(env->block_dims, bl);
-       char buf[64];
+       static const color_t      black    = { 0, 0, 0 };
+       const draw_chordal_env_t  *env     = data;
+       const be_lv_t             *lv      = be_get_birg_liveness(env->chordal_env->birg);
+       pset                      *live_in = be_lv_pset_put_in(lv, bl, pset_new_ptr_default());
+       struct list_head          *head    = get_block_border_head(env->chordal_env, bl);
+       ir_node                   *dom     = get_Block_idom(bl);
+       const draw_chordal_opts_t *opts    = env->opts;
+       struct block_dims         *dims    = pmap_get(env->block_dims, bl);
+       char                      buf[64];
+       ir_node                   *irn;
+       border_t                  *b;
 
        ir_snprintf(buf, sizeof(buf), "%F", bl);
 
@@ -410,98 +390,94 @@ static void draw_block(ir_node *bl, void *data)
        env->plotter->vtab->box(env->plotter, &dims->box);
 
 #if 0
-  env->plotter->vtab->text(env->plotter, dims->box.x, dims->box.y, buf);
+       env->plotter->vtab->text(env->plotter, dims->box.x, dims->box.y, buf);
 #endif
 
-  list_for_each_entry(border_t, b, head, list) {
-         if(b->is_def) {
-                 const arch_register_t *reg = arch_get_irn_register(env->arch_env, b->irn);
-                 int col = arch_register_get_index(reg);
-                 int live_out = be_is_live_out(lv, bl, b->irn);
-                 int x = (col + 1) * opts->h_inter_gap;
-                 int ystart = (b->step) * opts->v_inter_gap;
-                 int ystop = (b->other_end->step)
-                         * opts->v_inter_gap + (live_out ? 0 : opts->v_inter_gap / 2);
-
-                 color_t color;
-                 reg_to_color(env, bl, b->irn, &color);
-
-                 x += dims->box.x;
-                 ystart += dims->box.y;
-                 ystop += dims->box.y;
-
-                 env->plotter->vtab->set_color(env->plotter, &color);
-                 env->plotter->vtab->line(env->plotter, x, ystart, x, ystop);
-
-                 env->plotter->vtab->line(env->plotter, x - 2, ystart, x + 2, ystart);
-                 env->plotter->vtab->line(env->plotter, x - 2, ystop, x + 2, ystop);
-         }
-  }
-
-  if(dom) {
-         struct block_dims *dom_dims = pmap_get(env->block_dims, dom);
-
-         for(irn = pset_first(live_in); irn; irn = pset_next(live_in)) {
-                 if(arch_irn_has_reg_class(env->arch_env, irn, -1, env->cls)) {
-                         const arch_register_t *reg = arch_get_irn_register(env->arch_env, irn);
-                         int col = arch_register_get_index(reg);
-                         int x = (col + 1) * opts->h_inter_gap;
-
-                         color_t color;
-                         reg_to_color(env, bl, irn, &color);
-
-                         env->plotter->vtab->set_color(env->plotter, &color);
-                         env->plotter->vtab->line(env->plotter,
-                                         dims->box.x + x,
-                                         dims->box.y + dims->box.h,
-                                         dom_dims->box.x + x,
-                                         dom_dims->box.y);
-                 }
-         }
-  }
-
-  del_pset(live_in);
+       list_for_each_entry(border_t, b, head, list) {
+               if (b->is_def) {
+                       const arch_register_t *reg = arch_get_irn_register(env->arch_env, b->irn);
+                       int col      = arch_register_get_index(reg);
+                       int live_out = be_is_live_out(lv, bl, b->irn);
+                       int x        = (col + 1) * opts->h_inter_gap;
+                       int ystart   = (b->step) * opts->v_inter_gap;
+                       int ystop    = (b->other_end->step) * opts->v_inter_gap + (live_out ? 0 : opts->v_inter_gap / 2);
+
+                       color_t color;
+                       reg_to_color(env, bl, b->irn, &color);
+
+                       x      += dims->box.x;
+                       ystart += dims->box.y;
+                       ystop  += dims->box.y;
+
+                       env->plotter->vtab->set_color(env->plotter, &color);
+                       env->plotter->vtab->line(env->plotter, x, ystart, x, ystop);
+
+                       env->plotter->vtab->line(env->plotter, x - 2, ystart, x + 2, ystart);
+                       env->plotter->vtab->line(env->plotter, x - 2, ystop, x + 2, ystop);
+               }
+       }
+
+       if (dom) {
+               struct block_dims *dom_dims = pmap_get(env->block_dims, dom);
+
+               for (irn = pset_first(live_in); irn; irn = pset_next(live_in)) {
+                       if (arch_irn_has_reg_class(env->arch_env, irn, -1, env->cls)) {
+                               const arch_register_t *reg = arch_get_irn_register(env->arch_env, irn);
+                               int     col = arch_register_get_index(reg);
+                               int     x   = (col + 1) * opts->h_inter_gap;
+                               color_t color;
+
+                               reg_to_color(env, bl, irn, &color);
+
+                               env->plotter->vtab->set_color(env->plotter, &color);
+                               env->plotter->vtab->line(env->plotter,
+                                       dims->box.x + x,
+                                       dims->box.y + dims->box.h,
+                                       dom_dims->box.x + x,
+                                       dom_dims->box.y);
+                       }
+               }
+       }
+
+       del_pset(live_in);
 }
 
 static void draw(draw_chordal_env_t *env, const rect_t *start_box)
 {
-  plotter_t *p = env->plotter;
-  rect_t bbox;
+       plotter_t *p = env->plotter;
+       rect_t bbox;
 
-  bbox.x = bbox.y = 0;
-  bbox.w = start_box->w + 2 * env->opts->x_margin;
-  bbox.h = start_box->h + 2 * env->opts->y_margin;
+       bbox.x = bbox.y = 0;
+       bbox.w = start_box->w + 2 * env->opts->x_margin;
+       bbox.h = start_box->h + 2 * env->opts->y_margin;
 
-  be_assure_liveness(env->chordal_env->birg);
+       be_assure_liveness(env->chordal_env->birg);
 
-  p->vtab->begin(p, &bbox);
-  irg_block_walk_graph(env->chordal_env->irg, draw_block, NULL, env);
-  p->vtab->finish(p);
+       p->vtab->begin(p, &bbox);
+       irg_block_walk_graph(env->chordal_env->irg, draw_block, NULL, env);
+       p->vtab->finish(p);
 }
 
-void draw_interval_tree(const draw_chordal_opts_t *opts,
-                                               const be_chordal_env_t *chordal_env,
-                                               plotter_t *plotter)
-{
-  draw_chordal_env_t env;
-  struct block_dims *start_dims;
-  ir_node *start_block = get_irg_start_block(chordal_env->irg);
-
-  env.arch_env = chordal_env->birg->main_env->arch_env;
-  env.opts = opts;
-  env.block_dims = pmap_create();
-  env.plotter = plotter;
-  env.cls = chordal_env->cls;
-  env.max_color = 0;
-  env.chordal_env = chordal_env;
-  obstack_init(&env.obst);
-
-  irg_block_walk_graph(chordal_env->irg, block_dims_walker, NULL, &env);
-  layout(&env, start_block, opts->x_margin);
-  set_y(&env, start_block, opts->y_margin);
-  start_dims = pmap_get(env.block_dims, start_block);
-  draw(&env, &start_dims->subtree_box);
-
-  pmap_destroy(env.block_dims);
-  obstack_free(&env.obst, NULL);
+void draw_interval_tree(const draw_chordal_opts_t *opts, const be_chordal_env_t *chordal_env, plotter_t *plotter) {
+       draw_chordal_env_t env;
+       struct block_dims  *start_dims;
+       ir_node            *start_block = get_irg_start_block(chordal_env->irg);
+
+       env.arch_env    = chordal_env->birg->main_env->arch_env;
+       env.opts        = opts;
+       env.block_dims  = pmap_create();
+       env.plotter     = plotter;
+       env.cls         = chordal_env->cls;
+       env.max_color   = 0;
+       env.chordal_env = chordal_env;
+       obstack_init(&env.obst);
+
+       irg_block_walk_graph(chordal_env->irg, block_dims_walker, NULL, &env);
+       layout(&env, start_block, opts->x_margin);
+       set_y(&env, start_block, opts->y_margin);
+       start_dims = pmap_get(env.block_dims, start_block);
+       draw(&env, &start_dims->subtree_box);
+
+       pmap_destroy(env.block_dims);
+       obstack_free(&env.obst, NULL);
 }
index 8240d2d..34e768f 100644 (file)
  * PURPOSE.
  */
 
-
 /**
- * @file   bechordal_draw.h
- * @date   13.05.2005
- * @author Sebastian Hack
- *
- * Drawing chordal graphs.
- *
- * Copyright (C) 2005 Universitaet Karlsruhe
- * Released under the GPL
+ * @file
+ * @brief       Paint chordal graphs.
+ * @author      Sebastian Hack
+ * @date        12.05.2005
+ * @version     $Id$
  */
+#ifndef FIRM_BE_BECHORDAL_DRAW_H
+#define FIRM_BE_BECHORDAL_DRAW_H
 
-#ifndef _BECHORDAL_DRAW_H
-#define _BECHORDAL_DRAW_H
+#include "bechordal.h"
 
-#include "bearch_t.h"
-
-typedef struct _plotter_t plotter_t;
-typedef struct _plotter_if_t plotter_if_t;
-typedef struct _rect_t rect_t;
+typedef struct _plotter_t           plotter_t;
+typedef struct _plotter_if_t        plotter_if_t;
+typedef struct _rect_t              rect_t;
 typedef struct _draw_chordal_opts_t draw_chordal_opts_t;
-typedef struct _color_t color_t;
+typedef struct _color_t             color_t;
 
 struct _color_t {
-  double r, g, b;
+       double r, g, b;
 };
 
 struct _rect_t {
-  int x, y, w, h;
+       int x, y, w, h;
 };
 
 struct _plotter_if_t {
-  void (*begin)(plotter_t *self, const rect_t *visible_area);
-
-  void (*set_color)(plotter_t *self, const color_t * color);
-  const color_t * (*get_color)(const plotter_t *self);
-  void (*set_width)(plotter_t *self, int width);
-  int (*get_width)(const plotter_t *self);
-  void (*line)(plotter_t *self, int x1, int y1, int x2, int y2);
-  void (*box)(plotter_t *self, const rect_t *rect);
-  void (*text)(plotter_t *self, int x, int y, const char *str);
-
-  void (*finish)(plotter_t *self);
-  void (*free)(plotter_t *self);
+       void (*begin)(plotter_t *self, const rect_t *visible_area);
+
+       void (*set_color)(plotter_t *self, const color_t * color);
+       const color_t *(*get_color)(const plotter_t *self);
+       void (*set_width)(plotter_t *self, int width);
+       int (*get_width)(const plotter_t *self);
+       void (*line)(plotter_t *self, int x1, int y1, int x2, int y2);
+       void (*box)(plotter_t *self, const rect_t *rect);
+       void (*text)(plotter_t *self, int x, int y, const char *str);
+
+       void (*finish)(plotter_t *self);
+       void (*free)(plotter_t *self);
 };
 
 extern void plotter_free(plotter_t *self);
 
 struct _plotter_t {
-  const plotter_if_t *vtab;
+       const plotter_if_t *vtab;
 };
 
 struct _draw_chordal_opts_t {
-  int h_gap;
-  int h_inter_gap;
-  int v_gap;
-  int v_inter_gap;
-  int x_margin;
-  int y_margin;
+       int h_gap;
+       int h_inter_gap;
+       int v_gap;
+       int v_inter_gap;
+       int x_margin;
+       int y_margin;
 };
 
 extern const draw_chordal_opts_t draw_chordal_def_opts;
 
 extern plotter_t *new_plotter_ps(const char *filename);
 
-extern void draw_interval_tree(
-    const draw_chordal_opts_t *opts,
-    const be_chordal_env_t *chordal_env,
-    plotter_t *plotter);
+extern void draw_interval_tree(const draw_chordal_opts_t *opts, const be_chordal_env_t *chordal_env, plotter_t *plotter);
 
-#endif /* _BECHORDAL_DRAW_H */
+#endif /* FIRM_BE_BECHORDAL_DRAW_H */
index 7c0f2dd..31006d4 100644 (file)
  */
 
 /**
- * @file   bechordal_main.c
- * @date   29.11.2005
- * @author Sebastian Hack
- * @cvs-id $Id$
- *
- * Copyright (C) 2005-2006 Universitaet Karlsruhe
- * Released under the GPL
- *
- * Driver for the chordal register allocator.
+ * @file
+ * @brief       Driver for the chordal register allocator.
+ * @author      Sebastian Hack
+ * @date        29.11.2005
+ * @version     $Id$
  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
+#include <stdlib.h>
 #include <time.h>
 
 #include "obst.h"
@@ -76,6 +73,8 @@
 #include "bestat.h"
 #include "bemodule.h"
 #include "be_t.h"
+#include "bera.h"
+#include "beirg_t.h"
 
 #include "bespillbelady.h"
 #include "bespillmorgan.h"
index a696031..1dfd665 100644 (file)
  * PURPOSE.
  */
 
-
 /**
- * Internal data structures for the chordal register allocator.
- * @author Sebastian Hack
- * @date 25.1.2005
+ * @file
+ * @brief       Internal data structures for the chordal register allocator.
+ * @author      Sebastian Hack
+ * @date        25.01.2005
+ * @version     $Id$
  */
+#ifndef FIRM_BE_BECHORDAL_T_H
+#define FIRM_BE_BECHORDAL_T_H
 
-#ifndef _BECHORDAL_T_H
-#define _BECHORDAL_T_H
-
-#include "firm_types.h"
-#include "firm_config.h"
-
-#include <stdlib.h>
-
-#include "bitset.h"
 #include "list.h"
-#include "obst.h"
-#include "pset.h"
 #include "pmap.h"
-#include "set.h"
-
-#include "execfreq.h"
+#include "irnode.h"
+#include "bitset.h"
+#include "obst.h"
+#include "debug.h"
 
-#include "be_t.h"
-#include "beifg.h"
-#include "bera.h"
-#include "bearch_t.h"
 #include "bechordal.h"
-#include "belive.h"
-#include "beirg_t.h"
-
-typedef struct be_ra_chordal_opts_t  be_ra_chordal_opts_t;
-typedef struct border_t              border_t;
+#include "beirg.h"
+#include "beifg.h"
 
 /** Defines an invalid register index. */
 #define NO_COLOR (-1)
@@ -65,7 +51,7 @@ struct border_t {
        ir_node          *irn;          /**< The node. */
        unsigned         step;          /**< The number equal to the interval border. */
        unsigned         pressure;      /**< The pressure at this interval border. (The border itself is counting). */
-       unsigned         is_def : 1;    /**< Does this border denote a use or a def. */
+       unsigned         is_def  : 1;   /**< Does this border denote a use or a def. */
        unsigned         is_real : 1;   /**< Is the def/use real? Or is it just
                                             inserted at block beginnings or ends
                                             to ensure that inside a block, each
@@ -137,4 +123,4 @@ struct be_ra_chordal_opts_t {
 
 void be_pre_spill_prepare_constr(be_chordal_env_t *cenv);
 
-#endif /* _BECHORDAL_T_H */
+#endif /* FIRM_BE_BECHORDAL_T_H */
index 74597a3..1afb062 100644 (file)
  */
 
 /**
- * Author:      Daniel Grund
- * Date:               12.04.2005
- * Copyright:   (c) Universitaet Karlsruhe
- * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
-
+ * @file
+ * @brief       First simple copy minimization heuristics.
+ * @author      Daniel Grund
+ * @date        12.04.2005
+ * @version     $Id$
+ *
  * Heuristic for minimizing copies using a queue which holds 'qnodes' not yet
  * examined. A qnode has a 'target color', nodes out of the opt unit and
  * a 'conflict graph'. 'Conflict graph' = "Interference graph' + 'conflict edges'
 #endif
 
 #include "debug.h"
+#include "bitset.h"
+#include "raw_bitset.h"
 #include "xmalloc.h"
+
 #include "becopyopt_t.h"
 #include "becopystat.h"
 #include "benodesets.h"
-#include "bitset.h"
-#include "raw_bitset.h"
-#include "xmalloc.h"
+#include "bera.h"
+#include "beirg_t.h"
 
 DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;)
 
@@ -68,29 +71,29 @@ typedef struct _conflict_t {
  */
 typedef struct _node_stat_t {
        ir_node *irn;
-       int new_color;
-       int pinned_local :1;
+       int     new_color;
+       int     pinned_local :1;
 } node_stat_t;
 
 /**
  * Represents a node in the optimization queue.
  */
 typedef struct _qnode_t {
-       struct list_head queue;         /**< chaining of unit_t->queue */
-       const unit_t *ou;                       /**< the opt unit this qnode belongs to */
-       int color;                                      /**< target color */
-       set *conflicts;                         /**< contains conflict_t's. All internal conflicts */
-       int mis_costs;                          /**< costs of nodes/copies in the mis. */
-       int mis_size;                           /**< size of the array below */
-       ir_node **mis;                          /**< the nodes of unit_t->nodes[] being part of the max independent set */
-       set *changed_nodes;                     /**< contains node_stat_t's. */
+       struct list_head queue;            /**< chaining of unit_t->queue */
+       const unit_t     *ou;              /**< the opt unit this qnode belongs to */
+       int              color;            /**< target color */
+       set              *conflicts;       /**< contains conflict_t's. All internal conflicts */
+       int              mis_costs;        /**< costs of nodes/copies in the mis. */
+       int              mis_size;         /**< size of the array below */
+       ir_node          **mis;            /**< the nodes of unit_t->nodes[] being part of the max independent set */
+       set              *changed_nodes;   /**< contains node_stat_t's. */
 } qnode_t;
 
 static pset *pinned_global;                    /**< optimized nodes should not be altered any more */
 
 static INLINE int nodes_interfere(const be_chordal_env_t *env, const ir_node *a, const ir_node *b)
 {
-       if(env->ifg)
+       if (env->ifg)
                return be_ifg_connected(env->ifg, a, b);
        else
                return values_interfere(env->birg->lv, a, b);
index a500d92..dcedd76 100644 (file)
  */
 
 /**
- * More experiments on coalescing.
- * @author Sebastian Hack
- * @date   14.04.2006
+ * @file
+ * @brief       More experiments on coalescing.
+ * @author      Sebastian Hack
+ * @date        14.04.2006
+ * @version     $Id$
  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -52,6 +54,7 @@
 #include "becopyopt.h"
 #include "becopyopt_t.h"
 #include "bechordal_t.h"
+#include "beirg_t.h"
 
 #define DUMP_BEFORE 1
 #define DUMP_AFTER  2
@@ -1247,9 +1250,9 @@ static be_ifg_dump_dot_cb_t ifg_dot_cb = {
 
 int co_solve_heuristic_new(copy_opt_t *co)
 {
-       char buf[256];
+       char  buf[256];
        co2_t env;
-       FILE *f;
+       FILE  *f;
 
        phase_init(&env.ph, "co2", co->cenv->birg->irg, PHASE_DEFAULT_GROWTH, co2_irn_init, NULL);
        env.touched     = NULL;
index 8aeb44a..6d1455d 100644 (file)
  */
 
 /**
- * More experiments on coalescing.
- * @author Sebastian Hack
- * @date   25.07.2006
+ * @file
+ * @brief       More experiments on coalescing with Java implementation.
+ * @author      Sebastian Hack
+ * @date        25.07.2006
+ * @version     $Id$
  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
index fd12adf..c28c807 100644 (file)
  */
 
 /**
- * @file       becopyheur4.c
- * @brief      Simple copy minimization heuristics.
- * @author     27.04.2007
- * @version    $Id$
- * @license
- *
- * Copyrigth (C) 1995-2007 University of Karlsruhe.  All right reserved.
- *
- * This file is part of libFirm.
- *
- * This file may be distributed and/or modified under the terms of the
- * GNU General Public License version 2 as published by the Free Software
- * Foundation and appearing in the file LICENSE.GPL included in the
- * packaging of this file.
- *
- * Licensees holding valid libFirm Professional Edition licenses may use
- * this file in accordance with the libFirm Commercial License.
- * Agreement provided with the Software.
- *
- * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
- * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE.
- *
- * @summary
+ * @file
+ * @brief       Simple copy minimization heuristics.
+ * @author      Christian Wuerdig
+ * @date        27.04.2007
+ * @version     $Id$
  *
  * This is the C implementation of the mst algorithm
  * originally written in Java by Sebastian Hack.
  * (also known as "heur3" :)
  * Performs simple copy minimization.
  */
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif /* HAVE_CONFIG_H */
 #include "xmalloc.h"
 #include "pdeq.h"
 #include "irprintf.h"
+#include "irbitset.h"
 
 #include "bearch.h"
 #include "beifg.h"
 #include "be_t.h"
 #include "becopyopt_t.h"
-#include "irbitset.h"
 
 #define COL_COST_INFEASIBLE       DBL_MAX
 #define AFF_NEIGHBOUR_FIX_BENEFIT 128.0
index ad39537..b42cad0 100644 (file)
  */
 
 /**
- * Author:      Daniel Grund
- * Date:               28.02.2006
- * Copyright:   (c) Universitaet Karlsruhe
- * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
- *
- * Common stuff used by all ILP fomulations.
- *
+ * @file
+ * @brief       Common stuff used by all ILP formulations.
+ * @author      Daniel Grund
+ * @date        28.02.2006
+ * @version     $Id$
  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
index e40698a..8054f48 100644 (file)
  */
 
 /**
- * Author:      Daniel Grund
- * Date:               28.02.2006
- * Copyright:   (c) Universitaet Karlsruhe
- * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
- *
+ * @file
+ * @brief       ILP based copy minimization.
+ * @author      Daniel Grund
+ * @date        28.02.2006
+ * @version     $Id$
  *
  * ILP formalization using G=(V, E, Q):
  *  - 2 class of variables: coloring vars x_ic   and   equal color vars y_ij
@@ -44,7 +44,6 @@
  *
  *             x_nc, y_ij \in N,   w_ij \in R^+
  */
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif /* HAVE_CONFIG_H */
index 9f9e62b..0bd2894 100644 (file)
  */
 
 /**
- * Author:      Daniel Grund
- * Date:               28.02.2006
- * Copyright:   (c) Universitaet Karlsruhe
- * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
- *
- * Common stuff used by all ILP fomulations.
- *
+ * @file
+ * @brief       Common stuff used by all ILP formulations.
+ * @author      Daniel Grund
+ * @date        28.02.2006
+ * @version     $Id$
  */
-
-#ifndef _BECOPYILP_T_H
-#define _BECOPYILP_T_H
+#ifndef FIRM_BE_BECOPYILP_T_H
+#define FIRM_BE_BECOPYILP_T_H
 
 #include "firm_config.h"
 
-#include "irnode_t.h"
+#include "irnode.h"
 #include "pset.h"
 #include "becopyopt_t.h"
-#include "xmalloc.h"
 
 /******************************************************************************
     _____ _                        _            _   _
@@ -51,14 +47,14 @@ typedef struct _coloring_suffix_t coloring_suffix_t;
 
 struct _coloring_suffix_t {
        coloring_suffix_t *next;
-       ir_node *irn;
+       ir_node           *irn;
 };
 
 typedef struct _size_red_t {
-       copy_opt_t *co;
-       pset *all_removed;                              /**< All nodes removed during problem size reduction */
-       coloring_suffix_t *col_suff;    /**< Coloring suffix. Reverse would be a PEO prefix */
-       struct obstack ob;
+       copy_opt_t        *co;
+       pset              *all_removed;   /**< All nodes removed during problem size reduction */
+       coloring_suffix_t *col_suff;      /**< Coloring suffix. Reverse would be a PEO prefix */
+       struct obstack    ob;
 } size_red_t;
 
 /**
@@ -93,14 +89,14 @@ void free_size_red(size_red_t *sr);
  *       Is this necessary?
  */
 static INLINE int co_ilp_get_costs(copy_opt_t *co, ir_node *root, ir_node *arg) {
-       int i;
+       int    i;
        unit_t *curr;
 
        /* search optimization unit for phi */
        list_for_each_entry(unit_t, curr, &co->units, units)
                if (curr->nodes[0] == root) {
 
-                       for (i=1; i<curr->node_count; ++i)
+                       for (i = 1; i < curr->node_count; ++i)
                                if (curr->nodes[i] == arg)
                                        return curr->costs[i];
 
@@ -139,12 +135,12 @@ typedef struct _ilp_env_t ilp_env_t;
 typedef void(*ilp_callback)(ilp_env_t*);
 
 struct _ilp_env_t {
-       const copy_opt_t *co;                   /**< the copy opt problem */
-       size_red_t *sr;                                 /**< problem size reduction. removes simple nodes */
-       lpp_t *lp;                                              /**< the linear programming problem */
-       void *env;
-       ilp_callback build;
-       ilp_callback apply;
+       const copy_opt_t *co;   /**< the copy opt problem */
+       size_red_t       *sr;   /**< problem size reduction. removes simple nodes */
+       lpp_t            *lp;   /**< the linear programming problem */
+       void             *env;
+       ilp_callback     build;
+       ilp_callback     apply;
 };
 
 ilp_env_t *new_ilp_env(copy_opt_t *co, ilp_callback build, ilp_callback apply, void *env);
@@ -160,6 +156,6 @@ void free_ilp_env(ilp_env_t *ienv);
 #define name_cdd_sorted(buf, char1, int1, int2) \
                        name_cdd(buf, char1, MIN(int1, int2), MAX(int1, int2))
 
-#endif // WITH_ILP
+#endif /* WITH_ILP */
 
-#endif
+#endif /* FIRM_BE_BECOPYILP_T_H */
index 5c5e169..05bc3ee 100644 (file)
  */
 
 /**
- * Author:      Daniel Grund
- * Date:               12.04.2005
- * Copyright:   (c) Universitaet Karlsruhe
- * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
+ * @file
+ * @brief       Copy minimization driver.
+ * @author      Daniel Grund
+ * @date        12.04.2005
+ * @version     $Id$
+ *
+ * Main file for the optimization reducing the copies needed for:
+ * - Phi coalescing
+ * - Register-constrained nodes
+ * - Two-address code instructions
  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -57,6 +63,7 @@
 #include "bestatevent.h"
 #include "beirg_t.h"
 #include "error.h"
+#include "bera.h"
 
 #include <libcore/lc_timing.h>
 #include <libcore/lc_opts.h>
index 08f82b9..fb2b055 100644 (file)
  */
 
 /**
- * Author:      Daniel Grund
- * Date:               11.04.2005
- * Copyright:   (c) Universitaet Karlsruhe
- * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
+ * @file
+ * @brief       Copy minimization driver.
+ * @author      Daniel Grund
+ * @date        11.04.2005
+ * @version     $Id$
  *
  * Main file for the optimization reducing the copies needed for:
  * - Phi coalescing
  * - Register-constrained nodes
  * - Two-address code instructions
  */
-#ifndef _BECOPYOPT_H
-#define _BECOPYOPT_H
+#ifndef FIRM_BE_BECOPYOPT_H
+#define FIRM_BE_BECOPYOPT_H
 
 #include <stdio.h>
 
-#include "firm_types.h"
+#include "irnode.h"
 #include "bechordal.h"
 
 /**
@@ -64,7 +65,7 @@ void co_driver(be_chordal_env_t *cenv);
 
 typedef struct _copy_opt_t copy_opt_t;
 
-typedef int(*cost_fct_t)(const copy_opt_t *, ir_node*, ir_node*, int);
+typedef int(*cost_fct_t)(const copy_opt_t *, ir_node *, ir_node *, int);
 
 /** A coalescing algorithm. */
 typedef int (co_algo_t)(copy_opt_t *);
@@ -262,4 +263,4 @@ int co_solve_ilp2(copy_opt_t *co);
  */
 int co_gs_is_optimizable(copy_opt_t *co, ir_node *irn);
 
-#endif /* _BECOPYOPT_H */
+#endif /* FIRM_BE_BECOPYOPT_H */
index 2151732..3a6a723 100644 (file)
  */
 
 /**
- * Author:      Daniel Grund
- * Date:               12.04.2005
- * Copyright:   (c) Universitaet Karlsruhe
- * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
- *
- * Internal header for copy optimization problem.
+ * @file
+ * @brief       Internal header for copy optimization problem.
+ * @author      Daniel Grund
+ * @date        12.04.2005
+ * @version     $Id$
  */
-
-#ifndef _BECOPYOPT_T_H
-#define _BECOPYOPT_T_H
+#ifndef FIRM_BE_BECOPYOPT_T_H
+#define FIRM_BE_BECOPYOPT_T_H
 
 #include "obst.h"
 #include "list.h"
+#include "set.h"
+
 #include "bearch_t.h"
 #include "bechordal_t.h"
 #include "becopyopt.h"
  * Data representing the problem of copy minimization.
  */
 struct _copy_opt_t {
-       be_chordal_env_t *cenv;
+       be_chordal_env_t            *cenv;
        const arch_register_class_t *cls;
-       const arch_env_t *aenv;
-       ir_graph *irg;
-       char *name;                                             /**< ProgName__IrgName__RegClassName */
-       cost_fct_t get_costs;                   /**< function ptr used to get costs for copies */
+       const arch_env_t            *aenv;
+       ir_graph                    *irg;
+       char                        *name;       /**< ProgName__IrgName__RegClassName */
+       cost_fct_t                  get_costs;   /**< function ptr used to get costs for copies */
 
        /** Representation as optimization units */
-       struct list_head units;                 /**< all units to optimize in specific order */
+       struct list_head units;    /**< all units to optimize in specific order */
 
        /** Representation in graph structure. Only build on demand */
        struct obstack obst;
-       set *nodes;
+       set    *nodes;
 };
 
 /* Helpers */
@@ -90,18 +90,18 @@ static INLINE int is_2addr_code(const arch_register_req_t *req)
 #define MIS_HEUR_TRIGGER 8
 
 typedef struct _unit_t {
-       struct list_head units;         /**< chain for all units */
-       copy_opt_t *co;                         /**< the copy opt this unit belongs to */
-       int node_count;                         /**< size of the nodes array */
-       ir_node **nodes;                        /**< [0] is the root-node, others are non interfering args of it. */
-       int *costs;                                     /**< costs[i] are incurred, if nodes[i] has a different color */
-       int inevitable_costs;           /**< sum of costs of all args interfering with root */
-       int all_nodes_costs;            /**< sum of all costs[i] */
-       int min_nodes_costs;            /**< a lower bound for the costs in costs[], determined by a max independent set */
-       int sort_key;                           /**< maximum costs. controls the order of ou's in the struct list_head units. */
+       struct list_head units;              /**< chain for all units */
+       copy_opt_t       *co;                /**< the copy opt this unit belongs to */
+       int              node_count;         /**< size of the nodes array */
+       ir_node          **nodes;            /**< [0] is the root-node, others are non interfering args of it. */
+       int              *costs;             /**< costs[i] are incurred, if nodes[i] has a different color */
+       int              inevitable_costs;   /**< sum of costs of all args interfering with root */
+       int              all_nodes_costs;    /**< sum of all costs[i] */
+       int              min_nodes_costs;    /**< a lower bound for the costs in costs[], determined by a max independent set */
+       int              sort_key;           /**< maximum costs. controls the order of ou's in the struct list_head units. */
 
        /* for heuristic */
-       struct list_head queue;         /**< list of qn's sorted by weight of qn-mis */
+       struct list_head queue;                  /**< list of qn's sorted by weight of qn-mis */
 } unit_t;
 
 
@@ -121,16 +121,16 @@ typedef struct _neighb_t neighb_t;
 typedef struct _affinity_node_t affinity_node_t;
 
 struct _neighb_t {
-       neighb_t *next;                 /** the next neighbour entry*/
-       ir_node *irn;                   /** the neighbour itself */
-       int costs;                              /** the costs of the edge (affinity_node_t->irn, neighb_t->irn) */
+       neighb_t *next;   /** the next neighbour entry*/
+       ir_node  *irn;    /** the neighbour itself */
+       int      costs;   /** the costs of the edge (affinity_node_t->irn, neighb_t->irn) */
 };
 
 struct _affinity_node_t {
-       ir_node *irn;                   /** a node with affinity edges */
-       int degree;                             /** number of affinity edges in the linked list below */
-       neighb_t *neighbours;   /** a linked list of all affinity neighbours */
-       void *data;             /** stuff that is attachable. */
+       ir_node  *irn;          /** a node with affinity edges */
+       int      degree;        /** number of affinity edges in the linked list below */
+       neighb_t *neighbours;   /** a linked list of all affinity neighbours */
+       void     *data;         /** stuff that is attachable. */
 };
 
 
@@ -151,4 +151,4 @@ static INLINE affinity_node_t *get_affinity_info(const copy_opt_t *co, ir_node *
 #define co_gs_foreach_neighb(aff_node, neighb) for (neighb = aff_node->neighbours; neighb; neighb = neighb->next)
 
 
-#endif
+#endif /* FIRM_BE_BECOPYOPT_T_H */
index 01edf22..1f7f657 100644 (file)
  */
 
 /**
- * Author:      Daniel Grund
- * Date:               19.04.2005
- * Copyright:   (c) Universitaet Karlsruhe
- * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
+ * @file
+ * @brief       Copy node statistics.
+ * @author      Daniel Grund
+ * @date        19.04.2005
+ * @version     $Id$
  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -44,6 +45,7 @@
 #include "becopystat.h"
 #include "beirg_t.h"
 #include "bemodule.h"
+#include "bera.h"
 
 #define DEBUG_LVL SET_LEVEL_1
 DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;)
index 930dca6..09a6127 100644 (file)
  */
 
 /**
- * Author:      Daniel Grund
- * Date:               11.04.2005
- * Copyright:   (c) Universitaet Karlsruhe
- * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
- * CVS-Id:      $Id$
+ * @file
+ * @brief       Copy node statistics.
+ * @author      Daniel Grund
+ * @date        11.04.2005
+ * @version     $Id$
  */
-#ifndef _BECOPYSTAT_H
-#define _BECOPYSTAT_H
+#ifndef FIRM_BE_BECOPYSTAT_H
+#define FIRM_BE_BECOPYSTAT_H
 
 #include "firm_config.h"
 #include "irgraph.h"
@@ -57,4 +57,4 @@ void copystat_add_ilp_iter(int iters);
  */
 void co_compare_solvers(be_chordal_env_t *chordal_env);
 
-#endif /* _BECOPYSTAT_H */
+#endif /* FIRM_BE_BECOPYSTAT_H */
index c5fbf60..c4c3d42 100644 (file)
 
 /**
  * @file
+ * @brief       Algorithms for computing normal and iterated dominance frontiers.
  * @author      Sebastian Hack, Daniel Grund
- * @date:       04.05.2005
+ * @date        04.05.2005
  * @version     $Id$
- * Copyright:   (c) Universitaet Karlsruhe
- * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
-#include "bedomfront.h"
-
 #include "obst.h"
 #include "pmap.h"
 #include "pdeq.h"
@@ -38,6 +35,9 @@
 #include "array.h"
 #include "irgraph.h"
 #include "iredges_t.h"
+#include "irnodeset.h"
+
+#include "bedomfront.h"
 
 /**
  * The dominance frontier for a graph.
@@ -155,11 +155,11 @@ void be_get_iterated_dominance_frontiers(const be_dom_front_info_t *domfronts,
                waitq_put(worklist, block);
        }
 
-       while(!pdeq_empty(worklist)) {
-               int i;
-               ir_node *block = waitq_get(worklist);
-               ir_node **domfront = be_get_dominance_frontier(domfronts, block);
-               int domfront_len = ARR_LEN(domfront);
+       while(! pdeq_empty(worklist)) {
+               int     i;
+               ir_node *block       = waitq_get(worklist);
+               ir_node **domfront   = be_get_dominance_frontier(domfronts, block);
+               int     domfront_len = ARR_LEN(domfront);
 
                for (i = 0; i < domfront_len; ++i) {
                        ir_node *y = domfront[i];
index 6d3f06e..b012c96 100644 (file)
  * @author      Sebastian Hack, Daniel Grund
  * @date:       04.05.2005
  * @version     $Id$
- * Copyright:   (c) Universitaet Karlsruhe
- * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
  */
-#ifndef _FIRM_BE_DOMFRONT_H_
-#define _FIRM_BE_DOMFRONT_H_
+#ifndef FIRM_BE_BEDOMFRONT_H
+#define FIRM_BE_BEDOMFRONT_H
 
-#include "irnodeset.h"
+#include "irnode.h"
+#include "irgraph.h"
 
 /*
  * Forward type declaration.
@@ -55,7 +54,6 @@ void be_free_dominance_frontiers(be_dom_front_info_t *info);
  * @param block The block whose dominance frontier you want.
  * @return A list containing the all blocks in the dominance frontier of @p block.
  */
-ir_node **be_get_dominance_frontier(const be_dom_front_info_t *info,
-                                    ir_node *block);
+ir_node **be_get_dominance_frontier(const be_dom_front_info_t *info, ir_node *block);
 
-#endif
+#endif /* FIRM_BE_BEDOMFRONT_H */
index 8501e53..9ca560f 100644 (file)
@@ -36,7 +36,6 @@
 #include <libcore/lc_timing.h>
 
 #include "bitset.h"
-
 #include "irgwalk.h"
 #include "irnode_t.h"
 #include "irprintf.h"
 #include "beifg_t.h"
 #include "beifg_impl.h"
 #include "irphase_t.h"
-#include "bechordal.h"
 #include "error.h"
 #include "xmalloc.h"
 
 #include "becopystat.h"
 #include "becopyopt.h"
 #include "beirg_t.h"
+#include "bemodule.h"
 
 /** Defines values for the ifg performance test */
 #define BE_CH_PERFORMANCETEST_MIN_NODES (50)
@@ -60,9 +59,9 @@
 typedef struct _coloring_t coloring_t;
 
 struct _coloring_t {
-       ir_phase ph;
+       ir_phase         ph;
        const arch_env_t *arch_env;
-       ir_graph *irg;
+       ir_graph         *irg;
 };
 
 size_t (be_ifg_nodes_iter_size)(const be_ifg_t *ifg)
index 82f3054..f207d05 100644 (file)
 #ifndef _BEIFG_H
 #define _BEIFG_H
 
-#include "becopyopt.h"
+#include <stdio.h>
+
+#include "irnode.h"
 
-#include "firm_types.h"
+#include "becopyopt.h"
+#include "beirg.h"
 
 typedef struct _be_ifg_impl_t   be_ifg_impl_t;
 typedef struct _be_ifg_t        be_ifg_t;
index 2450578..6c36e22 100644 (file)
  */
 
 /**
- * @file   beifg_clique.c
- * @date   18.11.2005
- * @author Sebastian Hack
- *
- * Copyright (C) 2005 Universitaet Karlsruhe
- * Released under the GPL
+ * @file
+ * @brief       Clique calculation for chordal ifg.
+ * @author      Sebastian Hack
+ * @date        18.11.2005
+ * @version     $Id$
  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -39,6 +38,7 @@
 #include "irgwalk.h"
 #include "irbitset.h"
 
+#include "bearch_t.h"
 #include "be_t.h"
 #include "bera.h"
 #include "beifg_t.h"
@@ -322,11 +322,11 @@ static ir_node *get_next_node(cli_iter_t *it)
 
 static void find_neighbour_walker(ir_node *bl, void *data)
 {
-       ifg_clique_t *ifg       = data;
-       struct list_head *head  = get_block_border_head(ifg->env, bl);
-       border_t *b;
-       int was_def = 0;
-       nodeset *live = new_nodeset(ifg->env->cls->n_regs);
+       ifg_clique_t     *ifg    = data;
+       struct list_head *head   = get_block_border_head(ifg->env, bl);
+       int              was_def = 0;
+       nodeset          *live   = new_nodeset(ifg->env->cls->n_regs);
+       border_t         *b;
 
        assert(is_Block(bl) && "There is no block to work on.");
 
index c7fd3fe..617f160 100644 (file)
@@ -39,6 +39,7 @@
 #include "irgraph_t.h"
 #include "irgwalk.h"
 
+#include "bearch_t.h"
 #include "be_t.h"
 #include "bera.h"
 #include "beifg_t.h"
index eb5b1b7..b139f19 100644 (file)
  */
 
 /**
- * @file   beifg_std.c
- * @date   18.11.2005
- * @author Sebastian Hack
- *
- * Copyright (C) 2005 Universitaet Karlsruhe
- * Released under the GPL
+ * @file
+ * @brief   Default ifg implementation.
+ * @author  Sebastian Hack
+ * @date    18.11.2005
+ * @version $Id$
  */
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 #include "irnodeset.h"
 #include "irgraph_t.h"
 #include "irgwalk.h"
+#include "irtools.h"
 
+#include "bearch_t.h"
 #include "be_t.h"
 #include "belive_t.h"
 #include "bera.h"
 #include "beifg_t.h"
 #include "bechordal_t.h"
-
-#define MAX(x, y) ((x) > (y) ? (x) : (y))
+#include "beirg_t.h"
+#include "bera.h"
 
 typedef struct _ifg_std_t ifg_std_t;
 
 struct _ifg_std_t {
-       const be_ifg_impl_t *impl;
+       const be_ifg_impl_t    *impl;
        const be_chordal_env_t *env;
 };
 
@@ -62,27 +62,26 @@ static void ifg_std_free(void *self)
 static int ifg_std_connected(const void *self, const ir_node *a, const ir_node *b)
 {
        const ifg_std_t *ifg = self;
-       be_lv_t *lv = ifg->env->birg->lv;
+       be_lv_t         *lv  = ifg->env->birg->lv;
        return values_interfere(lv, a, b);
 }
 
 typedef struct _nodes_iter_t {
        const be_chordal_env_t *env;
-       struct obstack obst;
-       int n;
-       int curr;
-       ir_node **nodes;
+       struct obstack         obst;
+       int                    n;
+       int                    curr;
+       ir_node                **nodes;
 } nodes_iter_t;
 
 static void nodes_walker(ir_node *bl, void *data)
 {
-       nodes_iter_t *it = data;
+       nodes_iter_t     *it   = data;
        struct list_head *head = get_block_border_head(it->env, bl);
-
-       border_t *b;
+       border_t         *b;
 
        foreach_border_head(head, b) {
-               if(b->is_def && b->is_real) {
+               if (b->is_def && b->is_real) {
                        obstack_ptr_grow(&it->obst, b->irn);
                        it->n++;
                }
index 4d1961d..de5a0aa 100644 (file)
@@ -53,7 +53,7 @@ struct _be_ifg_impl_t {
 };
 
 struct _be_ifg_t {
-       const be_ifg_impl_t *impl;
+       const be_ifg_impl_t    *impl;
        const be_chordal_env_t *env;
 };
 
index b8a9d91..f1b372b 100644 (file)
  */
 
 /**
- * Scheduling algorithms.
+ * @file
+ * @brief       ILP based instruction scheduling.
+ * @author      Christian Wuerdig
+ * @date        22.10.2006
+ * @version     $Id$
+ *
  * An ILP scheduler based on
  * "ILP-based Instruction Scheduling for IA-64"
  * by Daniel Kaestner and Sebastian Winkel
  * extended with register pressure constraints by Christian Wuerdig
- *
- * @date   22.10.2005
- * @author Christian Wuerdig
- * @cvs-id $Id$
  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -68,6 +69,7 @@
 #include "beutil.h"
 #include "bestat.h"
 #include "beirg_t.h"
+#include "benodesets.h"
 
 typedef struct _ilpsched_options_t {
        unsigned regpress;
index c9eb4d5..301234e 100644 (file)
 
 /**
  * @file
- * @brief
+ * @brief       Backend IRG modification routines.
+ * @author      Sebastian Hack, Daniel Grund, Matthias Braun, Christian Wuerdig
+ * @date        04.05.2005
+ * @version     $Id$
+ *
  * This file contains the following IRG modifications for be routines:
  * - insertion of Perm nodes
  * - empty block elimination
  * - a simple dead node elimination (set inputs of unreachable nodes to BAD)
- *
- * @author      Sebastian Hack, Daniel Grund, Matthias Braun, Christian Wuerdig
- * @date        04.05.2005
- * @version     $Id$
- * Copyright:   (c) Universitaet Karlsruhe
- * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -67,8 +65,9 @@
 #include "beutil.h"
 #include "beinsn_t.h"
 #include "bessaconstr.h"
-
+#include "beirg_t.h"
 #include "beirgmod.h"
+#include "bemodule.h"
 
 DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;)
 
index 9d665f8..ce3e0a1 100644 (file)
  */
 
 /**
- * Author:      Christian Wuerdig
- * Date:        2005/12/14
- * Copyright:   (c) Universitaet Karlsruhe
- * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
- * CVS-Id:      $Id$
- *
- * Performs lowering of perm nodes and spill/reload optimization.
+ * @file
+ * @brief       Performs lowering of perm nodes and spill/reload optimization.
+ * @author      Christian Wuerdig
+ * @date        14.12.2005
+ * @version     $Id$
  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #include "debug.h"
 #include "irhooks.h"
 #include "xmalloc.h"
+#include "irnodeset.h"
+#include "irgmod.h"
+#include "iredges_t.h"
+#include "irgwalk.h"
 
 #include "bearch_t.h"
 #include "belower.h"
 #include "besched_t.h"
 #include "bestat.h"
 #include "bessaconstr.h"
-#include "irnodeset.h"
-
-#include "irgmod.h"
-#include "iredges_t.h"
-#include "irgwalk.h"
+#include "benodesets.h"
 
 #undef KEEP_ALIVE_COPYKEEP_HACK
 
index 7db0979..c51f65d 100644 (file)
  */
 
 /**
- * Backend driver.
- * @author Sebastian Hack
- * @date   25.11.2004
- * @cvsid  $Id$
+ * @file
+ * @brief       Main Backend driver.
+ * @author      Sebastian Hack
+ * @date        25.11.2004
+ * @version     $Id$
  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -78,6 +79,7 @@
 #include "beverify.h"
 #include "beprofile.h"
 #include "be_dbgout.h"
+#include "beirg_t.h"
 
 #ifdef WITH_ILP
 #include "beilpsched.h"
index e166a11..cb0d1c2 100644 (file)
  * PURPOSE.
  */
 
-/** vim: set sw=4 ts=4:
- * @file   bepressurestat.c
- * @date   2006-04-06
- * @author Adam M. Szalkowski
- *
- * Register Pressure Statistics
- *
- * Copyright (C) 2006 Universitaet Karlsruhe
- * Released under the GPL
+/**
+ * @file
+ * @brief       Register Pressure Statistics.
+ * @author      Adam M. Szalkowski
+ * @date        06.04.2006
+ * @version     $Id$
  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -49,6 +46,7 @@
 #include "phiclass.h"
 #include "iredges.h"
 #include "execfreq.h"
+#include "irtools.h"
 
 #include <libcore/lc_bitset.h>
 
@@ -61,8 +59,7 @@
 #include "beutil.h"
 #include "bespillremat.h"
 #include "bespill.h"
-
-#include "bechordal_t.h"
+#include "beirg_t.h"
 
 #define MAXPRESSURE 128
 
@@ -71,92 +68,87 @@ typedef struct _regpressure_ana_t {
        const arch_register_class_t  *cls;
        const be_lv_t                *lv;
        unsigned int                 *stat;
-       DEBUG_ONLY(firm_dbg_module_t * dbg);
+       DEBUG_ONLY(firm_dbg_module_t *dbg);
 } regpressure_ana_t;
 
-static INLINE int
-has_reg_class(const regpressure_ana_t * ra, const ir_node * irn)
+static INLINE int has_reg_class(const regpressure_ana_t *ra, const ir_node *irn)
 {
        return arch_irn_consider_in_reg_alloc(ra->arch_env, ra->cls, irn);
 }
 
-static INLINE int
-regpressure(pset * live)
-{
+static INLINE int regpressure(pset *live) {
        int pressure = pset_count(live);
-
-       return (pressure>MAXPRESSURE)?MAXPRESSURE:pressure;
+       return MIN(pressure, MAXPRESSURE);
 }
 
 static void
-regpressureanawalker(ir_node * bb, void * data)
+regpressureanawalker(ir_node *bb, void *data)
 {
-  regpressure_ana_t  *ra   = data;
-  pset               *live = pset_new_ptr_default();
-  const ir_node      *irn;
-  unsigned int       *stat = ra->stat;
-  int                i;
-  const be_lv_t      *lv   = ra->lv;
-
-  be_lv_foreach(lv, bb, be_lv_state_end, i) {
-    ir_node *value = be_lv_get_irn(lv, bb, i);
-    if (has_reg_class(ra, value)) {
-      pset_insert_ptr(live, value);
-    }
-  }
-  stat[regpressure(live)]++;
-
-  sched_foreach_reverse(bb, irn) {
-
-    if(is_Phi(irn)) break;
-
-    if(has_reg_class(ra, irn)) {
-      pset_remove_ptr(live, irn);
-    }
-
-    for(i=get_irn_arity(irn)-1; i>=0; --i) {
-      ir_node  *arg = get_irn_n(irn, i);
-
-      if(has_reg_class(ra, arg)) {
-                 pset_insert_ptr(live, arg);
-      }
-    }
-
-    if(!is_Proj(irn)) stat[regpressure(live)]++;
-  }
+       regpressure_ana_t  *ra   = data;
+       pset               *live = pset_new_ptr_default();
+       const ir_node      *irn;
+       unsigned int       *stat = ra->stat;
+       int                i;
+       const be_lv_t      *lv   = ra->lv;
+
+       be_lv_foreach(lv, bb, be_lv_state_end, i) {
+               ir_node *value = be_lv_get_irn(lv, bb, i);
+               if (has_reg_class(ra, value)) {
+                       pset_insert_ptr(live, value);
+               }
+       }
+       stat[regpressure(live)]++;
+
+       sched_foreach_reverse(bb, irn) {
+
+               if (is_Phi(irn)) break;
+
+               if (has_reg_class(ra, irn)) {
+                       pset_remove_ptr(live, irn);
+               }
+
+               for (i = get_irn_arity(irn) - 1; i >= 0; --i) {
+                       ir_node  *arg = get_irn_n(irn, i);
+
+                       if (has_reg_class(ra, arg)) {
+                               pset_insert_ptr(live, arg);
+                       }
+               }
+
+               if (! is_Proj(irn))
+                       stat[regpressure(live)]++;
+       }
 }
 
-void
-be_analyze_regpressure(be_irg_t *birg, const arch_register_class_t *cls,
-                       const char * suffix)
+void be_analyze_regpressure(be_irg_t *birg, const arch_register_class_t *cls, const char *suffix)
 {
-  regpressure_ana_t   ra;
-  unsigned int        stat[MAXPRESSURE+1];
-  unsigned int        i;
-  char                fname[256];
-  FILE               *f;
-  ir_graph           *irg = be_get_birg_irg(birg);
+       regpressure_ana_t ra;
+       unsigned int      stat[MAXPRESSURE+1];
+       unsigned int      i;
+       char              fname[256];
+       FILE              *f;
+       ir_graph          *irg = be_get_birg_irg(birg);
 
-  ir_snprintf(fname, sizeof(fname), "%F_%s%s_pressure.stat", irg, cls->name, suffix);
-  f = fopen(fname, "w");
-  assert(f);
+       ir_snprintf(fname, sizeof(fname), "%F_%s%s_pressure.stat", irg, cls->name, suffix);
+       f = fopen(fname, "w");
+       assert(f);
 
-  be_assure_liveness(birg);
+       be_assure_liveness(birg);
 
-  FIRM_DBG_REGISTER(ra.dbg, "firm.be.regpressureana");
+       FIRM_DBG_REGISTER(ra.dbg, "firm.be.regpressureana");
 
-  ra.arch_env = birg->main_env->arch_env;
-  ra.lv = be_get_birg_liveness(birg);
-  ra.cls = cls;
-  ra.stat = stat;
+       ra.arch_env = birg->main_env->arch_env;
+       ra.lv       = be_get_birg_liveness(birg);
+       ra.cls      = cls;
+       ra.stat     = stat;
 
-  memset(stat, 0, sizeof(stat));
+       memset(stat, 0, sizeof(stat));
 
-  irg_block_walk_graph(irg, regpressureanawalker, NULL, &ra);
+       irg_block_walk_graph(irg, regpressureanawalker, NULL, &ra);
 
-  for(i=0; i<=MAXPRESSURE; ++i) {
-    fprintf(f,"%d\n",stat[i]);
-  }
+       for (i = 0; i <= MAXPRESSURE; ++i) {
+               fprintf(f, "%d\n", stat[i]);
+       }
 
-  fclose(f);
+       fclose(f);
 }
index 852d40d..a9dde4f 100644 (file)
 
 /**
  * @file
+ * @brief       Main spill driver.
  * @author      Daniel Grund, Sebastian Hack, Matthias Braun
  * @date               29.09.2005
  * @version     $Id$
- * Copyright:   (c) Universitaet Karlsruhe
- * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #include "bespilloptions.h"
 #include "bestatevent.h"
 #include "bessaconstr.h"
+#include "beirg_t.h"
+#include "bera.h"
 
-// only rematerialise when costs are less than REMAT_COST_LIMIT
-// TODO determine a good value here...
+/* only rematerialise when costs are less than REMAT_COST_LIMIT */
+/* TODO determine a good value here... */
 #define REMAT_COST_LIMIT       10
 
 typedef struct _reloader_t reloader_t;
index 42c5bcd..60272ed 100644 (file)
@@ -31,7 +31,6 @@
 #include "pset.h"
 #include "debug.h"
 
-#include "bechordal.h"
 #include "be_t.h"
 
 #include "bearch_t.h"
index 375a0fc..0534413 100644 (file)
  */
 
 /**
- * Author:      Daniel Grund, Matthias Braun
- * Date:        20.09.2005
- * Copyright:   (c) Universitaet Karlsruhe
- * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
- *
+ * @file
+ * @brief       Beladys spillalgorithm.
+ * @author      Daniel Grund, Matthias Braun
+ * @date        20.09.2005
+ * @version     $Id$
  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -53,6 +53,8 @@
 #include "bechordal_t.h"
 #include "bespilloptions.h"
 #include "beloopana.h"
+#include "beirg_t.h"
+#include "bemodule.h"
 
 #define DBG_SPILL   1
 #define DBG_WSETS   2
index 5c956c7..aa326cd 100644 (file)
 #ifndef BESPILLBELADY_H_
 #define BESPILLBELADY_H_
 
-#include "be_t.h"
-#include "bechordal.h"
-
-#include "bearch_t.h"
+#include "beirg.h"
+#include "bearch.h"
 #include "bespill.h"
 
 /**
index 1ed67c0..1ebce39 100644 (file)
  * PURPOSE.
  */
 
-/*
- * Author:      Matthias Braun
- * Date:               05.05.2006
- * Copyright:   (c) Universitaet Karlsruhe
- * License:     This file is protected by GPL -  GNU GENERAL PUBLIC LICENSE.
- *
+/**
+ * @file
+ * @brief       Morgans spill algorithm.
+ * @author      Matthias Braun
+ * @date        05.05.2006
+ * @version     $Id$
  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
-#include "bespillmorgan.h"
-
-#include "bechordal_t.h"
-#include "bespill.h"
-#include "belive_t.h"
-#include "beabi.h"
 #include "irgwalk.h"
-#include "besched.h"
-#include "beutil.h"
 #include "irloop_t.h"
 #include "irgraph_t.h"
 #include "irprintf.h"
 #include "obst.h"
 
+#include "bespillmorgan.h"
+#include "bechordal_t.h"
+#include "bespill.h"
+#include "belive_t.h"
+#include "beabi.h"
 #include "bespillbelady.h"
 #include "beverify.h"
 #include "benodesets.h"
 #include "bespilloptions.h"
+#include "besched.h"
+#include "beutil.h"
+#include "bemodule.h"
+#include "beirg_t.h"
 
 #define DBG_LIVE               1
 #define DBG_LOOPANA            2
@@ -560,15 +561,15 @@ static int reduce_register_pressure_in_loop(morgan_env_t *env, const ir_loop *lo
 }
 
 void be_spill_morgan(be_irg_t *birg, const arch_register_class_t *cls) {
-       ir_graph *irg = be_get_birg_irg(birg);
+       ir_graph     *irg = be_get_birg_irg(birg);
        morgan_env_t env;
 
        be_assure_liveness(birg);
 
        env.arch = birg->main_env->arch_env;
-       env.irg = irg;
-       env.cls = cls;
-       env.lv = be_get_birg_liveness(birg);
+       env.irg  = irg;
+       env.cls  = cls;
+       env.lv   = be_get_birg_liveness(birg);
        env.senv = be_new_spill_env(birg);
        DEBUG_ONLY(be_set_spill_env_dbg_module(env.senv, dbg);)
 
@@ -576,13 +577,13 @@ void be_spill_morgan(be_irg_t *birg, const arch_register_class_t *cls) {
 
        env.registers_available = env.cls->n_regs - be_put_ignore_regs(birg, env.cls, NULL);
 
-       env.loop_attr_set = new_set(loop_attr_cmp, 5);
+       env.loop_attr_set  = new_set(loop_attr_cmp, 5);
        env.block_attr_set = new_set(block_attr_cmp, 20);
 
-       /*-- Part1: Analysis --*/
+       /* -- Part1: Analysis -- */
 
        /* construct control flow loop tree */
-       if(! (get_irg_loopinfo_state(irg) & loopinfo_cf_consistent)) {
+       if (! (get_irg_loopinfo_state(irg) & loopinfo_cf_consistent)) {
                construct_cf_backedges(irg);
        }
 
@@ -590,7 +591,7 @@ void be_spill_morgan(be_irg_t *birg, const arch_register_class_t *cls) {
        irg_block_walk_graph(irg, construct_block_livethrough_unused, construct_loop_edges, &env);
        construct_loop_livethrough_unused(&env, get_irg_loop(irg));
 
-       /*-- Part2: Transformation --*/
+       /* -- Part2: Transformation -- */
 
        /* spill unused livethrough values around loops and blocks where
         * the pressure is too high
@@ -601,7 +602,7 @@ void be_spill_morgan(be_irg_t *birg, const arch_register_class_t *cls) {
        be_insert_spills_reloads(env.senv);
 
        /* Verify the result */
-       if(birg->main_env->options->vrfy_option == BE_VRFY_WARN) {
+       if (birg->main_env->options->vrfy_option == BE_VRFY_WARN) {
                be_verify_schedule(birg);
        } else if (birg->main_env->options->vrfy_option == BE_VRFY_ASSERT) {
                assert(be_verify_schedule(birg));
index 4be550e..a1cf19b 100644 (file)
@@ -26,8 +26,8 @@
 #ifndef BESPILLMORGAN_H_
 #define BESPILLMORGAN_H_
 
-#include "be_t.h"
-#include "bechordal.h"
+#include "beirg.h"
+#include "bearch.h"
 
 void be_spill_morgan(be_irg_t *birg, const arch_register_class_t *cls);
 
index 986ba1f..d3cfc92 100644 (file)
@@ -26,7 +26,8 @@
 #ifndef BESPILL_OPTIONS_H_
 #define BESPILL_OPTIONS_H_
 
-#include "bechordal.h"
+#include "bearch.h"
+#include "beirg.h"
 
 extern int be_coalesce_spill_slots;
 extern int be_do_remats;
index b75215e..407e332 100644 (file)
@@ -74,8 +74,9 @@
 #include "bepressurestat.h"
 #include "beprofile.h"
 #include "bespilloptions.h"
-
+#include "bera.h"
 #include "bechordal_t.h"
+#include "bemodule.h"
 
 #include <libcore/lc_opts.h>
 #include <libcore/lc_opts_enum.h>
@@ -2914,19 +2915,19 @@ set_insert_interference(spill_ilp_t * si, set * set, ir_node * a, ir_node * b, i
        return result;
 }
 
-static int
-values_interfere_in_block(const spill_ilp_t * si, const ir_node * bb, const ir_node * a, const ir_node * b)
+static
+int values_interfere_in_block(const spill_ilp_t *si, const ir_node *bb, const ir_node *a, const ir_node *b)
 {
        const ir_edge_t *edge;
 
-       if(get_nodes_block(a) != bb && get_nodes_block(b) != bb) {
+       if (get_nodes_block(a) != bb && get_nodes_block(b) != bb) {
                /* both values are live in, so they interfere */
                return 1;
        }
 
        /* ensure a dominates b */
-       if(value_dominates(b,a)) {
-               const ir_node * t;
+       if (value_dominates(b, a)) {
+               const ir_node *t;
                t = b;
                b = a;
                a = t;
@@ -2935,15 +2936,15 @@ values_interfere_in_block(const spill_ilp_t * si, const ir_node * bb, const ir_n
 
 
        /* the following code is stolen from bera.c */
-       if(be_is_live_end(si->lv, bb, a))
+       if (be_is_live_end(si->lv, bb, a))
                return 1;
 
        foreach_out_edge(a, edge) {
                const ir_node *user = edge->src;
-               if(get_nodes_block(user) == bb
-                               && !is_Phi(user)
+               if (get_nodes_block(user) == bb
+                               && ! is_Phi(user)
                                && b != user
-                               && !pset_find_ptr(si->inverse_ops, user)
+                               && ! pset_find_ptr(si->inverse_ops, user)
                                && value_dominates(b, user))
                        return 1;
        }
index b1943f3..da7e8f1 100644 (file)
@@ -28,7 +28,6 @@
 
 #ifndef BESPILLREMAT_H_
 #define BESPILLREMAT_H_
-#include "bechordal.h"
 
 void be_spill_remat(be_irg_t *birg, const arch_register_class_t *cls);
 
index 629dfd8..9d38eae 100644 (file)
@@ -48,6 +48,8 @@
 #include "bestatevent.h"
 #include "bespilloptions.h"
 #include "bemodule.h"
+#include "bera.h"
+#include "beirg_t.h"
 
 #define DBG_COALESCING         1
 #define DBG_INTERFERENCES      2
@@ -298,40 +300,41 @@ static void do_greedy_coalescing(be_fec_env_t *env)
                interferences[i] = bitset_alloca(spillcount);
        }
 
-       // construct interferences
-       for(i = 0; i < spillcount; ++i) {
+       /* construct interferences */
+       for (i = 0; i < spillcount; ++i) {
                ir_node *spill1 = spilllist[i]->spill;
-               if(is_NoMem(spill1))
+
+               if (is_NoMem(spill1))
                        continue;
 
                for(i2 = i+1; i2 < spillcount; ++i2) {
                        ir_node *spill2 = spilllist[i2]->spill;
-                       if(is_NoMem(spill2))
+
+                       if (is_NoMem(spill2))
                                continue;
 
-                       if(values_interfere(lv, spill1, spill2)) {
-                               DBG((dbg, DBG_INTERFERENCES, "Slot %d and %d interfere\n",
-                                    i, i2));
+                       if (values_interfere(lv, spill1, spill2)) {
+                               DBG((dbg, DBG_INTERFERENCES, "Slot %d and %d interfere\n", i, i2));
                                bitset_set(interferences[i], i2);
                                bitset_set(interferences[i2], i);
                        }
                }
        }
 
-       // sort affinity edges
+       /* sort affinity edges */
        affinity_edge_count = ARR_LEN(env->affinity_edges);
        qsort(env->affinity_edges, affinity_edge_count, sizeof(env->affinity_edges[0]), cmp_affinity);
 
        //dump_interference_graph(env, interferences, "before");
 
-       // try to merge affine nodes
+       /* try to merge affine nodes */
        for(i = 0; i < affinity_edge_count; ++i) {
                const affinity_edge_t *edge = env->affinity_edges[i];
                int s1 = uf_find(spillslot_unionfind, edge->slot1);
                int s2 = uf_find(spillslot_unionfind, edge->slot2);
 
                /* test if values interfere */
-               if(bitset_is_set(interferences[s1], s2)) {
+               if (bitset_is_set(interferences[s1], s2)) {
                        assert(bitset_is_set(interferences[s2], s1));
                        continue;
                }
@@ -442,7 +445,7 @@ static ir_entity* create_stack_entity(be_fec_env_t *env, spill_slot_t *slot)
        ir_type *frame = get_irg_frame_type(irg);
        ir_entity *res = frame_alloc_area(frame, slot->size, slot->align, 0);
 
-       // adjust size of the entity type...
+       /* adjust size of the entity type... */
        ir_type *enttype = get_entity_type(res);
        set_type_size_bytes(enttype, slot->size);
 
@@ -658,18 +661,17 @@ static int count_spillslots(const be_fec_env_t *env)
 be_fec_env_t *be_new_frame_entity_coalescer(be_irg_t *birg)
 {
        const arch_env_t *arch_env = birg->main_env->arch_env;
-
-       be_fec_env_t *env = xmalloc(sizeof(env[0]));
+       be_fec_env_t     *env      = xmalloc(sizeof(env[0]));
 
        be_assure_liveness(birg);
 
        obstack_init(&env->obst);
-       env->arch_env = arch_env;
-       env->birg = birg;
-       env->spills = new_set(cmp_spill, 10);
-       env->reloads = NEW_ARR_F(ir_node*, 0);
+       env->arch_env       = arch_env;
+       env->birg           = birg;
+       env->spills         = new_set(cmp_spill, 10);
+       env->reloads        = NEW_ARR_F(ir_node*, 0);
        env->affinity_edges = NEW_ARR_F(affinity_edge_t*, 0);
-       env->memperms = new_set(cmp_memperm, 10);
+       env->memperms       = new_set(cmp_memperm, 10);
 
        return env;
 }
index 825f46b..e3d7c88 100644 (file)
@@ -49,6 +49,8 @@
 #include "besched_t.h"
 #include "benodesets.h"
 #include "bestatevent.h"
+#include "beirg_t.h"
+#include "bera.h"
 
 DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;)
 
@@ -72,7 +74,7 @@ static void clear_link(ir_node *irn, void *data) {
  */
 static void collect_phis_walker(ir_node *irn, void *data) {
        be_chordal_env_t *env = data;
-       if(is_Phi(irn) && chordal_has_class(env, irn)) {
+       if (is_Phi(irn) && chordal_has_class(env, irn)) {
                ir_node *bl = get_nodes_block(irn);
                set_irn_link(irn, get_irn_link(bl));
                set_irn_link(bl, irn);
@@ -246,7 +248,7 @@ static void set_regs_or_place_dupls_walker(ir_node *bl, void *data) {
 
                        DBG((dbg, LEVEL_1, "  for %+F(%s) -- %+F(%s)\n", phi, phi_reg->name, arg, arg_reg->name));
 
-                       if(values_interfere(lv, phi, arg)) {
+                       if (values_interfere(lv, phi, arg)) {
                                /*
                                        Insert a duplicate in arguments block,
                                        make it the new phi arg,
index b6c51d6..e972a0b 100644 (file)
  */
 
 /**
- * Provides several statistic functions for the backend.
- * @author Christian Wuerdig
- * $Id$
+ * @file
+ * @brief       Provides several statistic functions for the backend.
+ * @author      Christian Wuerdig
+ * @version     $Id$
  */
-
-#ifndef _BESTAT_H_
-#define _BESTAT_H_
+#ifndef FIRM_BE_BESTAT_H_
+#define FIRM_BE_BESTAT_H_
 
 #include "firm_config.h"
-#include "be_t.h"
-#include "benodesets.h"
+
+#include "irnode.h"
+#include "irgraph.h"
+#include "irnodeset.h"
+
+#include "beirg.h"
 #include "bestatevent.h"
+#include "bearch.h"
 
 enum {
        STAT_TAG_FILE = 0,  /**< tag for source file name */
@@ -115,4 +120,4 @@ void be_close_stat_file(void);
  */
 double be_estimate_irg_costs(ir_graph *irg, const arch_env_t *arch_env, ir_exec_freq *execfreqs);
 
-#endif /* _BESTAT_H_ */
+#endif /* FIRM_BE_BESTAT_H_ */
index 7599a17..f0accc4 100644 (file)
@@ -46,6 +46,7 @@
 #include "besched_t.h"
 #include "benode_t.h"
 #include "beirg_t.h"
+#include "bera.h"
 
 static int my_values_interfere(const ir_node *a, const ir_node *b);
 
index 32511f9..ae97061 100644 (file)
 #ifndef BEVERIFY_H_
 #define BEVERIFY_H_
 
-#include "bechordal.h"
+#include "irgraph.h"
+
+#include "beirg.h"
+#include "bearch.h"
 
 /**
  * Verifies, that the register pressure for a given register class doesn't exceed the limit