diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-01-18 02:59:54 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-01-18 02:59:54 +0000 |
commit | 7808dcba055f9770db119663f30efc504ad7edfa (patch) | |
tree | 0d2d8cb99bf486b9c0770bc8694add9641a09011 /lib | |
parent | 39e9c09763d06b3c2133bcf0d8fec02120d63b93 (diff) |
Provide an isPowerOf2ByteWidth method for the IntegerType class. This will
mostly be used by back ends that wish to distinguish between integer types
that fit evenly within a natural integer type and those that don't.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33328 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/VMCore/Type.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp index 00e97520b7..b41d1a0414 100644 --- a/lib/VMCore/Type.cpp +++ b/lib/VMCore/Type.cpp @@ -975,6 +975,11 @@ const IntegerType *IntegerType::get(unsigned NumBits) { return ITy; } +bool IntegerType::isPowerOf2ByteWidth() const { + unsigned BitWidth = getBitWidth(); + return (BitWidth > 7 && Log2_32(BitWidth) == Log2_32_Ceil(BitWidth)); +} + // FunctionValType - Define a class to hold the key that goes into the TypeMap // namespace llvm { |