]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/fold-const.h
Optimize ODR enum streaming
[thirdparty/gcc.git] / gcc / fold-const.h
index 54c850a3ee1f5db7c20fc8ab07ea504d634b55b8..0f788a458f21e802431fdeaaa449c20e35c0b048 100644 (file)
@@ -1,5 +1,5 @@
 /* Fold a constant sub-tree into a single node for C-compiler
-   Copyright (C) 1987-2019 Free Software Foundation, Inc.
+   Copyright (C) 1987-2020 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -26,7 +26,14 @@ extern int folding_initializer;
 
 /* Convert between trees and native memory representation.  */
 extern int native_encode_expr (const_tree, unsigned char *, int, int off = -1);
+extern int native_encode_initializer (tree, unsigned char *, int,
+                                     int off = -1);
 extern tree native_interpret_expr (tree, const unsigned char *, int);
+extern bool can_native_interpret_type_p (tree);
+extern void shift_bytes_in_array_left (unsigned char *, unsigned int,
+                                      unsigned int);
+extern void shift_bytes_in_array_right (unsigned char *, unsigned int,
+                                       unsigned int);
 
 /* Fold constants as much as possible in an expression.
    Returns the simplified expression.
@@ -84,7 +91,7 @@ extern bool fold_deferring_overflow_warnings_p (void);
 extern void fold_overflow_warning (const char*, enum warn_strict_overflow_code);
 extern enum tree_code fold_div_compare (enum tree_code, tree, tree,
                                        tree *, tree *, bool *);
-extern bool operand_equal_p (const_tree, const_tree, unsigned int);
+extern bool operand_equal_p (const_tree, const_tree, unsigned int flags = 0);
 extern int multiple_of_p (tree, const_tree, const_tree);
 #define omit_one_operand(T1,T2,T3)\
    omit_one_operand_loc (UNKNOWN_LOCATION, T1, T2, T3)
@@ -212,4 +219,27 @@ extern tree fold_build_pointer_plus_hwi_loc (location_t loc, tree ptr, HOST_WIDE
 
 #define fold_build_pointer_plus_hwi(p,o) \
        fold_build_pointer_plus_hwi_loc (UNKNOWN_LOCATION, p, o)
+
+
+/* Class used to compare gimple operands.  */
+
+class operand_compare
+{
+public:
+  /* Return true if two operands are equal.  The flags fields can be used
+     to specify OEP flags described above.  */
+  virtual bool operand_equal_p (const_tree, const_tree, unsigned int flags);
+
+  /* Generate a hash value for an expression.  This can be used iteratively
+     by passing a previous result as the HSTATE argument.  */
+  virtual void hash_operand (const_tree, inchash::hash &, unsigned flags);
+
+protected:
+  /* Verify that when arguments (ARG0 and ARG1) are equal, then they have
+     an equal hash value.  When the function knowns comparison return,
+     true is returned.  Then RET is set to corresponding comparsion result.  */
+  bool verify_hash_value (const_tree arg0, const_tree arg1, unsigned int flags,
+                         bool *ret);
+};
+
 #endif // GCC_FOLD_CONST_H