[llvm-commits] CVS: llvm/lib/Support/APInt.cpp

Reid Spencer rspencer at reidspencer.com
Wed May 16 13:38:47 PDT 2007


On Wed, 2007-05-16 at 13:30 -0700, Chris Lattner wrote:
> > Fix a bug in the "fromString" method where radix 2,8 and 16 values  
> > were
> > not being generated correctly because the shl operator does not  
> > mutate its
> > object but returns a new value. Also, make the distinction between  
> > radix
> > 16 and the others more clear.
> 
> FWIW, I find this part of the API extremely confusing.  What do you  
> think about changing the "in place" operators to not return *this?

Yeah, that might help, but it would break some code, I think. We want to
be able to do things like:

Y = X.zext(25).shr(10)

with your change we'd have to:

X.zext(25)
Y = X.shr(10)

Although, this makes it more clear what's going on because in the first
case, its not clear that X is changing. One might be fooled into
thinking that it wasn't zext.

> That would make it very clear which ones mutate in place and which  
> ones return their result.

Yeah, it would.

Another thing we could do is just make none of them work in-place, but
then that has performance implcations because two temporaries are being
constructed and since these are 12-byte things they don't fit in
registers and consume stack and ...

Reid.

> 
> -Chris
> _______________________________________________
> 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