Commit 1cb93250 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

ia32: Add and use helper function set_frame_addr().

parent a2f0f545
...@@ -255,6 +255,15 @@ static bool eat_shl(ia32_address_t *addr, ir_node *node) ...@@ -255,6 +255,15 @@ static bool eat_shl(ia32_address_t *addr, ir_node *node)
return true; return true;
} }
static void set_frame_addr(ia32_address_t *const addr, ir_node *const frame)
{
assert(!addr->base);
assert(!addr->frame_entity);
addr->base = be_get_FrameAddr_frame(frame);
addr->frame_entity = be_get_FrameAddr_entity(frame);
addr->use_frame = 1;
}
void ia32_create_address_mode(ia32_address_t *addr, ir_node *node, void ia32_create_address_mode(ia32_address_t *addr, ir_node *node,
ia32_create_am_flags_t flags) ia32_create_am_flags_t flags)
{ {
...@@ -306,11 +315,7 @@ void ia32_create_address_mode(ia32_address_t *addr, ir_node *node, ...@@ -306,11 +315,7 @@ void ia32_create_address_mode(ia32_address_t *addr, ir_node *node,
eat_immediate(addr, node, 0); eat_immediate(addr, node, 0);
return; return;
} else if (be_is_FrameAddr(node)) { } else if (be_is_FrameAddr(node)) {
assert(addr->base == NULL); set_frame_addr(addr, node);
assert(addr->frame_entity == NULL);
addr->base = be_get_FrameAddr_frame(node);
addr->use_frame = 1;
addr->frame_entity = be_get_FrameAddr_entity(node);
return; return;
} else if (is_Add(node)) { } else if (is_Add(node)) {
ir_node *left = get_Add_left(node); ir_node *left = get_Add_left(node);
...@@ -331,20 +336,12 @@ void ia32_create_address_mode(ia32_address_t *addr, ir_node *node, ...@@ -331,20 +336,12 @@ void ia32_create_address_mode(ia32_address_t *addr, ir_node *node,
} }
if (left != NULL && be_is_FrameAddr(left) if (left != NULL && be_is_FrameAddr(left)
&& !ia32_is_non_address_mode_node(left)) { && !ia32_is_non_address_mode_node(left)) {
assert(addr->base == NULL); set_frame_addr(addr, left);
assert(addr->frame_entity == NULL); left = NULL;
addr->base = be_get_FrameAddr_frame(left);
addr->use_frame = 1;
addr->frame_entity = be_get_FrameAddr_entity(left);
left = NULL;
} else if (right != NULL && be_is_FrameAddr(right) } else if (right != NULL && be_is_FrameAddr(right)
&& !ia32_is_non_address_mode_node(right)) { && !ia32_is_non_address_mode_node(right)) {
assert(addr->base == NULL); set_frame_addr(addr, right);
assert(addr->frame_entity == NULL); right = NULL;
addr->base = be_get_FrameAddr_frame(right);
addr->use_frame = 1;
addr->frame_entity = be_get_FrameAddr_entity(right);
right = NULL;
} }
if (left != NULL) { if (left != NULL) {
......
Supports Markdown
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