Commit f019f92a authored by Christoph Mallon's avatar Christoph Mallon
Browse files

bearch: Remove arch_get_inverse() and associated code.

parent 686e5485
......@@ -85,7 +85,6 @@ static const arch_irn_ops_t TEMPLATE_irn_ops = {
TEMPLATE_get_frame_entity,
TEMPLATE_set_frame_offset,
TEMPLATE_get_sp_bias,
NULL, /* get_inverse */
NULL, /* get_op_estimated_cost */
NULL, /* possible_memory_operand */
NULL, /* perform_memory_operand */
......
......@@ -111,7 +111,6 @@ static const arch_irn_ops_t amd64_irn_ops = {
amd64_get_frame_entity,
amd64_set_frame_offset,
amd64_get_sp_bias,
NULL, /* get_inverse */
NULL, /* get_op_estimated_cost */
NULL, /* possible_memory_operand */
NULL, /* perform_memory_operand */
......
......@@ -114,7 +114,6 @@ static const arch_irn_ops_t arm_irn_ops = {
arm_get_frame_entity,
arm_set_stack_bias,
arm_get_sp_bias,
NULL, /* get_inverse */
NULL, /* get_op_estimated_cost */
NULL, /* possible_memory_operand */
NULL, /* perform_memory_operand */
......
......@@ -33,7 +33,6 @@ typedef struct arch_register_class_t arch_register_class_t;
typedef struct arch_register_req_t arch_register_req_t;
typedef struct arch_register_t arch_register_t;
typedef struct arch_flag_t arch_flag_t;
typedef struct arch_inverse_t arch_inverse_t;
typedef struct arch_isa_if_t arch_isa_if_t;
typedef struct arch_env_t arch_env_t;
......
......@@ -93,17 +93,6 @@ int arch_get_sp_bias(ir_node *irn)
return ops->get_sp_bias(irn);
}
arch_inverse_t *arch_get_inverse(const ir_node *irn, int i, arch_inverse_t *inverse, struct obstack *obstack)
{
const arch_irn_ops_t *ops = get_irn_ops(irn);
if (ops->get_inverse) {
return ops->get_inverse(irn, i, inverse, obstack);
} else {
return NULL;
}
}
int arch_possible_memory_operand(const ir_node *irn, unsigned int i)
{
const arch_irn_ops_t *ops = get_irn_ops(irn);
......
......@@ -113,9 +113,6 @@ ir_entity *arch_get_frame_entity(const ir_node *irn);
int arch_get_sp_bias(ir_node *irn);
int arch_get_op_estimated_cost(const ir_node *irn);
arch_inverse_t *arch_get_inverse(const ir_node *irn, int i,
arch_inverse_t *inverse,
struct obstack *obstack);
int arch_possible_memory_operand(const ir_node *irn,
unsigned int i);
void arch_perform_memory_operand(ir_node *irn, ir_node *spill,
......@@ -320,18 +317,6 @@ static inline bool reg_reqs_equal(const arch_register_req_t *req1,
return true;
}
/**
* An inverse operation returned by the backend
*/
struct arch_inverse_t {
int n; /**< count of nodes returned in nodes array */
int costs; /**< costs of this remat */
/** nodes for this inverse operation. shall be in schedule order.
* last element is the target value */
ir_node **nodes;
};
struct arch_irn_ops_t {
/**
......@@ -362,22 +347,6 @@ struct arch_irn_ops_t {
*/
int (*get_sp_bias)(const ir_node *irn);
/**
* Returns an inverse operation which yields the i-th argument
* of the given node as result.
*
* @param irn The original operation
* @param i Index of the argument we want the inverse operation to
* yield
* @param inverse struct to be filled with the resulting inverse op
* @param obstack The obstack to use for allocation of the returned nodes
* array
* @return The inverse operation or NULL if operation invertible
*/
arch_inverse_t *(*get_inverse)(const ir_node *irn, int i,
arch_inverse_t *inverse,
struct obstack *obstack);
/**
* Get the estimated cycle count for @p irn.
*
......
......@@ -969,7 +969,6 @@ static const arch_irn_ops_t be_node_irn_ops = {
be_node_get_frame_entity,
be_node_set_frame_offset,
be_node_get_sp_bias,
NULL, /* get_inverse */
NULL, /* get_op_estimated_cost */
NULL, /* possible_memory_operand */
NULL, /* perform_memory_operand */
......@@ -1055,7 +1054,6 @@ static const arch_irn_ops_t dummy_be_irn_ops = {
dummy_get_frame_entity,
dummy_set_frame_offset,
dummy_get_sp_bias,
NULL, /* get_inverse */
NULL, /* get_op_estimated_cost */
NULL, /* possible_memory_operand */
NULL, /* perform_memory_operand */
......@@ -1130,7 +1128,6 @@ static const arch_irn_ops_t phi_irn_ops = {
dummy_get_frame_entity,
dummy_set_frame_offset,
dummy_get_sp_bias,
NULL, /* get_inverse */
NULL, /* get_op_estimated_cost */
NULL, /* possible_memory_operand */
NULL, /* perform_memory_operand */
......
......@@ -349,133 +349,6 @@ static int ia32_get_op_estimated_cost(const ir_node *irn)
return cost;
}
/**
* Returns the inverse operation if @p irn, recalculating the argument at position @p i.
*
* @param irn The original operation
* @param i Index of the argument we want the inverse operation to yield
* @param inverse struct to be filled with the resulting inverse op
* @param obstack The obstack to use for allocation of the returned nodes array
* @return The inverse operation or NULL if operation invertible
*/
static arch_inverse_t *ia32_get_inverse(const ir_node *irn, int i, arch_inverse_t *inverse, struct obstack *obst)
{
(void) irn;
(void) i;
(void) inverse;
(void) obst;
return NULL;
#if 0
ir_mode *mode;
ir_mode *irn_mode;
ir_node *block, *noreg, *nomem;
dbg_info *dbgi;
/* we cannot invert non-ia32 irns */
if (! is_ia32_irn(irn))
return NULL;
/* operand must always be a real operand (not base, index or mem) */
if (i != n_ia32_binary_left && i != n_ia32_binary_right)
return NULL;
/* we don't invert address mode operations */
if (get_ia32_op_type(irn) != ia32_Normal)
return NULL;
/* TODO: adjust for new immediates... */
ir_fprintf(stderr, "TODO: fix get_inverse for new immediates (%+F)\n",
irn);
return NULL;
block = get_nodes_block(irn);
mode = get_irn_mode(irn);
irn_mode = get_irn_mode(irn);
noreg = get_irn_n(irn, 0);
nomem = get_irg_no_mem(irg);
dbgi = get_irn_dbg_info(irn);
/* initialize structure */
inverse->nodes = obstack_alloc(obst, 2 * sizeof(inverse->nodes[0]));
inverse->costs = 0;
inverse->n = 1;
switch (get_ia32_irn_opcode(irn)) {
case iro_ia32_Add:
if (get_ia32_immop_type(irn) == ia32_ImmConst) {
/* we have an add with a const here */
/* invers == add with negated const */
inverse->nodes[0] = new_bd_ia32_Add(dbgi, block, noreg, noreg, nomem, get_irn_n(irn, i), noreg);
inverse->costs += 1;
copy_ia32_Immop_attr(inverse->nodes[0], (ir_node *)irn);
set_ia32_Immop_tarval(inverse->nodes[0], tarval_neg(get_ia32_Immop_tarval(irn)));
set_ia32_commutative(inverse->nodes[0]);
}
else if (get_ia32_immop_type(irn) == ia32_ImmSymConst) {
/* we have an add with a symconst here */
/* invers == sub with const */
inverse->nodes[0] = new_bd_ia32_Sub(dbgi, block, noreg, noreg, nomem, get_irn_n(irn, i), noreg);
inverse->costs += 2;
copy_ia32_Immop_attr(inverse->nodes[0], (ir_node *)irn);
}
else {
/* normal add: inverse == sub */
inverse->nodes[0] = new_bd_ia32_Sub(dbgi, block, noreg, noreg, nomem, (ir_node*) irn, get_irn_n(irn, i ^ 1));
inverse->costs += 2;
}
break;
case iro_ia32_Sub:
if (get_ia32_immop_type(irn) != ia32_ImmNone) {
/* we have a sub with a const/symconst here */
/* invers == add with this const */
inverse->nodes[0] = new_bd_ia32_Add(dbgi, block, noreg, noreg, nomem, get_irn_n(irn, i), noreg);
inverse->costs += (get_ia32_immop_type(irn) == ia32_ImmSymConst) ? 5 : 1;
copy_ia32_Immop_attr(inverse->nodes[0], (ir_node *)irn);
}
else {
/* normal sub */
if (i == n_ia32_binary_left) {
inverse->nodes[0] = new_bd_ia32_Add(dbgi, block, noreg, noreg, nomem, (ir_node*) irn, get_irn_n(irn, 3));
}
else {
inverse->nodes[0] = new_bd_ia32_Sub(dbgi, block, noreg, noreg, nomem, get_irn_n(irn, n_ia32_binary_left), (ir_node*) irn);
}
inverse->costs += 1;
}
break;
case iro_ia32_Xor:
if (get_ia32_immop_type(irn) != ia32_ImmNone) {
/* xor with const: inverse = xor */
inverse->nodes[0] = new_bd_ia32_Xor(dbgi, block, noreg, noreg, nomem, get_irn_n(irn, i), noreg);
inverse->costs += (get_ia32_immop_type(irn) == ia32_ImmSymConst) ? 5 : 1;
copy_ia32_Immop_attr(inverse->nodes[0], (ir_node *)irn);
}
else {
/* normal xor */
inverse->nodes[0] = new_bd_ia32_Xor(dbgi, block, noreg, noreg, nomem, (ir_node *) irn, get_irn_n(irn, i));
inverse->costs += 1;
}
break;
case iro_ia32_Not: {
inverse->nodes[0] = new_bd_ia32_Not(dbgi, block, (ir_node*) irn);
inverse->costs += 1;
break;
}
case iro_ia32_Neg: {
inverse->nodes[0] = new_bd_ia32_Neg(dbgi, block, (ir_node*) irn);
inverse->costs += 1;
break;
}
default:
/* inverse operation not supported */
return NULL;
}
return inverse;
#endif
}
static ir_mode *get_spill_mode_mode(const ir_mode *mode)
{
if (mode_is_float(mode))
......@@ -608,7 +481,6 @@ static const arch_irn_ops_t ia32_irn_ops = {
ia32_get_frame_entity,
ia32_set_frame_offset,
ia32_get_sp_bias,
ia32_get_inverse,
ia32_get_op_estimated_cost,
ia32_possible_memory_operand,
ia32_perform_memory_operand,
......
......@@ -125,7 +125,6 @@ const arch_irn_ops_t sparc_irn_ops = {
sparc_get_frame_entity,
sparc_set_frame_offset,
sparc_get_sp_bias,
NULL, /* get_inverse */
NULL, /* get_op_estimated_cost */
NULL, /* possible_memory_operand */
NULL, /* perform_memory_operand */
......
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