Commit 2f10d963 authored by Christian Würdig's avatar Christian Würdig
Browse files

create register slots in attributes on irg obstack

fixed some bugs
parent ea93457f
......@@ -775,6 +775,7 @@ static void *ia32_init(void) {
ia32_register_init(isa);
ia32_create_opcodes();
ia32_register_copy_attr_func();
isa->regs_16bit = pmap_create();
isa->regs_8bit = pmap_create();
......
......@@ -33,7 +33,6 @@
#include "ia32_nodes_attr.h"
#include "ia32_new_nodes.h"
#include "gen_ia32_regalloc_if.h"
#include "gen_ia32_new_nodes.h"
#ifdef obstack_chunk_alloc
# undef obstack_chunk_alloc
......@@ -1060,7 +1059,8 @@ void alloc_ia32_reg_slots(ir_node *node, int num) {
ia32_attr_t *attr = get_ia32_attr(node);
if (num) {
attr->slots = xcalloc(num, sizeof(attr->slots[0]));
attr->slots = NEW_ARR_D(arch_register_t *, get_irg_obstack(get_irn_irg(node)), num);
memset(attr->slots, 0, sizeof(attr->slots[0]) * num);
}
else {
attr->slots = NULL;
......@@ -1117,6 +1117,9 @@ static void ia32_copy_attr(const ir_node *old_node, ir_node *new_node) {
memcpy((void *)attr_new->slots, (void *)attr_old->slots, sizeof(attr_new->slots[0]) * n_res);
}
/**
* Registers the ia32_copy_attr function for all ia32 opcodes.
*/
void ia32_register_copy_attr_func(void) {
unsigned i, f = get_ia32_opcode_first(), l = get_ia32_opcode_last();
......
......@@ -371,6 +371,11 @@ void alloc_ia32_reg_slots(ir_node *node, int num);
void init_ia32_attributes(ir_node *node, arch_irn_flags_t flags, const ia32_register_req_t **in_reqs, \
const ia32_register_req_t **out_reqs, int n_res);
/**
* Registers the ia32_copy_attr function for all ia32 opcodes.
*/
void ia32_register_copy_attr_func(void);
/* Include the generated headers */
#include "gen_ia32_new_nodes.h"
......
......@@ -1463,6 +1463,7 @@ static ir_node *gen_Conv(ia32_transform_env_t *env, ir_node *op) {
ir_graph *irg = env->irg;
ir_mode *src_mode = get_irn_mode(op);
ir_mode *tgt_mode = env->mode;
int src_bits = get_mode_size_bits(src_mode);
int tgt_bits = get_mode_size_bits(tgt_mode);
ir_node *block = env->block;
ir_node *new_op = NULL;
......@@ -1495,7 +1496,7 @@ static ir_node *gen_Conv(ia32_transform_env_t *env, ir_node *op) {
proj = new_rd_Proj(dbg, irg, block, new_op, mode_Is, 0);
if (tgt_bits == 8) {
if (tgt_bits == 8 || src_bits == 8) {
new_op = new_rd_ia32_Conv_I2I8Bit(dbg, irg, block, noreg, noreg, proj, nomem, mode_T);
}
else {
......@@ -1519,7 +1520,7 @@ static ir_node *gen_Conv(ia32_transform_env_t *env, ir_node *op) {
}
else {
DB((mod, LEVEL_1, "create Conv(int, int) ...", src_mode, tgt_mode));
if (tgt_bits == 8) {
if (tgt_bits == 8 || src_bits == 8) {
new_op = new_rd_ia32_Conv_I2I8Bit(dbg, irg, block, noreg, noreg, op, nomem, mode_T);
}
else {
......
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