- if (isSigned) {
- int64_t V = getSExtValue();
- if (V > 0) return false; // Be careful about wrap-around on 'long's
- --V;
- return !isValueValidForType(Value::getType(), V) || V > 0;
- }
- return getZExtValue() == 0;
+ if (isSigned)
+ return Val.isMinSignedValue();
+ else
+ return Val.isMinValue();
+ }
+
+ /// This function will return true iff this constant represents a value with
+ /// active bits bigger than 64 bits or a value greater than the given uint64_t
+ /// value.
+ /// @returns true iff this constant is greater or equal to the given number.
+ /// @brief Determine if the value is greater or equal to the given number.
+ bool uge(uint64_t Num) {
+ return Val.getActiveBits() > 64 || Val.getZExtValue() >= Num;
+ }
+
+ /// @returns the 64-bit value of this constant if its active bits number is
+ /// not greater than 64, otherwise, just return the given uint64_t number.
+ /// @brief Get the constant's value if possible.
+ uint64_t getLimitedValue(uint64_t Limit = ~0ULL) const {
+ return Val.getLimitedValue(Limit);