diff options
author | Owen Anderson <resistor@mac.com> | 2010-08-07 00:42:06 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2010-08-07 00:42:06 +0000 |
commit | 07d063700048982b4c62d6b3460d22d88e11a3ea (patch) | |
tree | 7d3b28a34ad650ac1dbff8f1acd92353729a7968 | |
parent | 71b30e0db63ccae5da794edd787e89841bd28bc7 (diff) | |
download | bcm5719-llvm-07d063700048982b4c62d6b3460d22d88e11a3ea.tar.gz bcm5719-llvm-07d063700048982b4c62d6b3460d22d88e11a3ea.zip |
Add a convenience constructor.
llvm-svn: 110493
-rw-r--r-- | llvm/include/llvm/Support/ConstantRange.h | 3 | ||||
-rw-r--r-- | llvm/lib/Support/ConstantRange.cpp | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/llvm/include/llvm/Support/ConstantRange.h b/llvm/include/llvm/Support/ConstantRange.h index 607a94fb4b5..1187cfd9494 100644 --- a/llvm/include/llvm/Support/ConstantRange.h +++ b/llvm/include/llvm/Support/ConstantRange.h @@ -37,6 +37,8 @@ namespace llvm { +class ConstantInt; + /// ConstantRange - This class represents an range of values. /// class ConstantRange { @@ -52,6 +54,7 @@ public: /// 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 diff --git a/llvm/lib/Support/ConstantRange.cpp b/llvm/lib/Support/ConstantRange.cpp index 2746f7aaaa5..fb0442823c4 100644 --- a/llvm/lib/Support/ConstantRange.cpp +++ b/llvm/lib/Support/ConstantRange.cpp @@ -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 @@ ConstantRange::ConstantRange(uint32_t BitWidth, bool Full) { /// 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) { |