Commit 4f10369b authored by Matthias Braun's avatar Matthias Braun
Browse files

cleanup x86 insn_mode

parent b025dd94
......@@ -36,13 +36,14 @@ static ir_node *get_cfop_target_block(const ir_node *irn)
return (ir_node*)get_irn_link(irn);
}
static char get_gp_mode_suffix(const amd64_insn_mode_t mode)
static char get_gp_mode_suffix(amd64_insn_mode_t const insn_mode)
{
switch (mode) {
switch (insn_mode) {
case INSN_MODE_8: return 'b';
case INSN_MODE_16: return 'w';
case INSN_MODE_32: return 'l';
case INSN_MODE_64: return 'q';
case INSN_MODE_80:
case INSN_MODE_128:
case INSN_MODE_INVALID:
break;
......@@ -50,28 +51,49 @@ static char get_gp_mode_suffix(const amd64_insn_mode_t mode)
panic("invalid insn mode");
}
static void amd64_emit_insn_mode_suffix(const amd64_insn_mode_t mode)
static void amd64_emit_insn_mode_suffix(amd64_insn_mode_t const insn_mode)
{
be_emit_char(get_gp_mode_suffix(mode));
be_emit_char(get_gp_mode_suffix(insn_mode));
}
static char get_xmm_mode_suffix(const amd64_insn_mode_t mode)
static char get_xmm_mode_suffix(amd64_insn_mode_t const insn_mode)
{
switch (mode) {
switch (insn_mode) {
case INSN_MODE_32: return 's';
case INSN_MODE_64: return 'd';
case INSN_MODE_128: return 'q';
case INSN_MODE_8:
case INSN_MODE_16:
case INSN_MODE_80:
case INSN_MODE_INVALID:
break;
}
panic("invalid insn mode");
}
static void amd64_emit_xmm_mode_suffix(const amd64_insn_mode_t mode)
static void amd64_emit_xmm_mode_suffix(amd64_insn_mode_t const insn_mode)
{
be_emit_char(get_xmm_mode_suffix(insn_mode));
}
static char get_x87_mode_suffix(amd64_insn_mode_t const insn_mode)
{
switch (insn_mode) {
case INSN_MODE_32: return 's';
case INSN_MODE_64: return 'l';
case INSN_MODE_80: return 't';
case INSN_MODE_8:
case INSN_MODE_16:
case INSN_MODE_128:
case INSN_MODE_INVALID:
break;
}
panic("Invalid insn mode");
}
static void amd64_emit_x87_mode_suffix(amd64_insn_mode_t const insn_mode)
{
be_emit_char(get_xmm_mode_suffix(mode));
be_emit_char(get_x87_mode_suffix(insn_mode));
}
static const char *get_register_name_8bit(const arch_register_t *reg)
......@@ -168,6 +190,7 @@ static const char *get_register_name_mode(const arch_register_t *reg,
case INSN_MODE_16: return get_register_name_16bit(reg);
case INSN_MODE_32: return get_register_name_32bit(reg);
case INSN_MODE_64:
case INSN_MODE_80:
case INSN_MODE_128: return reg->name;
case INSN_MODE_INVALID:
break;
......@@ -402,20 +425,6 @@ static void emit_shiftop(const ir_node *const node)
panic("invalid op_mode for shiftop");
}
static void amd64_emit_x87_mode_suffix(amd64_insn_mode_t const insn_mode)
{
switch (insn_mode) {
case INSN_MODE_32: be_emit_char('s'); return;
case INSN_MODE_64: be_emit_char('l'); return;
case INSN_MODE_128: be_emit_char('t'); return;
case INSN_MODE_8:
case INSN_MODE_16:
case INSN_MODE_INVALID:
break;
}
panic("Invalid insn mode");
}
void amd64_emitf(ir_node const *const node, char const *fmt, ...)
{
va_list ap;
......@@ -859,6 +868,7 @@ static void emit_amd64_mov_gp(const ir_node *node)
case INSN_MODE_16: amd64_emitf(node, "movzwq %AM, %^D0"); return;
case INSN_MODE_32: amd64_emitf(node, "movl %AM, %3D0"); return;
case INSN_MODE_64: amd64_emitf(node, "movq %AM, %^D0"); return;
case INSN_MODE_80:
case INSN_MODE_128:
case INSN_MODE_INVALID:
break;
......
......@@ -30,6 +30,7 @@ typedef enum {
INSN_MODE_16,
INSN_MODE_32,
INSN_MODE_64,
INSN_MODE_80,
INSN_MODE_128,
} amd64_insn_mode_t;
......
......@@ -330,7 +330,7 @@ static amd64_insn_mode_t get_insn_mode_from_mode(const ir_mode *mode)
case 16: return INSN_MODE_16;
case 32: return INSN_MODE_32;
case 64: return INSN_MODE_64;
case 80: return INSN_MODE_128; /* hack for mode_E */
case 80: return INSN_MODE_80;
case 128: return INSN_MODE_128;
}
panic("unexpected mode %+F", mode);
......@@ -2477,7 +2477,7 @@ ir_node *amd64_new_spill(ir_node *value, ir_node *after)
arch_register_req_t const **reqs;
if (mode_is_float(mode) || mode == amd64_mode_xmm) {
if (mode == x86_mode_E) {
insn_mode = INSN_MODE_128;
insn_mode = INSN_MODE_80;
cons = &new_bd_amd64_fst;
reqs = x87_reg_mem_reqs;
} else {
......@@ -2530,7 +2530,7 @@ ir_node *amd64_new_reload(ir_node *value, ir_node *spill, ir_node *before)
amd64_insn_mode_t insn_mode;
if (mode_is_float(mode) || mode == amd64_mode_xmm) {
if (mode == x86_mode_E) {
insn_mode = INSN_MODE_128;
insn_mode = INSN_MODE_80;
cons = &new_bd_amd64_fld;
pn_res = pn_amd64_fld_res;
} else {
......
......@@ -7,11 +7,12 @@
static unsigned get_bits_from_insn_mode(amd64_insn_mode_t const insn_mode)
{
switch (insn_mode) {
case INSN_MODE_8: return 8;
case INSN_MODE_8: return 8;
case INSN_MODE_16: return 16;
case INSN_MODE_32: return 32;
case INSN_MODE_64: return 64;
case INSN_MODE_128: return 128;
case INSN_MODE_80: return 80;
case INSN_MODE_128:
case INSN_MODE_INVALID:
break;
}
......
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