ia32: Use a more logical specification of operand sizes in the binary emitter.
[libfirm] / ir / be / besched.c
index c436884..197371c 100644 (file)
  * @file
  * @brief       Scheduling utilities for nodes in Blocks and Blocks.
  * @author      Sebastian Hack
- * @version     $Id$
  */
 #include "config.h"
 
 #include <stdlib.h>
 
-#include "irprintf.h"
-#include "irgwalk.h"
 #include "firm_types.h"
-#include "irgraph_t.h"
 #include "iredges_t.h"
 #include "ircons.h"
-#include "irextbb.h"
 #include "irgmod.h"
 #include "debug.h"
 
@@ -52,7 +47,6 @@
 
 static void sched_renumber(const ir_node *block)
 {
-       ir_node *irn;
        sched_info_t *inf;
        sched_timestep_t step = SCHED_INITIAL_GRANULARITY;
 
@@ -149,7 +143,23 @@ void sched_remove(ir_node *irn)
        info->prev      = NULL;
 }
 
+void sched_replace(ir_node *const old, ir_node *const irn)
+{
+       assert(sched_is_scheduled(old));
+       assert(!sched_is_scheduled(irn));
+
+       sched_info_t *const old_info = get_irn_sched_info(old);
+       sched_info_t *const irn_info = get_irn_sched_info(irn);
+       *irn_info = *old_info;
 
+       old_info->prev = NULL;
+       old_info->next = NULL;
+
+       ir_node *const prev = irn_info->prev;
+       ir_node *const next = irn_info->next;
+       get_irn_sched_info(prev)->next = irn;
+       get_irn_sched_info(next)->prev = irn;
+}
 
 static be_module_list_entry_t *schedulers;
 static schedule_func           scheduler;
@@ -158,7 +168,7 @@ void be_register_scheduler(const char *name, schedule_func func)
 {
        if (scheduler == NULL)
                scheduler = func;
-       be_add_module_to_list(&schedulers, name, func);
+       be_add_module_to_list(&schedulers, name, (void*)func);
 }
 
 void be_schedule_graph(ir_graph *irg)