Move some comparison simplifications to match.pd
[official-gcc.git] / gcc / generic-match-head.c
blob0a7038dfc864e28ba1f1ca04a0c810638cff8f6e
1 /* Preamble and helpers for the autogenerated generic-match.c file.
2 Copyright (C) 2014-2015 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 "alias.h"
24 #include "backend.h"
25 #include "tree.h"
26 #include "gimple.h"
27 #include "rtl.h"
28 #include "ssa.h"
29 #include "options.h"
30 #include "fold-const.h"
31 #include "stor-layout.h"
32 #include "flags.h"
33 #include "internal-fn.h"
34 #include "gimple-fold.h"
35 #include "gimple-iterator.h"
36 #include "insn-config.h"
37 #include "expmed.h"
38 #include "dojump.h"
39 #include "explow.h"
40 #include "calls.h"
41 #include "emit-rtl.h"
42 #include "varasm.h"
43 #include "stmt.h"
44 #include "expr.h"
45 #include "tree-dfa.h"
46 #include "builtins.h"
47 #include "dumpfile.h"
48 #include "target.h"
49 #include "cgraph.h"
50 #include "generic-match.h"
53 /* Routine to determine if the types T1 and T2 are effectively
54 the same for GENERIC. If T1 or T2 is not a type, the test
55 applies to their TREE_TYPE. */
57 static inline bool
58 types_match (tree t1, tree t2)
60 if (!TYPE_P (t1))
61 t1 = TREE_TYPE (t1);
62 if (!TYPE_P (t2))
63 t2 = TREE_TYPE (t2);
65 return TYPE_MAIN_VARIANT (t1) == TYPE_MAIN_VARIANT (t2);
68 /* Return if T has a single use. For GENERIC, we assume this is
69 always true. */
71 static inline bool
72 single_use (tree t ATTRIBUTE_UNUSED)
74 return true;