Finalise initialisation
[libfirm] / ir / ana2 / pto_util.c
1 /* -*- c -*- */
2
3 /*
4    Project:     libFIRM
5    File name:   ir/ana/pto_util.c
6    Purpose:     Utilitites for PTO
7    Author:      Florian
8    Modified by:
9    Created:     Sat Nov 13 19:35:27 CET 2004
10    CVS-ID:      $Id$
11    Copyright:   (c) 1999-2004 Universität Karlsruhe
12    Licence:     This file is protected by the GPL -  GNU GENERAL PUBLIC LICENSE.
13 */
14
15 # ifdef HAVE_CONFIG_H
16 #  include <config.h>
17 # endif
18
19 /*
20  pto_util: Utilitites for PTO
21 */
22
23 # include "pto_util.h"
24
25 # include "irnode.h"
26 # include "xmalloc.h"
27
28 # include "pto_debug.h"
29
30 /* Local Defines: */
31
32 /* Local Data Types: */
33
34 /* Local Variables: */
35
36 /* Local Prototypes: */
37
38 /* ===================================================
39    Local Implementation:
40    =================================================== */
41
42
43 /* ===================================================
44    Exported Implementation:
45    =================================================== */
46 /* Get the entity of a ptr */
47 entity *get_ptr_ent (ir_node *ptr)
48 {
49   entity *ent = NULL;
50   const opcode ptr_op = get_irn_opcode (ptr);
51   switch (ptr_op) {
52   case (iro_Sel): {
53     ent = get_Sel_entity (ptr);
54   } break;
55
56   case (iro_SymConst): {
57     ent = get_SymConst_entity (ptr);
58   } break;
59
60   default: {
61     fprintf (stderr, "%s: no ent for ptr=%s[%ld]\n",
62              __FUNCTION__,
63              get_op_name (get_irn_op (ptr)),
64              get_irn_node_nr (ptr));
65     assert (0);
66   }
67   }
68
69   return (ent);
70 }
71
72
73
74 \f
75 /*
76   $Log$
77   Revision 1.6  2004/11/18 16:37:07  liekweg
78   rewrite
79
80
81 */