00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef LLVM_ANALYSIS_VALUETRACKING_H
00016 #define LLVM_ANALYSIS_VALUETRACKING_H
00017
00018 #include "llvm/System/DataTypes.h"
00019 #include <string>
00020
00021 namespace llvm {
00022 template <typename T> class SmallVectorImpl;
00023 class Value;
00024 class Instruction;
00025 class APInt;
00026 class TargetData;
00027
00038 void ComputeMaskedBits(Value *V, const APInt &Mask, APInt &KnownZero,
00039 APInt &KnownOne, const TargetData *TD = 0,
00040 unsigned Depth = 0);
00041
00051 bool MaskedValueIsZero(Value *V, const APInt &Mask,
00052 const TargetData *TD = 0, unsigned Depth = 0);
00053
00054
00063 unsigned ComputeNumSignBits(Value *Op, const TargetData *TD = 0,
00064 unsigned Depth = 0);
00065
00071 bool ComputeMultiple(Value *V, unsigned Base, Value *&Multiple,
00072 bool LookThroughSExt = false,
00073 unsigned Depth = 0);
00074
00078 bool CannotBeNegativeZero(const Value *V, unsigned Depth = 0);
00079
00094 const Value *DecomposeGEPExpression(const Value *V, int64_t &BaseOffs,
00095 SmallVectorImpl<std::pair<const Value*, int64_t> > &VarIndices,
00096 const TargetData *TD);
00097
00098
00099
00106 Value *FindInsertedValue(Value *V,
00107 const unsigned *idx_begin,
00108 const unsigned *idx_end,
00109 Instruction *InsertBefore = 0);
00110
00113 inline Value *FindInsertedValue(Value *V, const unsigned Idx,
00114 Instruction *InsertBefore = 0) {
00115 const unsigned Idxs[1] = { Idx };
00116 return FindInsertedValue(V, &Idxs[0], &Idxs[1], InsertBefore);
00117 }
00118
00125 bool GetConstantStringInfo(Value *V, std::string &Str, uint64_t Offset = 0,
00126 bool StopAtNul = true);
00127
00130 uint64_t GetStringLength(Value *V);
00131 }
00132
00133 #endif