Aart Bik | d14c595 | 2015-09-08 15:25:15 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef ART_COMPILER_OPTIMIZING_INDUCTION_VAR_RANGE_H_ |
| 18 | #define ART_COMPILER_OPTIMIZING_INDUCTION_VAR_RANGE_H_ |
| 19 | |
| 20 | #include "induction_var_analysis.h" |
| 21 | |
| 22 | namespace art { |
| 23 | |
| 24 | /** |
Aart Bik | b3365e0 | 2015-09-21 14:45:05 -0700 | [diff] [blame] | 25 | * This class implements range analysis on expressions within loops. It takes the results |
| 26 | * of induction variable analysis in the constructor and provides a public API to obtain |
Aart Bik | 8e02e3e | 2017-02-28 14:41:55 -0800 | [diff] [blame] | 27 | * a conservative lower and upper bound value or last value on each instruction in the HIR. |
| 28 | * The public API also provides a few general-purpose utility methods related to induction. |
Aart Bik | d14c595 | 2015-09-08 15:25:15 -0700 | [diff] [blame] | 29 | * |
Aart Bik | b3365e0 | 2015-09-21 14:45:05 -0700 | [diff] [blame] | 30 | * The range analysis is done with a combination of symbolic and partial integral evaluation |
| 31 | * of expressions. The analysis avoids complications with wrap-around arithmetic on the integral |
| 32 | * parts but all clients should be aware that wrap-around may occur on any of the symbolic parts. |
| 33 | * For example, given a known range for [0,100] for i, the evaluation yields range [-100,100] |
| 34 | * for expression -2*i+100, which is exact, and range [x,x+100] for expression i+x, which may |
| 35 | * wrap-around anywhere in the range depending on the actual value of x. |
Aart Bik | d14c595 | 2015-09-08 15:25:15 -0700 | [diff] [blame] | 36 | */ |
| 37 | class InductionVarRange { |
| 38 | public: |
| 39 | /* |
| 40 | * A value that can be represented as "a * instruction + b" for 32-bit constants, where |
Aart Bik | b3365e0 | 2015-09-21 14:45:05 -0700 | [diff] [blame] | 41 | * Value() denotes an unknown lower and upper bound. Although range analysis could yield |
| 42 | * more complex values, the format is sufficiently powerful to represent useful cases |
| 43 | * and feeds directly into optimizations like bounds check elimination. |
Aart Bik | d14c595 | 2015-09-08 15:25:15 -0700 | [diff] [blame] | 44 | */ |
| 45 | struct Value { |
Aart Bik | b3365e0 | 2015-09-21 14:45:05 -0700 | [diff] [blame] | 46 | Value() : instruction(nullptr), a_constant(0), b_constant(0), is_known(false) {} |
Aart Bik | d14c595 | 2015-09-08 15:25:15 -0700 | [diff] [blame] | 47 | Value(HInstruction* i, int32_t a, int32_t b) |
Aart Bik | b3365e0 | 2015-09-21 14:45:05 -0700 | [diff] [blame] | 48 | : instruction(a != 0 ? i : nullptr), a_constant(a), b_constant(b), is_known(true) {} |
Aart Bik | d14c595 | 2015-09-08 15:25:15 -0700 | [diff] [blame] | 49 | explicit Value(int32_t b) : Value(nullptr, 0, b) {} |
Aart Bik | b3365e0 | 2015-09-21 14:45:05 -0700 | [diff] [blame] | 50 | // Representation as: a_constant x instruction + b_constant. |
Aart Bik | d14c595 | 2015-09-08 15:25:15 -0700 | [diff] [blame] | 51 | HInstruction* instruction; |
| 52 | int32_t a_constant; |
| 53 | int32_t b_constant; |
Aart Bik | b3365e0 | 2015-09-21 14:45:05 -0700 | [diff] [blame] | 54 | // If true, represented by prior fields. Otherwise unknown value. |
| 55 | bool is_known; |
Aart Bik | d14c595 | 2015-09-08 15:25:15 -0700 | [diff] [blame] | 56 | }; |
| 57 | |
| 58 | explicit InductionVarRange(HInductionVarAnalysis* induction); |
| 59 | |
| 60 | /** |
Aart Bik | 52be7e7 | 2016-06-23 11:20:41 -0700 | [diff] [blame] | 61 | * Given a context denoted by the first instruction, returns a possibly conservative lower |
| 62 | * and upper bound on the instruction's value in the output parameters min_val and max_val, |
| 63 | * respectively. The need_finite_test flag denotes if an additional finite-test is needed |
| 64 | * to protect the range evaluation inside its loop. The parameter chase_hint defines an |
| 65 | * instruction at which chasing may stop. Returns false on failure. |
Aart Bik | d14c595 | 2015-09-08 15:25:15 -0700 | [diff] [blame] | 66 | */ |
Aart Bik | 1fc3afb | 2016-02-02 13:26:16 -0800 | [diff] [blame] | 67 | bool GetInductionRange(HInstruction* context, |
Aart Bik | 389b3db | 2015-10-28 14:23:40 -0700 | [diff] [blame] | 68 | HInstruction* instruction, |
Aart Bik | 52be7e7 | 2016-06-23 11:20:41 -0700 | [diff] [blame] | 69 | HInstruction* chase_hint, |
Aart Bik | 1fc3afb | 2016-02-02 13:26:16 -0800 | [diff] [blame] | 70 | /*out*/ Value* min_val, |
| 71 | /*out*/ Value* max_val, |
| 72 | /*out*/ bool* needs_finite_test); |
Aart Bik | d14c595 | 2015-09-08 15:25:15 -0700 | [diff] [blame] | 73 | |
| 74 | /** |
Aart Bik | 389b3db | 2015-10-28 14:23:40 -0700 | [diff] [blame] | 75 | * Returns true if range analysis is able to generate code for the lower and upper |
| 76 | * bound expressions on the instruction in the given context. The need_finite_test |
| 77 | * and need_taken test flags denote if an additional finite-test and/or taken-test |
| 78 | * are needed to protect the range evaluation inside its loop. |
Aart Bik | d14c595 | 2015-09-08 15:25:15 -0700 | [diff] [blame] | 79 | */ |
Aart Bik | 16d3a65 | 2016-09-09 10:33:50 -0700 | [diff] [blame] | 80 | bool CanGenerateRange(HInstruction* context, |
| 81 | HInstruction* instruction, |
| 82 | /*out*/ bool* needs_finite_test, |
| 83 | /*out*/ bool* needs_taken_test); |
Aart Bik | aec3cce | 2015-10-14 17:44:55 -0700 | [diff] [blame] | 84 | |
| 85 | /** |
| 86 | * Generates the actual code in the HIR for the lower and upper bound expressions on the |
| 87 | * instruction in the given context. Code for the lower and upper bound expression are |
Aart Bik | 389b3db | 2015-10-28 14:23:40 -0700 | [diff] [blame] | 88 | * generated in given block and graph and are returned in the output parameters lower and |
| 89 | * upper, respectively. For a loop invariant, lower is not set. |
Aart Bik | aec3cce | 2015-10-14 17:44:55 -0700 | [diff] [blame] | 90 | * |
| 91 | * For example, given expression x+i with range [0, 5] for i, calling this method |
| 92 | * will generate the following sequence: |
| 93 | * |
| 94 | * block: |
| 95 | * lower: add x, 0 |
| 96 | * upper: add x, 5 |
Aart Bik | 389b3db | 2015-10-28 14:23:40 -0700 | [diff] [blame] | 97 | * |
Aart Bik | 16d3a65 | 2016-09-09 10:33:50 -0700 | [diff] [blame] | 98 | * Precondition: CanGenerateRange() returns true. |
Aart Bik | aec3cce | 2015-10-14 17:44:55 -0700 | [diff] [blame] | 99 | */ |
Aart Bik | 16d3a65 | 2016-09-09 10:33:50 -0700 | [diff] [blame] | 100 | void GenerateRange(HInstruction* context, |
| 101 | HInstruction* instruction, |
| 102 | HGraph* graph, |
| 103 | HBasicBlock* block, |
| 104 | /*out*/ HInstruction** lower, |
| 105 | /*out*/ HInstruction** upper); |
Aart Bik | 389b3db | 2015-10-28 14:23:40 -0700 | [diff] [blame] | 106 | |
| 107 | /** |
| 108 | * Generates explicit taken-test for the loop in the given context. Code is generated in |
Aart Bik | 16d3a65 | 2016-09-09 10:33:50 -0700 | [diff] [blame] | 109 | * given block and graph. Returns generated taken-test. |
Aart Bik | 389b3db | 2015-10-28 14:23:40 -0700 | [diff] [blame] | 110 | * |
Aart Bik | 16d3a65 | 2016-09-09 10:33:50 -0700 | [diff] [blame] | 111 | * Precondition: CanGenerateRange() returns true and needs_taken_test is set. |
Aart Bik | 389b3db | 2015-10-28 14:23:40 -0700 | [diff] [blame] | 112 | */ |
Aart Bik | 16d3a65 | 2016-09-09 10:33:50 -0700 | [diff] [blame] | 113 | HInstruction* GenerateTakenTest(HInstruction* context, HGraph* graph, HBasicBlock* block); |
| 114 | |
| 115 | /** |
| 116 | * Returns true if induction analysis is able to generate code for last value of |
| 117 | * the given instruction inside the closest enveloping loop. |
| 118 | */ |
| 119 | bool CanGenerateLastValue(HInstruction* instruction); |
| 120 | |
| 121 | /** |
| 122 | * Generates last value of the given instruction in the closest enveloping loop. |
| 123 | * Code is generated in given block and graph. Returns generated last value. |
| 124 | * |
| 125 | * Precondition: CanGenerateLastValue() returns true. |
| 126 | */ |
| 127 | HInstruction* GenerateLastValue(HInstruction* instruction, HGraph* graph, HBasicBlock* block); |
| 128 | |
| 129 | /** |
| 130 | * Updates all matching fetches with the given replacement in all induction information |
| 131 | * that is associated with the given instruction. |
| 132 | */ |
| 133 | void Replace(HInstruction* instruction, HInstruction* fetch, HInstruction* replacement); |
Aart Bik | aec3cce | 2015-10-14 17:44:55 -0700 | [diff] [blame] | 134 | |
Aart Bik | 482095d | 2016-10-10 15:39:10 -0700 | [diff] [blame] | 135 | /** |
| 136 | * Incrementally updates induction information for just the given loop. |
| 137 | */ |
| 138 | void ReVisit(HLoopInformation* loop) { |
| 139 | induction_analysis_->induction_.erase(loop); |
Aart Bik | cc42be0 | 2016-10-20 16:14:16 -0700 | [diff] [blame] | 140 | for (HInstructionIterator it(loop->GetHeader()->GetPhis()); !it.Done(); it.Advance()) { |
| 141 | induction_analysis_->cycles_.erase(it.Current()->AsPhi()); |
| 142 | } |
Aart Bik | 482095d | 2016-10-10 15:39:10 -0700 | [diff] [blame] | 143 | induction_analysis_->VisitLoop(loop); |
| 144 | } |
| 145 | |
Aart Bik | 9abf894 | 2016-10-14 09:49:42 -0700 | [diff] [blame] | 146 | /** |
Aart Bik | cc42be0 | 2016-10-20 16:14:16 -0700 | [diff] [blame] | 147 | * Lookup an interesting cycle associated with an entry phi. |
| 148 | */ |
| 149 | ArenaSet<HInstruction*>* LookupCycle(HPhi* phi) const { |
| 150 | return induction_analysis_->LookupCycle(phi); |
| 151 | } |
| 152 | |
| 153 | /** |
Aart Bik | 6b69e0a | 2017-01-11 10:20:43 -0800 | [diff] [blame] | 154 | * Checks if header logic of a loop terminates. Sets trip-count tc if known. |
Aart Bik | 9abf894 | 2016-10-14 09:49:42 -0700 | [diff] [blame] | 155 | */ |
Aart Bik | 6b69e0a | 2017-01-11 10:20:43 -0800 | [diff] [blame] | 156 | bool IsFinite(HLoopInformation* loop, /*out*/ int64_t* tc) const; |
Aart Bik | 9abf894 | 2016-10-14 09:49:42 -0700 | [diff] [blame] | 157 | |
Aart Bik | 8e02e3e | 2017-02-28 14:41:55 -0800 | [diff] [blame] | 158 | /** |
Aart Bik | fa76296 | 2017-04-07 11:33:37 -0700 | [diff] [blame] | 159 | * Checks if the given instruction is a unit stride induction inside the closest enveloping |
| 160 | * loop of the context that is defined by the first parameter (e.g. pass an array reference |
| 161 | * as context and the index as instruction to make sure the stride is tested against the |
| 162 | * loop that envelops the reference the closest). Returns invariant offset on success. |
Aart Bik | 8e02e3e | 2017-02-28 14:41:55 -0800 | [diff] [blame] | 163 | */ |
Aart Bik | fa76296 | 2017-04-07 11:33:37 -0700 | [diff] [blame] | 164 | bool IsUnitStride(HInstruction* context, |
| 165 | HInstruction* instruction, |
| 166 | /*out*/ HInstruction** offset) const; |
Aart Bik | 8e02e3e | 2017-02-28 14:41:55 -0800 | [diff] [blame] | 167 | |
| 168 | /** |
| 169 | * Generates the trip count expression for the given loop. Code is generated in given block |
| 170 | * and graph. The expression is guarded by a taken test if needed. Returns the trip count |
| 171 | * expression on success or null otherwise. |
| 172 | */ |
| 173 | HInstruction* GenerateTripCount(HLoopInformation* loop, HGraph* graph, HBasicBlock* block); |
| 174 | |
Aart Bik | d14c595 | 2015-09-08 15:25:15 -0700 | [diff] [blame] | 175 | private: |
Aart Bik | 97412c92 | 2016-02-19 20:14:38 -0800 | [diff] [blame] | 176 | /* |
| 177 | * Enum used in IsConstant() request. |
| 178 | */ |
| 179 | enum ConstantRequest { |
| 180 | kExact, |
| 181 | kAtMost, |
| 182 | kAtLeast |
| 183 | }; |
| 184 | |
| 185 | /** |
| 186 | * Returns true if exact or upper/lower bound on the given induction |
| 187 | * information is known as a 64-bit constant, which is returned in value. |
| 188 | */ |
| 189 | bool IsConstant(HInductionVarAnalysis::InductionInfo* info, |
| 190 | ConstantRequest request, |
Aart Bik | 52be7e7 | 2016-06-23 11:20:41 -0700 | [diff] [blame] | 191 | /*out*/ int64_t* value) const; |
Aart Bik | 97412c92 | 2016-02-19 20:14:38 -0800 | [diff] [blame] | 192 | |
Aart Bik | 52be7e7 | 2016-06-23 11:20:41 -0700 | [diff] [blame] | 193 | /** Returns whether induction information can be obtained. */ |
| 194 | bool HasInductionInfo(HInstruction* context, |
| 195 | HInstruction* instruction, |
| 196 | /*out*/ HLoopInformation** loop, |
| 197 | /*out*/ HInductionVarAnalysis::InductionInfo** info, |
| 198 | /*out*/ HInductionVarAnalysis::InductionInfo** trip) const; |
| 199 | |
| 200 | bool HasFetchInLoop(HInductionVarAnalysis::InductionInfo* info) const; |
Aart Bik | 16d3a65 | 2016-09-09 10:33:50 -0700 | [diff] [blame] | 201 | bool NeedsTripCount(HInductionVarAnalysis::InductionInfo* info, |
| 202 | /*out*/ int64_t* stride_value) const; |
Aart Bik | 7d57d7f | 2015-12-09 14:39:48 -0800 | [diff] [blame] | 203 | bool IsBodyTripCount(HInductionVarAnalysis::InductionInfo* trip) const; |
| 204 | bool IsUnsafeTripCount(HInductionVarAnalysis::InductionInfo* trip) const; |
Aart Bik | 52be7e7 | 2016-06-23 11:20:41 -0700 | [diff] [blame] | 205 | bool IsWellBehavedTripCount(HInductionVarAnalysis::InductionInfo* trip) const; |
Aart Bik | d14c595 | 2015-09-08 15:25:15 -0700 | [diff] [blame] | 206 | |
Aart Bik | 7d57d7f | 2015-12-09 14:39:48 -0800 | [diff] [blame] | 207 | Value GetLinear(HInductionVarAnalysis::InductionInfo* info, |
| 208 | HInductionVarAnalysis::InductionInfo* trip, |
| 209 | bool in_body, |
| 210 | bool is_min) const; |
Aart Bik | df7822e | 2016-12-06 10:05:30 -0800 | [diff] [blame] | 211 | Value GetPolynomial(HInductionVarAnalysis::InductionInfo* info, |
| 212 | HInductionVarAnalysis::InductionInfo* trip, |
| 213 | bool in_body, |
| 214 | bool is_min) const; |
Aart Bik | c071a01 | 2016-12-01 10:22:31 -0800 | [diff] [blame] | 215 | Value GetGeometric(HInductionVarAnalysis::InductionInfo* info, |
| 216 | HInductionVarAnalysis::InductionInfo* trip, |
| 217 | bool in_body, |
| 218 | bool is_min) const; |
Aart Bik | 7d57d7f | 2015-12-09 14:39:48 -0800 | [diff] [blame] | 219 | Value GetFetch(HInstruction* instruction, |
| 220 | HInductionVarAnalysis::InductionInfo* trip, |
| 221 | bool in_body, |
| 222 | bool is_min) const; |
| 223 | Value GetVal(HInductionVarAnalysis::InductionInfo* info, |
| 224 | HInductionVarAnalysis::InductionInfo* trip, |
| 225 | bool in_body, |
| 226 | bool is_min) const; |
| 227 | Value GetMul(HInductionVarAnalysis::InductionInfo* info1, |
| 228 | HInductionVarAnalysis::InductionInfo* info2, |
| 229 | HInductionVarAnalysis::InductionInfo* trip, |
| 230 | bool in_body, |
| 231 | bool is_min) const; |
| 232 | Value GetDiv(HInductionVarAnalysis::InductionInfo* info1, |
| 233 | HInductionVarAnalysis::InductionInfo* info2, |
| 234 | HInductionVarAnalysis::InductionInfo* trip, |
| 235 | bool in_body, |
| 236 | bool is_min) const; |
Aart Bik | df7822e | 2016-12-06 10:05:30 -0800 | [diff] [blame] | 237 | Value GetRem(HInductionVarAnalysis::InductionInfo* info1, |
| 238 | HInductionVarAnalysis::InductionInfo* info2) const; |
Aart Bik | 7dc9693 | 2016-10-12 10:01:05 -0700 | [diff] [blame] | 239 | Value GetXor(HInductionVarAnalysis::InductionInfo* info1, |
| 240 | HInductionVarAnalysis::InductionInfo* info2) const; |
Aart Bik | d14c595 | 2015-09-08 15:25:15 -0700 | [diff] [blame] | 241 | |
Aart Bik | 52be7e7 | 2016-06-23 11:20:41 -0700 | [diff] [blame] | 242 | Value MulRangeAndConstant(int64_t value, |
| 243 | HInductionVarAnalysis::InductionInfo* info, |
| 244 | HInductionVarAnalysis::InductionInfo* trip, |
| 245 | bool in_body, |
| 246 | bool is_min) const; |
| 247 | Value DivRangeAndConstant(int64_t value, |
| 248 | HInductionVarAnalysis::InductionInfo* info, |
| 249 | HInductionVarAnalysis::InductionInfo* trip, |
| 250 | bool in_body, |
| 251 | bool is_min) const; |
Aart Bik | d14c595 | 2015-09-08 15:25:15 -0700 | [diff] [blame] | 252 | |
Aart Bik | 7d57d7f | 2015-12-09 14:39:48 -0800 | [diff] [blame] | 253 | Value AddValue(Value v1, Value v2) const; |
| 254 | Value SubValue(Value v1, Value v2) const; |
| 255 | Value MulValue(Value v1, Value v2) const; |
| 256 | Value DivValue(Value v1, Value v2) const; |
| 257 | Value MergeVal(Value v1, Value v2, bool is_min) const; |
Aart Bik | d14c595 | 2015-09-08 15:25:15 -0700 | [diff] [blame] | 258 | |
Aart Bik | aec3cce | 2015-10-14 17:44:55 -0700 | [diff] [blame] | 259 | /** |
Aart Bik | 16d3a65 | 2016-09-09 10:33:50 -0700 | [diff] [blame] | 260 | * Generates code for lower/upper/taken-test or last value in the HIR. Returns true on |
| 261 | * success. With values nullptr, the method can be used to determine if code generation |
Aart Bik | aec3cce | 2015-10-14 17:44:55 -0700 | [diff] [blame] | 262 | * would be successful without generating actual code yet. |
| 263 | */ |
Aart Bik | 9abf894 | 2016-10-14 09:49:42 -0700 | [diff] [blame] | 264 | bool GenerateRangeOrLastValue(HInstruction* context, |
| 265 | HInstruction* instruction, |
| 266 | bool is_last_val, |
| 267 | HGraph* graph, |
| 268 | HBasicBlock* block, |
| 269 | /*out*/ HInstruction** lower, |
| 270 | /*out*/ HInstruction** upper, |
| 271 | /*out*/ HInstruction** taken_test, |
| 272 | /*out*/ int64_t* stride_value, |
| 273 | /*out*/ bool* needs_finite_test, |
| 274 | /*out*/ bool* needs_taken_test) const; |
| 275 | |
Aart Bik | df7822e | 2016-12-06 10:05:30 -0800 | [diff] [blame] | 276 | bool GenerateLastValuePolynomial(HInductionVarAnalysis::InductionInfo* info, |
| 277 | HInductionVarAnalysis::InductionInfo* trip, |
| 278 | HGraph* graph, |
| 279 | HBasicBlock* block, |
| 280 | /*out*/HInstruction** result) const; |
| 281 | |
Aart Bik | c071a01 | 2016-12-01 10:22:31 -0800 | [diff] [blame] | 282 | bool GenerateLastValueGeometric(HInductionVarAnalysis::InductionInfo* info, |
| 283 | HInductionVarAnalysis::InductionInfo* trip, |
| 284 | HGraph* graph, |
| 285 | HBasicBlock* block, |
| 286 | /*out*/HInstruction** result) const; |
| 287 | |
Aart Bik | df7822e | 2016-12-06 10:05:30 -0800 | [diff] [blame] | 288 | bool GenerateLastValueWrapAround(HInductionVarAnalysis::InductionInfo* info, |
| 289 | HInductionVarAnalysis::InductionInfo* trip, |
| 290 | HGraph* graph, |
| 291 | HBasicBlock* block, |
| 292 | /*out*/HInstruction** result) const; |
| 293 | |
Aart Bik | 9abf894 | 2016-10-14 09:49:42 -0700 | [diff] [blame] | 294 | bool GenerateLastValuePeriodic(HInductionVarAnalysis::InductionInfo* info, |
| 295 | HInductionVarAnalysis::InductionInfo* trip, |
| 296 | HGraph* graph, |
| 297 | HBasicBlock* block, |
| 298 | /*out*/HInstruction** result, |
| 299 | /*out*/ bool* needs_taken_test) const; |
Aart Bik | aec3cce | 2015-10-14 17:44:55 -0700 | [diff] [blame] | 300 | |
Aart Bik | 7d57d7f | 2015-12-09 14:39:48 -0800 | [diff] [blame] | 301 | bool GenerateCode(HInductionVarAnalysis::InductionInfo* info, |
| 302 | HInductionVarAnalysis::InductionInfo* trip, |
| 303 | HGraph* graph, |
| 304 | HBasicBlock* block, |
Aart Bik | 1fc3afb | 2016-02-02 13:26:16 -0800 | [diff] [blame] | 305 | /*out*/ HInstruction** result, |
Aart Bik | 7d57d7f | 2015-12-09 14:39:48 -0800 | [diff] [blame] | 306 | bool in_body, |
| 307 | bool is_min) const; |
Aart Bik | aec3cce | 2015-10-14 17:44:55 -0700 | [diff] [blame] | 308 | |
Aart Bik | 16d3a65 | 2016-09-09 10:33:50 -0700 | [diff] [blame] | 309 | void ReplaceInduction(HInductionVarAnalysis::InductionInfo* info, |
| 310 | HInstruction* fetch, |
| 311 | HInstruction* replacement); |
| 312 | |
Aart Bik | d14c595 | 2015-09-08 15:25:15 -0700 | [diff] [blame] | 313 | /** Results of prior induction variable analysis. */ |
Aart Bik | 52be7e7 | 2016-06-23 11:20:41 -0700 | [diff] [blame] | 314 | HInductionVarAnalysis* induction_analysis_; |
| 315 | |
| 316 | /** Instruction at which chasing may stop. */ |
| 317 | HInstruction* chase_hint_; |
Aart Bik | d14c595 | 2015-09-08 15:25:15 -0700 | [diff] [blame] | 318 | |
Aart Bik | 22af3be | 2015-09-10 12:50:58 -0700 | [diff] [blame] | 319 | friend class HInductionVarAnalysis; |
Aart Bik | d14c595 | 2015-09-08 15:25:15 -0700 | [diff] [blame] | 320 | friend class InductionVarRangeTest; |
| 321 | |
| 322 | DISALLOW_COPY_AND_ASSIGN(InductionVarRange); |
| 323 | }; |
| 324 | |
| 325 | } // namespace art |
| 326 | |
| 327 | #endif // ART_COMPILER_OPTIMIZING_INDUCTION_VAR_RANGE_H_ |