Commit 9b583efe authored by Christian Würdig's avatar Christian Würdig
Browse files

made unknown a joker register

parent 4cc60676
......@@ -128,13 +128,6 @@ static void ia32_dump_function_size(FILE *F, const char *name)
* |_| |_|
*************************************************************/
static INLINE int be_is_unknown_reg(const arch_register_t *reg) {
return \
REGS_ARE_EQUAL(reg, &ia32_gp_regs[REG_GP_UKNWN]) || \
REGS_ARE_EQUAL(reg, &ia32_xmm_regs[REG_XMM_UKNWN]) || \
REGS_ARE_EQUAL(reg, &ia32_vfp_regs[REG_VFP_UKNWN]);
}
/**
* returns true if a node has x87 registers
*/
......@@ -165,13 +158,29 @@ static const arch_register_t *get_in_reg(const ir_node *irn, int pos) {
assert(reg && "no in register found");
/* in case of unknown: just return a register */
if (REGS_ARE_EQUAL(reg, &ia32_gp_regs[REG_GP_UKNWN]))
reg = &ia32_gp_regs[REG_EAX];
else if (REGS_ARE_EQUAL(reg, &ia32_xmm_regs[REG_XMM_UKNWN]))
reg = &ia32_xmm_regs[REG_XMM0];
else if (REGS_ARE_EQUAL(reg, &ia32_vfp_regs[REG_VFP_UKNWN]))
reg = &ia32_vfp_regs[REG_VF0];
/* in case of a joker register: just return a valid register */
if (arch_register_type_is(reg, joker)) {
arch_register_req_t req;
const arch_register_req_t *p_req;
/* ask for the requirements */
p_req = arch_get_register_req(arch_env, &req, irn, pos);
if (arch_register_req_is(p_req, limited)) {
/* in case of limited requirements: get the first allowed register */
bitset_t *bs = bitset_alloca(arch_register_class_n_regs(p_req->cls));
int idx;
p_req->limited(p_req->limited_env, bs);
idx = bitset_next_set(bs, 0);
reg = arch_register_for_index(p_req->cls, idx);
}
else {
/* otherwise get first register in class */
reg = arch_register_for_index(p_req->cls, 0);
}
}
return reg;
}
......@@ -1734,7 +1743,7 @@ static void Copy_emitter(const ir_node *irn, ir_node *op, ia32_emit_env_t *emit_
char cmd_buf[SNPRINTF_BUF_LEN], cmnt_buf[SNPRINTF_BUF_LEN];
if (REGS_ARE_EQUAL(arch_get_irn_register(aenv, irn), arch_get_irn_register(aenv, op)) ||
be_is_unknown_reg(arch_get_irn_register(aenv, op)))
arch_register_type_is(arch_get_irn_register(aenv, op), joker))
return;
if (mode_is_float(get_irn_mode(irn)))
......
......@@ -133,8 +133,8 @@ $comment_string = "/*";
# { "name" => "r32", "type" => 1 },
{ "name" => "ebp", "type" => 2 },
{ "name" => "esp", "type" => 4 },
{ "name" => "gp_NOREG", "type" => 6 }, # we need a dummy register for NoReg nodes
{ "name" => "gp_UKNWN", "type" => 6 }, # we need a dummy register for Unknown nodes
{ "name" => "gp_NOREG", "type" => 2 | 4 }, # we need a dummy register for NoReg nodes
{ "name" => "gp_UKNWN", "type" => 2 | 4 | 8 }, # we need a dummy register for Unknown nodes
{ "mode" => "mode_P" }
],
"xmm" => [
......@@ -146,8 +146,8 @@ $comment_string = "/*";
{ "name" => "xmm5", "type" => 1 },
{ "name" => "xmm6", "type" => 1 },
{ "name" => "xmm7", "type" => 1 },
{ "name" => "xmm_NOREG", "type" => 6 }, # we need a dummy register for NoReg nodes
{ "name" => "xmm_UKNWN", "type" => 6 }, # we need a dummy register for Unknown nodes
{ "name" => "xmm_NOREG", "type" => 2 | 4 }, # we need a dummy register for NoReg nodes
{ "name" => "xmm_UKNWN", "type" => 2 | 4 | 8 }, # we need a dummy register for Unknown nodes
{ "mode" => "mode_D" }
],
"vfp" => [
......@@ -159,8 +159,8 @@ $comment_string = "/*";
{ "name" => "vf5", "type" => 1 },
{ "name" => "vf6", "type" => 1 },
{ "name" => "vf7", "type" => 1 },
{ "name" => "vfp_NOREG", "type" => 6 }, # we need a dummy register for NoReg nodes
{ "name" => "vfp_UKNWN", "type" => 6 }, # we need a dummy register for Unknown nodes
{ "name" => "vfp_NOREG", "type" => 2 | 4 }, # we need a dummy register for NoReg nodes
{ "name" => "vfp_UKNWN", "type" => 2 | 4 | 8 }, # we need a dummy register for Unknown nodes
{ "mode" => "mode_E" }
],
"st" => [
......
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