diff options
author | froydnj <froydnj@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-07-05 12:46:52 +0000 |
---|---|---|
committer | froydnj <froydnj@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-07-05 12:46:52 +0000 |
commit | 008f96d836284b65ab4bc3ee81b62d2bd84ba452 (patch) | |
tree | 5666dfc48fb2cc1c04e55452418033ee9e2438bd /gcc/vec.h | |
parent | 080c0b9a26d5b7294add94f2e6689a325fe276a8 (diff) | |
download | gcc-008f96d836284b65ab4bc3ee81b62d2bd84ba452.tar.gz |
gcc/
* vec.h (VEC_splice, VEC_safe_splice): New macros. Add function
implementations.
gcc/fortran/
* trans.h (gfc_conv_procedure_call): Take a VEC instead of a tree.
* trans-intrinsic.c (gfc_conv_intrinsic_funcall): Adjust for new
type of gfc_conv_procedure_call.
(conv_generic_with_optional_char_arg): Likewise.
* trans-stmt.c (gfc_trans_call): Likewise.
* trans-expr.c (gfc_conv_function_expr): Likewise.
(gfc_conv_procedure_call): Use build_call_vec instead of
build_call_list.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161834 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/vec.h')
-rw-r--r-- | gcc/vec.h | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/gcc/vec.h b/gcc/vec.h index 93a432df839..e6c42bc0a60 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)); \ } \ \ +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) \ { \ |