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

fixed indents

changed interface
using generic architecture interface to obtain register from node
parent b853dd56
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#define SNPRINTF_BUF_LEN 128 #define SNPRINTF_BUF_LEN 128
static set *cur_reg_set = NULL; static const arch_env_t *arch_env = NULL;
/************************************************************* /*************************************************************
...@@ -79,7 +79,6 @@ static int ia32_get_arg_type(const lc_arg_occ_t *occ) { ...@@ -79,7 +79,6 @@ static int ia32_get_arg_type(const lc_arg_occ_t *occ) {
static const arch_register_t *get_in_reg(ir_node *irn, int pos) { static const arch_register_t *get_in_reg(ir_node *irn, int pos) {
ir_node *op; ir_node *op;
const arch_register_t *reg = NULL; const arch_register_t *reg = NULL;
const arch_register_t **slots;
assert(get_irn_arity(irn) > pos && "Invalid IN position"); assert(get_irn_arity(irn) > pos && "Invalid IN position");
...@@ -87,28 +86,9 @@ static const arch_register_t *get_in_reg(ir_node *irn, int pos) { ...@@ -87,28 +86,9 @@ static const arch_register_t *get_in_reg(ir_node *irn, int pos) {
in register we need. */ in register we need. */
op = get_irn_n(irn, pos); op = get_irn_n(irn, pos);
if (is_Proj(op)) { reg = arch_get_irn_register(arch_env, op);
pos = (int)translate_proj_pos(op);
while(is_Proj(op))
op = get_Proj_pred(op);
}
if (is_ia32_irn(op)) { assert(reg && "could not get in register");
/* The operator is an ia32 node: this node has only one out */
slots = get_ia32_slots(op);
reg = slots[0];
}
else {
/* The operator is not an ia32 node: check for Phi or Proj */
if (is_Phi(op)) {
/* Phi's getting register assigned */
reg = ia32_get_firm_reg(NULL, op, cur_reg_set);
assert(reg && "No register assigned to Phi node");
}
else {
assert(0 && "Unsupported node for IN register");
}
}
return reg; return reg;
} }
...@@ -737,14 +717,14 @@ void ia32_gen_labels(ir_node *block, void *env) { ...@@ -737,14 +717,14 @@ void ia32_gen_labels(ir_node *block, void *env) {
/** /**
* Main driver * Main driver
*/ */
void ia32_gen_routine(FILE *F, ir_graph *irg, set *reg_set) { void ia32_gen_routine(FILE *F, ir_graph *irg, const arch_env_t *env) {
emit_env_t emit_env; emit_env_t emit_env;
emit_env.mod = firm_dbg_register("be.codegen.ia32"); emit_env.mod = firm_dbg_register("ir.be.codegen.ia32");
emit_env.out = F; emit_env.out = F;
emit_env.reg_set = reg_set; emit_env.arch_env = env;
cur_reg_set = reg_set; arch_env = env;
ia32_emit_start(F, irg); ia32_emit_start(F, irg);
irg_block_walk_graph(irg, ia32_gen_labels, NULL, &emit_env); irg_block_walk_graph(irg, ia32_gen_labels, NULL, &emit_env);
......
...@@ -3,14 +3,14 @@ ...@@ -3,14 +3,14 @@
#include "irargs_t.h" // this also inlucdes <libcore/lc_print.h> #include "irargs_t.h" // this also inlucdes <libcore/lc_print.h>
#include "irnode.h" #include "irnode.h"
#include "set.h"
#include "debug.h" #include "debug.h"
#include "../bearch.h"
typedef struct _emit_env_t { typedef struct _emit_env_t {
firm_dbg_module_t *mod; firm_dbg_module_t *mod;
FILE *out; FILE *out;
set *reg_set; const arch_env_t *arch_env;
} emit_env_t; } emit_env_t;
const lc_arg_env_t *ia32_get_arg_env(void); const lc_arg_env_t *ia32_get_arg_env(void);
...@@ -20,6 +20,6 @@ void equalize_dest_src(FILE *F, ir_node *n); ...@@ -20,6 +20,6 @@ void equalize_dest_src(FILE *F, ir_node *n);
int get_ia32_in_regnr(ir_node *irn, int pos); int get_ia32_in_regnr(ir_node *irn, int pos);
const char *get_ia32_in_reg_name(ir_node *irn, int pos); const char *get_ia32_in_reg_name(ir_node *irn, int pos);
void ia32_gen_routine(FILE *F, ir_graph *irg, set *reg_set); void ia32_gen_routine(FILE *F, ir_graph *irg, const arch_env_t *env);
#endif /* _IA32_EMITTER_H_ */ #endif /* _IA32_EMITTER_H_ */
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