[llvm-commits] CVS: llvm/include/llvm/CodeGen/ValueTypes.h
Chris Lattner
lattner at cs.uiuc.edu
Tue Feb 7 18:05:58 PST 2006
Changes in directory llvm/include/llvm/CodeGen:
ValueTypes.h updated: 1.16 -> 1.17
---
Log message:
Add some happy helper methods.
---
Diffs of the changes: (+15 -1)
ValueTypes.h | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletion(-)
Index: llvm/include/llvm/CodeGen/ValueTypes.h
diff -u llvm/include/llvm/CodeGen/ValueTypes.h:1.16 llvm/include/llvm/CodeGen/ValueTypes.h:1.17
--- llvm/include/llvm/CodeGen/ValueTypes.h:1.16 Thu Dec 29 18:09:56 2005
+++ llvm/include/llvm/CodeGen/ValueTypes.h Tue Feb 7 20:05:45 2006
@@ -17,6 +17,7 @@
#define LLVM_CODEGEN_VALUETYPES_H
#include <cassert>
+#include "llvm/Support/DataTypes.h"
namespace llvm {
class Type;
@@ -67,7 +68,7 @@
static inline bool isVector(ValueType VT) {
return (VT >= v16i8 && VT <= v2f64);
}
-
+
/// getVectorType - Returns the ValueType that represents a vector NumElements
/// in length, where each element is of type VT. If there is no ValueType
/// that represents this vector, a ValueType of Other is returned.
@@ -107,6 +108,19 @@
case MVT::v2f64: return 128;
}
}
+
+ /// getIntVTBitMask - Return an integer with 1's every place there are bits
+ /// in the specified integer value type.
+ static inline uint64_t getIntVTBitMask(ValueType VT) {
+ assert(isInteger(VT) && !isVector(VT) && "Only applies to int scalars!");
+ return ~0ULL >> (64-getSizeInBits(VT));
+ }
+ /// getIntVTSignBit - Return an integer with a 1 in the position of the sign
+ /// bit for the specified integer value type.
+ static inline uint64_t getIntVTSignBit(ValueType VT) {
+ assert(isInteger(VT) && !isVector(VT) && "Only applies to int scalars!");
+ return 1ULL << (getSizeInBits(VT)-1);
+ }
/// MVT::getValueTypeString - This function returns value type as a string,
/// e.g. "i32".
More information about the llvm-commits
mailing list