PIPS
same_names.c
Go to the documentation of this file.
1 /*
2 
3  $Id: same_names.c 23065 2016-03-02 09:05:50Z coelho $
4 
5  Copyright 1989-2016 MINES ParisTech
6 
7  This file is part of PIPS.
8 
9  PIPS is free software: you can redistribute it and/or modify it
10  under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  any later version.
13 
14  PIPS is distributed in the hope that it will be useful, but WITHOUT ANY
15  WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  FITNESS FOR A PARTICULAR PURPOSE.
17 
18  See the GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with PIPS. If not, see <http://www.gnu.org/licenses/>.
22 
23 */
24 #ifdef HAVE_CONFIG_H
25  #include "pips_config.h"
26 #endif
27  /*
28  * Comparison functions based on perttyprinted strings
29  */
30 
31 #include <stdio.h>
32 #include <string.h>
33 #include <ctype.h>
34 
35 #include "linear.h"
36 #include "genC.h"
37 #include "misc.h"
38 #include "ri.h"
39 
40 #include "text.h"
41 
42 #include "ri-util.h"
43 
44 
45 /****************************************************** SAME EXPRESSION NAME */
46 
47 /* compare two entities for their appearance point of view.
48  * used for putting common in includes.
49  */
50 
52 
54 {
55  if (gen_length(l1)!=gen_length(l2))
56  return false;
57  /* else */
58  for(; l1 && l2; POP(l1), POP(l2))
60  return false;
61  return true;
62 }
63 
65 {
67 }
68 
70 {
73 }
74 
76 {
79 }
80 
82 {
86 }
87 
89 {
94  return false;
95 }
96 
98 {
101 }
102 
103 bool same_cast_name_p(cast cs1, cast cs2)
104 {
105  return same_type_name_p(cast_type(cs1), cast_type(cs2)) &&
107 }
108 
110 {
113 }
114 
116 {
117  if (gen_length(l1)!=gen_length(l2))
118  return false;
119 
120  for(; l1 && l2; POP(l1), POP(l2)) {
124  return false;
125  }
126  return true;
127 }
128 
129 
131 {
132  if (syntax_tag(s1)!=syntax_tag(s2))
133  return false;
134  /* else */
135  switch (syntax_tag(s1))
136  {
137  case is_syntax_call:
139  case is_syntax_reference:
141  case is_syntax_range:
145  case is_syntax_subscript:
147  case is_syntax_cast:
151  case is_syntax_va_arg:
153  default:
154  pips_internal_error("unexpected syntax tag: %d", syntax_tag(s1));
155  }
156  return false;
157 }
158 
160 {
162 }
#define POP(l)
Modify a list pointer to point on the next element of the list.
Definition: newgen_list.h:59
size_t gen_length(const list l)
Definition: list.c:150
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
#define pips_internal_error
Definition: misc-local.h:149
#define same_string_p(s1, s2)
bool same_type_name_p(const type, const type)
For naming homogeneity: expression_to_string(), reference_to_string()...
Definition: type.c:74
const char * entity_local_name(entity e)
entity_local_name modified so that it does not core when used in vect_fprint, since someone thought t...
Definition: entity.c:453
#define syntax_reference(x)
Definition: ri.h:2730
#define syntax_tag(x)
Definition: ri.h:2727
#define call_function(x)
Definition: ri.h:709
#define reference_variable(x)
Definition: ri.h:2326
#define SIZEOFEXPRESSION(x)
SIZEOFEXPRESSION.
Definition: ri.h:2364
#define sizeofexpression_type(x)
Definition: ri.h:2406
#define range_upper(x)
Definition: ri.h:2290
#define sizeofexpression_expression(x)
Definition: ri.h:2409
#define syntax_cast(x)
Definition: ri.h:2739
#define syntax_application(x)
Definition: ri.h:2748
#define syntax_va_arg(x)
Definition: ri.h:2751
#define syntax_range(x)
Definition: ri.h:2733
@ is_syntax_range
Definition: ri.h:2692
@ is_syntax_application
Definition: ri.h:2697
@ is_syntax_cast
Definition: ri.h:2694
@ is_syntax_call
Definition: ri.h:2693
@ is_syntax_va_arg
Definition: ri.h:2698
@ is_syntax_reference
Definition: ri.h:2691
@ is_syntax_sizeofexpression
Definition: ri.h:2695
@ is_syntax_subscript
Definition: ri.h:2696
#define range_increment(x)
Definition: ri.h:2292
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
#define cast_expression(x)
Definition: ri.h:747
#define application_arguments(x)
Definition: ri.h:510
#define subscript_indices(x)
Definition: ri.h:2563
#define reference_indices(x)
Definition: ri.h:2328
#define syntax_sizeofexpression(x)
Definition: ri.h:2742
#define sizeofexpression_expression_p(x)
Definition: ri.h:2407
#define sizeofexpression_type_p(x)
Definition: ri.h:2404
#define syntax_call(x)
Definition: ri.h:2736
#define cast_type(x)
Definition: ri.h:745
#define subscript_array(x)
Definition: ri.h:2561
#define application_function(x)
Definition: ri.h:508
#define range_lower(x)
Definition: ri.h:2288
#define syntax_subscript(x)
Definition: ri.h:2745
#define call_arguments(x)
Definition: ri.h:711
#define expression_syntax(x)
Definition: ri.h:1247
bool same_expression_name_p(expression, expression)
compare two entities for their appearance point of view.
Definition: same_names.c:159
bool same_sizeofexpression_name_p(sizeofexpression s0, sizeofexpression s1)
Definition: same_names.c:88
bool same_lexpr_name_p(list l1, list l2)
same_names.c
Definition: same_names.c:53
bool same_call_name_p(call c1, call c2)
Definition: same_names.c:69
bool same_entity_lname_p(entity e1, entity e2)
Definition: same_names.c:64
bool same_ref_name_p(reference r1, reference r2)
Definition: same_names.c:75
bool same_subscript_name_p(subscript ss1, subscript ss2)
Definition: same_names.c:97
bool same_application_name_p(application a1, application a2)
Definition: same_names.c:109
bool same_va_arg_name_p(list l1, list l2)
Definition: same_names.c:115
bool same_cast_name_p(cast cs1, cast cs2)
Definition: same_names.c:103
bool same_range_name_p(range r1, range r2)
Definition: same_names.c:81
bool same_syntax_name_p(syntax s1, syntax s2)
Definition: same_names.c:130
s1
Definition: set.c:247
The structure used to build lists in NewGen.
Definition: newgen_list.h:41