X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FAnalysis%2FInductionVariable.h;h=26deb832f80770098ce14397cf6c8f8a98f8a3c1;hb=6fbcc26f1460eaee4e0eb8b426fc1ff0c7af11be;hp=951ac05135214ffc2f54dbf81ea5ad82e68a7ec6;hpb=8fc2f2072de83665ae20e06929e28317f449bcdf;p=oota-llvm.git diff --git a/include/llvm/Analysis/InductionVariable.h b/include/llvm/Analysis/InductionVariable.h index 951ac051352..26deb832f80 100644 --- a/include/llvm/Analysis/InductionVariable.h +++ b/include/llvm/Analysis/InductionVariable.h @@ -1,4 +1,11 @@ -//===- llvm/Analysis/InductionVariable.h - Induction variable ----*- C++ -*--=// +//===- llvm/Analysis/InductionVariable.h - Induction variables --*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// // // This interface is used to identify and classify induction variables that // exist in the program. Induction variables must contain a PHI node that @@ -19,6 +26,7 @@ #ifndef LLVM_ANALYSIS_INDUCTIONVARIABLE_H #define LLVM_ANALYSIS_INDUCTIONVARIABLE_H +#include class Value; class PHINode; class Instruction; @@ -27,13 +35,13 @@ class LoopInfo; class Loop; class InductionVariable { public: enum iType { // Identify the type of this induction variable - Cannonical, // Starts at 0, counts by 1 + Canonical, // Starts at 0, counts by 1 SimpleLinear, // Simple linear: Constant start, constant step Linear, // General linear: loop invariant start, and step Unknown, // Unknown type. Start & Step are null } InductionType; - Value *Start, *Step; // Start and step expressions for this indvar + Value *Start, *Step, *End; // Start, step, and end expressions for this indvar PHINode *Phi; // The PHI node that corresponds to this indvar public: @@ -45,6 +53,11 @@ public: // Classify Induction static enum iType Classify(const Value *Start, const Value *Step, const Loop *L = 0); + + // Get number of times this loop will execute. Returns NULL if unpredictable. + Value* getExecutionCount(LoopInfo *LoopInfo); + + void print(std::ostream &OS) const; }; #endif