comparison gcc/fold-const.h @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 /* Fold a constant sub-tree into a single node for C-compiler 1 /* Fold a constant sub-tree into a single node for C-compiler
2 Copyright (C) 1987-2018 Free Software Foundation, Inc. 2 Copyright (C) 1987-2020 Free Software Foundation, Inc.
3 3
4 This file is part of GCC. 4 This file is part of GCC.
5 5
6 GCC is free software; you can redistribute it and/or modify it under 6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free 7 the terms of the GNU General Public License as published by the Free
24 otherwise. */ 24 otherwise. */
25 extern int folding_initializer; 25 extern int folding_initializer;
26 26
27 /* Convert between trees and native memory representation. */ 27 /* Convert between trees and native memory representation. */
28 extern int native_encode_expr (const_tree, unsigned char *, int, int off = -1); 28 extern int native_encode_expr (const_tree, unsigned char *, int, int off = -1);
29 extern int native_encode_initializer (tree, unsigned char *, int,
30 int off = -1);
29 extern tree native_interpret_expr (tree, const unsigned char *, int); 31 extern tree native_interpret_expr (tree, const unsigned char *, int);
32 extern bool can_native_interpret_type_p (tree);
30 33
31 /* Fold constants as much as possible in an expression. 34 /* Fold constants as much as possible in an expression.
32 Returns the simplified expression. 35 Returns the simplified expression.
33 Acts only on the top level of the expression; 36 Acts only on the top level of the expression;
34 if the argument itself cannot be simplified, its 37 if the argument itself cannot be simplified, its
65 fold_build_call_array_loc (UNKNOWN_LOCATION, T1, T2, N, T4) 68 fold_build_call_array_loc (UNKNOWN_LOCATION, T1, T2, N, T4)
66 extern tree fold_build_call_array_loc (location_t, tree, tree, int, tree *); 69 extern tree fold_build_call_array_loc (location_t, tree, tree, int, tree *);
67 #define fold_build_call_array_initializer(T1,T2,N,T4)\ 70 #define fold_build_call_array_initializer(T1,T2,N,T4)\
68 fold_build_call_array_initializer_loc (UNKNOWN_LOCATION, T1, T2, N, T4) 71 fold_build_call_array_initializer_loc (UNKNOWN_LOCATION, T1, T2, N, T4)
69 extern tree fold_build_call_array_initializer_loc (location_t, tree, tree, int, tree *); 72 extern tree fold_build_call_array_initializer_loc (location_t, tree, tree, int, tree *);
70 extern tree get_array_ctor_element_at_index (tree, offset_int); 73 extern tree get_array_ctor_element_at_index (tree, offset_int,
74 unsigned * = NULL);
71 extern bool fold_convertible_p (const_tree, const_tree); 75 extern bool fold_convertible_p (const_tree, const_tree);
72 #define fold_convert(T1,T2)\ 76 #define fold_convert(T1,T2)\
73 fold_convert_loc (UNKNOWN_LOCATION, T1, T2) 77 fold_convert_loc (UNKNOWN_LOCATION, T1, T2)
74 extern tree fold_convert_loc (location_t, tree, tree); 78 extern tree fold_convert_loc (location_t, tree, tree);
75 extern tree fold_single_bit_test (location_t, enum tree_code, tree, tree, tree); 79 extern tree fold_single_bit_test (location_t, enum tree_code, tree, tree, tree);
81 extern void fold_undefer_and_ignore_overflow_warnings (void); 85 extern void fold_undefer_and_ignore_overflow_warnings (void);
82 extern bool fold_deferring_overflow_warnings_p (void); 86 extern bool fold_deferring_overflow_warnings_p (void);
83 extern void fold_overflow_warning (const char*, enum warn_strict_overflow_code); 87 extern void fold_overflow_warning (const char*, enum warn_strict_overflow_code);
84 extern enum tree_code fold_div_compare (enum tree_code, tree, tree, 88 extern enum tree_code fold_div_compare (enum tree_code, tree, tree,
85 tree *, tree *, bool *); 89 tree *, tree *, bool *);
86 extern int operand_equal_p (const_tree, const_tree, unsigned int); 90 extern bool operand_equal_p (const_tree, const_tree, unsigned int flags = 0);
87 extern int multiple_of_p (tree, const_tree, const_tree); 91 extern int multiple_of_p (tree, const_tree, const_tree);
88 #define omit_one_operand(T1,T2,T3)\ 92 #define omit_one_operand(T1,T2,T3)\
89 omit_one_operand_loc (UNKNOWN_LOCATION, T1, T2, T3) 93 omit_one_operand_loc (UNKNOWN_LOCATION, T1, T2, T3)
90 extern tree omit_one_operand_loc (location_t, tree, tree, tree); 94 extern tree omit_one_operand_loc (location_t, tree, tree, tree);
91 #define omit_two_operands(T1,T2,T3,T4)\ 95 #define omit_two_operands(T1,T2,T3,T4)\
98 extern tree fold_binary_to_constant (enum tree_code, tree, tree, tree); 102 extern tree fold_binary_to_constant (enum tree_code, tree, tree, tree);
99 extern tree fold_bit_and_mask (tree, tree, enum tree_code, 103 extern tree fold_bit_and_mask (tree, tree, enum tree_code,
100 tree, enum tree_code, tree, tree, 104 tree, enum tree_code, tree, tree,
101 tree, enum tree_code, tree, tree, tree *); 105 tree, enum tree_code, tree, tree, tree *);
102 extern tree fold_read_from_constant_string (tree); 106 extern tree fold_read_from_constant_string (tree);
107 extern tree fold_read_from_vector (tree, poly_uint64);
108 #if GCC_VEC_PERN_INDICES_H
109 extern tree fold_vec_perm (tree, tree, tree, const vec_perm_indices &);
110 #endif
103 extern bool wide_int_binop (wide_int &res, enum tree_code, 111 extern bool wide_int_binop (wide_int &res, enum tree_code,
104 const wide_int &arg1, const wide_int &arg2, 112 const wide_int &arg1, const wide_int &arg2,
105 signop, wi::overflow_type *); 113 signop, wi::overflow_type *);
106 extern tree int_const_binop (enum tree_code, const_tree, const_tree, int = 1); 114 extern tree int_const_binop (enum tree_code, const_tree, const_tree, int = 1);
107 #define build_fold_addr_expr(T)\ 115 #define build_fold_addr_expr(T)\
205 /* Build and fold a POINTER_PLUS_EXPR at LOC offsetting PTR by OFF. */ 213 /* Build and fold a POINTER_PLUS_EXPR at LOC offsetting PTR by OFF. */
206 extern tree fold_build_pointer_plus_hwi_loc (location_t loc, tree ptr, HOST_WIDE_INT off); 214 extern tree fold_build_pointer_plus_hwi_loc (location_t loc, tree ptr, HOST_WIDE_INT off);
207 215
208 #define fold_build_pointer_plus_hwi(p,o) \ 216 #define fold_build_pointer_plus_hwi(p,o) \
209 fold_build_pointer_plus_hwi_loc (UNKNOWN_LOCATION, p, o) 217 fold_build_pointer_plus_hwi_loc (UNKNOWN_LOCATION, p, o)
218
219
220 /* Class used to compare gimple operands. */
221
222 class operand_compare
223 {
224 public:
225 /* Return true if two operands are equal. The flags fields can be used
226 to specify OEP flags described above. */
227 virtual bool operand_equal_p (const_tree, const_tree, unsigned int flags);
228
229 /* Generate a hash value for an expression. This can be used iteratively
230 by passing a previous result as the HSTATE argument. */
231 virtual void hash_operand (const_tree, inchash::hash &, unsigned flags);
232
233 protected:
234 /* Verify that when arguments (ARG0 and ARG1) are equal, then they have
235 an equal hash value. When the function knowns comparison return,
236 true is returned. Then RET is set to corresponding comparsion result. */
237 bool verify_hash_value (const_tree arg0, const_tree arg1, unsigned int flags,
238 bool *ret);
239 };
240
210 #endif // GCC_FOLD_CONST_H 241 #endif // GCC_FOLD_CONST_H