#ifndef FIRM_BE_BESCHED_H
#define FIRM_BE_BESCHED_H
-#include <stdio.h>
#include <stdbool.h>
-#include "irgraph.h"
-#include "irnode.h"
-#include "beirg.h"
#include "beinfo.h"
-#include "beutil.h"
static sched_info_t *get_irn_sched_info(const ir_node *node)
{
return is_Block(node);
}
-/**
- * Check, if an ir_node has a scheduling successor.
- * @param irn The ir node.
- * @return 1, if the node has a scheduling successor, 0 if not.
- */
-static inline bool sched_has_next(const ir_node *irn)
-{
- const sched_info_t *info = get_irn_sched_info(irn);
- const ir_node *block = is_Block(irn) ? irn : get_nodes_block(irn);
- return info->next != block;
-}
-
-/**
- * Check, if an ir_node has a scheduling predecessor.
- * @param irn The ir node.
- * @return 1, if the node has a scheduling predecessor, 0 if not.
- */
-static inline bool sched_has_prev(const ir_node *irn)
-{
- const sched_info_t *info = get_irn_sched_info(irn);
- const ir_node *block = is_Block(irn) ? irn : get_nodes_block(irn);
- return info->prev != block;
-}
-
/**
* Get the scheduling successor of a node.
* @param irn The node.
/**
* Add a node to a block schedule.
- * @param block The block to whose schedule the node shall be added to.
* @param irn The node to add.
* @return The given node.
*/
/**
* Add a node to a block schedule.
- * @param block The block to whose schedule the node shall be added to.
* @param irn The node to add.
* @return The given node.
*/
*/
void sched_remove(ir_node *irn);
+/**
+ * Remove @p old from the schedule and put @p irn in its place.
+ */
+void sched_replace(ir_node *old, ir_node *irn);
+
/**
* Checks, if one node is scheduled before another.
* @param n1 A node.
*/
static inline bool sched_comes_after(const ir_node *n1, const ir_node *n2)
{
- assert(sched_is_scheduled(n1));
- assert(sched_is_scheduled(n2));
assert((is_Block(n1) ? n1 : get_nodes_block(n1)) == (is_Block(n2) ? n2 : get_nodes_block(n2)));
return sched_get_time_step(n1) < sched_get_time_step(n2);
}