summaryrefslogtreecommitdiff
path: root/compiler/optimizing/induction_var_range.h
diff options
context:
space:
mode:
author Aart Bik <ajcbik@google.com> 2017-02-28 14:41:55 -0800
committer Aart Bik <ajcbik@google.com> 2017-03-01 11:14:05 -0800
commit8e02e3e77ff8ac7a80e25689750b4d329593e12a (patch)
treef8201a2def0d3f9c05b05ddcb8ab338f84169ab7 /compiler/optimizing/induction_var_range.h
parente0aa5beef7419b8c9ab5d3dc93553ef2b30d126c (diff)
New utilities for induction variables.
Rationale: Break-out CL of ART Vectorizer: 2 OF many. The purpose is making the original CL smaller and easier to review. Bug: 34083438 Test: test-art-host Change-Id: I46d297eba504af3850a5998ee279ea9f7b38bed8
Diffstat (limited to 'compiler/optimizing/induction_var_range.h')
-rw-r--r--compiler/optimizing/induction_var_range.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/compiler/optimizing/induction_var_range.h b/compiler/optimizing/induction_var_range.h
index 6c424b78b9..0858d73982 100644
--- a/compiler/optimizing/induction_var_range.h
+++ b/compiler/optimizing/induction_var_range.h
@@ -24,7 +24,8 @@ namespace art {
/**
* This class implements range analysis on expressions within loops. It takes the results
* of induction variable analysis in the constructor and provides a public API to obtain
- * a conservative lower and upper bound value on each instruction in the HIR.
+ * a conservative lower and upper bound value or last value on each instruction in the HIR.
+ * The public API also provides a few general-purpose utility methods related to induction.
*
* The range analysis is done with a combination of symbolic and partial integral evaluation
* of expressions. The analysis avoids complications with wrap-around arithmetic on the integral
@@ -154,6 +155,19 @@ class InductionVarRange {
*/
bool IsFinite(HLoopInformation* loop, /*out*/ int64_t* tc) const;
+ /**
+ * Checks if instruction is a unit stride induction inside the closest enveloping loop.
+ * Returns invariant offset on success.
+ */
+ bool IsUnitStride(HInstruction* instruction, /*out*/ HInstruction** offset) const;
+
+ /**
+ * Generates the trip count expression for the given loop. Code is generated in given block
+ * and graph. The expression is guarded by a taken test if needed. Returns the trip count
+ * expression on success or null otherwise.
+ */
+ HInstruction* GenerateTripCount(HLoopInformation* loop, HGraph* graph, HBasicBlock* block);
+
private:
/*
* Enum used in IsConstant() request.