Commit 4ed766ac authored by Matthias Braun's avatar Matthias Braun
Browse files

remove some unnecessary #defines and unused code

[r27987]
parent df33b59f
/*
* 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 ILP formalization using: ???
* @author Daniel Grund
* @date 17.05.2005
* @version $Id$
*/
#include "config.h"
#ifdef WITH_ILP
#include "becopyilp_t.h"
#define DEBUG_LVL 1
typedef struct my_env_t {
int dummy;
} my_env_t;
int co_solve_ilp1(copy_opt_t *co, double time_limit)
{
(void) co;
(void) time_limit;
return 1;
}
#else /* WITH_ILP */
static inline void only_that_you_can_compile_without_WITH_ILP_defined(void)
{
}
#endif /* WITH_ILP */
......@@ -858,8 +858,6 @@ void co_free_graph_structure(copy_opt_t *co)
co->nodes = NULL;
}
/* co_solve_ilp1() co_solve_ilp2() are implemented in becopyilpX.c */
int co_gs_is_optimizable(copy_opt_t *co, ir_node *irn)
{
affinity_node_t new_node, *n;
......
......@@ -252,13 +252,6 @@ void co_build_graph_structure(copy_opt_t *co);
*/
void co_free_graph_structure(copy_opt_t *co);
/**
* Solves the problem using mixed integer programming
* @returns 1 iff solution state was optimal
* NYI
*/
int co_solve_ilp1(copy_opt_t *co, double time_limit);
/**
* Solves the problem using mixed integer programming
* @returns 1 iff solution state was optimal
......@@ -273,4 +266,4 @@ int co_solve_ilp2(copy_opt_t *co);
*/
int co_gs_is_optimizable(copy_opt_t *co, ir_node *irn);
#endif /* FIRM_BE_BECOPYOPT_H */
#endif
......@@ -52,9 +52,6 @@
DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;)
#define get_reg(irn) arch_get_irn_register(irn)
#define set_reg(irn, reg) arch_set_irn_register(irn, reg)
static void clear_link(ir_node *irn, void *data)
{
(void) data;
......@@ -182,10 +179,10 @@ static void insert_all_perms_walker(ir_node *bl, void *data)
for (pp = set_first(arg_set); pp; pp = set_next(arg_set)) {
ir_node *proj = new_r_Proj(perm, get_irn_mode(pp->arg), pp->pos);
pp->proj = proj;
assert(get_reg(pp->arg));
set_reg(proj, get_reg(pp->arg));
assert(arch_get_irn_register(pp->arg));
arch_set_irn_register(proj, arch_get_irn_register(pp->arg));
insert_after = proj;
DBG((dbg, LEVEL_2, "Copy register assignment %s from %+F to %+F\n", get_reg(pp->arg)->name, pp->arg, pp->proj));
DBG((dbg, LEVEL_2, "Copy register assignment %s from %+F to %+F\n", arch_get_irn_register(pp->arg)->name, pp->arg, pp->proj));
}
/*
......@@ -237,7 +234,7 @@ static void set_regs_or_place_dupls_walker(ir_node *bl, void *data)
/* Consider all phis of this block */
for (phi = get_irn_link(bl); phi; phi = get_irn_link(phi)) {
ir_node *phi_block = get_nodes_block(phi);
const arch_register_t *phi_reg = get_reg(phi);
const arch_register_t *phi_reg = arch_get_irn_register(phi);
const arch_register_class_t *cls = phi_reg->reg_class;
int max;
int i;
......@@ -251,7 +248,7 @@ static void set_regs_or_place_dupls_walker(ir_node *bl, void *data)
ir_node *arg_block;
arg_block = get_Block_cfgpred_block(phi_block, i);
arg_reg = get_reg(arg);
arg_reg = arch_get_irn_register(arg);
assert(arg_reg && "Register must be set while placing perms");
......@@ -262,7 +259,7 @@ static void set_regs_or_place_dupls_walker(ir_node *bl, void *data)
|| (arg_reg->type & arch_register_type_virtual)) {
/* Phi and arg have the same register, so pin and continue */
pin_irn(arg, phi_block);
DBG((dbg, LEVEL_1, " arg has same reg: pin %+F(%s)\n", arg, get_reg(arg)->name));
DBG((dbg, LEVEL_1, " arg has same reg: pin %+F(%s)\n", arg, arch_get_irn_register(arg)->name));
continue;
}
......@@ -277,12 +274,12 @@ static void set_regs_or_place_dupls_walker(ir_node *bl, void *data)
ir_node *dupl = be_new_Copy(cls, arg_block, arg);
set_irn_n(phi, i, dupl);
set_reg(dupl, phi_reg);
arch_set_irn_register(dupl, phi_reg);
sched_add_after(sched_skip(sched_last(arg_block), 0, sched_skip_cf_predicator, NULL), dupl);
pin_irn(dupl, phi_block);
be_liveness_introduce(lv, dupl);
be_liveness_update(lv, arg);
DBG((dbg, LEVEL_1, " they do interfere: insert %+F(%s)\n", dupl, get_reg(dupl)->name));
DBG((dbg, LEVEL_1, " they do interfere: insert %+F(%s)\n", dupl, arch_get_irn_register(dupl)->name));
continue; /* with next argument */
}
......@@ -307,8 +304,8 @@ static void set_regs_or_place_dupls_walker(ir_node *bl, void *data)
get_nodes_block(phi) == get_nodes_block(other_phi) &&
"link fields are screwed up");
if (get_irn_n(other_phi, i) == arg && get_reg(other_phi) == arg_reg) {
DBG((dbg, LEVEL_1, " found %+F(%s)\n", other_phi, get_reg(other_phi)->name));
if (get_irn_n(other_phi, i) == arg && arch_get_irn_register(other_phi) == arg_reg) {
DBG((dbg, LEVEL_1, " found %+F(%s)\n", other_phi, arch_get_irn_register(other_phi)->name));
pin_irn(arg, phi_block);
break;
}
......@@ -328,7 +325,7 @@ static void set_regs_or_place_dupls_walker(ir_node *bl, void *data)
ir_node *ins;
set_irn_n(phi, i, dupl);
set_reg(dupl, phi_reg);
arch_set_irn_register(dupl, phi_reg);
/* skip the Perm's Projs and insert the copies behind. */
for (ins = sched_next(perm); is_Proj(ins); ins = sched_next(ins)) {
}
......@@ -336,15 +333,15 @@ static void set_regs_or_place_dupls_walker(ir_node *bl, void *data)
pin_irn(dupl, phi_block);
be_liveness_introduce(lv, dupl);
be_liveness_update(lv, arg);
DBG((dbg, LEVEL_1, " arg is pinned: insert %+F(%s)\n", dupl, get_reg(dupl)->name));
DBG((dbg, LEVEL_1, " arg is pinned: insert %+F(%s)\n", dupl, arch_get_irn_register(dupl)->name));
} else {
/*
No other phi has the same color (else arg would have been pinned),
so just set the register and pin
*/
set_reg(arg, phi_reg);
arch_set_irn_register(arg, phi_reg);
pin_irn(arg, phi_block);
DBG((dbg, LEVEL_1, " arg is not pinned: so pin %+F(%s)\n", arg, get_reg(arg)->name));
DBG((dbg, LEVEL_1, " arg is not pinned: so pin %+F(%s)\n", arg, arch_get_irn_register(arg)->name));
}
}
}
......@@ -399,7 +396,7 @@ static void ssa_destruction_check_walker(ir_node *bl, void *data)
for (phi = get_irn_link(bl); phi; phi = get_irn_link(phi)) {
const arch_register_t *phi_reg, *arg_reg;
phi_reg = get_reg(phi);
phi_reg = arch_get_irn_register(phi);
/* iterate over all args of phi */
for (i = 0, max = get_irn_arity(phi); i < max; ++i) {
ir_node *arg = get_irn_n(phi, i);
......@@ -408,7 +405,7 @@ static void ssa_destruction_check_walker(ir_node *bl, void *data)
if (req->type & arch_register_req_type_ignore)
continue;
arg_reg = get_reg(arg);
arg_reg = arch_get_irn_register(arg);
if (phi_reg != arg_reg) {
DBG((dbg, 0, "Error: Registers of %+F and %+F differ: %s %s\n", phi, arg, phi_reg->name, arg_reg->name));
......
......@@ -50,8 +50,6 @@
#include "bearch.h"
#include "beuses.h"
#define SCAN_INTERBLOCK_USES
typedef struct be_use_t {
const ir_node *block;
const ir_node *node;
......@@ -173,7 +171,6 @@ static be_next_use_t get_next_use(be_uses_t *env, ir_node *from,
unsigned next_use_step;
const ir_edge_t *edge;
#if 1
assert(skip_from_uses == 0 || skip_from_uses == 1);
if (skip_from_uses) {
from = sched_next(from);
......@@ -213,48 +210,6 @@ static be_next_use_t get_next_use(be_uses_t *env, ir_node *from,
node = sched_last(block);
step = get_step(node) + 1 + timestep + skip_from_uses;
#else
if (skip_from_uses) {
from = sched_next(from);
++step;
}
sched_foreach_from(from, node) {
int i, arity;
if (is_Phi(node)) {
step++;
continue;
}
arity = get_irn_arity(node);
for (i = 0; i < arity; ++i) {
const ir_node *operand = get_irn_n(node, i);
if (operand == def) {
be_next_use_t result;
DBG((env->dbg, LEVEL_3, "found use of %+F at %+F\n", operand, node));
/**
* Spills/Reloads are a special case, they're not really a
* usage of a value, continue searching
*/
if (be_is_Spill(node) || be_is_Reload(node)) {
return be_get_next_use(env, node, step, node, 1);
}
result.time = step;
result.outermost_loop = get_loop_depth(get_irn_loop(block));
result.before = node;
return result;
}
}
step++;
}
#endif
if (be_is_phi_argument(block, def)) {
// TODO we really should continue searching the uses of the phi,
// as a phi isn't a real use that implies a reload (because we could
......@@ -267,7 +222,6 @@ static be_next_use_t get_next_use(be_uses_t *env, ir_node *from,
return result;
}
#ifdef SCAN_INTERBLOCK_USES
{
unsigned next_use = USES_INFINITY;
int outermost_loop;
......@@ -339,9 +293,6 @@ static be_next_use_t get_next_use(be_uses_t *env, ir_node *from,
DBG((env->dbg, LEVEL_5, "Result: %d (outerloop: %d)\n", result.time, result.outermost_loop));
return result;
}
#else
return USES_INFINITY;
#endif
}
be_next_use_t be_get_next_use(be_uses_t *env, ir_node *from,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment