Commit 2b2ac363 authored by Christian Würdig's avatar Christian Würdig
Browse files

fixed some bugs

parent 17e47394
......@@ -37,7 +37,6 @@ typedef struct _ia32_irn_ops_t {
/* this is a struct to minimize the number of parameters
for transformation walker */
typedef struct _ia32_transform_env_t {
const arch_env_t *arch_env; /**< The arch_env */
firm_dbg_module_t *mod; /**< The firm debugger */
dbg_info *dbg; /**< The node debug info */
ir_graph *irg; /**< The irg, the node should be created in */
......
......@@ -334,27 +334,11 @@ const lc_arg_env_t *ia32_get_arg_env(void) {
return env;
}
/**
* For 2-address code we need to make sure the first src reg is equal to dest reg.
*/
void equalize_dest_src(FILE *F, ir_node *n) {
if (get_ia32_reg_nr(n, 0, 1) != get_ia32_reg_nr(n, 0, 0)) {
if (get_irn_arity(n) > 1 && get_ia32_reg_nr(n, 1, 1) == get_ia32_reg_nr(n, 0, 0)) {
if (! is_op_commutative(get_irn_op(n))) {
/* we only need to exchange for non-commutative ops */
lc_efprintf(ia32_get_arg_env(), F, "\txchg %1S, %2S\t\t\t/* xchg src1 <-> src2 for 2 address code */\n", n, n);
}
}
else {
lc_efprintf(ia32_get_arg_env(), F, "\tmovl %1S, %1D\t\t\t/* src -> dest for 2 address code */\n", n, n);
}
}
}
/*
* Add a number to a prefix. This number will not be used a second time.
*/
char *get_unique_label(char *buf, size_t buflen, const char *prefix) {
static char *get_unique_label(char *buf, size_t buflen, const char *prefix) {
static unsigned long id = 0;
snprintf(buf, buflen, "%s%lu", prefix, ++id);
return buf;
......
......@@ -173,7 +173,6 @@ void ia32_place_consts(ir_node *irn, void *env) {
mode = get_irn_mode(irn);
tenv.arch_env = cg->arch_env;
tenv.block = get_nodes_block(irn);
tenv.cg = cg;
tenv.irg = cg->irg;
......
......@@ -457,7 +457,7 @@ static ir_node *gen_Add(ia32_transform_env_t *env, ir_node *op1, ir_node *op2) {
* @param mode node mode
* @return the created ia32 Mul node
*/
ir_node *gen_Mul(ia32_transform_env_t *env, ir_node *op1, ir_node *op2) {
static ir_node *gen_Mul(ia32_transform_env_t *env, ir_node *op1, ir_node *op2) {
ir_node *new_op;
if (mode_is_float(env->mode)) {
......@@ -1122,7 +1122,7 @@ static ir_node *gen_Load(ia32_transform_env_t *env) {
* @param mode node mode
* @return the created ia32 Store node
*/
ir_node *gen_Store(ia32_transform_env_t *env) {
static ir_node *gen_Store(ia32_transform_env_t *env) {
ir_node *node = env->irn;
ir_node *noreg = ia32_new_NoReg_gp(env->cg);
ir_node *new_op;
......@@ -1288,7 +1288,6 @@ void ia32_transform_node(ir_node *node, void *env) {
if (is_Block(node))
return;
tenv.arch_env = cgenv->arch_env;
tenv.block = get_nodes_block(node);
tenv.dbg = get_irn_dbg_info(node);
tenv.irg = current_ir_graph;
......
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