[llvm-commits] CVS: llvm/include/llvm/Constants.h

Reid Spencer reid at x10sys.com
Wed Dec 6 13:24:35 PST 2006


On Wed, 2006-12-06 at 13:20 -0800, Chris Lattner wrote:
> On Dec 6, 2006, at 12:30 PM, Reid Spencer wrote:
> 
> >
> >
> > Changes in directory llvm/include/llvm:
> >
> > Constants.h updated: 1.103 -> 1.104
> > ---
> > Log message:
> >
> > For PR950: http://llvm.org/PR950 :
> > Remove the getMaxValue and getMinValue functions from  
> > ConstantIntegral.
> > They don't make sense for a signless type. Also, for isMaxValue and
> > isMinValue, have the caller provided the signedness rather than  
> > obtaining
> > it from the constant's type.
> 
> Nice, is there any reason for these to remain virtual?

Yes, because I'm scared of breaking things badly? :)

I'll give it a whirl.

> 
> -Chris
> 
> >
> > ---
> > Diffs of the changes:  (+8 -16)
> >
> >  Constants.h |   24 ++++++++----------------
> >  1 files changed, 8 insertions(+), 16 deletions(-)
> >
> >
> > Index: llvm/include/llvm/Constants.h
> > diff -u llvm/include/llvm/Constants.h:1.103 llvm/include/llvm/ 
> > Constants.h:1.104
> > --- llvm/include/llvm/Constants.h:1.103	Tue Dec  5 13:14:13 2006
> > +++ llvm/include/llvm/Constants.h	Wed Dec  6 14:30:17 2006
> > @@ -75,14 +75,14 @@
> >    /// constant's type.
> >    /// @returns true if the constant's value is maximal.
> >    /// @brief Determine if the value is maximal.
> > -  virtual bool isMaxValue() const = 0;
> > +  virtual bool isMaxValue(bool isSigned) const = 0;
> >
> >    /// This function is implemented by subclasses and will return  
> > true iff this
> >    /// constant represents the smallest value that may be  
> > represented by this
> >    /// constant's type.
> >    /// @returns true if the constant's value is minimal
> >    /// @brief Determine if the value is minimal.
> > -  virtual bool isMinValue() const = 0;
> > +  virtual bool isMinValue(bool isSigned) const = 0;
> >
> >    /// This function is implemented by subclasses and will return  
> > true iff every
> >    /// bit in this constant is set to true.
> > @@ -90,14 +90,6 @@
> >    /// @brief Determine if the value is all ones.
> >    virtual bool isAllOnesValue() const = 0;
> >
> > -  /// @returns the largest value for an integer constant of the  
> > given type
> > -  /// @brief Get the maximal value
> > -  static ConstantIntegral *getMaxValue(const Type *Ty);
> > -
> > -  /// @returns the smallest value for an integer constant of the  
> > given type
> > -  /// @brief Get the minimal value
> > -  static ConstantIntegral *getMinValue(const Type *Ty);
> > -
> >    /// @returns the value for an integer constant of the given type  
> > that has all
> >    /// its bits set to true.
> >    /// @brief Get the all ones value
> > @@ -147,8 +139,8 @@
> >    /// @see ConstantIntegral for details
> >    /// @brief Implement overrides
> >    virtual bool isNullValue() const { return getValue() == false; }
> > -  virtual bool isMaxValue() const { return getValue() == true; }
> > -  virtual bool isMinValue() const { return getValue() == false; }
> > +  virtual bool isMaxValue(bool isSigned) const { return getValue()  
> > == true; }
> > +  virtual bool isMinValue(bool isSigned) const { return getValue()  
> > == false; }
> >    virtual bool isAllOnesValue() const { return getValue() == true; }
> >
> >    /// @brief Methods to support type inquiry through isa, cast,  
> > and dyn_cast:
> > @@ -208,8 +200,8 @@
> >    /// by this type.
> >    /// @see ConstantIntegeral
> >    /// @brief Override implementation
> > -  virtual bool isMaxValue() const {
> > -    if (getType()->isSigned()) {
> > +  virtual bool isMaxValue(bool isSigned) const {
> > +    if (isSigned) {
> >        int64_t V = getSExtValue();
> >        if (V < 0) return false;    // Be careful about wrap-around  
> > on 'long's
> >        ++V;
> > @@ -222,8 +214,8 @@
> >    /// this type.
> >    /// @see ConstantIntegral
> >    /// @brief Override implementation
> > -  virtual bool isMinValue() const {
> > -    if (getType()->isSigned()) {
> > +  virtual bool isMinValue(bool isSigned) const {
> > +    if (isSigned) {
> >        int64_t V = getSExtValue();
> >        if (V > 0) return false;    // Be careful about wrap-around  
> > on 'long's
> >        --V;
> >
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20061206/a4b41ad4/attachment.sig>


More information about the llvm-commits mailing list