-/* Returns the number of nodes in the loop */
-int get_loop_n_nodes (ir_loop *loop) {
- assert(loop); assert(loop->kind == k_ir_loop);
- return loop -> n_nodes;
-/* return ARR_LEN(loop->nodes); */
-}
-
-/* Returns the pos`th ir_node-child *
- * TODO: This method isn`t very efficient ! *
- * Returns NULL if there isn`t a pos`th ir_node */
-ir_node *get_loop_node (ir_loop *loop, int pos) {
- int child_nr, node_nr = -1;
-
- assert(loop && loop->kind == k_ir_loop);
- assert(pos < get_loop_n_nodes(loop));
-
- for (child_nr = 0; child_nr < ARR_LEN(loop->children); child_nr++) {
- if(*(loop -> children[child_nr].kind) == k_ir_node)
- node_nr++;
- if(node_nr == pos)
- return(loop -> children[child_nr].node);
- }
- DDML(loop);
- printf("pos: %d\n", pos);
- assert(0 && "no child at pos found");
- return NULL;
-}
-
-/* Use EXCLUSIVELY this function to add nodes, otherwise the loop->n_nodes
- is invalid! */
-
-void
-add_loop_node(ir_loop *loop, ir_node *n) {
- loop_element ln;
- ln.node = n;
- assert(loop && loop->kind == k_ir_loop);
- assert(get_kind(n) == k_ir_node || get_kind(n) == k_ir_graph); /* used in callgraph.c */
- ARR_APP1 (loop_element, loop->children, ln);
- loop->n_nodes++;
-}
-
-/* Returns the number of elements contained in loop. */
-int get_loop_n_elements (const ir_loop *loop) {
- assert(loop && loop->kind == k_ir_loop);
- return(ARR_LEN(loop->children));
-}
-
-/*
- Returns the pos`th loop element.
- This may be a loop_node or a ir_node. The caller of this function has
- to check the *(loop_element.kind) field for "k_ir_node" or "k_ir_loop"
- and then select the appropriate "loop_element.node" or "loop_element.son".
-*/
-
-loop_element get_loop_element(const ir_loop *loop, int pos) {
- assert(loop && loop->kind == k_ir_loop && pos < ARR_LEN(loop->children));
- return(loop -> children[pos]);
-}
-
-int get_loop_element_pos(const ir_loop *loop, void *le) {
- int i, n;
- assert(loop && loop->kind == k_ir_loop);
-
- n = get_loop_n_elements(loop);
- for (i = 0; i < n; i++)
- if (get_loop_element(loop, i).node == le) return i;
- return -1;
-}
-
-int get_loop_loop_nr(const ir_loop *loop) {
- assert(loop && loop->kind == k_ir_loop);
-#ifdef DEBUG_libfirm
- return loop->loop_nr;
-#else
- return (int)loop;
-#endif
-}
-
-
-/** A field to connect additional information to a loop. Only valid
- if libfirm_debug is set. */
-void set_loop_link (ir_loop *loop, void *link) {
- assert(loop && loop->kind == k_ir_loop);
-#ifdef DEBUG_libfirm
- loop->link = link;
-#endif
-}
-void *get_loop_link (const ir_loop *loop) {
- assert(loop && loop->kind == k_ir_loop);
-#ifdef DEBUG_libfirm
- return loop->link;
-#else
- return NULL;
-#endif
-}
-
-int (is_ir_loop)(const void *thing) {
- return _is_ir_loop(thing);
-}
-
-/* The outermost loop is remarked in the surrounding graph. */
-void (set_irg_loop)(ir_graph *irg, ir_loop *loop) {
- _set_irg_loop(irg, loop);
-}
-
-/* Returns the root loop info (if exists) for an irg. */
-ir_loop *(get_irg_loop)(ir_graph *irg) {
- return _get_irg_loop(irg);
-}
-
-