* @date 29.09.2005
* @version $Id$
*/
-#ifdef HAVE_CONFIG_H
#include "config.h"
-#endif
#include <stdlib.h>
#include <stdbool.h>
/* build a new PhiM */
arity = get_irn_arity(phi);
- ins = alloca(sizeof(ir_node*) * arity);
+ ins = ALLOCAN(ir_node*, arity);
unknown = new_r_Unknown(irg, mode_M);
for(i = 0; i < arity; ++i) {
ins[i] = unknown;
if(arg == get_irg_frame(env->irg))
return 1;
+#if 0
/* hack for now (happens when command should be inserted at end of block) */
- if(is_Block(reloader)) {
+ if(is_Block(reloader))
return 0;
- }
+#else
+ (void)reloader;
+#endif
/*
* Ignore registers are always available
*/
- if (arch_irn_is(arg, ignore)) {
- return 1;
- }
-
- /* the following test does not work while spilling,
- * because the liveness info is not adapted yet to the effects of the
- * additional spills/reloads.
- */
-#if 0
- /* we want to remat before the insn reloader
- * thus an arguments is alive if
- * - it interferes with the reloaders result
- * - or it is (last-) used by reloader itself
- */
- if (values_interfere(env->birg->lv, reloader, arg)) {
+ if (arch_irn_is_ignore(arg))
return 1;
- }
-
- arity = get_irn_arity(reloader);
- for (i = 0; i < arity; ++i) {
- ir_node *rel_arg = get_irn_n(reloader, i);
- if (rel_arg == arg)
- return 1;
- }
-#endif
return 0;
}
if(parentcosts + costs >= env->reload_cost + env->spill_cost) {
return REMAT_COST_INFINITE;
}
+ /* never rematerialize a node which modifies the flags.
+ * (would be better to test wether the flags are actually live at point
+ * reloader...)
+ */
if (arch_irn_is(spilled, modify_flags)) {
return REMAT_COST_INFINITE;
}
bl = get_nodes_block(reloader);
}
- ins = alloca(get_irn_arity(spilled) * sizeof(ins[0]));
+ ins = ALLOCAN(ir_node*, get_irn_arity(spilled));
for(i = 0, arity = get_irn_arity(spilled); i < arity; ++i) {
ir_node *arg = get_irn_n(spilled, i);
spill_t *s;
double spills_execfreq;
- /* calculate sum of executaion frequencies of individual spills */
+ /* calculate sum of execution frequencies of individual spills */
spills_execfreq = 0;
s = spillinfo->spills;
for( ; s != NULL; s = s->next) {
void be_insert_spills_reloads(spill_env_t *env)
{
- const arch_env_t *arch_env = env->arch_env;
const ir_exec_freq *exec_freq = env->exec_freq;
spill_info_t *si;
ir_nodeset_iterator_t iter;
/* create a reload, use the first spill for now SSA
* reconstruction for memory comes below */
assert(si->spills != NULL);
- copy = be_reload(arch_env, si->reload_cls, rld->reloader, mode,
+ copy = be_reload(si->reload_cls, rld->reloader, mode,
si->spills->spill);
#ifdef FIRM_STATISTICS
env->reload_count++;