Commit e6fe1244 authored by Matthias Braun's avatar Matthias Braun
Browse files

alloc has a count not a size argument, reflect this in method names

[r27254]
parent ca21c59e
......@@ -969,8 +969,8 @@ typedef enum {
ir_node *get_Alloc_mem(const ir_node *node);
void set_Alloc_mem(ir_node *node, ir_node *mem);
ir_node *get_Alloc_size(const ir_node *node);
void set_Alloc_size(ir_node *node, ir_node *size);
ir_node *get_Alloc_count(const ir_node *node);
void set_Alloc_count(ir_node *node, ir_node *count);
ir_type *get_Alloc_type(ir_node *node);
void set_Alloc_type(ir_node *node, ir_type *tp);
......
......@@ -888,7 +888,11 @@ static ir_node *adjust_alloc(be_abi_irg_t *env, ir_node *alloc, ir_node *curr_sp
dbg_info *dbg;
const ir_edge_t *edge;
ir_node *new_alloc, *size, *addr, *ins[2];
ir_node *new_alloc;
ir_node *count;
ir_node *size;
ir_node *addr;
ir_node *ins[2];
unsigned stack_alignment;
assert(get_Alloc_where(alloc) == stack_alloc);
......@@ -923,16 +927,18 @@ static ir_node *adjust_alloc(be_abi_irg_t *env, ir_node *alloc, ir_node *curr_sp
return curr_sp;
}
dbg = get_irn_dbg_info(alloc);
size = get_Alloc_size(alloc);
dbg = get_irn_dbg_info(alloc);
count = get_Alloc_count(alloc);
/* we might need to multiply the size with the element size */
/* we might need to multiply the count with the element size */
if (type != firm_unknown_type && get_type_size_bytes(type) != 1) {
ir_mode *mode = get_irn_mode(size);
ir_mode *mode = get_irn_mode(count);
tarval *tv = new_tarval_from_long(get_type_size_bytes(type),
mode);
ir_node *cnst = new_rd_Const(dbg, irg, tv);
size = new_rd_Mul(dbg, block, size, cnst, mode);
size = new_rd_Mul(dbg, block, count, cnst, mode);
} else {
size = count;
}
/* The stack pointer will be modified in an unknown manner.
......
......@@ -2054,16 +2054,16 @@ void set_Alloc_mem(ir_node *node, ir_node *mem)
set_irn_n(node, 0, mem);
}
ir_node *get_Alloc_size(const ir_node *node)
ir_node *get_Alloc_count(const ir_node *node)
{
assert(is_Alloc(node));
return get_irn_n(node, 1);
}
void set_Alloc_size(ir_node *node, ir_node *size)
void set_Alloc_count(ir_node *node, ir_node *count)
{
assert(is_Alloc(node));
set_irn_n(node, 1, size);
set_irn_n(node, 1, count);
}
ir_type *get_Alloc_type(ir_node *node)
......
......@@ -1791,7 +1791,7 @@ static int verify_node_Alloc(ir_node *n, ir_graph *irg)
{
ir_mode *mymode = get_irn_mode(n);
ir_mode *op1mode = get_irn_mode(get_Alloc_mem(n));
ir_mode *op2mode = get_irn_mode(get_Alloc_size(n));
ir_mode *op2mode = get_irn_mode(get_Alloc_count(n));
(void) irg;
ASSERT_AND_RET_DBG(
......
......@@ -404,7 +404,7 @@ static void transform_allocs(ir_graph *irg, walk_env_t *env)
ftp = get_irg_frame_type(irg);
for (alloc = env->found_allocs; alloc; alloc = next) {
next = get_irn_link(alloc);
size = get_Alloc_size(alloc);
size = get_Alloc_count(alloc);
atp = get_Alloc_type(alloc);
tp = NULL;
......
......@@ -27,7 +27,7 @@ class Add(Binop):
flags = ["commutative"]
class Alloc(Op):
ins = [ "mem", "size" ]
ins = [ "mem", "count" ]
outs = [ "M", "X_regular", "X_except", "res" ]
flags = [ "fragile", "uses_memory" ]
attrs = [
......
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