Small fix for -fdump-ada-spec
[official-gcc.git] / gcc / generic-match-head.cc
blobf011204c5be450663231bdece0596317b37f9f9b
1 /* Preamble and helpers for the autogenerated generic-match.cc file.
2 Copyright (C) 2014-2023 Free Software Foundation, Inc.
4 This file is part of GCC.
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
8 Software Foundation; either version 3, or (at your option) any later
9 version.
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 for more details.
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
20 #include "config.h"
21 #include "system.h"
22 #include "coretypes.h"
23 #include "backend.h"
24 #include "target.h"
25 #include "rtl.h"
26 #include "tree.h"
27 #include "gimple.h"
28 #include "ssa.h"
29 #include "cgraph.h"
30 #include "vec-perm-indices.h"
31 #include "fold-const.h"
32 #include "fold-const-call.h"
33 #include "stor-layout.h"
34 #include "tree-dfa.h"
35 #include "builtins.h"
36 #include "case-cfn-macros.h"
37 #include "gimplify.h"
38 #include "optabs-tree.h"
39 #include "dbgcnt.h"
40 #include "tm.h"
41 #include "tree-eh.h"
42 #include "langhooks.h"
43 #include "tree-pass.h"
45 /* Routine to determine if the types T1 and T2 are effectively
46 the same for GENERIC. If T1 or T2 is not a type, the test
47 applies to their TREE_TYPE. */
49 static inline bool
50 types_match (tree t1, tree t2)
52 if (!TYPE_P (t1))
53 t1 = TREE_TYPE (t1);
54 if (!TYPE_P (t2))
55 t2 = TREE_TYPE (t2);
57 return TYPE_MAIN_VARIANT (t1) == TYPE_MAIN_VARIANT (t2);
60 /* Return if T has a single use. For GENERIC, we assume this is
61 always true. */
63 static inline bool
64 single_use (tree t ATTRIBUTE_UNUSED)
66 return true;
69 /* Return true if math operations should be canonicalized,
70 e.g. sqrt(sqrt(x)) -> pow(x, 0.25). */
72 static inline bool
73 canonicalize_math_p ()
75 return !cfun || (cfun->curr_properties & PROP_gimple_opt_math) == 0;
78 /* Return true if math operations that are beneficial only after
79 vectorization should be canonicalized. */
81 static inline bool
82 canonicalize_math_after_vectorization_p ()
84 return false;
87 /* Return true if we can still perform transformations that may introduce
88 vector operations that are not supported by the target. Vector lowering
89 normally handles those, but after that pass, it becomes unsafe. */
91 static inline bool
92 optimize_vectors_before_lowering_p ()
94 return !cfun || (cfun->curr_properties & PROP_gimple_lvec) == 0;
97 /* Return true if successive divisions can be optimized.
98 Defer to GIMPLE opts. */
100 static inline bool
101 optimize_successive_divisions_p (tree, tree)
103 return false;