Re: [llvm-commits] CVS: llvm/include/llvm/ADT/SmallVector.h

2007-06-29 Thread Chris Lattner
 Add a default parameter to a SmallVector constructor to allow it to
 be called with just an initial length value, just like in std::vector.

Ok.

Should this be marked 'explicit'?

-Chris


 ---
 Diffs of the changes:  (+1 -1)

  SmallVector.h |2 +-
  1 files changed, 1 insertion(+), 1 deletion(-)


 Index: llvm/include/llvm/ADT/SmallVector.h
 diff -u llvm/include/llvm/ADT/SmallVector.h:1.30 llvm/include/llvm/ 
 ADT/SmallVector.h:1.31
 --- llvm/include/llvm/ADT/SmallVector.h:1.30  Thu May 17 15:01:40 2007
 +++ llvm/include/llvm/ADT/SmallVector.h   Thu Jun 28 15:27:24 2007
 @@ -442,7 +442,7 @@
SmallVector() : SmallVectorImplT(NumTsAvailable) {
}

 -  SmallVector(unsigned Size, const T Value)
 +  SmallVector(unsigned Size, const T Value = T())
  : SmallVectorImplT(NumTsAvailable) {
  this-reserve(Size);
  while (Size--)



 ___
 llvm-commits mailing list
 llvm-commits@cs.uiuc.edu
 http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] CVS: llvm/include/llvm/ADT/SmallVector.h

2007-06-29 Thread Dan Gohman
 Add a default parameter to a SmallVector constructor to allow it to
 be called with just an initial length value, just like in std::vector.
 
 Ok.
 
 Should this be marked 'explicit'?

Yep. Good catch.

Dan

-- 
Dan Gohman, Cray Inc.
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] CVS: llvm/include/llvm/ADT/SmallVector.h

2006-10-09 Thread Reid Spencer
Andrew, 
...
On Mon, 2006-10-09 at 14:05 -0500, Andrew Lenharth wrote:
 
 Changes in directory llvm/include/llvm/ADT:
 
 SmallVector.h updated: 1.19 - 1.20
 ---
 Log message:
 
 Fix build error in gcc 3.4 and make more this general

This compiled on my 3.4.6 compiler on Linux just fine before the patch.
What was the error you were trying to fix?

 
 ---
 Diffs of the changes:  (+1 -1)
 
  SmallVector.h |2 +-
  1 files changed, 1 insertion(+), 1 deletion(-)
 
 
 Index: llvm/include/llvm/ADT/SmallVector.h
 diff -u llvm/include/llvm/ADT/SmallVector.h:1.19 
 llvm/include/llvm/ADT/SmallVector.h:1.20
 --- llvm/include/llvm/ADT/SmallVector.h:1.19  Sun Oct  8 17:28:34 2006
 +++ llvm/include/llvm/ADT/SmallVector.h   Mon Oct  9 14:05:44 2006
 @@ -35,7 +35,7 @@
  protected:
  #ifdef __GNUC__
typedef char U;
 -  U FirstEl __attribute__((aligned(__alignof__(double;
 +  U FirstEl __attribute__((aligned));

Are you sure this is right?  In section 5.31 of the GCC Manual it
indicates that if an alignment size is not given with the aligned
attribute keyword then it defaults to:

the maximum useful alignment for the target machine you are compiling
for. Whenever you leave out the alignment factor in an `aligned'
attribute specification, the compiler automatically sets the alignment
for the declared variable or field to the largest alignment which is
ever used for any data type on the target machine you are compiling
for.

Is this what we want here?

Reid.

  #else
union U {
  double D;
 
 
 
 ___
 llvm-commits mailing list
 llvm-commits@cs.uiuc.edu
 http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] CVS: llvm/include/llvm/ADT/SmallVector.h

2006-10-09 Thread Andrew Lenharth
 This compiled on my 3.4.6 compiler on Linux just fine before the patch.
 What was the error you were trying to fix?

Allignment Value not constant was the error. This was gcc 3.4.4

 Are you sure this is right?  In section 5.31 of the GCC Manual it
 indicates that if an alignment size is not given with the aligned
 attribute keyword then it defaults to:

 the maximum useful alignment for the target machine you are compiling
 for. Whenever you leave out the alignment factor in an `aligned'
 attribute specification, the compiler automatically sets the alignment
 for the declared variable or field to the largest alignment which is
 ever used for any data type on the target machine you are compiling
 for.

 Is this what we want here?

I believe so.  The alignment of that field needs to be sufficient for
any data type put there.  The non-gcc version does that with a union.
My reading of the gcc manual is that without a value, this attribute
does exactly that (and since doubles are not always the most
constrained types, vectors tend to be, this is more general, though I
doubt altivec vectors are going to be used directly by LLVM in small
vectors anytime soon).

Andrew
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] CVS: llvm/include/llvm/ADT/SmallVector.h

2006-10-09 Thread Chris Lattner

On Oct 9, 2006, at 12:56 PM, Andrew Lenharth wrote:


 Is this what we want here?

 I believe so.

I agree, Andrew's patch looks great to me.

-Chris
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits