-static void pto_node_post (ir_node *node, void *env)
-{
- const opcode op = get_irn_opcode (node);
-
-
- if (iro_Call == op) {
- ir_node *call = node;
- entity *ent = NULL;
- type *ent_tp = NULL;
- ir_graph *graph = NULL;
- ir_node *ptr = get_Call_ptr (call);
-
- if (verbose) {
- fprintf (stdout, "POST MEM Call Node (%ld)\n",
- get_irn_node_nr (call));
- }
-
- if (iro_Sel == get_irn_opcode (ptr)) {
- ent = get_Sel_entity (ptr);
- } else if (iro_SymConst == get_irn_opcode (ptr)) {
- if (get_SymConst_kind(ptr) == symconst_addr_ent) {
- ent = get_SymConst_entity (ptr);
- }
- }
-
- assert (NULL != ent && "No ent to call");
-
- /* Todo: Iterate over all graphs in 'get_implementing_graphs' */
- graph = get_entity_irg (ent);
- if (NULL != graph) {
- const char *ent_name = (char*) get_entity_name (ent);
- const char *own_name = (char*) get_type_name (get_entity_owner (ent));
-
- if (! get_irg_is_mem_visited (graph)) {
- if (verbose) {
- fprintf (stdout, " -> visit graph (0x%08x) of \"%s.%s\"\n",
- (int) graph,
- own_name,
- ent_name);
- }
-
- if (TRUE) {
- ent_tp = get_entity_type (ent);
- const long n_args =
- get_method_n_params (ent_tp);
- ir_node **args = find_irg_args (graph);
- int i;
-
- const int n_call_args = get_irn_arity (call);
-
- assert (n_call_args == n_call_args);
-
- /* Set args for graph */
-
- for (i = 0; i < n_args; i ++) {
- if (NULL != args [i]) {
- if (mode_P == get_irn_mode (args [i])) {
- pto_t *arg_pto = compute_pto (get_irn_n (call, i+1), env);
- /* off-by-one because of ProjT bd */
- set_pto (args [i], arg_pto);
- } else {
- /* set_pto (args [i], NULL); */
- /* nothing */
- }
- }
- }
- free (args);
- }
-
- irg_walk_mem (graph, NULL, pto_node_post, NULL);
-
- /* maybe get result from called graph */
- if (0 != get_method_n_ress (ent_tp)) {
- type *ent_ret_tp = get_method_res_type (ent_tp, 0);
-
- if (mode_P == get_type_mode (ent_ret_tp)) {
- pto_t *res_pto = get_pto (get_irg_end (graph));
- set_pto (call, res_pto);
- }
- } else {
- fprintf (stdout, "%s:%i: no return value for \"%s.%s\"\n",
- __FUNCTION__, __LINE__,
- get_type_name (get_entity_owner (ent)),
- get_entity_name (ent));
- }
- }
- } else {
- if (verbose) {
- fprintf (stdout, "%s:%i: Warning: no graph for ent \"%s.%s\"\n",
- __FUNCTION__, __LINE__,
- get_type_name (get_entity_owner (ent)),
- get_entity_name (ent));
- }
- }
- } else {
- /* anyway: */
- pto_node (node, env);
- }
-}