Commit 236c08e5 authored by Matthias Braun's avatar Matthias Braun
Browse files

use size_t for ASM n_clobbers, n_outputs

parent 662f9ccd
......@@ -1256,8 +1256,9 @@ FIRM_API ir_node *new_rd_defaultProj(dbg_info *db, ir_node *arg, long max_proj);
*/
FIRM_API ir_node *new_rd_ASM(dbg_info *db, ir_node *block,
int arity, ir_node *in[], ir_asm_constraint *inputs,
int n_outs, ir_asm_constraint *outputs,
int n_clobber, ident *clobber[], ident *asm_text);
size_t n_outs, ir_asm_constraint *outputs,
size_t n_clobber, ident *clobber[],
ident *asm_text);
/*-------------------------------------------------------------------------*/
/* The raw interface without debug support */
......@@ -1374,8 +1375,9 @@ FIRM_API ir_node *new_r_defaultProj(ir_node *arg, long max_proj);
*/
FIRM_API ir_node *new_r_ASM(ir_node *block,
int arity, ir_node *in[], ir_asm_constraint *inputs,
int n_outs, ir_asm_constraint *outputs,
int n_clobber, ident *clobber[], ident *asm_text);
size_t n_outs, ir_asm_constraint *outputs,
size_t n_clobber, ident *clobber[],
ident *asm_text);
/*-----------------------------------------------------------------------*/
/* The block oriented interface */
......@@ -1504,8 +1506,9 @@ FIRM_API ir_node *new_d_defaultProj(dbg_info *db, ir_node *arg, long max_proj);
*/
FIRM_API ir_node *new_d_ASM(dbg_info *db, int arity, ir_node *in[],
ir_asm_constraint *inputs,
int n_outs, ir_asm_constraint *outputs,
int n_clobber, ident *clobber[], ident *asm_text);
size_t n_outs, ir_asm_constraint *outputs,
size_t n_clobber, ident *clobber[],
ident *asm_text);
/*-----------------------------------------------------------------------*/
/* The block oriented interface without debug support */
......@@ -1617,8 +1620,8 @@ FIRM_API ir_node *new_defaultProj(ir_node *arg, long max_proj);
* @param *asm_text The assembler text.
*/
FIRM_API ir_node *new_ASM(int arity, ir_node *in[], ir_asm_constraint *inputs,
int n_outs, ir_asm_constraint *outputs,
int n_clobber, ident *clobber[], ident *asm_text);
size_t n_outs, ir_asm_constraint *outputs,
size_t n_clobber, ident *clobber[], ident *asm_text);
/*---------------------------------------------------------------------*/
/* The comfortable interface. */
......
......@@ -549,11 +549,11 @@ FIRM_API ir_node *get_Tuple_pred(const ir_node *node, int pos);
FIRM_API void set_Tuple_pred(ir_node *node, int pos, ir_node *pred);
/** Return the number of input constraints for an ASM node. */
FIRM_API int get_ASM_n_input_constraints(const ir_node *node);
FIRM_API size_t get_ASM_n_input_constraints(const ir_node *node);
/** Return the number of output constraints for an ASM node. */
FIRM_API int get_ASM_n_output_constraints(const ir_node *node);
FIRM_API size_t get_ASM_n_output_constraints(const ir_node *node);
/** Return the number of clobbered registers for an ASM node. */
FIRM_API int get_ASM_n_clobbers(const ir_node *node);
FIRM_API size_t get_ASM_n_clobbers(const ir_node *node);
/** Returns operand of node if node is a Proj. */
FIRM_API ir_node *skip_Proj(ir_node *node);
......
......@@ -163,7 +163,7 @@ int ia32_mode_needs_gp_reg(ir_mode *mode)
}
static void parse_asm_constraints(constraint_t *constraint, const char *c,
int is_output)
bool is_output)
{
char immediate_type = '\0';
unsigned limited = 0;
......@@ -419,14 +419,14 @@ ir_node *ia32_gen_ASM(ir_node *node)
ir_node *block = get_nodes_block(node);
ir_node *new_block = get_new_node(block);
dbg_info *dbgi = get_irn_dbg_info(node);
int i, arity;
int value_arity;
int out_idx;
int arity;
size_t value_arity;
size_t out_idx;
ir_node **in;
ir_node *new_node;
int out_arity;
int n_out_constraints;
int n_clobbers;
size_t out_arity;
size_t n_out_constraints;
size_t n_clobbers;
const arch_register_req_t **out_reg_reqs;
const arch_register_req_t **in_reg_reqs;
ia32_asm_reg_t *register_map;
......@@ -436,8 +436,11 @@ ir_node *ia32_gen_ASM(ir_node *node)
const ir_asm_constraint *out_constraints;
ident **clobbers;
unsigned clobber_bits[N_IA32_CLASSES];
int out_size;
size_t out_size;
backend_info_t *info;
int i;
size_t c;
size_t o;
memset(&clobber_bits, 0, sizeof(clobber_bits));
......@@ -446,17 +449,17 @@ ir_node *ia32_gen_ASM(ir_node *node)
clobbers = get_ASM_clobbers(node);
n_clobbers = 0;
for (i = 0; i < get_ASM_n_clobbers(node); ++i) {
for (c = 0; c < get_ASM_n_clobbers(node); ++c) {
const arch_register_req_t *req;
const char *c = get_id_str(clobbers[i]);
const char *clobber = get_id_str(clobbers[c]);
if (strcmp(c, "memory") == 0)
if (strcmp(clobber, "memory") == 0)
continue;
if (strcmp(c, "cc") == 0) {
if (strcmp(clobber, "cc") == 0) {
continue;
}
req = ia32_parse_clobber(c);
req = ia32_parse_clobber(clobber);
clobber_bits[req->cls->index] |= *req->limited;
n_clobbers++;
......@@ -485,7 +488,7 @@ ir_node *ia32_gen_ASM(ir_node *node)
memset(register_map, 0, reg_map_size * sizeof(register_map[0]));
/* construct output constraints */
out_size = out_arity + 1;
out_size = out_arity + 1;
out_reg_reqs = OALLOCN(obst, const arch_register_req_t*, out_size);
for (out_idx = 0; out_idx < n_out_constraints; ++out_idx) {
......@@ -495,9 +498,9 @@ ir_node *ia32_gen_ASM(ir_node *node)
constraint_t parsed_constraint;
const arch_register_req_t *req;
parse_asm_constraints(&parsed_constraint, c, 1);
parse_asm_constraints(&parsed_constraint, c, true);
req = ia32_make_register_req(&parsed_constraint, n_out_constraints,
out_reg_reqs, out_idx);
out_reg_reqs, out_idx);
out_reg_reqs[out_idx] = req;
/* multiple constraints for same pos. This can happen for example when
......@@ -527,7 +530,7 @@ ir_node *ia32_gen_ASM(ir_node *node)
constraint_t parsed_constraint;
const arch_register_req_t *req;
parse_asm_constraints(&parsed_constraint, c, 0);
parse_asm_constraints(&parsed_constraint, c, false);
if (parsed_constraint.cls != NULL) {
r_clobber_bits = clobber_bits[parsed_constraint.cls->index];
if (r_clobber_bits != 0) {
......@@ -570,14 +573,14 @@ ir_node *ia32_gen_ASM(ir_node *node)
}
/* parse clobbers */
for (i = 0; i < get_ASM_n_clobbers(node); ++i) {
const char *c = get_id_str(clobbers[i]);
for (c = 0; c < get_ASM_n_clobbers(node); ++c) {
const char *clobber = get_id_str(clobbers[c]);
const arch_register_req_t *req;
if (strcmp(c, "memory") == 0 || strcmp(c, "cc") == 0)
if (strcmp(clobber, "memory") == 0 || strcmp(clobber, "cc") == 0)
continue;
req = ia32_parse_clobber(c);
req = ia32_parse_clobber(clobber);
out_reg_reqs[out_idx] = req;
++out_idx;
}
......@@ -606,8 +609,8 @@ ir_node *ia32_gen_ASM(ir_node *node)
if (out_arity <= value_arity) {
int orig_arity = arity;
int in_size = arity;
int o;
bitset_t *used_ins = bitset_alloca(arity);
bitset_t *used_ins = bitset_alloca(arity);
size_t o;
for (o = 0; o < out_arity; ++o) {
const arch_register_req_t *outreq = out_reg_reqs[o];
......@@ -652,11 +655,11 @@ ir_node *ia32_gen_ASM(ir_node *node)
++arity;
}
} else {
bitset_t *used_outs = bitset_alloca(out_arity);
int orig_out_arity = out_arity;
bitset_t *used_outs = bitset_alloca(out_arity);
size_t orig_out_arity = out_arity;
for (i = 0; i < arity; ++i) {
int o;
const arch_register_req_t *inreq = in_reg_reqs[i];
size_t o;
if (inreq->cls == NULL) {
continue;
......@@ -715,8 +718,8 @@ ir_node *ia32_gen_ASM(ir_node *node)
get_ASM_text(node), register_map);
info = be_get_info(new_node);
for (i = 0; i < out_arity; ++i) {
info->out_infos[i].req = out_reg_reqs[i];
for (o = 0; o < out_arity; ++o) {
info->out_infos[o].req = out_reg_reqs[o];
}
arch_set_irn_register_reqs_in(new_node, in_reg_reqs);
......
......@@ -1201,7 +1201,7 @@ static const char* emit_asm_operand(const ir_node *node, const char *s)
panic("Invalid asm op modifier");
}
} else {
emit_register(reg, asm_reg->mode);
emit_register(reg, asm_reg->memory ? mode_Iu : asm_reg->mode);
}
if (asm_reg->memory) {
......
......@@ -67,8 +67,8 @@ ir_node *new_rd_defaultProj(dbg_info *db, ir_node *arg, long max_proj)
}
ir_node *new_rd_ASM(dbg_info *db, ir_node *block, int arity, ir_node *in[],
ir_asm_constraint *inputs, int n_outs,
ir_asm_constraint *outputs, int n_clobber,
ir_asm_constraint *inputs, size_t n_outs,
ir_asm_constraint *outputs, size_t n_clobber,
ident *clobber[], ident *text)
{
ir_graph *irg = get_irn_irg(block);
......@@ -165,8 +165,8 @@ ir_node *new_r_defaultProj(ir_node *arg, long max_proj)
}
ir_node *new_r_ASM(ir_node *block,
int arity, ir_node *in[], ir_asm_constraint *inputs,
int n_outs, ir_asm_constraint *outputs,
int n_clobber, ident *clobber[], ident *text)
size_t n_outs, ir_asm_constraint *outputs,
size_t n_clobber, ident *clobber[], ident *text)
{
return new_rd_ASM(NULL, block, arity, in, inputs, n_outs, outputs, n_clobber, clobber, text);
}
......@@ -413,8 +413,8 @@ ir_node *new_d_SymConst(dbg_info *db, ir_mode *mode, symconst_symbol value,
ir_node *new_d_ASM(dbg_info *db, int arity, ir_node *in[],
ir_asm_constraint *inputs,
int n_outs, ir_asm_constraint *outputs, int n_clobber,
ident *clobber[], ident *text)
size_t n_outs, ir_asm_constraint *outputs,
size_t n_clobber, ident *clobber[], ident *text)
{
assert(get_irg_phase_state(current_ir_graph) == phase_building);
return new_rd_ASM(db, current_ir_graph->current_block, arity, in, inputs,
......@@ -767,8 +767,8 @@ ir_node *new_defaultProj(ir_node *arg, long max_proj)
return new_d_defaultProj(NULL, arg, max_proj);
}
ir_node *new_ASM(int arity, ir_node *in[], ir_asm_constraint *inputs,
int n_outs, ir_asm_constraint *outputs,
int n_clobber, ident *clobber[], ident *text)
size_t n_outs, ir_asm_constraint *outputs,
size_t n_clobber, ident *clobber[], ident *text)
{
return new_d_ASM(NULL, arity, in, inputs, n_outs, outputs, n_clobber, clobber, text);
}
......
......@@ -1330,19 +1330,19 @@ void set_Tuple_pred(ir_node *node, int pos, ir_node *pred)
set_irn_n(node, pos, pred);
}
int get_ASM_n_input_constraints(const ir_node *node)
size_t get_ASM_n_input_constraints(const ir_node *node)
{
assert(is_ASM(node));
return ARR_LEN(node->attr.assem.input_constraints);
}
int get_ASM_n_output_constraints(const ir_node *node)
size_t get_ASM_n_output_constraints(const ir_node *node)
{
assert(is_ASM(node));
return ARR_LEN(node->attr.assem.output_constraints);
}
int get_ASM_n_clobbers(const ir_node *node)
size_t get_ASM_n_clobbers(const ir_node *node)
{
assert(is_ASM(node));
return ARR_LEN(node->attr.assem.clobbers);
......
......@@ -6634,7 +6634,8 @@ static int node_cmp_attr_Builtin(const ir_node *a, const ir_node *b)
/** Compares the attributes of two ASM nodes. */
static int node_cmp_attr_ASM(const ir_node *a, const ir_node *b)
{
int i, n;
size_t n;
size_t i;
const ir_asm_constraint *ca;
const ir_asm_constraint *cb;
ident **cla, **clb;
......
......@@ -100,7 +100,7 @@ class ASM(Op):
),
dict(
name = "n_output_constraints",
type = "int",
type = "size_t",
noprop = True,
comment = "number of output constraints",
),
......@@ -111,7 +111,7 @@ class ASM(Op):
),
dict(
name = "n_clobbers",
type = "int",
type = "size_t",
noprop = True,
comment = "number of clobbered registers/memory",
),
......
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