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

amd64: Consistently use X86_IMM_FRAMEOFFSET

parent e3098fe3
......@@ -1441,11 +1441,15 @@ static ir_node *gen_Member(ir_node *const node)
if (is_parameter_entity(entity) &&
get_entity_parameter_number(entity) == IR_VA_START_PARAMETER_NUMBER)
panic("gen_Member: Request for invalid parameter (va_start parameter)");
amd64_addr_t addr;
memset(&addr, 0, sizeof(addr));
addr.base_input = 0;
addr.index_input = NO_INPUT;
addr.immediate.entity = entity;
amd64_addr_t addr = {
.immediate = {
.entity = entity,
.kind = X86_IMM_FRAMEOFFSET,
},
.base_input = 0,
.index_input = NO_INPUT,
};
ir_node *in[] = { base };
return new_bd_amd64_lea(dbgi, new_block, ARRAY_SIZE(in), in, reg_reqs, INSN_MODE_64, addr);
}
......
......@@ -288,10 +288,8 @@ static ir_node *make_mov_imm32_to_offset_mem(dbg_info *dbgi, ir_node *block, ir_
int32_t const offset = get_entity_offset(offset_ent);
amd64_binop_addr_attr_t mov_attr = {
.base = {
.base = {
.op_mode = AMD64_OP_ADDR_IMM,
},
.insn_mode = INSN_MODE_32,
.base.op_mode = AMD64_OP_ADDR_IMM,
.insn_mode = INSN_MODE_32,
.addr = {
.immediate = {
.offset = offset,
......@@ -322,15 +320,13 @@ static ir_node *make_mov_val64_to_offset_mem(dbg_info *dbgi, ir_node *block, ir_
int32_t const offset = get_entity_offset(offset_ent);
amd64_binop_addr_attr_t mov_attr = {
.base = {
.base = {
.op_mode = AMD64_OP_ADDR_REG,
},
.insn_mode = INSN_MODE_64,
.base.op_mode = AMD64_OP_ADDR_REG,
.insn_mode = INSN_MODE_64,
.addr = {
.immediate = {
.entity = entity,
.offset = offset,
.kind = X86_IMM_VALUE,
.kind = X86_IMM_FRAMEOFFSET,
},
.base_input = 1,
.mem_input = 2,
......@@ -354,15 +350,13 @@ static ir_node *make_mov_xmmval64_to_offset_mem(dbg_info *dbgi, ir_node *block,
int32_t const offset = get_entity_offset(offset_ent);
amd64_binop_addr_attr_t mov_attr = {
.base = {
.base = {
.op_mode = AMD64_OP_ADDR_REG,
},
.insn_mode = INSN_MODE_64,
.base.op_mode = AMD64_OP_ADDR_REG,
.insn_mode = INSN_MODE_64,
.addr = {
.immediate = {
.entity = entity,
.offset = offset,
.kind = X86_IMM_VALUE,
.kind = X86_IMM_FRAMEOFFSET,
},
.base_input = 1,
.mem_input = 2,
......
......@@ -51,17 +51,9 @@ static ir_entity *amd64_get_frame_entity(const ir_node *node)
if (!amd64_has_addr_attr(node))
return NULL;
const amd64_addr_attr_t *attr = get_amd64_addr_attr_const(node);
ir_entity *entity = attr->addr.immediate.entity;
if (entity == NULL)
if (attr->addr.immediate.kind != X86_IMM_FRAMEOFFSET)
return NULL;
ir_type *owner = get_entity_owner(entity);
if (is_frame_type(owner))
return entity;
ir_graph *irg = get_irn_irg(node);
be_stack_layout_t *layout = be_get_irg_stack_layout(irg);
if (owner == layout->arg_type)
return entity;
return NULL;
return attr->addr.immediate.entity;
}
static int get_insn_mode_bytes(amd64_insn_mode_t insn_mode)
......@@ -93,6 +85,7 @@ static void amd64_set_frame_offset(ir_node *node, int offset)
if (layout->sp_relative)
attr->addr.immediate.offset -= get_insn_mode_bytes(attr->insn_mode);
}
assert(attr->addr.immediate.kind == X86_IMM_FRAMEOFFSET);
attr->addr.immediate.kind = X86_IMM_VALUE;
attr->addr.immediate.entity = NULL;
}
......@@ -124,11 +117,14 @@ static ir_node *create_push(ir_node *node, ir_node *schedpoint, ir_node *sp,
ir_graph *irg = get_irn_irg(node);
ir_node *frame = get_irg_frame(irg);
amd64_addr_t addr;
memset(&addr, 0, sizeof(addr));
addr.base_input = 1;
addr.index_input = NO_INPUT;
addr.immediate.entity = ent;
amd64_addr_t addr = {
.immediate = {
.kind = X86_IMM_FRAMEOFFSET,
.entity = ent,
},
.base_input = 1,
.index_input = NO_INPUT,
};
ir_node *in[] = { sp, frame, mem };
ir_node *const push = new_bd_amd64_push_am(dbgi, block, ARRAY_SIZE(in), in, rsp_reg_mem_reqs, insn_mode, addr);
sched_add_before(schedpoint, push);
......@@ -143,11 +139,14 @@ static ir_node *create_pop(ir_node *node, ir_node *schedpoint, ir_node *sp,
ir_graph *irg = get_irn_irg(node);
ir_node *frame = get_irg_frame(irg);
amd64_addr_t addr;
memset(&addr, 0, sizeof(addr));
addr.base_input = 1;
addr.index_input = NO_INPUT;
addr.immediate.entity = ent;
amd64_addr_t addr = {
.immediate = {
.kind = X86_IMM_FRAMEOFFSET,
.entity = ent,
},
.base_input = 1,
.index_input = NO_INPUT,
};
ir_node *in[] = { sp, frame, get_irg_no_mem(irg) };
ir_node *const pop = new_bd_amd64_pop_am(dbgi, block, ARRAY_SIZE(in), in, rsp_reg_mem_reqs, insn_mode, addr);
......
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