becopyheur2: Remove unnecessary indirection.
[libfirm] / include / libfirm / vrp.h
1 /*
2  * This file is part of libFirm.
3  * Copyright (C) 2012 University of Karlsruhe.
4  */
5
6 /**
7  * @file
8  * @brief   Analyse the graph with value range propagation
9  * @author  Jonas Fietz
10  */
11 #ifndef VRP_H
12 #define VRP_H
13
14 #include "firm_types.h"
15 #include "begin.h"
16
17 /**
18  * @ingroup irana
19  * @defgroup vrp  Value Information
20  * Information about SSA-values (ranges, known bits, ...)
21  * @{
22  */
23
24 /** Type of a value range */
25 enum range_types {
26         VRP_UNDEFINED, /**< No information could be derived so far */
27         VRP_RANGE,     /**< bottom and top form a range, including both values */
28         VRP_ANTIRANGE, /**< range from bottom to top cannot be, but borders might
29                             be */
30         VRP_VARYING    /**< information cannot be derived */
31 };
32
33 /** VRP information for a single node */
34 typedef struct {
35         ir_tarval *bits_set;         /**< The bits which, by analysis, are
36                                           definitely set:
37                                           0: may be not set, 1: definitely set */
38         ir_tarval *bits_not_set;     /**< The bits which by analysis are definitely
39                                           not set:
40                                           1 for may be set, 0: definitely not set */
41         enum range_types range_type; /**< The range represented by range_top, range_bottom */
42         ir_tarval *range_bottom;     /**< lower end of the value range */
43         ir_tarval *range_top;        /**< upper end of the value range */
44 } vrp_attr;
45
46 /**
47  * Sets vrp data on the graph irg
48  * @param irg graph on which to set vrp data
49  */
50 FIRM_API void set_vrp_data(ir_graph *irg);
51
52 /**
53  * free vrp infos in an irg
54  */
55 FIRM_API void free_vrp_data(ir_graph *irg);
56
57 /**
58  * Test, if the two nodes can be compared with their vrp information
59  *
60  * @param left: the left node
61  * @param right: the right node
62  * @return all possible relations
63  */
64 FIRM_API ir_relation vrp_cmp(const ir_node *left, const ir_node *right);
65
66 /**
67  * Returns the vrp data for this node
68  * Note: only allowed for nodes with an integer mode!
69  *
70  * @param n: the node for which to return the vrp information
71  * @return a pointer to the vrp data or NULL if there is none
72  */
73 FIRM_API vrp_attr *vrp_get_info(const ir_node *n);
74
75 /** @} */
76
77 #include "end.h"
78
79 #endif