5 * File name: ir/external/pseudo_irg.c
6 * Purpose: implementation
7 * Author: G"otz Lindenmaier
8 * Modified by: Boris Boesler
11 * Copyright: (c) 1999-2004 Universität Karlsruhe
12 * Licence: This file is protected by GPL - GNU GENERAL PUBLIC LICENSE.
20 #include "pseudo_irg.h"
22 #include "irgraph_t.h"
27 /* Returns the number of pseudo graphs in the program. */
28 int get_irp_n_pseudo_irgs(void) {
29 assert (irp && irp->pseudo_graphs);
30 return ARR_LEN(irp->pseudo_graphs);
33 /* Returns the pos'th pseudo graph in the program. */
34 ir_graph *get_irp_pseudo_irg(int pos) {
35 assert(0 <= pos && pos <= get_irp_n_pseudo_irgs());
36 return irp->pseudo_graphs[pos];
39 void add_irp_pseudo_irg(ir_graph *irg) {
40 assert (irp && irp->pseudo_graphs);
41 ARR_APP1(ir_graph *, irp->pseudo_graphs, irg);
45 /* Create a new ir graph to build a pseudo representation of a procedure.
47 * The pseudo representation can only be used for analyses. It may not be
48 * optimized. Pseudo graphs are kept in a separate graph list in irprog.
51 new_pseudo_ir_graph(entity *ent, int n_loc) {
52 ir_graph *res = new_r_ir_graph (ent, n_loc);
53 add_irp_pseudo_irg(res); /* remember this graph global. */
57 /* Returns non-zero ir ir_graph is pseudo graph. */
58 int is_pseudo_ir_graph(ir_graph *irg)
62 assert(irg && "nothing here");
63 assert(is_ir_graph(irg) && "no ir_graph given");
65 n_pseudo_irgs = get_irp_n_pseudo_irgs();
66 for (i = 0; i < n_pseudo_irgs; ++i) {
67 if (irg == get_irp_pseudo_irg(i)) return 1;
72 static int visit_pseudo_irgs = 0;
74 void set_visit_pseudo_irgs(int x) {
75 visit_pseudo_irgs = x;
78 int get_visit_pseudo_irgs(void) {
79 return visit_pseudo_irgs;