Note to self: SAVE FILES!
[oota-llvm.git] / include / llvm / Analysis / Expressions.h
index 0471fb21a677ff1a50f95820078093c80bc4a5b2..8b02b14538618568a32ad04657fbe96e63bb90a2 100644 (file)
@@ -1,32 +1,39 @@
-//===- llvm/Analysis/Expressions.h - Expression Analysis Utils ---*- C++ -*--=//
+//===- llvm/Analysis/Expressions.h - Expression Analysis Utils --*- 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 file defines a package of expression analysis utilties:
 //
-// ClassifyExpression: Analyze an expression to determine the complexity of the
-//   expression, and which other variables it depends on.  
+// ClassifyExpr: Analyze an expression to determine the complexity of the
+// expression, and which other variables it depends on.
 // 
 //===----------------------------------------------------------------------===//
 
 #ifndef LLVM_ANALYSIS_EXPRESSIONS_H
 #define LLVM_ANALYSIS_EXPRESSIONS_H
 
-#include <assert.h>
-class Value;
-class ConstPoolInt;
+namespace llvm {
 
-namespace analysis {
+class Type;
+class Value;
+class ConstantInt;
 
 struct ExprType;
 
-// ClassifyExpression: Analyze an expression to determine the complexity of the
-// expression, and which other values it depends on.  
-//
-ExprType ClassifyExpression(Value *Expr);
+/// ClassifyExpr - Analyze an expression to determine the complexity of the
+/// expression, and which other values it depends on.
+///
+ExprType ClassifyExpr(Value *Expr);
 
-// ExprType - Represent an expression of the form CONST*VAR+CONST
-// or simpler.  The expression form that yields the least information about the
-// expression is just the Linear form with no offset.
-//
+/// ExprType Class - Represent an expression of the form CONST*VAR+CONST
+/// or simpler.  The expression form that yields the least information about the
+/// expression is just the Linear form with no offset.
+///
 struct ExprType {
   enum ExpressionType {
     Constant,            // Expr is a simple constant, Offset is value
@@ -34,25 +41,23 @@ struct ExprType {
     ScaledLinear,        // Expr is scaled linear exp, Value is Scale*Var+Offset
   } ExprTy;
 
-  const ConstPoolInt *Offset;  // Offset of expr, or null if 0
-  Value              *Var;     // Var referenced, if Linear or above (null if 0)
-  const ConstPoolInt *Scale;   // Scale of var if ScaledLinear expr (null if 1)
+  const ConstantInt *Offset;  // Offset of expr, or null if 0
+  Value             *Var;     // Var referenced, if Linear or above (null if 0)
+  const ConstantInt *Scale;   // Scale of var if ScaledLinear expr (null if 1)
 
-  inline ExprType(const ConstPoolInt *CPV = 0) {
+  inline ExprType(const ConstantInt *CPV = 0) {
     Offset = CPV; Var = 0; Scale = 0;
     ExprTy = Constant;
   }
-  inline ExprType(Value *Val) {
-    Var = Val; Offset = Scale = 0;
-    ExprTy = Var ? Linear : Constant;
-  }
-  inline ExprType(const ConstPoolInt *scale, Value *var, 
-                 const ConstPoolInt *offset) {
-    Scale = scale; Var = var; Offset = offset;
-    ExprTy = Scale ? ScaledLinear : (Var ? Linear : Constant);
-  }
+  ExprType(Value *Val);        // Create a linear or constant expression
+  ExprType(const ConstantInt *scale, Value *var, const ConstantInt *offset);
+
+  /// If this expression has an intrinsic type, return it.  If it is zero,
+  /// return the specified type.
+  ///
+  const Type *getExprType(const Type *Default) const;
 };
 
-} // End namespace analysis
+} // End llvm namespace
 
 #endif