diff options
| author | Nick Lewycky <nicholas@mxc.ca> | 2009-09-27 21:33:04 +0000 |
|---|---|---|
| committer | Nick Lewycky <nicholas@mxc.ca> | 2009-09-27 21:33:04 +0000 |
| commit | 28a5f25d87d08c074771c97bbd8e6e75d9661cb2 (patch) | |
| tree | 86c56bfe9d6009ad498ce94b15a0c75037fbfdae /llvm | |
| parent | 466d57f6c1e8b7c016119cc9e3b59ffb7da80b0c (diff) | |
| download | bcm5719-llvm-28a5f25d87d08c074771c97bbd8e6e75d9661cb2.tar.gz bcm5719-llvm-28a5f25d87d08c074771c97bbd8e6e75d9661cb2.zip | |
Round out the API for the new optimization flags.
llvm-svn: 82930
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/include/llvm/InstrTypes.h | 15 | ||||
| -rw-r--r-- | llvm/include/llvm/Instructions.h | 5 | ||||
| -rw-r--r-- | llvm/lib/VMCore/Instructions.cpp | 16 |
3 files changed, 32 insertions, 4 deletions
diff --git a/llvm/include/llvm/InstrTypes.h b/llvm/include/llvm/InstrTypes.h index 6d6d0bae29b..cc923dec298 100644 --- a/llvm/include/llvm/InstrTypes.h +++ b/llvm/include/llvm/InstrTypes.h @@ -311,17 +311,26 @@ public: /// setHasNoUnsignedWrap - Set or clear the nsw flag on this instruction, /// which must be an operator which supports this flag. See LangRef.html /// for the meaning of this flag. - void setHasNoUnsignedWrap(bool); + void setHasNoUnsignedWrap(bool b = true); /// setHasNoSignedWrap - Set or clear the nsw flag on this instruction, /// which must be an operator which supports this flag. See LangRef.html /// for the meaning of this flag. - void setHasNoSignedWrap(bool); + void setHasNoSignedWrap(bool b = true); /// setIsExact - Set or clear the exact flag on this instruction, /// which must be an operator which supports this flag. See LangRef.html /// for the meaning of this flag. - void setIsExact(bool); + void setIsExact(bool b = true); + + /// hasNoUnsignedWrap - Determine whether the no unsigned wrap flag is set. + bool hasNoUnsignedWrap() const; + + /// hasNoSignedWrap - Determine whether the no signed wrap flag is set. + bool hasNoSignedWrap() const; + + /// isExact - Determine whether the exact flag is set. + bool isExact() const; // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const BinaryOperator *) { return true; } diff --git a/llvm/include/llvm/Instructions.h b/llvm/include/llvm/Instructions.h index 51ea50af3bd..c71d64ab072 100644 --- a/llvm/include/llvm/Instructions.h +++ b/llvm/include/llvm/Instructions.h @@ -604,7 +604,10 @@ public: /// setIsInBounds - Set or clear the inbounds flag on this GEP instruction. /// See LangRef.html for the meaning of inbounds on a getelementptr. - void setIsInBounds(bool); + void setIsInBounds(bool b = true); + + /// isInBounds - Determine whether the GEP has the inbounds flag. + bool isInBounds() const; // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const GetElementPtrInst *) { return true; } diff --git a/llvm/lib/VMCore/Instructions.cpp b/llvm/lib/VMCore/Instructions.cpp index 1300e5fa259..c2fddfa3477 100644 --- a/llvm/lib/VMCore/Instructions.cpp +++ b/llvm/lib/VMCore/Instructions.cpp @@ -1282,6 +1282,10 @@ void GetElementPtrInst::setIsInBounds(bool B) { cast<GEPOperator>(this)->setIsInBounds(B); } +bool GetElementPtrInst::isInBounds() const { + return cast<GEPOperator>(this)->isInBounds(); +} + //===----------------------------------------------------------------------===// // ExtractElementInst Implementation //===----------------------------------------------------------------------===// @@ -1838,6 +1842,18 @@ void BinaryOperator::setIsExact(bool b) { cast<SDivOperator>(this)->setIsExact(b); } +bool BinaryOperator::hasNoUnsignedWrap() const { + return cast<OverflowingBinaryOperator>(this)->hasNoUnsignedWrap(); +} + +bool BinaryOperator::hasNoSignedWrap() const { + return cast<OverflowingBinaryOperator>(this)->hasNoSignedWrap(); +} + +bool BinaryOperator::isExact() const { + return cast<SDivOperator>(this)->isExact(); +} + //===----------------------------------------------------------------------===// // CastInst Class //===----------------------------------------------------------------------===// |

