PATCH RFC: Implement and use VEC(T,stack)

Ian Lance Taylor iant@google.com
Wed Jun 10 02:24:00 GMT 2009


After some more testing and tweaking of

http://gcc.gnu.org/ml/gcc-patches/2009-06/msg00722.html

this is the patch I've wound up with.  I went with VEC(T,stack) rather
than VEC(T,alloca) because alloca might be #define'd as a macro.  This
patch eliminates the arbitrary and unchecked limits used by the
vectors in df-scan.c.  In fact, the changes to df-scan.c are the bulk
of this patch.

I've bootstrapped and tested this patch on x86_64-unknown-linux-gnu.
I plan to commit this patch tomorrow unless somebody objects.

Ian


2009-06-09  Ian Lance Taylor  <iant@google.com>

	* vec.h (DEF_VEC_ALLOC_I): Use DEF_VEC_NONALLOC_FUNCS_I.
	(DEF_VEC_ALLOC_P): Use DEF_VEC_NONALLOC_FUNCS_P.
	(DEF_VEC_ALLOC_O): Use DEF_VEC_NONALLOC_FUNCS_O.
	(DEF_VEC_ALLOC_FUNC_P): Only define VEC_OP (T,A,alloc).
	(DEF_VEC_NONALLOC_FUNCS_P): New macro, broken out of old
	DEF_VEC_ALLOC_FUNC_P.
	(DEF_VEC_ALLOC_FUNC_O): Only define VEC_OP (T,A,alloc).
	(DEF_VEC_NONALLOC_FUNCS_O): New macro, broken out of old
	DEF_VEC_ALLOC_FUNC_O.
	(DEF_VEC_ALLOC_FUNC_I): Only define VEC_OP (T,A,alloc).
	(DEF_VEC_NONALLOC_FUNCS_I): New macro, broken out of old
	DEF_VEC_ALLOC_FUNC_I.
	(vec_stack_p_reserve, vec_stack_p_reserve_exact): Declare.
	(vec_stack_p_reserve_exact_1): Declare.
	(vec_stack_o_reserve, vec_stack_o_reserve_exact): Declare.
	(vec_stack_free): Declare.
	(DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_FUNC_P_STACK): Define.
	(DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_FUNC_O_STACK): Define.
	(DEF_VEC_ALLOC_I_STACK, DEF_VEC_ALLOC_FUNC_I_STACK): Define.
	* vec.c (stack_vecs): New static variable.
	(vec_stack_p_reserve_exact_1): New function.
	(vec_stack_o_reserve_1): New static function.
	(vec_stack_p_reserve, vec_stack_p_reserve_exact): New functions.
	(vec_stack_o_reserve, vec_stack_o_reserve_exact): New functions.
	(vec_stack_free): New function.
	* df-scan.c (df_ref): Use DEF_VEC_P and DEF_VEC_ALLOC_P_STACK.
	(VEC_df_ref_stack_alloc): Define.
	(df_mw_hardreg_ptr): New type.  Use DEF_VEC_P and
	DEF_VEC_ALLOC_P_STACK.
	(VEC_df_mw_hardreg_ptr_stack_alloc): Define.
	(struct df_collection_rec): Change _vec fields to VEC.  Remove
	_use fields.
	(df_free_collection_rec): Adjust for new fields.
	(df_insn_rescan): Use new df_collection_rec fields.
	(df_notes_rescan, df_canonize_collection_rec): Likewise.
	(df_ref_create_structure, df_ref_record): Likewise.
	(df_get_conditional_uses, df_get_call_refs): Likewise.
	(df_insn_refs_collect, df_bb_refs_collect): Likewise.
	(df_bb_refs_record, df_record_entry_block_defs): Likewise.
	(df_record_exit_block_uses, df_bb_verify): Likewise.
	(df_swap_refs): Change ref_vec parameter to VEC.  Change all
	callers.
	(df_sort_and_compress_refs): Change ref_vec parameter to VEC.
	Remove count parameter.  Change return type to void.  Change all
	callers.
	(df_sort_and_compress_mws): Change mw_vec parameter to VEC.
	Remove count parameter.  Change return type to void.  Change all
	callers.
	(df_install_refs): Change old_vec parameter to VEC.  Remove count
	parameter.  Change all callers.
	(df_install_mws): Change old_vec parameter to VEC.  Remove count
	parameter.  Change all callers.
	(df_refs_verify): Change new_rec parameter to VEC.  Change call
	callers.
	(df_mws_verify): Likewise.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.patch
Type: text/x-patch
Size: 34975 bytes
Desc: Define and use VEC(T,stack)
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20090610/4ed2ce3f/attachment.bin>


More information about the Gcc-patches mailing list