[llvm-commits] CVS: llvm/include/llvm/DerivedTypes.h
Reid Spencer
rspencer at reidspencer.com
Sun Mar 4 15:45:39 PST 2007
Hi Chris,
On Sun, 2007-03-04 at 17:33 -0600, Chris Lattner wrote:
>
> Changes in directory llvm/include/llvm:
>
> DerivedTypes.h updated: 1.86 -> 1.87
> ---
> Log message:
>
> add a getSignBit method, elimiante virtual method from getBitMask()
>
>
> ---
> Diffs of the changes: (+7 -1)
>
> DerivedTypes.h | 8 +++++++-
> 1 files changed, 7 insertions(+), 1 deletion(-)
>
>
> Index: llvm/include/llvm/DerivedTypes.h
> diff -u llvm/include/llvm/DerivedTypes.h:1.86 llvm/include/llvm/DerivedTypes.h:1.87
> --- llvm/include/llvm/DerivedTypes.h:1.86 Wed Feb 28 22:02:06 2007
> +++ llvm/include/llvm/DerivedTypes.h Sun Mar 4 17:33:19 2007
> @@ -106,9 +106,15 @@
> /// that can be set by an unsigned version of this type. This is 0xFF for
> /// sbyte/ubyte, 0xFFFF for shorts, etc.
> uint64_t getBitMask() const {
> - return ~uint64_t(0UL) >> (64-getPrimitiveSizeInBits());
> + return ~uint64_t(0UL) >> (64-getBitWidth());
> }
>
> + /// getSignBit - Return a uint64_t with just the most significant bit set (the
> + /// sign bit, if the value is treated as a signed number).
> + uint64_t getSignBit() const {
> + return 1ULL << (getBitWidth()-1);
> + }
> +
I'm trying to get rid of such functions and you're adding more of
them :)
Please note that in many places (like the place you intend to use
getSignBit), it may be necessary to use APInt::getSignedMinValue() for
this value to enable it to work with > 64 bits. The exception to this is
GEP indexing which are known to be 32/64 bit indices. If your use is
similar, I suppose this is fine. If not, please note that when
InstructionCombining is done (Sheng's working on it), I intend to pass
through LLVM and get rid of calls to both of these functions, if
appropriate.
Reid.
> /// For example, this is 0xFF for an 8 bit integer, 0xFFFF for i16, etc.
> /// @returns a bit mask with ones set for all the bits of this type.
> /// @brief Get a bit mask for this type.
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list