Commit 5d8baec2 authored by Matthias Braun's avatar Matthias Braun
Browse files

ia32: Use x86_imm32_t for address mode immediate values

parent 0cf067f0
......@@ -151,20 +151,22 @@ static void ia32_dump_node(FILE *F, const ir_node *n, dump_reason_t reason)
} else {
const ia32_attr_t *attr = get_ia32_attr_const(n);
if (attr->am_ent != NULL || attr->am_offs != 0) {
int32_t offset = attr->am_imm.offset;
ir_entity *entity = attr->am_imm.entity;
if (entity != NULL || offset != 0) {
fputs(" [", F);
if (attr->am_ent != NULL) {
fputs(get_entity_name(attr->am_ent), F);
if (entity != NULL) {
fputs(get_entity_name(entity), F);
if (attr->am_sc_no_pic_adjust) {
fputs("(no_pic_adjust)", F);
}
}
if (attr->am_offs != 0) {
if (attr->am_offs > 0 && attr->am_ent != NULL) {
if (offset != 0) {
if (offset > 0 && entity != NULL) {
fputc('+', F);
}
fprintf(F, "%d", attr->am_offs);
fprintf(F, "%d", offset);
}
fputc(']', F);
......@@ -466,7 +468,7 @@ void set_ia32_am_support(ir_node *node, ia32_am_type_t arity)
int32_t get_ia32_am_offs_int(const ir_node *node)
{
const ia32_attr_t *attr = get_ia32_attr_const(node);
return attr->am_offs;
return attr->am_imm.offset;
}
/**
......@@ -475,25 +477,25 @@ int32_t get_ia32_am_offs_int(const ir_node *node)
void set_ia32_am_offs_int(ir_node *node, int32_t offset)
{
ia32_attr_t *attr = get_ia32_attr(node);
attr->am_offs = offset;
attr->am_imm.offset = offset;
}
void add_ia32_am_offs_int(ir_node *node, int32_t offset)
{
ia32_attr_t *attr = get_ia32_attr(node);
attr->am_offs += offset;
attr->am_imm.offset += offset;
}
ir_entity *get_ia32_am_ent(const ir_node *node)
{
const ia32_attr_t *attr = get_ia32_attr_const(node);
return attr->am_ent;
return attr->am_imm.entity;
}
void set_ia32_am_ent(ir_node *node, ir_entity *entity)
{
ia32_attr_t *attr = get_ia32_attr(node);
attr->am_ent = entity;
attr->am_imm.entity = entity;
}
void set_ia32_am_tls_segment(ir_node *node, bool value)
......@@ -856,8 +858,7 @@ static int ia32_attrs_equal_(const ia32_attr_t *a, const ia32_attr_t *b)
return a->tp == b->tp
&& a->am_scale == b->am_scale
&& a->am_offs == b->am_offs
&& a->am_ent == b->am_ent
&& x86_imm32_equal(&a->am_imm, &b->am_imm)
&& a->am_sc_no_pic_adjust == b->am_sc_no_pic_adjust
&& a->ls_mode == b->ls_mode
&& a->frame_use == b->frame_use
......
......@@ -109,8 +109,7 @@ struct ia32_attr_t {
unsigned is_spill:1;
unsigned is_remat:1;
int32_t am_offs; /**< offsets for AddrMode */
ir_entity *am_ent; /**< entity for AddrMode */
x86_imm32_t am_imm; /**< imm32 for address mode */
ir_mode *ls_mode; /**< Load/Store mode: This is the mode of the
value that is manipulated by this node. */
......
......@@ -290,19 +290,19 @@ static void peephole_ia32_Test(ir_node *node)
ir_graph *const irg = get_irn_irg(node);
if ((offset & 0xFFFFFF80) == 0) {
/* attr->am_offs += 0; */
/* attr->am_imm.offset += 0; */
} else if ((offset & 0xFFFF80FF) == 0) {
ir_node *const imm_node = ia32_create_Immediate(irg, offset >> 8);
set_irn_n(node, n_ia32_Test_right, imm_node);
attr->am_offs += 1;
attr->am_imm.offset += 1;
} else if ((offset & 0xFF80FFFF) == 0) {
ir_node *const imm_node = ia32_create_Immediate(irg, offset >> 16);
set_irn_n(node, n_ia32_Test_right, imm_node);
attr->am_offs += 2;
attr->am_imm.offset += 2;
} else if ((offset & 0x00FFFFFF) == 0) {
ir_node *const imm_node = ia32_create_Immediate(irg, offset >> 24);
set_irn_n(node, n_ia32_Test_right, imm_node);
attr->am_offs += 3;
attr->am_imm.offset += 3;
} else {
return;
}
......@@ -803,7 +803,7 @@ static void peephole_ia32_Lea(ir_node *node)
}
ir_graph *const irg = get_irn_irg(node);
ia32_attr_t const *const attr = get_ia32_attr_const(node);
op2 = ia32_create_Immediate_full(irg, attr->am_ent, attr->am_sc_no_pic_adjust, attr->am_offs);
op2 = ia32_create_Immediate_full(irg, attr->am_imm.entity, attr->am_sc_no_pic_adjust, attr->am_imm.offset);
} else if (has_disp) {
return; /* Lea has base, index and displacement. */
}
......
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