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

made code C89 compliant

removes some unused variables and functions
code cleanup
parent 6e3e499d
#
# Project: libFIRM
# File name: ir/be/ia32/Makefile.in
# File name: ir/be/mips/Makefile.in
# Purpose:
# Author: Boris Boesler, Till Riedel
# Modified by:
......
......@@ -13,7 +13,7 @@
#include "irgmod.h"
#include "irgopt.h"
#include "irgwalk.h"
#include "iredges.h "
#include "iredges.h"
#include "irdump.h"
#include "irextbb.h"
......
......@@ -97,10 +97,10 @@ static const char *node_const_to_str(ir_node *n)
assert(attr->tv != NULL);
if(get_mode_sign(get_tarval_mode(attr->tv))) {
long val = get_tarval_long(attr->tv);
snprintf(buf, sizeof(buf), "0x%04X", val & 0xffff);
snprintf(buf, sizeof(buf), "0x%04lX", val & 0xffff);
} else {
unsigned long val = get_tarval_long(attr->tv);
snprintf(buf, sizeof(buf), "0x%04X", val & 0xffff);
snprintf(buf, sizeof(buf), "0x%04lX", val & 0xffff);
}
return buf;
......@@ -109,11 +109,11 @@ static const char *node_const_to_str(ir_node *n)
if(get_mode_sign(get_tarval_mode(attr->tv))) {
long val = get_tarval_long(attr->tv);
val = (val & 0xffff0000) >> 16;
snprintf(buf, sizeof(buf), "0x%04X", val & 0xffff);
snprintf(buf, sizeof(buf), "0x%04lX", val & 0xffff);
} else {
unsigned long val = get_tarval_long(attr->tv);
val = (val & 0xffff0000) >> 16;
snprintf(buf, sizeof(buf), "0x%04X", val & 0xffff);
snprintf(buf, sizeof(buf), "0x%04lX", val & 0xffff);
}
return buf;
......@@ -345,13 +345,14 @@ static char *get_cfop_target(const ir_node *irn, char *buf)
}
/************************************************************************/
/* ABI Handling
/* ABI Handling */
/************************************************************************/
static void mips_emit_IncSP(const ir_node *node, mips_emit_env_t *env)
{
FILE *F = env->out;
int offset = be_get_IncSP_offset(node);
FILE *F = env->out;
int offset = be_get_IncSP_offset(node);
if(offset == 0)
return;
......@@ -385,7 +386,7 @@ static void mips_emit_nops(FILE* F, int n)
static void mips_emit_Perm(const ir_node *node, mips_emit_env_t *env)
{
FILE* F = env->out;
FILE *F = env->out;
assert(/*get_irn_n_outs(node) == 2 &&*/ get_irn_arity(node) == 2);
......@@ -399,23 +400,22 @@ static void mips_emit_Perm(const ir_node *node, mips_emit_env_t *env)
static void mips_emit_Spill(const ir_node* node, mips_emit_env_t *env)
{
FILE* F = env->out;
FILE *F = env->out;
entity *ent = be_get_spill_entity(node);
ir_node* context = be_get_Spill_context(node);
entity* ent = be_get_spill_entity(node);
lc_efprintf(mips_get_arg_env(), F, "\tsw %1S, %d($fp)\n", node, get_entity_offset_bytes(ent));
}
static void mips_emit_Reload(const ir_node* node, mips_emit_env_t *env)
{
FILE* F = env->out;
FILE *F = env->out;
entity *ent = be_get_spill_entity(node);
entity* ent = be_get_spill_entity(node);
lc_efprintf(mips_get_arg_env(), F, "\tlw %1D, %d($fp)\n", node, get_entity_offset_bytes(ent));
}
/************************************************************************/
/* Calls
/* Calls */
/************************************************************************/
static void mips_emit_Call(ir_node *node, mips_emit_env_t *env)
......@@ -533,15 +533,11 @@ const char* mips_get_jumptbl_label(const ir_node* switchjmp)
* possible otherwise a cmp-jmp cascade). Stolen from ia32
*/
void emit_mips_jump_table(const ir_node *irn, FILE* F) {
int lastval, i, pn, do_jmp_tbl = 1;
jmp_tbl_t tbl;
ir_node *proj;
const ir_edge_t *edge;
const lc_arg_env_t *env = mips_get_arg_env();
mips_attr_t *attr;
int i2;
attr = get_mips_attr(irn);
int lastval, i, i2, pn;
jmp_tbl_t tbl;
ir_node *proj;
const ir_edge_t *edge;
mips_attr_t *attr = get_mips_attr(irn);
/* fill the table structure */
tbl.label = xmalloc(SNPRINTF_BUF_LEN);
......
......@@ -112,33 +112,6 @@ static void dump_arith_tarval(struct obstack *obst, tarval *tv, int bytes)
}
}
/*
* dump an arithmetic tarval
*/
static void mips_dump_arith_tarval(struct obstack *obst, tarval *tv, int bytes)
{
switch (bytes) {
case 1:
obstack_printf(obst, "\t.byte\t");
break;
case 2:
obstack_printf(obst, "\t.half\t");
break;
case 4:
obstack_printf(obst, "\t.word\t");
break;
default:
fprintf(stderr, "Try to dump an tarval with %d bytes\n", bytes);
assert(0);
}
dump_arith_tarval(obst, tv, bytes);
}
/*
* dump an atomic value
*/
......
......@@ -51,8 +51,5 @@ const arch_register_t *mips_get_firm_reg(const ir_node *irn, set *reg_set) {
* requirements dependend on the predecessor.
*/
long mips_translate_proj_pos(const ir_node *proj) {
ir_node *pred = get_Proj_pred(proj);
long nr = get_Proj_proj(proj);
return nr;
return get_Proj_proj(proj);
}
......@@ -462,23 +462,23 @@ ir_node *mips_transform_##srcnode(ir_node* node) \
return node; \
}
MIPS_MAKE_IFOLDING_TRANSFORM(add, addi, 1);
MIPS_MAKE_IFOLDING_TRANSFORM(and, andi, 1);
MIPS_MAKE_IFOLDING_TRANSFORM(or, ori, 1);
MIPS_MAKE_IFOLDING_TRANSFORM(sra, srai, 0);
MIPS_MAKE_IFOLDING_TRANSFORM(xor, xori, 1);
MIPS_MAKE_IFOLDING_TRANSFORM(sl, sli, 0);
MIPS_MAKE_IFOLDING_TRANSFORM(sr, sri, 0);
MIPS_MAKE_IFOLDING_TRANSFORM(slt, slti, 0);
void mips_init_opcode_transforms() {
MIPS_MAKE_IFOLDING_TRANSFORM(add, addi, 1)
MIPS_MAKE_IFOLDING_TRANSFORM(and, andi, 1)
MIPS_MAKE_IFOLDING_TRANSFORM(or, ori, 1)
MIPS_MAKE_IFOLDING_TRANSFORM(sra, srai, 0)
MIPS_MAKE_IFOLDING_TRANSFORM(xor, xori, 1)
MIPS_MAKE_IFOLDING_TRANSFORM(sl, sli, 0)
MIPS_MAKE_IFOLDING_TRANSFORM(sr, sri, 0)
MIPS_MAKE_IFOLDING_TRANSFORM(slt, slti, 0)
void mips_init_opcode_transforms(void) {
op_mips_add->ops.transform_node = mips_transform_add;
op_mips_and->ops.transform_node = mips_transform_and;
op_mips_or->ops.transform_node = mips_transform_or;
op_mips_or->ops.transform_node = mips_transform_or;
op_mips_sra->ops.transform_node = mips_transform_sra;
op_mips_xor->ops.transform_node = mips_transform_xor;
op_mips_sl->ops.transform_node = mips_transform_sl;
op_mips_sr->ops.transform_node = mips_transform_sr;
op_mips_sl->ops.transform_node = mips_transform_sl;
op_mips_sr->ops.transform_node = mips_transform_sr;
op_mips_slt->ops.transform_node = mips_transform_slt;
}
......
......@@ -102,9 +102,9 @@ void init_mips_attributes(ir_node *node, arch_irn_flags_t flags, const mips_regi
const mips_register_req_t **out_reqs, int n_res);
/**
* Initilize transform ops for the mips opcodes
* Initialize transform ops for the mips opcodes
*/
void mips_init_opcode_transforms();
void mips_init_opcode_transforms(void);
/* Include the generated headers */
......
......@@ -53,15 +53,15 @@
return new_rd_mips_##mips_nodetype(env->dbg, env->irg, env->block, op1, op2, env->mode);\
}
MIPS_GENBINFUNC(add);
MIPS_GENBINFUNC(sub);
MIPS_GENBINFUNC(div);
MIPS_GENBINFUNC(and);
MIPS_GENBINFUNC(or);
MIPS_GENBINFUNC(xor);
MIPS_GENBINFUNC(sl);
MIPS_GENBINFUNC(sr);
MIPS_GENBINFUNC(sra);
MIPS_GENBINFUNC(add)
MIPS_GENBINFUNC(sub)
MIPS_GENBINFUNC(div)
MIPS_GENBINFUNC(and)
MIPS_GENBINFUNC(or)
MIPS_GENBINFUNC(xor)
MIPS_GENBINFUNC(sl)
MIPS_GENBINFUNC(sr)
MIPS_GENBINFUNC(sra)
#define MIPS_GENUNFUNC(mips_nodetype) \
static ir_node *mips_gen_##mips_nodetype(mips_transform_env_t *env, ir_node *op) { \
......@@ -71,7 +71,7 @@ MIPS_GENBINFUNC(sra);
return new_rd_mips_##mips_nodetype(env->dbg, env->irg, env->block, op, env->mode); \
}
MIPS_GENUNFUNC(not);
MIPS_GENUNFUNC(not)
static ir_node* mips_get_reg_node(mips_transform_env_t *env, const arch_register_t *reg) {
return be_abi_get_callee_save_irn(env->cg->birg->abi, reg);
......@@ -128,7 +128,6 @@ static ir_node* exchange_node_for_Const(mips_transform_env_t *env, ir_node* pred
ir_node *node = env->irn;
dbg_info *dbg = get_irn_dbg_info(pred);
ir_graph *irg = get_irn_irg(node);
ir_mode* mode = get_irn_mode(pred);
ir_node *block;
if(get_irn_opcode(node) == iro_Phi) {
......@@ -286,7 +285,6 @@ static ir_node *gen_node_for_Cond_Proj(mips_transform_env_t *env, ir_node* node,
// replaced by a mips_ compare node
ir_node *proj = get_Cond_selector(node);
ir_node *original_cmp = get_irn_n(proj, 0);
ir_node *result = NULL;
ir_node *cmp;
ir_node *condjmp;
ir_node *op1, *op2;
......@@ -887,7 +885,6 @@ static void mips_transform_Reload(mips_transform_env_t* env) {
ir_node *node = env->irn;
ir_node *sched_point = NULL;
ir_node *load, *proj;
ir_node *nomem = new_rd_NoMem(env->irg);
ir_node *ptr = get_irn_n(node, 0);
ir_node *mem = get_irn_n(node, 1);
ir_mode *mode = get_irn_mode(node);
......
......@@ -3,4 +3,4 @@
#define ASSERT_NO_FLOAT(mode) { assert( (!mode_is_float(mode)) && "floating point not supported (yet)"); }
#endif
#endif /* _MIPS_UTIL_H_ */
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