diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-01-21 00:29:26 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-01-21 00:29:26 +0000 |
commit | 24d6da5fedcf39891f7d8c5b031c01324b3db545 (patch) | |
tree | e7fd1eac07e11c2f15075d23f3c07a5ff48ff1cd /include | |
parent | 67f827ce5ba1296db9051892b4a8e10920053933 (diff) |
For PR970:
Clean up handling of isFloatingPoint() and dealing with PackedType.
Patch by Gordon Henriksen!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33415 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Analysis/ScalarEvolutionExpander.h | 3 | ||||
-rw-r--r-- | include/llvm/Constants.h | 7 | ||||
-rw-r--r-- | include/llvm/Support/PatternMatch.h | 31 |
3 files changed, 7 insertions, 34 deletions
diff --git a/include/llvm/Analysis/ScalarEvolutionExpander.h b/include/llvm/Analysis/ScalarEvolutionExpander.h index 80e0a9d8cf..fad2da9b9b 100644 --- a/include/llvm/Analysis/ScalarEvolutionExpander.h +++ b/include/llvm/Analysis/ScalarEvolutionExpander.h @@ -60,8 +60,7 @@ namespace llvm { /// loop (inserting one if there is none). A canonical induction variable /// starts at zero and steps by one on each iteration. Value *getOrInsertCanonicalInductionVariable(const Loop *L, const Type *Ty){ - assert((Ty->isInteger() || Ty->isFloatingPoint()) && - "Can only insert integer or floating point induction variables!"); + assert(Ty->isInteger() && "Can only insert integer induction variables!"); SCEVHandle H = SCEVAddRecExpr::get(SCEVUnknown::getIntegerSCEV(0, Ty), SCEVUnknown::getIntegerSCEV(1, Ty), L); return expand(H); diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h index 5a17f39887..c92229e879 100644 --- a/include/llvm/Constants.h +++ b/include/llvm/Constants.h @@ -36,7 +36,7 @@ template<class ConstantClass, class TypeClass> struct ConvertConstantType; //===----------------------------------------------------------------------===// -/// This is the shared class of boolean and integrer constants. This class +/// This is the shared class of boolean and integer constants. This class /// represents both boolean and integral constants. /// @brief Class for constant integers. class ConstantInt : public Constant { @@ -585,6 +585,11 @@ public: static Constant *getInsertElement(Constant *Vec, Constant *Elt,Constant *Idx); static Constant *getShuffleVector(Constant *V1, Constant *V2, Constant *Mask); + /// Floating point negation must be implemented with f(x) = -0.0 - x. This + /// method returns the negative zero constant for floating point or packed + /// floating point types; for all other types, it returns the null value. + static Constant *getZeroValueForNegationExpr(const Type *Ty); + /// isNullValue - Return true if this is the value that would be returned by /// getNullValue. virtual bool isNullValue() const { return false; } diff --git a/include/llvm/Support/PatternMatch.h b/include/llvm/Support/PatternMatch.h index f0acbcbaa6..97e9b5f961 100644 --- a/include/llvm/Support/PatternMatch.h +++ b/include/llvm/Support/PatternMatch.h @@ -306,37 +306,6 @@ m_FCmp(FCmpInst::Predicate &Pred, const LHS &L, const RHS &R) { // template<typename LHS_t> -struct neg_match { - LHS_t L; - - neg_match(const LHS_t &LHS) : L(LHS) {} - - template<typename OpTy> - bool match(OpTy *V) { - if (Instruction *I = dyn_cast<Instruction>(V)) - if (I->getOpcode() == Instruction::Sub) - return matchIfNeg(I->getOperand(0), I->getOperand(1)); - if (ConstantExpr *CE = dyn_cast<ConstantExpr>(V)) - if (CE->getOpcode() == Instruction::Sub) - return matchIfNeg(CE->getOperand(0), CE->getOperand(1)); - if (ConstantInt *CI = dyn_cast<ConstantInt>(V)) - return L.match(ConstantExpr::getNeg(CI)); - return false; - } -private: - bool matchIfNeg(Value *LHS, Value *RHS) { - if (!LHS->getType()->isFloatingPoint()) - return LHS == Constant::getNullValue(LHS->getType()) && L.match(RHS); - else - return LHS == ConstantFP::get(LHS->getType(), -0.0) && L.match(RHS); - } -}; - -template<typename LHS> -inline neg_match<LHS> m_Neg(const LHS &L) { return L; } - - -template<typename LHS_t> struct not_match { LHS_t L; |