Commit 03d5195e authored by Christoph Mallon's avatar Christoph Mallon
Browse files

ia32: Use arch_get_irn_register() instead of arch_get_irn_register_in() where...

ia32: Use arch_get_irn_register() instead of arch_get_irn_register_in() where the operand is already available.
parent 35937fa4
...@@ -387,14 +387,14 @@ static void ia32_emit_am(ir_node const *const node) ...@@ -387,14 +387,14 @@ static void ia32_emit_am(ir_node const *const node)
/* emit base */ /* emit base */
if (has_base) { if (has_base) {
const arch_register_t *reg = arch_get_irn_register_in(node, n_ia32_base); arch_register_t const *const reg = arch_get_irn_register(base);
emit_register(reg, NULL); emit_register(reg, NULL);
} }
/* emit index + scale */ /* emit index + scale */
if (has_index) { if (has_index) {
const arch_register_t *reg = arch_get_irn_register_in(node, n_ia32_index);
be_emit_char(','); be_emit_char(',');
arch_register_t const *const reg = arch_get_irn_register(idx);
emit_register(reg, NULL); emit_register(reg, NULL);
int scale = get_ia32_am_scale(node); int scale = get_ia32_am_scale(node);
...@@ -501,10 +501,10 @@ emit_AM: ...@@ -501,10 +501,10 @@ emit_AM:
break; break;
} }
case 'B': case 'B': {
imm = get_irn_n(node, n_ia32_binary_right); ir_node const *const src = get_irn_n(node, n_ia32_binary_right);
if (is_ia32_Immediate(imm)) { if (is_ia32_Immediate(src)) {
emit_ia32_Immediate(imm); emit_ia32_Immediate(src);
be_emit_cstring(", "); be_emit_cstring(", ");
if (get_ia32_op_type(node) == ia32_Normal) { if (get_ia32_op_type(node) == ia32_Normal) {
goto destination_operand; goto destination_operand;
...@@ -513,7 +513,7 @@ emit_AM: ...@@ -513,7 +513,7 @@ emit_AM:
} }
} else { } else {
if (get_ia32_op_type(node) == ia32_Normal) { if (get_ia32_op_type(node) == ia32_Normal) {
reg = arch_get_irn_register_in(node, n_ia32_binary_right); reg = arch_get_irn_register(src);
emit_register(reg, get_ia32_ls_mode(node)); emit_register(reg, get_ia32_ls_mode(node));
} else { } else {
ia32_emit_am(node); ia32_emit_am(node);
...@@ -524,6 +524,7 @@ destination_operand: ...@@ -524,6 +524,7 @@ destination_operand:
emit_register(reg, get_ia32_ls_mode(node)); emit_register(reg, get_ia32_ls_mode(node));
} }
break; break;
}
case 'D': case 'D':
if (*fmt < '0' || '9' < *fmt) if (*fmt < '0' || '9' < *fmt)
...@@ -641,11 +642,12 @@ emit_S: ...@@ -641,11 +642,12 @@ emit_S:
goto unknown; goto unknown;
unsigned pos = *fmt++ - '0'; unsigned pos = *fmt++ - '0';
imm = get_irn_n(node, pos); ir_node const *const src = get_irn_n(node, pos);
if (is_ia32_Immediate(imm)) { if (is_ia32_Immediate(src)) {
imm = src;
goto emit_I; goto emit_I;
} else { } else {
reg = arch_get_irn_register_in(node, pos); reg = arch_get_irn_register(src);
goto emit_R; goto emit_R;
} }
} }
...@@ -1031,7 +1033,7 @@ static const char* emit_asm_operand(const ir_node *node, const char *s) ...@@ -1031,7 +1033,7 @@ static const char* emit_asm_operand(const ir_node *node, const char *s)
emit_ia32_Immediate(pred); emit_ia32_Immediate(pred);
return s; return s;
} }
reg = arch_get_irn_register_in(node, asm_reg->inout_pos); reg = arch_get_irn_register(pred);
} }
if (reg == NULL) { if (reg == NULL) {
ir_fprintf(stderr, ir_fprintf(stderr,
...@@ -2695,7 +2697,7 @@ static void bemit_push(const ir_node *node) ...@@ -2695,7 +2697,7 @@ static void bemit_push(const ir_node *node)
bemit8(0xFF); bemit8(0xFF);
bemit_mod_am(6, node); bemit_mod_am(6, node);
} else { } else {
const arch_register_t *reg = arch_get_irn_register_in(node, n_ia32_Push_val); arch_register_t const *const reg = arch_get_irn_register(value);
bemit8(0x50 + reg->encoding); bemit8(0x50 + reg->encoding);
} }
} }
......
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