forked from facebook/hhvm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathguard-relaxation.h
66 lines (52 loc) · 2.33 KB
/
guard-relaxation.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
+----------------------------------------------------------------------+
| HipHop for PHP |
+----------------------------------------------------------------------+
| Copyright (c) 2010-2014 Facebook, Inc. (http://www.facebook.com) |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| [email protected] so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
*/
#ifndef incl_HPHP_RUNTIME_VM_JIT_GUARD_RELAXATION_H_
#define incl_HPHP_RUNTIME_VM_JIT_GUARD_RELAXATION_H_
#include "hphp/runtime/base/datatype.h"
#include "hphp/runtime/vm/jit/region-selection.h"
#include "hphp/runtime/vm/jit/type.h"
#include "hphp/runtime/vm/jit/block.h"
namespace HPHP { namespace jit {
struct GuardConstraints;
struct IRUnit;
struct SSATmp;
enum RelaxGuardsFlags {
RelaxNormal = 0,
RelaxSimple = 1 << 0,
RelaxReflow = 1 << 1,
};
bool shouldHHIRRelaxGuards();
/*
* Given a possibly null SSATmp*, determine if the type of that tmp may be
* loosened by guard relaxation.
*/
bool typeMightRelax(const SSATmp* tmp);
bool relaxGuards(IRUnit&, const GuardConstraints& guards,
RelaxGuardsFlags flags);
typedef std::function<void(const RegionDesc::Location&, Type)> VisitGuardFn;
void visitGuards(IRUnit&, const VisitGuardFn& func);
/*
* Returns true iff `t' is specific enough to fit `cat', meaning a consumer
* constraining a value with `cat' would be satisfied with `t' as the value's
* type after relaxation.
*/
bool typeFitsConstraint(Type t, TypeConstraint cat);
Type relaxType(Type t, TypeConstraint cat);
TypeConstraint relaxConstraint(const TypeConstraint origTc,
const Type knownType, const Type toRelax);
TypeConstraint applyConstraint(TypeConstraint origTc, TypeConstraint newTc);
} }
#endif