[llvm-commits] [llvm] r110493 - in /llvm/trunk: include/llvm/Support/ConstantRange.h lib/Support/ConstantRange.cpp

Owen Anderson resistor at mac.com
Fri Aug 6 17:42:06 PDT 2010


Author: resistor
Date: Fri Aug  6 19:42:06 2010
New Revision: 110493

URL: http://llvm.org/viewvc/llvm-project?rev=110493&view=rev
Log:
Add a convenience constructor.

Modified:
    llvm/trunk/include/llvm/Support/ConstantRange.h
    llvm/trunk/lib/Support/ConstantRange.cpp

Modified: llvm/trunk/include/llvm/Support/ConstantRange.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/ConstantRange.h?rev=110493&r1=110492&r2=110493&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/ConstantRange.h (original)
+++ llvm/trunk/include/llvm/Support/ConstantRange.h Fri Aug  6 19:42:06 2010
@@ -37,6 +37,8 @@
 
 namespace llvm {
 
+class ConstantInt;
+
 /// ConstantRange - This class represents an range of values.
 ///
 class ConstantRange {
@@ -52,6 +54,7 @@
   /// Initialize a range to hold the single specified value.
   ///
   ConstantRange(const APInt &Value);
+  ConstantRange(const ConstantInt *Value);
 
   /// @brief Initialize a range of values explicitly. This will assert out if
   /// Lower==Upper and Lower != Min or Max value for its type. It will also

Modified: llvm/trunk/lib/Support/ConstantRange.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/ConstantRange.cpp?rev=110493&r1=110492&r2=110493&view=diff
==============================================================================
--- llvm/trunk/lib/Support/ConstantRange.cpp (original)
+++ llvm/trunk/lib/Support/ConstantRange.cpp Fri Aug  6 19:42:06 2010
@@ -21,6 +21,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "llvm/Constants.h"
 #include "llvm/Support/ConstantRange.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
@@ -39,6 +40,8 @@
 /// Initialize a range to hold the single specified value.
 ///
 ConstantRange::ConstantRange(const APInt & V) : Lower(V), Upper(V + 1) {}
+ConstantRange::ConstantRange(const ConstantInt *V)
+  : Lower(V->getValue()), Upper(V->getValue() + 1) {}
 
 ConstantRange::ConstantRange(const APInt &L, const APInt &U) :
   Lower(L), Upper(U) {





More information about the llvm-commits mailing list