X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbespill.h;h=84f0457f3b0b072b5a6ed7d618e8f1c011694259;hb=d07cec1341e61a5321ec44d93455bbbac312be75;hp=e53ff0ac1bff5d1d7ccce1523f9d7a24e4b5f3f8;hpb=ae515d01cd46334273438ce4019847f4ba05ab3d;p=libfirm diff --git a/ir/be/bespill.h b/ir/be/bespill.h index e53ff0ac1..84f0457f3 100644 --- a/ir/be/bespill.h +++ b/ir/be/bespill.h @@ -19,7 +19,8 @@ /** * @file - * @brief Main spill driver. + * @brief higher level abstraction for the creation of spill and reload + * instructions and rematerialisation of values. * @author Daniel Grund, Sebastian Hack, Matthias Braun * @date 29.09.2005 * @version $Id$ @@ -56,22 +57,25 @@ void be_delete_spill_env(spill_env_t *senv); * @param to_spill The node which is about to be spilled * @param before The node before the reload should be added * @param reload_cls The register class the reloaded value will be put into - * @param allow_remat Set to 1 if the node may be rematerialized instead of reloaded + * @param allow_remat Set to 1 if the node may be rematerialized instead of + * reloaded */ void be_add_reload(spill_env_t *senv, ir_node *to_spill, ir_node *before, - const arch_register_class_t *reload_cls, int allow_remat); + const arch_register_class_t *reload_cls, int allow_remat); /** * Analog to be_add_reload, but places the reload "on an edge" between 2 blocks * @see be_add_reload */ -void be_add_reload_on_edge(spill_env_t *senv, ir_node *to_spill, ir_node *bl, int pos, - const arch_register_class_t *reload_cls, int allow_remat); +void be_add_reload_on_edge(spill_env_t *senv, ir_node *to_spill, ir_node *bl, + int pos, const arch_register_class_t *reload_cls, + int allow_remat); /** * Analog to be_add_reload but adds an already created rematerialized node. */ -void be_add_remat(spill_env_t *env, ir_node *to_spill, ir_node *before, ir_node *rematted_node); +void be_add_remat(spill_env_t *env, ir_node *to_spill, ir_node *before, + ir_node *rematted_node); /** * The main function that places real spills/reloads (or rematerializes values) @@ -89,18 +93,28 @@ void be_insert_spills_reloads(spill_env_t *senv); */ void be_spill_phi(spill_env_t *env, ir_node *node); +/** + * Returns the estimated costs if a node would ge spilled. This does only return + * the costs for the spill instructions, not the costs for needed reload + * instructions. The value is weighted by the estimated execution frequency of + * the spill. + */ +double be_get_spill_costs(spill_env_t *env, ir_node *to_spill, ir_node *after); + /** * Returns the estimated costs if a node would get reloaded at a specific place - * This usually returns the cost of spill + reload operation. But might return - * smaller values if the value has already been spilled in a former run or - * when it is possible to rematerialize the value. + * This returns the costs for a reload instructions, or when possible the costs + * for a rematerialisation. The value is weighted by the estimated execution + * frequency of the reload/rematerialisation. */ -int be_get_reload_costs(spill_env_t *env, ir_node *to_spill, ir_node *before); +double be_get_reload_costs(spill_env_t *env, ir_node *to_spill, + ir_node *before); /** * Analog to be_get_reload_costs but returns the cost if the reload would be * placed "on an edge" between 2 blocks */ -int be_get_reload_costs_on_edge(spill_env_t *env, ir_node *to_spill, ir_node *block, int pos); +double be_get_reload_costs_on_edge(spill_env_t *env, ir_node *to_spill, + ir_node *block, int pos); -#endif /* FIRM_BE_BESPILL_H */ +#endif