Commit 588054c0 authored by Christian Würdig's avatar Christian Würdig
Browse files

fixed phase to assure register constraints

parent ff73e39f
......@@ -266,9 +266,6 @@ static void be_ra_chordal_main(const be_irg_t *bi)
obstack_init(&chordal_env.obst);
/* add Keeps for should_be_different constrained nodes */
lower_nodes_before_ra(&chordal_env);
/* Perform the following for each register class. */
for(j = 0, m = arch_isa_get_n_reg_class(isa); j < m; ++j) {
chordal_env.cls = arch_isa_get_reg_class(isa, j);
......
......@@ -467,11 +467,12 @@ static void lower_perm_node(ir_node *irn, void *walk_env) {
* Checks if node has a should_be_different constraint in output
* and adds a Keep then to assure the constraint.
*/
static void assure_different_constraint(ir_node *irn, lower_env_t *env) {
const arch_env_t *arch_env = env->chord_env->birg->main_env->arch_env;
static void assure_different_constraint(ir_node *irn, be_irg_t *birg) {
const arch_env_t *arch_env = birg->main_env->arch_env;
const arch_register_req_t *req;
arch_register_req_t req_temp;
ir_node *in[2], *keep;
firm_dbg_module_t *mod = firm_dbg_register("firm.be.lower");
req = arch_get_register_req(arch_env, &req_temp, irn, -1);
......@@ -482,20 +483,20 @@ static void assure_different_constraint(ir_node *irn, lower_env_t *env) {
in[0] = irn;
in[1] = req->other_different;
keep = be_new_Keep(req->cls, env->chord_env->birg->irg, get_nodes_block(irn), 2, in);
DBG((env->dbg_module, LEVEL_1, "created %+F for %+F to assure should_be_different\n", keep, irn));
keep = be_new_Keep(req->cls, birg->irg, get_nodes_block(irn), 2, in);
DBG((mod, LEVEL_1, "created %+F for %+F to assure should_be_different\n", keep, irn));
}
}
/**
* Calls the corresponding lowering function for the node.
* Calls the functions to assure register constraints.
*
* @param irn The node to be checked for lowering
* @param walk_env The walker environment
*/
static void lower_nodes_before_ra_walker(ir_node *irn, void *walk_env) {
static void assure_constraints_walker(ir_node *irn, void *walk_env) {
if (is_Block(irn))
return;
......@@ -507,6 +508,17 @@ static void lower_nodes_before_ra_walker(ir_node *irn, void *walk_env) {
/**
* Walks over all nodes to assure register constraints.
*
* @param birg The birg structure containing the irg
*/
void assure_constraints(be_irg_t *birg) {
irg_walk_blkwise_graph(birg->irg, NULL, assure_constraints_walker, birg);
}
/**
* Calls the corresponding lowering function for the node.
*
......@@ -528,23 +540,6 @@ static void lower_nodes_after_ra_walker(ir_node *irn, void *walk_env) {
/**
* Walks over all blocks in an irg and performs action need to be
* done before register allocation (e.g. add Keeps for should be different constraints).
*
* @param chord_env The chordal environment containing the irg
*/
void lower_nodes_before_ra(be_chordal_env_t *chord_env) {
lower_env_t env;
env.chord_env = chord_env;
env.dbg_module = firm_dbg_register("firm.be.lower");
irg_walk_blkwise_graph(chord_env->irg, NULL, lower_nodes_before_ra_walker, &env);
}
/**
* Walks over all blocks in an irg and performs lowering need to be
* done after register allocation (e.g. perm lowering).
......
......@@ -9,8 +9,9 @@
#define _BELOWER_H_
#include "bechordal.h"
#include "be_t.h"
void lower_nodes_before_ra(be_chordal_env_t *chord_env);
void assure_constraints(be_irg_t *birg);
void lower_nodes_after_ra(be_chordal_env_t *chord_env, int do_copy);
#endif /* _BELOWER_H_ */
......@@ -287,6 +287,9 @@ static void be_main_loop(FILE *file_handle)
dump(DUMP_PREPARED, irg, "-prepared", dump_ir_block_graph);
/* add Keeps for should_be_different constrained nodes */
assure_constraints(&birg);
/* Schedule the graphs. */
arch_code_generator_before_sched(birg.cg);
list_sched(isa, irg);
......
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