Fixed small copy & paste error in the "foreach" defines and added additional defines...
[libfirm] / ir / be / besched.h
index 564a1c0..2ad3e46 100644 (file)
@@ -3,10 +3,35 @@
 #define _BESCHED_H
 
 #include <stdio.h>
+#include "irgraph.h"
+#include "irnode.h"
 
-#include "besched_t.h"
-
-void be_sched_init(void);
 void be_sched_dump(FILE *f, const ir_graph *irg);
 
+int (sched_get_time_step)(const ir_node *irn);
+int (sched_has_next)(const ir_node *irn);
+int (sched_has_prev)(const ir_node *irn);
+ir_node *(sched_next)(const ir_node *irn);
+ir_node *(sched_prev)(const ir_node *irn);
+ir_node *(sched_first)(const ir_node *block);
+ir_node *(sched_last)(const ir_node *block);
+ir_node *(sched_add_before)(ir_node *before, ir_node *irn);
+ir_node *(sched_add_after)(ir_node *before, ir_node *irn);
+
+/**
+ * A shorthand macro for iterating over a schedule.
+ * @param block The block.
+ * @param irn A ir node pointer used as an iterator.
+ */
+#define sched_foreach(block,irn) \
+       for(irn = sched_first(block); !is_Block(irn); irn = sched_next(irn))
+
+/**
+ * A shorthand macro for reversely iterating over a schedule.
+ * @param block The block.
+ * @param irn A ir node pointer used as an iterator.
+ */
+#define sched_foreach_reverse(block,irn) \
+       for(irn = sched_last(block); !is_Block(irn); irn = sched_prev(irn))
+
 #endif