]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/gimple-range.h
Correct a function pre/postcondition [PR102403].
[thirdparty/gcc.git] / gcc / gimple-range.h
1 /* Header file for the GIMPLE range interface.
2 Copyright (C) 2019-2021 Free Software Foundation, Inc.
3 Contributed by Andrew MacLeod <amacleod@redhat.com>
4 and Aldy Hernandez <aldyh@redhat.com>.
5
6 This file is part of GCC.
7
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.
12
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.
17
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/>. */
21
22 #ifndef GCC_GIMPLE_RANGE_H
23 #define GCC_GIMPLE_RANGE_H
24
25 #include "range.h"
26 #include "value-query.h"
27 #include "range-op.h"
28 #include "gimple-range-trace.h"
29 #include "gimple-range-edge.h"
30 #include "gimple-range-fold.h"
31 #include "gimple-range-gori.h"
32 #include "gimple-range-cache.h"
33
34 // This is the basic range generator interface.
35 //
36 // This base class provides all the API entry points, but only provides
37 // functionality at the statement level. Ie, it can calculate ranges on
38 // statements, but does no additonal lookup.
39 //
40 // All the range_of_* methods will return a range if the types is
41 // supported by the range engine. It may be the full range for the
42 // type, AKA varying_p or it may be a refined range. If the range
43 // type is not supported, then false is returned. Non-statement
44 // related methods return whatever the current global value is.
45
46 class gimple_ranger : public range_query
47 {
48 public:
49 gimple_ranger ();
50 virtual bool range_of_stmt (irange &r, gimple *, tree name = NULL) OVERRIDE;
51 virtual bool range_of_expr (irange &r, tree name, gimple * = NULL) OVERRIDE;
52 virtual bool range_on_edge (irange &r, edge e, tree name) OVERRIDE;
53 void range_on_entry (irange &r, basic_block bb, tree name);
54 void range_on_exit (irange &r, basic_block bb, tree name);
55 void export_global_ranges ();
56 inline gori_compute &gori () { return m_cache.m_gori; }
57 virtual void dump (FILE *f) OVERRIDE;
58 void dump_bb (FILE *f, basic_block bb);
59 protected:
60 bool fold_range_internal (irange &r, gimple *s, tree name);
61 ranger_cache m_cache;
62 range_tracer tracer;
63 };
64
65 /* Create a new ranger instance and associate it with a function.
66 Each call must be paired with a call to disable_ranger to release
67 resources. */
68 extern gimple_ranger *enable_ranger (struct function *);
69 extern void disable_ranger (struct function *);
70
71 #endif // GCC_GIMPLE_RANGE_H