X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fia32%2Fbearch_ia32.c;h=714c49566a543979cdb64810d13849d00d057579;hb=004f9b10d631414720ea9c4a86d3f89b742a027e;hp=8f0594cb38aa3d1f5afb735db683f2849f3a2630;hpb=b334cdb542bb13dac5b787f196b7316c0ea3e630;p=libfirm diff --git a/ir/be/ia32/bearch_ia32.c b/ir/be/ia32/bearch_ia32.c index 8f0594cb3..714c49566 100644 --- a/ir/be/ia32/bearch_ia32.c +++ b/ir/be/ia32/bearch_ia32.c @@ -456,6 +456,54 @@ static ir_type *ia32_abi_get_between_type(void *self) return env->flags.try_omit_fp ? omit_fp_between_type : between_type; } +/** + * Get the estimated cycle count for @p irn. + * + * @param self The this pointer. + * @param irn The node. + * + * @return The estimated cycle count for this operation + */ +static int ia32_get_op_estimated_cost(const void *self, const ir_node *irn) +{ + int cost; + switch (get_ia32_irn_opcode(irn)) { + case iro_ia32_xDiv: + case iro_ia32_DivMod: + cost = 8; + break; + + case iro_ia32_xLoad: + case iro_ia32_l_Load: + case iro_ia32_Load: + case iro_ia32_Push: + case iro_ia32_Pop: + cost = 10; + break; + + case iro_ia32_xStore: + case iro_ia32_l_Store: + case iro_ia32_Store: + case iro_ia32_Store8Bit: + cost = 50; + break; + + case iro_ia32_MulS: + case iro_ia32_Mul: + case iro_ia32_Mulh: + case iro_ia32_xMul: + case iro_ia32_l_MulS: + case iro_ia32_l_Mul: + cost = 2; + break; + + default: + cost = 1; + } + + return cost; +} + /** * Returns the inverse operation if @p irn, recalculating the argument at position @p i. * @@ -572,6 +620,7 @@ static arch_inverse_t *ia32_get_inverse(const void *self, const ir_node *irn, in return NULL; } + set_ia32_res_mode(inverse->nodes[0], mode); inverse->nodes[1] = new_r_Proj(irg, block, inverse->nodes[0], mode, pnc); return inverse; @@ -596,7 +645,8 @@ static const arch_irn_ops_if_t ia32_irn_ops_if = { ia32_get_flags, ia32_get_frame_entity, ia32_set_stack_bias, - ia32_get_inverse + ia32_get_inverse, + ia32_get_op_estimated_cost }; ia32_irn_ops_t ia32_irn_ops = {