Crash less. The i64 restriction in BinomialCoefficient caused some problems
[oota-llvm.git] / include / llvm / Analysis / ValueTracking.h
1 //===- llvm/Analysis/ValueTracking.h - Walk computations --------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains routines that help analyze properties that chains of
11 // computations have.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_ANALYSIS_VALUETRACKING_H
16 #define LLVM_ANALYSIS_VALUETRACKING_H
17
18 namespace llvm {
19   class Value;
20   class APInt;
21   class TargetData;
22   
23   /// ComputeMaskedBits - Determine which of the bits specified in Mask are
24   /// known to be either zero or one and return them in the KnownZero/KnownOne
25   /// bit sets.  This code only analyzes bits in Mask, in order to short-circuit
26   /// processing.
27   void ComputeMaskedBits(Value *V, const APInt &Mask, APInt &KnownZero,
28                          APInt &KnownOne, TargetData *TD = 0,
29                          unsigned Depth = 0);
30   
31   /// MaskedValueIsZero - Return true if 'V & Mask' is known to be zero.  We use
32   /// this predicate to simplify operations downstream.  Mask is known to be
33   /// zero for bits that V cannot have.
34   bool MaskedValueIsZero(Value *V, const APInt &Mask, 
35                          TargetData *TD = 0, unsigned Depth = 0);
36
37   
38   /// ComputeNumSignBits - Return the number of times the sign bit of the
39   /// register is replicated into the other bits.  We know that at least 1 bit
40   /// is always equal to the sign bit (itself), but other cases can give us
41   /// information.  For example, immediately after an "ashr X, 2", we know that
42   /// the top 3 bits are all equal to each other, so we return 3.
43   ///
44   /// 'Op' must have a scalar integer type.
45   ///
46   unsigned ComputeNumSignBits(Value *Op, TargetData *TD = 0,
47                               unsigned Depth = 0);
48
49   /// CannotBeNegativeZero - Return true if we can prove that the specified FP 
50   /// value is never equal to -0.0.
51   ///
52   bool CannotBeNegativeZero(const Value *V, unsigned Depth = 0);
53 } // end namespace llvm
54
55 #endif