#include "irprintf.h"
#include "plist.h"
#include "irprintf.h"
+#include "timing.h"
#include <lpp/lpp.h>
#include <lpp/lpp_net.h>
-#include <libcore/lc_opts.h>
-#include <libcore/lc_opts_enum.h>
-#include <libcore/lc_timing.h>
+#include "lc_opts.h"
+#include "lc_opts_enum.h"
#include "be.h"
#include "benode_t.h"
void *irg_env; /**< An environment for the irg scheduling, provided by the backend */
void *block_env; /**< An environment for scheduling a block, provided by the backend */
const arch_env_t *arch_env;
- const arch_isa_t *isa; /**< The ISA */
const be_main_env_t *main_env;
const be_machine_t *cpu; /**< the current abstract machine */
ilpsched_options_t *opts; /**< the ilp options for current irg */
#define get_ilpsched_node_attr(node) (&(node)->attr.node_attr)
/* check if node is considered for ILP scheduling */
-#define consider_for_sched(isa, irn) \
+#define consider_for_sched(env, irn) \
(! (is_Block(irn) || \
- is_normal_Proj(isa, irn) || \
+ is_normal_Proj(env, irn) || \
is_Phi(irn) || \
is_NoMem(irn) || \
is_Unknown(irn) || \
/* check if a double value is within an epsilon environment of 0 */
#define LPP_VALUE_IS_0(dbl) (fabs((dbl)) <= 1e-10)
-#define ilp_timer_push(t) lc_timer_push((t))
-#define ilp_timer_pop() lc_timer_pop()
-#define ilp_timer_elapsed_usec(t) lc_timer_elapsed_usec((t))
+#define ilp_timer_push(t) ir_timer_push((t))
+#define ilp_timer_pop() ir_timer_pop()
+#define ilp_timer_elapsed_usec(t) ir_timer_elapsed_usec((t))
/* option variable */
static ilpsched_options_t ilp_opts = {
* Check if irn is a Proj, which has no execution units assigned.
* @return 1 if irn is a Proj having no execution units assigned, 0 otherwise
*/
-static INLINE int is_normal_Proj(const arch_isa_t *isa, const ir_node *irn) {
- return is_Proj(irn) && (arch_isa_get_allowed_execution_units(isa, irn) == NULL);
+static INLINE int is_normal_Proj(const arch_env_t *env, const ir_node *irn) {
+ return is_Proj(irn) && (arch_env_get_allowed_execution_units(env, irn) == NULL);
}
/**
* Skips normal Projs.
* @return predecessor if irn is a normal Proj, otherwise irn.
*/
-static INLINE ir_node *skip_normal_Proj(const arch_isa_t *isa, ir_node *irn) {
- if (is_normal_Proj(isa, irn))
+static INLINE ir_node *skip_normal_Proj(const arch_env_t *env, ir_node *irn) {
+ if (is_normal_Proj(env, irn))
return get_Proj_pred(irn);
return irn;
}
ilpsched_block_attr_t *ba;
set_irn_link(irn, NULL);
- if (! consider_for_sched(env->arch_env->isa, irn))
+ if (! consider_for_sched(env->arch_env, irn))
return;
node = get_ilpsched_irn(env, irn);
ir_node **consumer;
unsigned idx;
- if (! consider_for_sched(env->arch_env->isa, irn))
+ if (! consider_for_sched(env->arch_env, irn))
return;
block = get_nodes_block(irn);
foreach_out_edge_kind(irn, edge, ekind[i]) {
ir_node *user = get_edge_src_irn(edge);
- if (is_normal_Proj(env->arch_env->isa, user)) {
+ if (is_normal_Proj(env->arch_env, user)) {
const ir_edge_t *user_edge;
if (get_irn_mode(user) == mode_X)
ilpsched_block_attr_t *ba;
/* These nodes are handled separate */
- if (! consider_for_sched(env->arch_env->isa, irn))
+ if (! consider_for_sched(env->arch_env, irn))
return;
DBG((env->dbg, LEVEL_2, "Calculating ASAP of node %+F ... ", irn));
na->asap = 1;
for (i = get_irn_ins_or_deps(irn) - 1; i >= 0; --i) {
- ir_node *pred = skip_normal_Proj(env->arch_env->isa, get_irn_in_or_dep(irn, i));
+ ir_node *pred = skip_normal_Proj(env->arch_env, get_irn_in_or_dep(irn, i));
/* check for greatest distance to top */
if (! is_Phi(pred) && ! is_NoMem(pred) && get_nodes_block(pred) == block) {
/* set the alap's of all predecessors */
for (i = get_irn_ins_or_deps(cur_irn) - 1; i >= 0; --i) {
- ir_node *pred = skip_normal_Proj(env->arch_env->isa, get_irn_in_or_dep(cur_irn, i));
+ ir_node *pred = skip_normal_Proj(env->arch_env, get_irn_in_or_dep(cur_irn, i));
/* check for greatest distance to bottom */
if (! is_Phi(pred) && ! is_NoMem(pred) && get_nodes_block(pred) == block) {
be_ilpsched_irn_t *node, *pred_node;
ilpsched_node_attr_t *na, *pna;
- if (! consider_for_sched(env->arch_env->isa, irn))
+ if (! consider_for_sched(env->arch_env, irn))
return;
if (! is_Proj(irn) && ! be_is_Keep(irn))
************************************************/
static int be_ilpsched_set_type_info(be_ilpsched_env_t *env, ir_node *irn, struct obstack *obst) {
- const be_execution_unit_t ***execunits = arch_isa_get_allowed_execution_units(env->arch_env->isa, irn);
+ const be_execution_unit_t ***execunits = arch_env_get_allowed_execution_units(env->arch_env, irn);
unsigned n_unit_types = 0;
be_ilpsched_irn_t *node;
ilpsched_node_attr_t *na;
ilp_livein_node_t *livein;
ilpsched_block_attr_t *ba = get_ilpsched_block_attr(block_node);
unsigned weigth_y = ba->n_interesting_nodes * ba->n_interesting_nodes;
- lc_timer_t *t_var = lc_timer_register("beilpsched_var", "create ilp variables");
+ ir_timer_t *t_var = ir_timer_register("beilpsched_var", "create ilp variables");
ilp_timer_push(t_var);
num_block_var = num_nodes = 0;
for (i = get_irn_arity(irn) - 1; i >= 0; --i) {
ir_node *pred = get_irn_n(irn, i);
- if (get_nodes_block(pred) != block_node->irn && consider_for_sched(env->arch_env->isa, pred)) {
+ if (get_nodes_block(pred) != block_node->irn && consider_for_sched(env->arch_env, pred)) {
be_ilpsched_set_type_info(env, pred, var_obst);
if (! na->is_dummy_node) {
ilp_livein_node_t *entry = obstack_alloc(var_obst, sizeof(*entry));
ir_node *irn;
ilpsched_block_attr_t *ba = get_ilpsched_block_attr(block_node);
bitset_t *bs_block_irns = bitset_alloca(ba->block_last_idx);
- lc_timer_t *t_cst_assign = lc_timer_register("beilpsched_cst_assign", "create assignment constraints");
- lc_timer_t *t_cst_prec = lc_timer_register("beilpsched_cst_prec", "create precedence constraints");
+ ir_timer_t *t_cst_assign = ir_timer_register("beilpsched_cst_assign", "create assignment constraints");
+ ir_timer_t *t_cst_prec = ir_timer_register("beilpsched_cst_prec", "create precedence constraints");
num_cst_assign = num_cst_prec = num_cst_dead = 0;
foreach_linked_irns(ba->head_ilp_nodes, irn) {
ilpsched_node_attr_t *pna;
unsigned delay;
- pred = skip_normal_Proj(env->arch_env->isa, pred);
+ pred = skip_normal_Proj(env->arch_env, pred);
if (is_Phi(pred) || block_node->irn != get_nodes_block(pred) || is_NoMem(pred))
continue;
char buf[1024];
unsigned num_cst_resrc = 0;
ilpsched_block_attr_t *ba = get_ilpsched_block_attr(block_node);
- lc_timer_t *t_cst_rsrc = lc_timer_register("beilpsched_cst_rsrc", "create resource constraints");
+ ir_timer_t *t_cst_rsrc = ir_timer_register("beilpsched_cst_rsrc", "create resource constraints");
ilp_timer_push(t_cst_rsrc);
for (glob_type_idx = env->cpu->n_unit_types - 1; glob_type_idx >= 0; --glob_type_idx) {
unsigned num_cst_bundle = 0;
unsigned n_instr_max = env->cpu->bundle_size * env->cpu->bundels_per_cycle;
ilpsched_block_attr_t *ba = get_ilpsched_block_attr(block_node);
- lc_timer_t *t_cst_bundle = lc_timer_register("beilpsched_cst_bundle", "create bundle constraints");
+ ir_timer_t *t_cst_bundle = ir_timer_register("beilpsched_cst_bundle", "create bundle constraints");
ilp_timer_push(t_cst_bundle);
for (t = 0; t < ba->max_steps; ++t) {
ir_node *irn;
unsigned num_cst = 0;
ilpsched_block_attr_t *ba = get_ilpsched_block_attr(block_node);
- lc_timer_t *t_cst = lc_timer_register("beilpsched_cst_alive_nodes", "create alive nodes constraints");
+ ir_timer_t *t_cst = ir_timer_register("beilpsched_cst_alive_nodes", "create alive nodes constraints");
ilp_timer_push(t_cst);
/* for each node */
ilp_livein_node_t *livein;
unsigned num_cst = 0;
ilpsched_block_attr_t *ba = get_ilpsched_block_attr(block_node);
- lc_timer_t *t_cst = lc_timer_register("beilpsched_cst_alive_livein_nodes", "create alive livein nodes constraints");
+ ir_timer_t *t_cst = ir_timer_register("beilpsched_cst_alive_livein_nodes", "create alive livein nodes constraints");
ilp_timer_push(t_cst);
/* for each node */
ir_node *cur_irn;
unsigned num_cst = 0;
ilpsched_block_attr_t *ba = get_ilpsched_block_attr(block_node);
- lc_timer_t *t_cst = lc_timer_register("beilpsched_cst_pressure", "create pressure constraints");
+ ir_timer_t *t_cst = ir_timer_register("beilpsched_cst_pressure", "create pressure constraints");
ilp_timer_push(t_cst);
/* y_{nt}^k is set for each node and timestep and unit type */
unsigned num_cst = 0;
unsigned num_non_branches = 0;
ilpsched_block_attr_t *ba = get_ilpsched_block_attr(block_node);
- lc_timer_t *t_cst = lc_timer_register("beilpsched_cst_branch", "create branch constraints");
+ ir_timer_t *t_cst = ir_timer_register("beilpsched_cst_branch", "create branch constraints");
ilp_timer_push(t_cst);
cfop = NULL;
ir_node *irn;
unsigned num_cst = 0;
ilpsched_block_attr_t *ba = get_ilpsched_block_attr(block_node);
- lc_timer_t *t_cst = lc_timer_register("beilpsched_cst_projkeep", "create proj and keep constraints");
+ ir_timer_t *t_cst = ir_timer_register("beilpsched_cst_projkeep", "create proj and keep constraints");
ilp_timer_push(t_cst);
/* check all nodes */
const char *name = "be ilp scheduling";
ir_graph *irg = be_get_birg_irg(birg);
const arch_env_t *arch_env = be_get_birg_arch_env(birg);
- const arch_isa_t *isa = arch_env->isa;
- const ilp_sched_selector_t *sel = isa->impl->get_ilp_sched_selector(isa);
+ const ilp_sched_selector_t *sel = arch_env->impl->get_ilp_sched_selector(arch_env);
FIRM_DBG_REGISTER(env.dbg, "firm.be.sched.ilp");
env.height = heights_new(irg);
env.main_env = birg->main_env;
env.arch_env = arch_env;
- env.cpu = arch_isa_get_machine(arch_env->isa);
+ env.cpu = arch_env_get_machine(arch_env);
env.opts = &ilp_opts;
env.birg = birg;
env.be_opts = be_opts;