xref: /PHP-7.4/ext/opcache/Optimizer/zend_dfg.h (revision da919a8b)
1 /*
2    +----------------------------------------------------------------------+
3    | Zend Engine, DFG - Data Flow Graph                                   |
4    +----------------------------------------------------------------------+
5    | Copyright (c) The PHP Group                                          |
6    +----------------------------------------------------------------------+
7    | This source file is subject to version 3.01 of the PHP license,      |
8    | that is bundled with this package in the file LICENSE, and is        |
9    | available through the world-wide-web at the following url:           |
10    | http://www.php.net/license/3_01.txt                                  |
11    | If you did not receive a copy of the PHP license and are unable to   |
12    | obtain it through the world-wide-web, please send a note to          |
13    | license@php.net so we can mail you a copy immediately.               |
14    +----------------------------------------------------------------------+
15    | Authors: Dmitry Stogov <dmitry@php.net>                              |
16    +----------------------------------------------------------------------+
17 */
18 
19 #ifndef ZEND_DFG_H
20 #define ZEND_DFG_H
21 
22 #include "zend_bitset.h"
23 #include "zend_cfg.h"
24 
25 typedef struct _zend_dfg {
26 	int         vars;
27 	uint32_t    size;
28 	zend_bitset tmp;
29 	zend_bitset def;
30 	zend_bitset use;
31 	zend_bitset in;
32 	zend_bitset out;
33 } zend_dfg;
34 
35 #define DFG_BITSET(set, set_size, block_num) \
36 	((set) + ((block_num) * (set_size)))
37 
38 #define DFG_SET(set, set_size, block_num, var_num) \
39 	zend_bitset_incl(DFG_BITSET(set, set_size, block_num), (var_num))
40 
41 #define DFG_ISSET(set, set_size, block_num, var_num) \
42 	zend_bitset_in(DFG_BITSET(set, set_size, block_num), (var_num))
43 
44 BEGIN_EXTERN_C()
45 
46 int zend_build_dfg(const zend_op_array *op_array, const zend_cfg *cfg, zend_dfg *dfg, uint32_t build_flags);
47 
48 END_EXTERN_C()
49 
50 #endif /* ZEND_DFG_H */
51