PR opt/14472
[official-gcc.git] / libbanshee / engine / term-sort.h
blob21a5dc5cff11f9d199f5b28585b38000c8a3abb7
1 /*
2 * Copyright (c) 2000-2001
3 * The Regents of the University of California. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of the University nor the names of its contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
31 #ifndef TERM_SORT_H
32 #define TERM_SORT_H
34 #include <stdio.h>
35 #include "banshee.h"
36 #include "termhash.h"
37 #include "term-var.h"
39 EXTERN_C_BEGIN
41 extern bool flag_occurs_check;
42 extern region term_sort_region;
43 extern term_hash term_sort_hash;
45 struct gen_term /* extends gen_e */
47 #ifdef NONSPEC
48 const sort_kind sort;
49 #endif
50 const int type;
51 const stamp st;
54 typedef struct gen_term *gen_term;
56 /* return TRUE if v occurs in e, fals otherwise */
57 typedef bool (* occurs_check_fn_ptr) (term_var v, gen_e e);
59 stamp term_get_stamp(gen_e e);
61 gen_e term_fresh(const char *name);
62 gen_e term_fresh_large(const char *name);
63 gen_e term_fresh_small(const char *name);
64 gen_e term_zero(void);
65 gen_e term_one(void);
66 gen_e term_constant(const char *name);
68 bool term_is_zero(gen_e e);
69 bool term_is_one(gen_e e);
70 bool term_is_var(gen_e e);
71 bool term_is_constant(gen_e e);
73 char *term_get_constant_name(gen_e e);
74 gen_e term_get_ecr(gen_e e);
76 void term_unify(con_match_fn_ptr con_match, occurs_check_fn_ptr occurs,
77 gen_e e1, gen_e e2);
78 void term_cunify(con_match_fn_ptr con_match, occurs_check_fn_ptr occurs,
79 gen_e e1, gen_e e2);
81 void term_print_stats(FILE *f);
82 void term_print_constraint_graph(FILE *f);
84 void term_init(void);
85 void term_reset(void);
87 extern struct term_stats term_stats;
89 struct term_stats
91 int fresh;
92 int fresh_small;
93 int fresh_large;
96 EXTERN_C_END
98 #endif /* TERM_SORT_H */