This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] remove build_call_list from Fortran FE


On Mon, Jul 5, 2010 at 6:13 AM, Nathan Froyd <froydnj@codesourcery.com> wrote:
> On Thu, Jul 01, 2010 at 05:04:50PM +0200, Richard Guenther wrote:
>> Finally a reason to add VEC_splice?
>
> Here's the promised patch to vec.h. ?Replacing the calls to append_vec
> with the obvious VEC_splice calls works fine. ?OK?

Ok.  (traditionally splice takes a position argument for the destination
vector, but I guess we can fix that once needed).

Thanks,
Richard.

> -Nathan
>
> ? ? ? ?* vec.h (VEC_splice, VEC_safe_splice): New macros. ?Add function
> ? ? ? ?implementations.
>
> diff --git a/gcc/vec.h b/gcc/vec.h
> index 93a432d..3f3386c 100644
> --- a/gcc/vec.h
> +++ b/gcc/vec.h
> @@ -259,6 +259,32 @@ along with GCC; see the file COPYING3. ?If not see
> ?#define VEC_reserve_exact(T,A,V,R) ? ? \
> ? ? ? ?(VEC_OP(T,A,reserve_exact)(&(V),R VEC_CHECK_INFO MEM_STAT_INFO))
>
> +/* Copy elements with no reallocation
> + ? void VEC_T_splice (VEC(T) *dst, VEC(T) *src); // Integer
> + ? void VEC_T_splice (VEC(T) *dst, VEC(T) *src); // Pointer
> + ? void VEC_T_splice (VEC(T) *dst, VEC(T) *src); // Object
> +
> + ? Copy the elements in SRC to the end of DST as if by memcpy. ?DST and
> + ? SRC need not be allocated with the same mechanism, although they most
> + ? often will be. ?DST is assumed to have sufficient headroom
> + ? available. ?*/
> +
> +#define VEC_splice(T,DST,SRC) ? ? ? ? ? ? ? ? ?\
> + ?(VEC_OP(T,base,splice)(VEC_BASE(DST), VEC_BASE(SRC) VEC_CHECK_INFO))
> +
> +/* Copy elements with reallocation
> + ? void VEC_T_safe_splice (VEC(T,A) *&dst, VEC(T) *src); // Integer
> + ? void VEC_T_safe_splice (VEC(T,A) *&dst, VEC(T) *src); // Pointer
> + ? void VEC_T_safe_splice (VEC(T,A) *&dst, VEC(T) *src); // Object
> +
> + ? Copy the elements in SRC to the end of DST as if by memcpy. ?DST and
> + ? SRC need not be allocated with the same mechanism, although they most
> + ? often will be. ?DST need not have sufficient headroom and will be
> + ? reallocated if needed. ?*/
> +
> +#define VEC_safe_splice(T,A,DST,SRC) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
> + ?(VEC_OP(T,A,safe_splice)(&(DST), VEC_BASE(SRC), VEC_CHECK_INFO MEM_STAT_INFO))
> +
> ?/* Push object with no reallocation
> ? ?T *VEC_T_quick_push (VEC(T) *v, T obj); // Integer
> ? ?T *VEC_T_quick_push (VEC(T) *v, T obj); // Pointer
> @@ -589,6 +615,19 @@ static inline int VEC_OP (T,base,space) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> ? return vec_ ? vec_->alloc - vec_->num >= (unsigned)alloc_ : !alloc_; ? \
> ?} ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> +static inline void VEC_OP(T,base,splice) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
> + ? ? (VEC(T,base) *dst_, VEC(T,base) *src_ VEC_CHECK_DECL) ? ? ? ? ? ? ? \
> +{ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> + ?if (src_) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> + ? ?{ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> + ? ? ?unsigned len_ = src_->num; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
> + ? ? ?VEC_ASSERT (dst_->num + len_ <= dst_->alloc, "splice", T, base); ? \
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
> + ? ? ?memcpy (&dst_->vec[dst_->num], &src_->vec[0], len_ * sizeof (T)); ? ? ? ? ?\
> + ? ? ?dst_->num += len_; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
> + ? ?} ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> +} ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
> ?static inline T *VEC_OP (T,base,quick_push) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> ? ? ?(VEC(T,base) *vec_, T obj_ VEC_CHECK_DECL) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> ?{ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> @@ -796,6 +835,19 @@ static inline void VEC_OP (T,A,safe_grow_cleared) ? ? ? ? ? ? ? ? ? ?\
> ? ? ? ? ?sizeof (T) * (size_ - oldsize)); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> ?} ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> +static inline void VEC_OP(T,A,safe_splice) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
> + ? ? (VEC(T,A) **dst_, VEC(T,base) *src_ VEC_CHECK_DECL MEM_STAT_DECL) ? \
> +{ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> + ?if (src_) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> + ? ?{ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> + ? ? ?VEC_OP (T,A,reserve_exact) (dst_, src_->num ? ? ? ? ? ? ? ? ? ? ? ?\
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? VEC_CHECK_PASS MEM_STAT_INFO); ? ? ? ? ?\
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
> + ? ? ?VEC_OP (T,base,splice) (VEC_BASE (*dst_), src_ ? ? ? ? ? ? ? ? ? ? \
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? VEC_CHECK_PASS); ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> + ? ?} ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> +} ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
> ?static inline T *VEC_OP (T,A,safe_push) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> ? ? ?(VEC(T,A) **vec_, T obj_ VEC_CHECK_DECL MEM_STAT_DECL) ? ? ? ? ? ? ?\
> ?{ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> @@ -881,6 +933,19 @@ static inline int VEC_OP (T,base,space) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> ? return vec_ ? vec_->alloc - vec_->num >= (unsigned)alloc_ : !alloc_; ? \
> ?} ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> +static inline void VEC_OP(T,base,splice) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
> + ? ? (VEC(T,base) *dst_, VEC(T,base) *src_ VEC_CHECK_DECL) ? ? ? ? ? ? ? \
> +{ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> + ?if (src_) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> + ? ?{ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> + ? ? ?unsigned len_ = src_->num; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
> + ? ? ?VEC_ASSERT (dst_->num + len_ <= dst_->alloc, "splice", T, base); ? \
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
> + ? ? ?memcpy (&dst_->vec[dst_->num], &src_->vec[0], len_ * sizeof (T)); ? ? ? ? ?\
> + ? ? ?dst_->num += len_; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
> + ? ?} ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> +} ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
> ?static inline T *VEC_OP (T,base,quick_push) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> ? ? ?(VEC(T,base) *vec_, const T *obj_ VEC_CHECK_DECL) ? ? ? ? ? ? ? ? ? \
> ?{ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> @@ -1084,6 +1149,19 @@ static inline void VEC_OP (T,A,safe_grow_cleared) ? ? ? ? ? ? ? ? ? ? ? ? ?\
> ? ? ? ? ?sizeof (T) * (size_ - oldsize)); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> ?} ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> +static inline void VEC_OP(T,A,safe_splice) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
> + ? ? (VEC(T,A) **dst_, VEC(T,base) *src_ VEC_CHECK_DECL MEM_STAT_DECL) ? \
> +{ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> + ?if (src_) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> + ? ?{ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> + ? ? ?VEC_OP (T,A,reserve_exact) (dst_, src_->num ? ? ? ? ? ? ? ? ? ? ? ?\
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? VEC_CHECK_PASS MEM_STAT_INFO); ? ? ? ? ?\
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
> + ? ? ?VEC_OP (T,base,splice) (VEC_BASE (*dst_), src_ ? ? ? ? ? ? ? ? ? ? \
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? VEC_CHECK_PASS); ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> + ? ?} ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> +} ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
> ?static inline T *VEC_OP (T,A,safe_push) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> ? ? ?(VEC(T,A) **vec_, const T *obj_ VEC_CHECK_DECL MEM_STAT_DECL) ? ? ? \
> ?{ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> @@ -1188,6 +1266,19 @@ static inline void VEC_OP (T,A,safe_grow_cleared) ? ? ? ? ? ? ? ? ? ? ? ? ?\
> ? ? ? ? ?sizeof (T) * (size_ - oldsize)); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> ?} ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 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? \
> ?static inline T *VEC_OP (T,A,safe_push) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> ? ? ?(VEC(T,A) **vec_, const T obj_ VEC_CHECK_DECL MEM_STAT_DECL) ? ? ? ?\
> ?{ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
>

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]