[llvm-commits] [llvm] r82930 - in /llvm/trunk: include/llvm/InstrTypes.h include/llvm/Instructions.h lib/VMCore/Instructions.cpp

Nick Lewycky nicholas at mxc.ca
Sun Sep 27 14:33:04 PDT 2009


Author: nicholas
Date: Sun Sep 27 16:33:04 2009
New Revision: 82930

URL: http://llvm.org/viewvc/llvm-project?rev=82930&view=rev
Log:
Round out the API for the new optimization flags.

Modified:
    llvm/trunk/include/llvm/InstrTypes.h
    llvm/trunk/include/llvm/Instructions.h
    llvm/trunk/lib/VMCore/Instructions.cpp

Modified: llvm/trunk/include/llvm/InstrTypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/InstrTypes.h?rev=82930&r1=82929&r2=82930&view=diff

==============================================================================
--- llvm/trunk/include/llvm/InstrTypes.h (original)
+++ llvm/trunk/include/llvm/InstrTypes.h Sun Sep 27 16:33:04 2009
@@ -311,17 +311,26 @@
   /// 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; }

Modified: llvm/trunk/include/llvm/Instructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=82930&r1=82929&r2=82930&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Instructions.h (original)
+++ llvm/trunk/include/llvm/Instructions.h Sun Sep 27 16:33:04 2009
@@ -604,7 +604,10 @@
 
   /// 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; }

Modified: llvm/trunk/lib/VMCore/Instructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=82930&r1=82929&r2=82930&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/Instructions.cpp (original)
+++ llvm/trunk/lib/VMCore/Instructions.cpp Sun Sep 27 16:33:04 2009
@@ -1282,6 +1282,10 @@
   cast<GEPOperator>(this)->setIsInBounds(B);
 }
 
+bool GetElementPtrInst::isInBounds() const {
+  return cast<GEPOperator>(this)->isInBounds();
+}
+
 //===----------------------------------------------------------------------===//
 //                           ExtractElementInst Implementation
 //===----------------------------------------------------------------------===//
@@ -1838,6 +1842,18 @@
   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
 //===----------------------------------------------------------------------===//





More information about the llvm-commits mailing list