2 +----------------------------------------------------------------------+
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-present Facebook, Inc. (http://www.facebook.com) |
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 +----------------------------------------------------------------------+
18 #include "hphp/hhbbc/representation.h"
20 namespace HPHP::HHBBC
{
25 //////////////////////////////////////////////////////////////////////
28 * Assist in removing blocks that aren't reachable by removing
29 * conditional jumps that are never taken. Conditional jumps that are
30 * always taken are turned into unconditional jumps in first_pass.
32 * If options.RemoveDeadBlocks is off, this function just replaces
33 * blocks we believe are unreachable with fatal opcodes.
35 void remove_unreachable_blocks(const FuncAnalysis
&, php::WideFunc
& func
);
38 * Simplify control flow, and create Switch and SSwitch bytecodes.
40 bool control_flow_opts(const FuncAnalysis
&, php::WideFunc
& func
);
43 * Split critical edges.
45 * Some optimizations require or are better if we split critical edges in the
46 * cfg. One example of this is UnsetL insertion. With the following cfg:
54 * Suppose in B1 we have local l1 holding a counted value. B2 may leave local
55 * l1 uninit (after a move optisation is applied during a call). Inserting an
56 * UnsetL(l1) at the start of block B3 will require a decref of
57 * Union(TCnt, TUninit), which is not great. If we split critical edges, the
58 * UnsetL(l1) (and its decref) could sit on the edge from B1 to B2 making it
61 * Critical edge blocks that remain a single nop will get folded away by
64 void split_critical_edges(const Index
&, FuncAnalysis
&, php::WideFunc
& func
);
66 //////////////////////////////////////////////////////////////////////