5 * File name: ir/ana2/pto_init.c
6 * Purpose: Pto Initialization
9 * Created: Wed 3 Nov 2004
11 * Copyright: (c) 1999-2004 Universität Karlsruhe
12 * Licence: This file is protected by GPL - GNU GENERAL PUBLIC LICENSE.
21 # include "pto_util.h"
27 # define DBGPRINT(lvl, msg) if (get_pto_verbose () > lvl) { fprintf msg; }
29 static void pto_init_proj_load (ir_node *proj, ir_node *load)
31 assert ((mode_P == get_irn_mode (proj)) && "wrong proj(load)");
33 pto_t *pto = pto_new_empty (proj);
36 DBGPRINT (1, (stdout, "%s: pto (%s[%li]) = 0x%08x\n",
38 get_op_name (get_irn_op (proj)),
39 get_irn_node_nr (proj),
45 static void pto_init_call (ir_node *call)
47 /* check return value: */
48 ir_node *ptr = get_Call_ptr (call);
49 entity *ent = get_ptr_ent (ptr);
50 type *meth_tp = get_entity_type (ent);
52 if (0 == get_method_n_ress (meth_tp)) {
53 /* no return value at all */
57 type *ret_tp = get_method_res_type (meth_tp, 0);
59 if (mode_P != get_type_mode (ret_tp)) {
60 /* no pointer-valued return value */
64 pto_t *pto = pto_new_empty (call);
67 DBGPRINT (1, (stdout, "%s: pto (%s[%li]) = 0x%08x\n",
69 get_op_name (get_irn_op (call)),
70 get_irn_node_nr (call),
76 static void pto_init_raise (ir_node *raise)
78 /* assert (0 && "initialise raise?"); */
80 /* right now, do nothing and hope that a raise can always be
81 analysed on-the-fly. */
84 static void pto_init_proj (ir_node *proj)
86 ir_node *in = get_Proj_pred (proj);
87 const opcode in_op = get_irn_opcode (in);
91 ir_node *in_in = get_Proj_pred (in);
92 const opcode in_in_op = get_irn_opcode (in_in);
96 /* nothing (always initialised with actual values) */
100 /* nothing (must use call itself) */
104 fprintf (stderr, "%s: proj(proj(%s[%ld])) not handled\n",
106 get_op_name (get_irn_op (in_in)),
107 get_irn_node_nr (in_in));
110 } /* end switch(Proj.Proj.op) */
111 } break; /* iro_Proj */
114 /* ProjM (start) or ProjT (start) --- nothing */
118 /* ProjT (start) --- nothing */
122 if (mode_P == get_irn_mode (proj)) {
124 pto_init_proj_load (proj, in);
126 /* ProjM(load) --- nothing to do */
131 /* ProjM (store) --- nothing */
135 /* nothing to do --- can always be computed on-the-fly */
139 /* ProjX (raise) --- TODO */
147 fprintf (stderr, "%s: proj(%s[%ld]) not handled\n",
149 get_op_name (get_irn_op (in)),
150 get_irn_node_nr (in));
153 } /* end switch (Proj.op) */
157 void pto_init_node (ir_node *node)
159 const opcode op = get_irn_opcode (node);
161 DBGPRINT (1, (stdout, "%s (%s[%li])\n",
163 get_op_name (get_irn_op (node)),
164 get_irn_node_nr (node)));
168 /* nothing (not needed) */
172 /* nothing (not needed) */
176 /* nothing (not needed) */
180 /* nothing (can always be computed on-the-fly) */
184 /* Todo: Check how a Raise works */
185 pto_init_raise (node);
189 /* pretend we have a return value */
190 pto_init_call (node);
194 /* this actually does most of the work */
195 pto_init_proj (node);
199 /* nothing (can always be computed on-the-fly) */
202 case (iro_SymConst): {
203 /* nothing (can always be computed on-the-fly) */
207 /* nothing (can always be computed on-the-fly) */
211 /* nothing (this is only interesting for the end block, and that
212 can always be computed on-the-fly) */
216 /* nothing (This would need the predecessors to be initialized! Do this on-the-fly) */
219 /* now, enumerate everything else that is uninteresting */
225 /* nothing (not needed) */
229 fprintf (stderr, "%s: %s[%ld] not handled\n",
231 get_op_name (get_irn_op (node)),
232 get_irn_node_nr (node));
243 * Revision 1.2 2004/11/08 12:33:06 liekweg
244 * initialisation; sanitize print levels, misc fixes
246 * Revision 1.1 2004/11/04 14:58:59 liekweg
247 * added initialisation