1 | // Licensed to the .NET Foundation under one or more agreements. |
2 | // The .NET Foundation licenses this file to you under the MIT license. |
3 | // See the LICENSE file in the project root for more information. |
4 | |
5 | // Defines the functions understood by the value-numbering system. |
6 | // ValueNumFuncDef(<name of function>, <arity (1-4)>, <is-commutative (for arity = 2)>, <non-null (for gc functions)>, |
7 | // <is-shared-static>) |
8 | |
9 | // clang-format off |
10 | ValueNumFuncDef(MapStore, 3, false, false, false) |
11 | ValueNumFuncDef(MapSelect, 2, false, false, false) |
12 | |
13 | ValueNumFuncDef(FieldSeq, 2, false, false, false) // Sequence (VN of null == empty) of (VN's of) field handles. |
14 | ValueNumFuncDef(NotAField, 0, false, false, false) // Value number function for FieldSeqStore::NotAField. |
15 | ValueNumFuncDef(ZeroMap, 0, false, false, false) // The "ZeroMap": indexing at any index yields "zero of the desired type". |
16 | |
17 | ValueNumFuncDef(PtrToLoc, 2, false, false, false) // Pointer (byref) to a local variable. Args: VN's of: 0: var num, 1: FieldSeq. |
18 | ValueNumFuncDef(PtrToArrElem, 4, false, false, false) // Pointer (byref) to an array element. Args: 0: array elem type eq class var_types value, VN's of: 1: array, 2: index, 3: FieldSeq. |
19 | ValueNumFuncDef(PtrToStatic, 1, false, false, false) // Pointer (byref) to a static variable (or possibly a field thereof, if the static variable is a struct). Args: 0: FieldSeq, first element |
20 | // of which is the static var. |
21 | ValueNumFuncDef(Phi, 2, false, false, false) // A phi function. Only occurs as arg of PhiDef or PhiMemoryDef. Arguments are SSA numbers of var being defined. |
22 | ValueNumFuncDef(PhiDef, 3, false, false, false) // Args: 0: local var # (or -1 for memory), 1: SSA #, 2: VN of definition. |
23 | // Wouldn't need this if I'd made memory a regular local variable... |
24 | ValueNumFuncDef(PhiMemoryDef, 2, false, false, false) // Args: 0: VN for basic block pointer, 1: VN of definition |
25 | ValueNumFuncDef(InitVal, 1, false, false, false) // An input arg, or init val of a local Args: 0: a constant VN. |
26 | |
27 | |
28 | |
29 | ValueNumFuncDef(Cast, 2, false, false, false) // VNF_Cast: Cast Operation changes the representations size and unsigned-ness. |
30 | // Args: 0: Source for the cast operation. |
31 | // 1: Constant integer representing the operation . |
32 | // Use VNForCastOper() to construct. |
33 | ValueNumFuncDef(CastOvf, 2, false, false, false) // Same as a VNF_Cast but also can throw an overflow exception, currently we don't try to constant fold this |
34 | |
35 | ValueNumFuncDef(CastClass, 2, false, false, false) // Args: 0: Handle of class being cast to, 1: object being cast. |
36 | ValueNumFuncDef(IsInstanceOf, 2, false, false, false) // Args: 0: Handle of class being queried, 1: object being queried. |
37 | ValueNumFuncDef(ReadyToRunCastClass, 2, false, false, false) // Args: 0: Helper stub address, 1: object being cast. |
38 | ValueNumFuncDef(ReadyToRunIsInstanceOf, 2, false, false, false) // Args: 0: Helper stub address, 1: object being queried. |
39 | ValueNumFuncDef(TypeHandleToRuntimeType, 1, false, false, false) // Args: 0: TypeHandle to translate |
40 | ValueNumFuncDef(TypeHandleToRuntimeTypeHandle, 1, false, false, false) // Args: 0: TypeHandle to translate |
41 | |
42 | ValueNumFuncDef(AreTypesEquivalent, 2, false, false, false) // Args: 0: first TypeHandle, 1: second TypeHandle |
43 | |
44 | ValueNumFuncDef(LdElemA, 3, false, false, false) // Args: 0: array value; 1: index value; 2: type handle of element. |
45 | |
46 | ValueNumFuncDef(ByrefExposedLoad, 3, false, false, false) // Args: 0: type handle/id, 1: pointer value; 2: ByrefExposed heap value |
47 | |
48 | ValueNumFuncDef(GetRefanyVal, 2, false, false, false) // Args: 0: type handle; 1: typedref value. Returns the value (asserting that the type is right). |
49 | |
50 | ValueNumFuncDef(GetClassFromMethodParam, 1, false, true, false) // Args: 0: method generic argument. |
51 | ValueNumFuncDef(GetSyncFromClassHandle, 1, false, true, false) // Args: 0: class handle. |
52 | ValueNumFuncDef(LoopCloneChoiceAddr, 0, false, true, false) |
53 | |
54 | // How we represent values of expressions with exceptional side effects: |
55 | ValueNumFuncDef(ValWithExc, 2, false, false, false) // Args: 0: value number from normal execution; 1: VN for set of possible exceptions. |
56 | ValueNumFuncDef(ExcSetCons, 2, false, false, false) // Args: 0: exception; 1: exception set (including EmptyExcSet). Invariant: "car"s are always in ascending order. |
57 | |
58 | // Various functions that are used to indicate that an exceptions may occur |
59 | // Curremtly when the execution is always thrown, the value VNForVoid() is used as Arg0 by OverflowExc and DivideByZeroExc |
60 | // |
61 | ValueNumFuncDef(NullPtrExc, 1, false, false, false) // Null pointer exception check. Args: 0: address value, throws when it is null |
62 | ValueNumFuncDef(ArithmeticExc, 2, false, false, false) // Arithmetic exception check, ckfinite and integer division overflow, Args: 0: expression value, |
63 | ValueNumFuncDef(OverflowExc, 1, false, false, false) // Integer overflow check. used for checked add,sub and mul Args: 0: expression value, throws when it overflows |
64 | ValueNumFuncDef(ConvOverflowExc, 2, false, false, false) // Cast conversion overflow check. Args: 0: input value; 1: var_types of the target type |
65 | // - (shifted left one bit; low bit encode whether source is unsigned.) |
66 | ValueNumFuncDef(DivideByZeroExc, 1, false, false, false) // Division by zero check. Args: 0: divisor value, throws when it is zero |
67 | ValueNumFuncDef(IndexOutOfRangeExc, 2, false, false, false) // Array bounds check, Args: 0: array length; 1: index value, throws when the bounds check fails. |
68 | ValueNumFuncDef(InvalidCastExc, 2, false, false, false) // CastClass check, Args: 0: ref value being cast; 1: handle of type being cast to, throws when the cast fails. |
69 | ValueNumFuncDef(NewArrOverflowExc, 1, false, false, false) // Raises Integer overflow when Arg 0 is negative |
70 | ValueNumFuncDef(HelperMultipleExc, 0, false, false, false) // Represents one or more different exceptions that could be thrown by a Jit Helper method |
71 | |
72 | ValueNumFuncDef(Lng2Dbl, 1, false, false, false) |
73 | ValueNumFuncDef(ULng2Dbl, 1, false, false, false) |
74 | ValueNumFuncDef(Dbl2Int, 1, false, false, false) |
75 | ValueNumFuncDef(Dbl2UInt, 1, false, false, false) |
76 | ValueNumFuncDef(Dbl2Lng, 1, false, false, false) |
77 | ValueNumFuncDef(Dbl2ULng, 1, false, false, false) |
78 | ValueNumFuncDef(FltRound, 1, false, false, false) |
79 | ValueNumFuncDef(DblRound, 1, false, false, false) |
80 | |
81 | ValueNumFuncDef(Sin, 1, false, false, false) |
82 | ValueNumFuncDef(Cos, 1, false, false, false) |
83 | ValueNumFuncDef(Cbrt, 1, false, false, false) |
84 | ValueNumFuncDef(Sqrt, 1, false, false, false) |
85 | ValueNumFuncDef(Abs, 1, false, false, false) |
86 | ValueNumFuncDef(RoundDouble, 1, false, false, false) |
87 | ValueNumFuncDef(RoundFloat, 1, false, false, false) |
88 | ValueNumFuncDef(RoundInt, 1, false, false, false) |
89 | ValueNumFuncDef(Cosh, 1, false, false, false) |
90 | ValueNumFuncDef(Sinh, 1, false, false, false) |
91 | ValueNumFuncDef(Tan, 1, false, false, false) |
92 | ValueNumFuncDef(Tanh, 1, false, false, false) |
93 | ValueNumFuncDef(Asin, 1, false, false, false) |
94 | ValueNumFuncDef(Asinh, 1, false, false, false) |
95 | ValueNumFuncDef(Acos, 1, false, false, false) |
96 | ValueNumFuncDef(Acosh, 1, false, false, false) |
97 | ValueNumFuncDef(Atan, 1, false, false, false) |
98 | ValueNumFuncDef(Atan2, 2, false, false, false) |
99 | ValueNumFuncDef(Atanh, 1, false, false, false) |
100 | ValueNumFuncDef(Log10, 1, false, false, false) |
101 | ValueNumFuncDef(Pow, 2, false, false, false) |
102 | ValueNumFuncDef(Exp, 1, false, false, false) |
103 | ValueNumFuncDef(Ceiling, 1, false, false, false) |
104 | ValueNumFuncDef(Floor, 1, false, false, false) |
105 | |
106 | ValueNumFuncDef(ManagedThreadId, 0, false, false, false) |
107 | |
108 | ValueNumFuncDef(ObjGetType, 1, false, false, false) |
109 | ValueNumFuncDef(GetgenericsGcstaticBase, 1, false, true, true) |
110 | ValueNumFuncDef(GetgenericsNongcstaticBase, 1, false, true, true) |
111 | ValueNumFuncDef(GetsharedGcstaticBase, 2, false, true, true) |
112 | ValueNumFuncDef(GetsharedNongcstaticBase, 2, false, true, true) |
113 | ValueNumFuncDef(GetsharedGcstaticBaseNoctor, 1, false, true, true) |
114 | ValueNumFuncDef(GetsharedNongcstaticBaseNoctor, 1, false, true, true) |
115 | ValueNumFuncDef(ReadyToRunStaticBase, 1, false, true, true) |
116 | ValueNumFuncDef(ReadyToRunGenericStaticBase, 2, false, true, true) |
117 | ValueNumFuncDef(GetsharedGcstaticBaseDynamicclass, 2, false, true, true) |
118 | ValueNumFuncDef(GetsharedNongcstaticBaseDynamicclass, 2, false, true, true) |
119 | ValueNumFuncDef(GetgenericsGcthreadstaticBase, 1, false, true, true) |
120 | ValueNumFuncDef(GetgenericsNongcthreadstaticBase, 1, false, true, true) |
121 | ValueNumFuncDef(GetsharedGcthreadstaticBase, 2, false, true, true) |
122 | ValueNumFuncDef(GetsharedNongcthreadstaticBase, 2, false, true, true) |
123 | ValueNumFuncDef(GetsharedGcthreadstaticBaseNoctor, 2, false, true, true) |
124 | ValueNumFuncDef(GetsharedNongcthreadstaticBaseNoctor, 2, false, true, true) |
125 | ValueNumFuncDef(GetsharedGcthreadstaticBaseDynamicclass, 2, false, true, true) |
126 | ValueNumFuncDef(GetsharedNongcthreadstaticBaseDynamicclass, 2, false, true, true) |
127 | |
128 | ValueNumFuncDef(ClassinitSharedDynamicclass, 2, false, false, false) |
129 | ValueNumFuncDef(RuntimeHandleMethod, 2, false, true, false) |
130 | ValueNumFuncDef(RuntimeHandleClass, 2, false, true, false) |
131 | |
132 | ValueNumFuncDef(GetStaticAddrContext, 1, false, true, false) |
133 | ValueNumFuncDef(GetStaticAddrTLS, 1, false, true, false) |
134 | |
135 | ValueNumFuncDef(JitNew, 2, false, true, false) |
136 | ValueNumFuncDef(JitNewArr, 3, false, true, false) |
137 | ValueNumFuncDef(JitReadyToRunNew, 2, false, true, false) |
138 | ValueNumFuncDef(JitReadyToRunNewArr, 3, false, true, false) |
139 | ValueNumFuncDef(Box, 3, false, false, false) |
140 | ValueNumFuncDef(BoxNullable, 3, false, false, false) |
141 | |
142 | ValueNumFuncDef(StrCns, 2, false, true, false) |
143 | ValueNumFuncDef(Unbox, 2, false, true, false) |
144 | |
145 | ValueNumFuncDef(LT_UN, 2, false, false, false) // unsigned or unordered comparisons |
146 | ValueNumFuncDef(LE_UN, 2, false, false, false) |
147 | ValueNumFuncDef(GE_UN, 2, false, false, false) |
148 | ValueNumFuncDef(GT_UN, 2, false, false, false) |
149 | |
150 | ValueNumFuncDef(MUL64_UN, 2, true, false, false) // unsigned multiplication (used by 32-bit targets) |
151 | |
152 | // currently we won't constant fold the next six |
153 | |
154 | ValueNumFuncDef(ADD_OVF, 2, true, false, false) // overflow checking operations |
155 | ValueNumFuncDef(SUB_OVF, 2, false, false, false) |
156 | ValueNumFuncDef(MUL_OVF, 2, true, false, false) |
157 | |
158 | ValueNumFuncDef(ADD_UN_OVF, 2, true, false, false) // unsigned overflow checking operations |
159 | ValueNumFuncDef(SUB_UN_OVF, 2, false, false, false) |
160 | ValueNumFuncDef(MUL_UN_OVF, 2, true, false, false) |
161 | |
162 | // clang-format on |
163 | |
164 | #undef ValueNumFuncDef |
165 | |