re PR libfortran/68744 (FAIL: gfortran.dg/backtrace_1.f90 -O0 execution test)
[official-gcc.git] / gcc / gimple-match.h
blob219b5decd55c614d2f781a77f8f70a89ba6a6d9f
1 /* Gimple simplify definitions.
3 Copyright (C) 2011-2016 Free Software Foundation, Inc.
4 Contributed by Richard Guenther <rguenther@suse.de>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
22 #ifndef GCC_GIMPLE_MATCH_H
23 #define GCC_GIMPLE_MATCH_H
26 /* Helper to transparently allow tree codes and builtin function codes
27 exist in one storage entity. */
28 class code_helper
30 public:
31 code_helper () {}
32 code_helper (tree_code code) : rep ((int) code) {}
33 code_helper (combined_fn fn) : rep (-(int) fn) {}
34 operator tree_code () const { return (tree_code) rep; }
35 operator combined_fn () const { return (combined_fn) -rep; }
36 bool is_tree_code () const { return rep > 0; }
37 bool is_fn_code () const { return rep < 0; }
38 int get_rep () const { return rep; }
39 private:
40 int rep;
43 /* Return whether OPS[0] with CODE is a non-expression result and
44 a gimple value. */
46 inline bool
47 gimple_simplified_result_is_gimple_val (code_helper code, tree *ops)
49 return (code.is_tree_code ()
50 && (TREE_CODE_LENGTH ((tree_code) code) == 0
51 || ((tree_code) code) == ADDR_EXPR)
52 && is_gimple_val (ops[0]));
55 extern tree (*mprts_hook) (code_helper, tree, tree *);
57 bool gimple_simplify (gimple *, code_helper *, tree *, gimple_seq *,
58 tree (*)(tree), tree (*)(tree));
59 bool gimple_resimplify1 (gimple_seq *, code_helper *, tree, tree *,
60 tree (*)(tree));
61 bool gimple_resimplify2 (gimple_seq *, code_helper *, tree, tree *,
62 tree (*)(tree));
63 bool gimple_resimplify3 (gimple_seq *, code_helper *, tree, tree *,
64 tree (*)(tree));
65 tree maybe_push_res_to_seq (code_helper, tree, tree *,
66 gimple_seq *, tree res = NULL_TREE);
67 void maybe_build_generic_op (enum tree_code, tree, tree *, tree, tree);
70 #endif /* GCC_GIMPLE_MATCH_H */