typos fixed
[libfirm] / ir / ana2 / pto_ctx.c
1 /* -*- c -*- */
2
3 /*
4    Project:     libFIRM
5    File name:   ir/ana/pto_ctx.c
6    Purpose:     ...
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_ctx: ...
21 */
22
23 # include "pto_ctx.h"
24 # include "pto_debug.h"
25 # include "pto_comp.h"
26 # include "ecg.h"
27
28 # include "irnode.h"
29 /* # include "xmalloc.h" */
30
31 /* Local Defines: */
32
33 /* Local Data Types: */
34
35 /* Local Variables: */
36 static ctx_info_t *curr_ctx = NULL;
37
38 /* Local Prototypes: */
39
40 /* ===================================================
41    Local Implementation:
42    =================================================== */
43
44
45 /* ===================================================
46    Exported Implementation:
47    =================================================== */
48 /* Find the appropriate ctx for the given call and the given graph */
49 /* ctx_info_t *find_ctx (ir_node *call, graph_info_t *ginfo, ctx_info_t *curr_ctx) */
50 int find_ctx_idx (ir_node *call, graph_info_t *ginfo, ctx_info_t *curr_ctx)
51 {
52   int i;
53   const int n_ctxs = ginfo->n_ctxs;
54
55   for (i = 0; i < n_ctxs; i ++) {
56     ctx_info_t *ctx = ginfo->ctxs [i];
57
58     if ((ctx->enc == curr_ctx) && (ctx->call == call)) {
59       return (i);
60     }
61   }
62
63   fflush (stdout);
64   assert (0 && "CTX not found");
65
66   return (-1);
67 }
68
69 /* Get the current ctx */
70 ctx_info_t *get_curr_ctx (void)
71 {
72   return (curr_ctx);
73 }
74
75 /* Set the current ctx to the given ctx.  Return the old value */
76 ctx_info_t *set_curr_ctx (ctx_info_t *ctx)
77 {
78   ctx_info_t *old_ctx = curr_ctx;
79
80   curr_ctx = ctx;
81
82   return (old_ctx);
83 }
84
85 \f
86 /*
87   $Log$
88   Revision 1.4  2004/12/02 16:17:51  beck
89   fixed config.h include
90
91   Revision 1.3  2004/11/24 14:53:55  liekweg
92   Bugfixes
93
94   Revision 1.2  2004/11/20 21:21:35  liekweg
95   Add pto_ctx_allocs
96
97   Revision 1.1  2004/11/18 16:37:34  liekweg
98   rewritten
99
100
101 */