*/
#include "config.h"
-#ifdef HAVE_STRING_H
-# include <string.h>
-#endif
-# ifdef HAVE_STDLIB_H
+#include <string.h>
#include <stdlib.h>
-#endif
#include "callgraph.h"
#include "irgwalk.h"
static ir_visited_t master_cg_visited = 0;
-static INLINE int cg_irg_visited (ir_graph *n);
-static INLINE void mark_cg_irg_visited(ir_graph *n);
-static INLINE void set_cg_irg_visited (ir_graph *n, ir_visited_t i);
+static inline int cg_irg_visited (ir_graph *n);
+static inline void mark_cg_irg_visited(ir_graph *n);
+static inline void set_cg_irg_visited (ir_graph *n, ir_visited_t i);
/** Returns the callgraph state of the program representation. */
irp_callgraph_state get_irp_callgraph_state(void) {
/**
* allocates a new scc_info on the obstack
*/
-static INLINE scc_info *new_scc_info(struct obstack *obst) {
+static inline scc_info *new_scc_info(struct obstack *obst) {
scc_info *info = obstack_alloc(obst, sizeof(*info));
memset(info, 0, sizeof(*info));
return info;
/**
* Returns non-zero if a graph was already visited.
*/
-static INLINE int cg_irg_visited(ir_graph *irg) {
+static inline int cg_irg_visited(ir_graph *irg) {
return irg->self_visited >= master_cg_visited;
}
/**
* Marks a graph as visited.
*/
-static INLINE void mark_cg_irg_visited(ir_graph *irg) {
+static inline void mark_cg_irg_visited(ir_graph *irg) {
irg->self_visited = master_cg_visited;
}
/**
* Set a graphs visited flag to i.
*/
-static INLINE void set_cg_irg_visited(ir_graph *irg, ir_visited_t i) {
+static inline void set_cg_irg_visited(ir_graph *irg, ir_visited_t i) {
irg->self_visited = i;
}
/**
* Returns the visited flag of a graph.
*/
-static INLINE ir_visited_t get_cg_irg_visited(ir_graph *irg) {
+static inline ir_visited_t get_cg_irg_visited(ir_graph *irg) {
return irg->self_visited;
}
-static INLINE void mark_irg_in_stack(ir_graph *irg) {
+static inline void mark_irg_in_stack(ir_graph *irg) {
scc_info *info = get_irg_link(irg);
assert(info && "missing call to init_scc()");
info->in_stack = 1;
}
-static INLINE void mark_irg_not_in_stack(ir_graph *irg) {
+static inline void mark_irg_not_in_stack(ir_graph *irg) {
scc_info *info = get_irg_link(irg);
assert(info && "missing call to init_scc()");
info->in_stack = 0;
}
-static INLINE int irg_is_in_stack(ir_graph *irg) {
+static inline int irg_is_in_stack(ir_graph *irg) {
scc_info *info = get_irg_link(irg);
assert(info && "missing call to init_scc()");
return info->in_stack;
}
-static INLINE void set_irg_uplink(ir_graph *irg, int uplink) {
+static inline void set_irg_uplink(ir_graph *irg, int uplink) {
scc_info *info = get_irg_link(irg);
assert(info && "missing call to init_scc()");
info->uplink = uplink;
}
-static INLINE int get_irg_uplink(ir_graph *irg) {
+static inline int get_irg_uplink(ir_graph *irg) {
scc_info *info = get_irg_link(irg);
assert(info && "missing call to init_scc()");
return info->uplink;
}
-static INLINE void set_irg_dfn(ir_graph *irg, int dfn) {
+static inline void set_irg_dfn(ir_graph *irg, int dfn) {
scc_info *info = get_irg_link(irg);
assert(info && "missing call to init_scc()");
info->dfn = dfn;
}
-static INLINE int get_irg_dfn(ir_graph *irg) {
+static inline int get_irg_dfn(ir_graph *irg) {
scc_info *info = get_irg_link(irg);
assert(info && "missing call to init_scc()");
return info->dfn;
/**
* Initialize the irg stack.
*/
-static INLINE void init_stack(void) {
+static inline void init_stack(void) {
if (stack) {
ARR_RESIZE(ir_graph *, stack, 1000);
} else {
* push a graph on the irg stack
* @param n the graph to be pushed
*/
-static INLINE void push(ir_graph *irg) {
+static inline void push(ir_graph *irg) {
if (tos == ARR_LEN(stack)) {
int nlen = ARR_LEN(stack) * 2;
ARR_RESIZE(ir_node *, stack, nlen);
/**
* return the topmost graph on the stack and pop it
*/
-static INLINE ir_graph *pop(void) {
+static inline ir_graph *pop(void) {
ir_graph *irg = stack[--tos];
mark_irg_not_in_stack(irg);
return irg;
* The nodes up to irg belong to the current loop.
* Removes them from the stack and adds them to the current loop.
*/
-static INLINE void pop_scc_to_loop(ir_graph *irg) {
+static inline void pop_scc_to_loop(ir_graph *irg) {
ir_graph *m;
do {
* Removes and unmarks all nodes up to n from the stack.
* The nodes must be visited once more to assign them to a scc.
*/
-static INLINE void pop_scc_unmark_visit(ir_graph *n) {
+static inline void pop_scc_unmark_visit(ir_graph *n) {
ir_graph *m = NULL;
while (m != n) {
/** This marks the backedge, but does it guarantee a correct loop tree? */
//if (m == n) { set_irg_callee_backedge(n, i); continue; }
- cgscc (m);
+ cgscc(m);
if (irg_is_in_stack(m)) {
/* Uplink of m is smaller if n->m is a backedge.
Propagate the uplink to mark the cfloop. */
/* Compute the backedges that represent recursions. */
void find_callgraph_recursions(void) {
- int i, n_irgs = get_irp_n_irgs();
+ int i, n_irgs;
struct obstack temp;
reset_isbe();
++master_cg_visited;
cgscc(outermost_ir_graph);
+ n_irgs = get_irp_n_irgs();
for (i = 0; i < n_irgs; ++i) {
ir_graph *irg = get_irp_irg(i);
if (!cg_irg_visited(irg) && get_irg_n_callers(irg) == 0)