Commit d2c1b019 authored by Matthias Braun's avatar Matthias Braun
Browse files

reorganize backend headers (kill some _t variants in favor of a be_types.h)

[r26317]
parent f0c26317
......@@ -34,9 +34,7 @@
#include "irgraph.h"
#include "irnode.h"
typedef struct _ilp_sched_selector_t ilp_sched_selector_t;
typedef struct _ilp_sched_selector_if_t ilp_sched_selector_if_t;
#include "be_types.h"
/**
* A selector interface which is used by the ILP schedule framework.
......
......@@ -25,7 +25,7 @@
#include "config.h"
#include "beinfo.h"
#include "bearch_t.h"
#include "bearch.h"
#include "irgwalk.h"
#include "irnode_t.h"
#include "error.h"
......
......@@ -26,11 +26,8 @@
#ifndef FIRM_BE_BEINFO_H
#define FIRM_BE_BEINFO_H
#include "bearch.h"
#include "irphase_t.h"
#include "irphases_t.h"
typedef unsigned int sched_timestep_t;
#include "be_types.h"
#include "irnode_t.h"
/**
* The schedule structure which is present at each ir node.
......@@ -38,23 +35,23 @@ typedef unsigned int sched_timestep_t;
* Currently, only basic blocks are scheduled. The list head of
* every block schedule list is the Block list.
*/
typedef struct sched_info_t {
struct sched_info_t {
ir_node *next;
ir_node *prev;
sched_timestep_t time_step; /**< If a is after b in a schedule, its time step is larger than b's. */
} sched_info_t;
};
typedef struct reg_out_info_t {
struct reg_out_info_t {
const arch_register_t *reg;
const arch_register_req_t *req;
} reg_out_info_t;
};
typedef struct backend_info_t {
struct backend_info_t {
sched_info_t sched_info;
const arch_register_req_t **in_reqs;
reg_out_info_t *out_infos;
arch_irn_flags_t flags;
} backend_info_t;
};
static inline backend_info_t *be_get_info(const ir_node *node)
{
......
......@@ -30,9 +30,9 @@
#include "irnode_t.h"
#include "iredges.h"
#include "besched_t.h"
#include "besched.h"
#include "beinsn_t.h"
#include "beirg_t.h"
#include "beirg.h"
#include "beabi.h"
#include "raw_bitset.h"
......
......@@ -18,8 +18,8 @@
#include "statev.h"
#include "beirg_t.h"
#include "besched_t.h"
#include "beirg.h"
#include "besched.h"
#include "belive_t.h"
/**
......
......@@ -27,8 +27,10 @@
#include "config.h"
#include "execfreq.h"
#include "beirg_t.h"
#include "beirg.h"
#include "absgraph.h"
#include "belive.h"
#include "bedomfront.h"
be_lv_t *be_assure_liveness(be_irg_t *birg)
{
......@@ -69,28 +71,3 @@ void be_free_birg(be_irg_t *birg)
birg->lv = NULL;
}
}
ir_graph *(be_get_birg_irg)(const be_irg_t *birg)
{
return _be_get_birg_irg(birg);
}
ir_exec_freq *(be_get_birg_exec_freq)(const be_irg_t *birg)
{
return _be_get_birg_exec_freq(birg);
}
be_lv_t *(be_get_birg_liveness)(const be_irg_t *birg)
{
return _be_get_birg_liveness(birg);
}
be_dom_front_info_t *(be_get_birg_dom_front)(const be_irg_t *birg)
{
return _be_get_birg_dom_front(birg);
}
const arch_env_t *(be_get_birg_arch_env)(const be_irg_t *birg)
{
return _be_get_birg_arch_env(birg);
}
......@@ -27,23 +27,14 @@
#ifndef FIRM_BE_BEIRG_H
#define FIRM_BE_BEIRG_H
#include "belive.h"
#include "bedomfront.h"
typedef struct be_irg_t be_irg_t;
ir_graph *be_get_birg_irg(const be_irg_t *birg);
#include "be.h"
#include "be_types.h"
#include "be_t.h"
be_lv_t *be_assure_liveness(be_irg_t *birg);
be_lv_t *be_get_birg_liveness(const be_irg_t *birg);
void be_assure_dom_front(be_irg_t *birg);
void be_invalidate_dom_front(be_irg_t *birg);
be_dom_front_info_t *be_get_birg_dom_front(const be_irg_t *birg);
const arch_env_t *be_get_birg_arch_env(const be_irg_t *birg);
ir_exec_freq *be_get_birg_exec_freq(const be_irg_t *birg);
/**
* frees all memory allocated by birg structures (liveness, dom_front, ...).
......@@ -51,4 +42,43 @@ ir_exec_freq *be_get_birg_exec_freq(const be_irg_t *birg);
*/
void be_free_birg(be_irg_t *birg);
/**
* An ir_graph with additional analysis data about this irg. Also includes some
* backend structures
*/
struct be_irg_t {
ir_graph *irg;
be_main_env_t *main_env;
be_abi_irg_t *abi;
arch_code_generator_t *cg;
ir_exec_freq *exec_freq;
be_dom_front_info_t *dom_front;
be_lv_t *lv;
};
static inline be_lv_t *
be_get_birg_liveness(const be_irg_t *birg) {
return birg->lv;
}
static inline ir_exec_freq *
be_get_birg_exec_freq(const be_irg_t *birg) {
return birg->exec_freq;
}
static inline be_dom_front_info_t *
be_get_birg_dom_front(const be_irg_t *birg) {
return birg->dom_front;
}
static inline ir_graph *
be_get_birg_irg(const be_irg_t *birg) {
return birg->irg;
}
static inline const arch_env_t *
be_get_birg_arch_env(const be_irg_t *birg) {
return birg->main_env->arch_env;
}
#endif /* FIRM_BE_BEIRG_H */
/*
* Copyright (C) 1995-2008 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.
*/
/**
* @file
* @brief Backend irg - a ir_graph with additional analysis information.
* @author Matthias Braun
* @date 05.05.2006
* @version $Id$
*/
#ifndef FIRM_BE_BEIRG_T_H
#define FIRM_BE_BEIRG_T_H
#include "beirg.h"
#include "be_t.h"
#include "beabi.h"
#include "irlivechk.h"
/**
* An ir_graph with additional analysis data about this irg. Also includes some
* backend structures
*/
struct be_irg_t {
ir_graph *irg;
be_main_env_t *main_env;
be_abi_irg_t *abi;
arch_code_generator_t *cg;
ir_exec_freq *exec_freq;
be_dom_front_info_t *dom_front;
be_lv_t *lv;
};
static inline be_lv_t *
_be_get_birg_liveness(const be_irg_t *birg) {
return birg->lv;
}
static inline ir_exec_freq *
_be_get_birg_exec_freq(const be_irg_t *birg) {
return birg->exec_freq;
}
static inline be_dom_front_info_t *
_be_get_birg_dom_front(const be_irg_t *birg) {
return birg->dom_front;
}
static inline ir_graph *
_be_get_birg_irg(const be_irg_t *birg) {
return birg->irg;
}
static inline const arch_env_t *
_be_get_birg_arch_env(const be_irg_t *birg) {
return birg->main_env->arch_env;
}
#define be_get_birg_exec_freq(birg) _be_get_birg_exec_freq(birg)
#define be_get_birg_liveness(birg) _be_get_birg_liveness(birg)
#define be_get_birg_dom_front(birg) _be_get_birg_dom_front(birg)
#define be_get_birg_irg(birg) _be_get_birg_irg(birg)
#endif /* FIRM_BE_BEIRG_T_H */
......@@ -57,14 +57,14 @@
#include "be_t.h"
#include "bechordal_t.h"
#include "bearch_t.h"
#include "besched_t.h"
#include "bearch.h"
#include "besched.h"
#include "belive_t.h"
#include "benode_t.h"
#include "beutil.h"
#include "beinsn_t.h"
#include "bessaconstr.h"
#include "beirg_t.h"
#include "beirg.h"
#include "beirgmod.h"
#include "bemodule.h"
......
......@@ -49,15 +49,15 @@
#include "irtools.h"
#include "bemodule.h"
#include "besched_t.h"
#include "besched.h"
#include "beutil.h"
#include "belive_t.h"
#include "belistsched.h"
#include "beschedmris.h"
#include "beschedrss.h"
#include "bearch_t.h"
#include "bearch.h"
#include "bestat.h"
#include "beirg_t.h"
#include "beirg.h"
#include "lc_opts.h"
#include "lc_opts_enum.h"
......
......@@ -31,11 +31,10 @@
#include "irnodeset.h"
#include "be.h"
#include "be_types.h"
#include "bearch.h"
#include "beirg.h"
typedef struct _list_sched_selector_t list_sched_selector_t;
/**
* A selector interface which is used by the list schedule framework.
* You can implement your own list scheduler by implementing these
......
......@@ -43,8 +43,8 @@
#include "beutil.h"
#include "belive_t.h"
#include "beirg_t.h"
#include "besched_t.h"
#include "beirg.h"
#include "besched.h"
#include "bemodule.h"
DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;)
......
......@@ -29,6 +29,8 @@
#include <stdio.h>
#include "be_types.h"
#include "firm_types.h"
#include "pset.h"
......@@ -44,10 +46,6 @@ typedef enum {
be_lv_state_out = 4,
} be_lv_state_t;
typedef struct _be_lv_t be_lv_t;
typedef struct _be_lv_info_t be_lv_info_t;
/**
* Compute the inter block liveness for a graph.
* @param irg The graph.
......
......@@ -34,7 +34,7 @@
#include "error.h"
#include "debug.h"
#include "bearch_t.h"
#include "bearch.h"
#include "belive.h"
#include "besched.h"
#include "beloopana.h"
......
......@@ -38,10 +38,10 @@
#include "irgwalk.h"
#include "array_t.h"
#include "bearch_t.h"
#include "bearch.h"
#include "belower.h"
#include "benode_t.h"
#include "besched_t.h"
#include "besched.h"
#include "bestat.h"
#include "bessaconstr.h"
#include "beintlive_t.h"
......
......@@ -27,9 +27,7 @@
#ifndef FIRM_BE_BEMACHINE_H
#define FIRM_BE_BEMACHINE_H
typedef struct _be_execution_unit_type_t be_execution_unit_type_t;
typedef struct _be_execution_unit_t be_execution_unit_t;
typedef struct _be_machine_t be_machine_t;
#include "be_types.h"
struct _be_execution_unit_t {
be_execution_unit_type_t *tp;
......
......@@ -51,13 +51,13 @@
#include "execfreq.h"
#include "irprofile.h"
#include "bearch_t.h"
#include "bearch.h"
#include "be_t.h"
#include "bemodule.h"
#include "beutil.h"
#include "benode_t.h"
#include "beirgmod.h"
#include "besched_t.h"
#include "besched.h"
#include "belistsched.h"
#include "belive_t.h"
#include "bera.h"
......@@ -73,7 +73,7 @@
#include "bestat.h"
#include "beverify.h"
#include "be_dbgout.h"
#include "beirg_t.h"
#include "beirg.h"
#define NEW_ID(s) new_id_from_chars(s, sizeof(s) - 1)
......
......@@ -39,11 +39,12 @@
* add copies and split live-ranges.
*
* TODO:
* - make use of free registers in the permutate_values code
* - output constraints are not ensured. The algorithm fails to copy values
* away, so the registers for constrained outputs are free.
* - must_be_different constraint is not respected
* - No parallel copies at basic block borders are created, no additional phis
* created after copies have been inserted.
* - We have to pessimistically construct Phi_0s when not all predecessors
* of a block are known.
* - Phi color assignment should give bonus points towards registers already
* assigned at predecessors.
* - think about a smarter sequence of visiting the blocks. Sorted by
......@@ -67,8 +68,8 @@
#include "belive_t.h"
#include "bemodule.h"
#include "bechordal_t.h"
#include "besched_t.h"
#include "beirg_t.h"
#include "besched.h"
#include "beirg.h"
#include "benode_t.h"
#include "bespill.h"
#include "bespilloptions.h"
......@@ -481,7 +482,8 @@ static void assign_reg(const ir_node *block, ir_node *node)
unsigned r = reg_prefs[i].num;
/* ignores should be last and we should have a non-ignore left */
assert(!bitset_is_set(ignore_regs, r));
/* already used? TODO: It might be better to copy the value occupying the register around here, find out when... */
/* already used?
TODO: It might be better to copy the value occupying the register around here, find out when... */
if (assignments[r].value != NULL)
continue;
reg = arch_register_for_index(cls, r);
......@@ -1025,8 +1027,7 @@ static void allocate_coalesce_block(ir_node *block, void *data)
/* assign regs for live-in values */
foreach_ir_nodeset(&live_nodes, node, iter) {
const arch_register_t *reg;
reg = arch_get_irn_register(node);
const arch_register_t *reg = arch_get_irn_register(node);
if (reg != NULL)
continue;
......@@ -1063,6 +1064,7 @@ static void allocate_coalesce_block(ir_node *block, void *data)
}
}
/* free registers of values last used at this instruction */
free_last_uses(&live_nodes, node);
/* assign output registers */
......@@ -1192,11 +1194,18 @@ static void be_straight_alloc(be_irg_t *new_birg)
bitset_free(ignore_regs);
/* TODO: dump intermediate results */
stat_ev_ctx_pop("bestraight_cls");
}
BE_TIMER_PUSH(t_verify);
if (birg->main_env->options->vrfy_option == BE_CH_VRFY_WARN) {
be_verify_register_allocation(birg);
} else if(birg->main_env->options->vrfy_option == BE_CH_VRFY_ASSERT) {
assert(be_verify_register_allocation(birg)
&& "Register allocation invalid");
}
BE_TIMER_POP(t_verify);
obstack_free(&obst, NULL);
}
......
......@@ -53,9 +53,9 @@
#include "be_t.h"
#include "belive_t.h"
#include "besched_t.h"
#include "besched.h"
#include "benode_t.h"
#include "bearch_t.h"
#include "bearch.h"
#include "beirgmod.h"
......
......@@ -34,11 +34,11 @@
#include "irgmod.h"
#include "error.h"
#include "beirg_t.h"
#include "beirg.h"
#include "belive_t.h"
#include "bearch_t.h"
#include "bearch.h"
#include "benode_t.h"
#include "besched_t.h"
#include "besched.h"
#include "bemodule.h"
DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment