New flag and error message for class to memo key conversion
[hiphop-php.git] / hphp / hhbbc / optimize.h
blob9f8c7e131ad6b3864e263b8934d55004eec5dba5
1 /*
2 +----------------------------------------------------------------------+
3 | HipHop for PHP |
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 +----------------------------------------------------------------------+
16 #pragma once
18 #include "hphp/hhbbc/context.h"
20 namespace HPHP::HHBBC {
22 //////////////////////////////////////////////////////////////////////
24 struct Index;
25 struct FuncAnalysis;
26 struct Bytecode;
27 struct BlockUpdateInfo;
29 using BlockUpdates = CompactVector<std::pair<BlockId, CompressedBlockUpdate>>;
32 * Use information from an analyze call to perform various
33 * optimizations on a function.
35 * The Index should be unchanged since the one that was provided to
36 * the corresponding analyze_func call.
38 * This routine may modify the php::Blocks attached to the passed-in
39 * php::Func, and may renumber the php::Func's locals, but won't update
40 * any of the func's other metadata.
42 void optimize_func(const Index&, FuncAnalysis&&, php::WideFunc&);
44 void update_bytecode(php::WideFunc&, BlockUpdates&&, FuncAnalysis* = nullptr);
47 * Optimize property type hints for a particular class.
49 void optimize_class_prop_type_hints(const Index& index, Context ctx);
52 * Return a bytecode to generate the value in cell
54 Bytecode gen_constant(const TypedValue& cell);
56 //////////////////////////////////////////////////////////////////////