Re: [RFC][patch] If-conversion of COMPONENT_REFs
On Fri, Apr 1, 2011 at 8:43 AM, Ira Rosen wrote: > On 30 March 2011 15:09, Ira Rosen wrote: >> >> I don't see any :) I'll test your version. >> > > Bootstrapped on powerpc64-suse-linux and tested on x86_64-suse-linux > the attached patch. > > OK to apply? Ok. Thanks, Richard. > Thanks, > Ira > > ChangeLog: > > * tree-if-conv.c (memrefs_read_or_written_unconditionally): Strip all > non-variable offsets and compare the remaining bases of the two > accesses instead of looking for exact same data-ref. > > testsuite/ChangeLog: > > * gcc.dg/vect/if-cvt-stores-vect-ifcvt-18.c: New test. > * gcc.dg/vect/vect.exp: Run if-cvt-stores-vect* tests with > -ftree-loop-if-convert-stores. >
Re: [PATCH, PR43920, 1/9] ARM specific part.
On Fri, Apr 1, 2011 at 6:06 PM, Tom de Vries wrote: > On 04/01/2011 05:18 PM, Richard Earnshaw wrote: >> >> On Fri, 2011-04-01 at 16:45 +0200, Tom de Vries wrote: >>> Reposting, with ChangeLog. >> >> #define BRANCH_COST(speed_p, predictable_p) \ >> - (TARGET_32BIT ? 4 : (optimize > 0 ? 2 : 0)) >> + (TARGET_32BIT ? (TARGET_THUMB2 && optimize_size ? 1 : 4) \ >> + : (optimize > 0 ? 2 : 0)) >> >> Don't use optimize_size here, use !speed_p. >> >> Otherwise OK. >> > > Replaced optimize_size by !speed_p. I wonder if we can add a code-size test harness. Using GNU size for examle, if available and a new dg-final { object-size SIZE } that fails when the size is greater than the specified one (of course all object-size tests with specific target restrictions). I would have started on this myself, but my TCL-fu causes me to jump off such tasks very quickly ;) Richard. > Thanks, > - Tom >
Re: [PATCH] make CONST_DECL a direct subclass of tree_decl_common
On Fri, Apr 1, 2011 at 9:01 PM, Nathan Froyd wrote: > Nobody touches CONST_DECL's DECL_RTL, so there's no reason to for > CONST_DECL to inherit from tree_decl_with_rtl. This patch adjusts the > inheritance structure accordingly. > > Bootstrapped on x86_64-unknown-linux-gnu; tests in progress. OK to > commit once those complete? Ok. Thanks, Richard. > -Nathan > > * tree.h (struct tree_const_decl): Inherit from tree_decl_common. > * tree.c (initialize_tree_contains_struct): Adjust accordingly. > > diff --git a/gcc/tree.c b/gcc/tree.c > index 69d5ecb..3d8abee 100644 > --- a/gcc/tree.c > +++ b/gcc/tree.c > @@ -439,6 +439,7 @@ initialize_tree_contains_struct (void) > break; > > case TS_DECL_WRTL: > + case TS_CONST_DECL: > MARK_TS_DECL_COMMON (code); > break; > > @@ -450,7 +451,6 @@ initialize_tree_contains_struct (void) > case TS_PARM_DECL: > case TS_LABEL_DECL: > case TS_RESULT_DECL: > - case TS_CONST_DECL: > MARK_TS_DECL_WRTL (code); > break; > > @@ -488,7 +488,6 @@ initialize_tree_contains_struct (void) > gcc_assert (tree_contains_struct[TRANSLATION_UNIT_DECL][TS_DECL_COMMON]); > gcc_assert (tree_contains_struct[LABEL_DECL][TS_DECL_COMMON]); > gcc_assert (tree_contains_struct[FIELD_DECL][TS_DECL_COMMON]); > - gcc_assert (tree_contains_struct[CONST_DECL][TS_DECL_WRTL]); > gcc_assert (tree_contains_struct[VAR_DECL][TS_DECL_WRTL]); > gcc_assert (tree_contains_struct[PARM_DECL][TS_DECL_WRTL]); > gcc_assert (tree_contains_struct[RESULT_DECL][TS_DECL_WRTL]); > diff --git a/gcc/tree.h b/gcc/tree.h > index 9a288cb..e166ae3 100644 > --- a/gcc/tree.h > +++ b/gcc/tree.h > @@ -2962,7 +2962,7 @@ struct GTY(()) tree_result_decl { > }; > > struct GTY(()) tree_const_decl { > - struct tree_decl_with_rtl common; > + struct tree_decl_common common; > }; > > /* For a PARM_DECL, records the data type used to pass the argument, >
Re: [cxx-mem-model] bitfield tests
On Fri, Apr 1, 2011 at 6:24 PM, Richard Henderson wrote: > On 03/31/2011 08:28 AM, Richard Guenther wrote: Well, I'm not sure that strict-align targets that provide byte access do not simply hide the issue inside the CPU (thus, perform the read-modify-write there and do not guarantee any atomicity unless you ask for it). >>> Certainly some do this internally, but that's clearly out of our >>> control. >> >> Sure. My argument is that the memory model which guarantees >> this kind of things for _any_ memory access is fundamentally flawed. >> They should have simply required annotating objects which should >> behave that way (and then only behave that way "per object", not >> for any concurrent field accesses). > > (0) Let's limit our discussion to cpus that are actually put into SMP systems, > and have been manufactured in the last decade. > > (1) Do we agree that all such cpus have user-level store insns with byte > granularity. Honestly the only non-microcontroler I ever heard of > without this was the original Alpha. Which is excluded per (0). > > (2) Do we agree that all such cpus have on-chip caches? > > (3) Let us at this point limit our discussion to cacheable, i.e. non-I/O, > memory. I believe we can agree that all sorts of system-dependent stuff > happens in memory-mapped registers. > > (4) Do we agree that all such cpus transfer entire cachelines to and fro > the memory bus? And further that they simultaneously transfer a > modification mask as part of their cache coherency protocol? > > (5) Do we agree that all such cpus use a byte-granular modification mask? > > I'm guessing that you don't actually agree on point (5), but ... honestly, > please name the offender because I can't think of one. For the mainstream > processors we really care about, I think every one of them Does The Right > Thing. Yes, we don't agree on (5). And I can't name a CPU, but I was just guessing that strict alignment CPUs would have such requirement to also make their store queues simpler (no need for such mask). Now, as of (0) I might agree to disregard the original Alpha, but as the embedded world moves to SMP I'm not sure we can disregard non-cache coherent NUMA setups or even CPUs without a byte store. But well, I guess the thing I don't like about the standard is that it makes people that have started to be somewhat aware about threading issues _less_ aware of them by providing some "false" safety to them. It really smells like a standard designed for a very high-level language where people don't have to think instead of a standard suitable for a C family language. Richard. > > > r~ >
[PR 48333] avoid -fcompare-debug errors from builtins in MEM attrs
I caught this with bootstrap-debug-lean, then realized a bug report was open about the same problem. When Jakub introduced MEM attrs for the MEMs that refer to the function to be called, it exposed a rare problem. Say we're compiling a translation unit that, in one function A, calls foo (available as __builtin_foo), and in another function B, calls bar, that GCC internally folded to __builtin_foo, a separate but equivalent FUNCTION_DECL as far as MEM attrs are concerned. While compiling A, we introduce in the MEM attrs hash table an attribute for foo. Then, while compiling B, we find and reuse the same MEM attr. So far, so good. Now, while recompiling for -fcompare-debug, the garbage collector decides to run between the compilations of A and B, and it finds that the MEM attr created for A's RTL is no longer necessary, throwing it away. Then, when it compiles B, it does not find a pre-existing MEM, and introduces one for __builtin_foo. It should be obvious now that the final RTL dumps that -fcompare-debug compares for B will differ in this case, because in one case it will say foo, and in the other, __builtin_foo. This patch avoids this particular instance of the problem by recording the __builtin FUNCTION_DECL in the MEM attrs for calls. This ought to be enough to fix this particular instance of the problem, but I'm a bit concerned that other, more convoluted versions of it might still be lingering around. Changing the tree expressions when creating attributes might be doable, but I find that highly undesirable; another option would be to always dump functions as their builtins; there are probably other options too. This regstrapped on x86_64-linux-gnu. Ok to install? for gcc/ChangeLog from Alexandre Oliva PR debug/48333 * calls.c (emit_call_1): Prefer the __builtin declaration of builtin functions. Index: gcc/calls.c === --- gcc/calls.c.orig 2011-03-31 01:40:42.960373301 -0300 +++ gcc/calls.c 2011-03-31 01:46:27.655319378 -0300 @@ -272,7 +272,20 @@ emit_call_1 (rtx funexp, tree fntree ATT funmem = gen_rtx_MEM (FUNCTION_MODE, funexp); if (fndecl && TREE_CODE (fndecl) == FUNCTION_DECL) -set_mem_expr (funmem, fndecl); +{ + tree t = fndecl; + /* Although a built-in FUNCTION_DECL and its non-__builtin + counterpart compare equal and get a shared mem_attrs, they + produce different dump output in compare-debug compilations, + if an entry gets garbage collected in one compilation, then + adds a different (but equivalent) entry, while the other + doesn't run the garbage collector at the same spot and then + shares the mem_attr with the equivalent entry. */ + if (DECL_BUILT_IN_CLASS (t) == BUILT_IN_NORMAL + && built_in_decls[DECL_FUNCTION_CODE (t)]) + t = built_in_decls[DECL_FUNCTION_CODE (t)]; + set_mem_expr (funmem, t); +} else if (fntree) set_mem_expr (funmem, build_fold_indirect_ref (CALL_EXPR_FN (fntree))); -- Alexandre Oliva, freedom fighterhttp://FSFLA.org/~lxoliva/ You must be the change you wish to see in the world. -- Gandhi Be Free! -- http://FSFLA.org/ FSF Latin America board member Free Software Evangelist Red Hat Brazil Compiler Engineer
[PR debug/47590] rework md option overriding to delay var-tracking
Some targets delayed the var-tracking pass to run it after machine-specific transformations. The introduction of option saving and restoring broke this, because the machine-specific overriding took place too late for it to be saved, so, after compiling a function that used a different set of options, we'd restore incorrect flags, running var-tracking at the wrong time. This patch fixes the handling of this option so that it takes place at the right time. It does not, however, support per-function overriding of -fvar-tracking; I'm not sure how to implement that with the current framework. Suggestions? Meanwhile, is this ok to install? I believe it should be applied to trunk and 4.6 as well. Although I've only tested it myself on trunk, and on platforms that were not affected, a comment in the bug report indicates it was tested (on trunk?) on one of the affected platforms. for gcc/ChangeLog from Alexandre Oliva PR debug/47590 * config/bfin/bfin.c (output_file_start): Move flag_var_tracking overriding... (bfin_option_override): ... here. * config/ia64/ia64.c (ia64_file_start): Likewise... (ia64_option_override): ... ditto. * config/spu/spu.c (asm_file_start): Likewise... (spu_option_override): ... ditto. * config/picochip/picochip.c (picochip_asm_file_start): Likewise... (picochip_option_override): ... ditto. Split previous code into... (picochip_override_options_after_change): ... this new function. (TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE): Use the latter. Index: gcc/config/bfin/bfin.c === --- gcc/config/bfin/bfin.c.orig 2011-03-27 09:15:56.0 -0300 +++ gcc/config/bfin/bfin.c 2011-03-31 03:58:54.968115465 -0300 @@ -343,13 +343,6 @@ output_file_start (void) FILE *file = asm_out_file; int i; - /* Variable tracking should be run after all optimizations which change order - of insns. It also needs a valid CFG. This can't be done in - bfin_option_override, because flag_var_tracking is finalized after - that. */ - bfin_flag_var_tracking = flag_var_tracking; - flag_var_tracking = 0; - fprintf (file, ".file \"%s\";\n", input_filename); for (i = 0; arg_regs[i] >= 0; i++) @@ -2723,6 +2716,13 @@ bfin_option_override (void) bfin_flag_schedule_insns2 = flag_schedule_insns_after_reload; flag_schedule_insns_after_reload = 0; + /* Variable tracking should be run after all optimizations which change order + of insns. It also needs a valid CFG. This can't be done in + bfin_option_override, because flag_var_tracking is finalized after + that. */ + bfin_flag_var_tracking = flag_var_tracking; + flag_var_tracking = 0; + init_machine_status = bfin_init_machine_status; } Index: gcc/config/ia64/ia64.c === --- gcc/config/ia64/ia64.c.orig 2011-03-31 03:58:25.493054332 -0300 +++ gcc/config/ia64/ia64.c 2011-03-31 03:58:55.176115781 -0300 @@ -2391,13 +2391,6 @@ ia64_expand_atomic_op (enum rtx_code cod static void ia64_file_start (void) { - /* Variable tracking should be run after all optimizations which change order - of insns. It also needs a valid CFG. This can't be done in - ia64_option_override, because flag_var_tracking is finalized after - that. */ - ia64_flag_var_tracking = flag_var_tracking; - flag_var_tracking = 0; - default_file_start (); emit_safe_across_calls (); } @@ -5722,6 +5715,13 @@ ia64_option_override (void) if (TARGET_ABI_OPEN_VMS) flag_no_common = 1; + /* Variable tracking should be run after all optimizations which change order + of insns. It also needs a valid CFG. This can't be done in + ia64_option_override, because flag_var_tracking is finalized after + that. */ + ia64_flag_var_tracking = flag_var_tracking; + flag_var_tracking = 0; + ia64_override_options_after_change(); } Index: gcc/config/picochip/picochip.c === --- gcc/config/picochip/picochip.c.orig 2011-03-27 09:15:33.0 -0300 +++ gcc/config/picochip/picochip.c 2011-03-31 03:58:55.242115880 -0300 @@ -127,6 +127,7 @@ picochip_asm_named_section (const char * static rtx picochip_static_chain (const_tree, bool); static void picochip_option_override (void); +static void picochip_override_options_after_change (void); /* Lookup table mapping a register number to the earliest containing class. Used by REGNO_REG_CLASS. */ @@ -335,7 +336,7 @@ static const struct default_options pico #define TARGET_OPTION_OVERRIDE picochip_option_override #undef TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE -#define TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE picochip_option_override +#define TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE picochip_override_options_after_change #undef TARGET_OPTION_OPTIMIZATION_TABLE #define TARGET_OPTION_OPTIMIZATION_TABLE picochip_option_optimization_table @@ -356,14 +357,29 @@ picochip_return_in_mem
[Ada] Do not emit empty Exception_Data record in debug info
This makes it so that the Ada compiler doesn't emit an empty Exception_Data record type in the debug info (DW_AT_declaration in DWARF). Tested on i586-suse-linux, applied on the mainline. 2011-04-02 Eric Botcazou * gcc-interface/decl.c (gnat_to_gnu_entity) : Defer finalizing types when updating the pointers to the designated type. : Finalize the deferred types even if we didn't defer processing of incomplete types in this invocation. -- Eric Botcazou Index: gcc-interface/decl.c === --- gcc-interface/decl.c (revision 171818) +++ gcc-interface/decl.c (working copy) @@ -3769,8 +3769,12 @@ gnat_to_gnu_entity (Entity_Id gnat_entit along the way. update_pointer_to is expected to properly take care of those situations. */ if (defer_incomplete_level == 0 && !is_from_limited_with) - update_pointer_to (TYPE_MAIN_VARIANT (gnu_old_desig_type), - gnat_to_gnu_type (gnat_desig_equiv)); + { + defer_finalize_level++; + update_pointer_to (TYPE_MAIN_VARIANT (gnu_old_desig_type), + gnat_to_gnu_type (gnat_desig_equiv)); + defer_finalize_level--; + } else { struct incomplete *p = XNEW (struct incomplete); @@ -4968,49 +4972,50 @@ gnat_to_gnu_entity (Entity_Id gnat_entit } /* If we deferred processing of incomplete types, re-enable it. If there - were no other disables and we have some to process, do so. */ - if (this_deferred && --defer_incomplete_level == 0) + were no other disables and we have deferred types to process, do so. */ + if (this_deferred + && --defer_incomplete_level == 0 + && defer_incomplete_list) { - if (defer_incomplete_list) - { - struct incomplete *p, *next; + struct incomplete *p, *next; - /* We are back to level 0 for the deferring of incomplete types. - But processing these incomplete types below may itself require - deferring, so preserve what we have and restart from scratch. */ - p = defer_incomplete_list; - defer_incomplete_list = NULL; - - /* For finalization, however, all types must be complete so we - cannot do the same because deferred incomplete types may end up - referencing each other. Process them all recursively first. */ - defer_finalize_level++; + /* We are back to level 0 for the deferring of incomplete types. + But processing these incomplete types below may itself require + deferring, so preserve what we have and restart from scratch. */ + p = defer_incomplete_list; + defer_incomplete_list = NULL; + + /* For finalization, however, all types must be complete so we + cannot do the same because deferred incomplete types may end up + referencing each other. Process them all recursively first. */ + defer_finalize_level++; - for (; p; p = next) - { - next = p->next; - - if (p->old_type) - update_pointer_to (TYPE_MAIN_VARIANT (p->old_type), - gnat_to_gnu_type (p->full_type)); - free (p); - } + for (; p; p = next) + { + next = p->next; - defer_finalize_level--; + if (p->old_type) + update_pointer_to (TYPE_MAIN_VARIANT (p->old_type), + gnat_to_gnu_type (p->full_type)); + free (p); } - /* All the deferred incomplete types have been processed so we can - now proceed with the finalization of the deferred types. */ - if (defer_finalize_level == 0 && defer_finalize_list) - { - unsigned int i; - tree t; + defer_finalize_level--; +} - FOR_EACH_VEC_ELT (tree, defer_finalize_list, i, t) - rest_of_type_decl_compilation_no_defer (t); + /* If all the deferred incomplete types have been processed, we can proceed + with the finalization of the deferred types. */ + if (defer_incomplete_level == 0 + && defer_finalize_level == 0 + && defer_finalize_list) +{ + unsigned int i; + tree t; - VEC_free (tree, heap, defer_finalize_list); - } + FOR_EACH_VEC_ELT (tree, defer_finalize_list, i, t) + rest_of_type_decl_compilation_no_defer (t); + + VEC_free (tree, heap, defer_finalize_list); } /* If we are not defining this type, see if it's on one of the lists of
[Ada] Emit named array types in debug info
This makes it so that the Ada compiler emits named array types in the debug info (DW_TAG_typedef in DWARF) for array types declared in the sources. Tested on i586-suse-linux, applied on the mainline. 2011-04-02 Eric Botcazou * gcc-interface/gigi.h (record_builtin_type): Add ARTIFICIAL_P param. * gcc-interface/utils.c (gnat_pushdecl): If this is a non-artificial declaration of an array type, then set DECL_ORIGINAL_TYPE to a distinct copy. (record_builtin_type): Add ARTIFICIAL_P parameter. Set DECL_ARTIFICIAL flag of the type accordingly. * gcc-interface/trans.c (gigi): Adjust calls to record_builtin_type. -- Eric Botcazou Index: gcc-interface/utils.c === --- gcc-interface/utils.c (revision 171818) +++ gcc-interface/utils.c (working copy) @@ -508,7 +508,18 @@ gnat_pushdecl (tree decl, Node_Id gnat_n tree t = TREE_TYPE (decl); if (!(TYPE_NAME (t) && TREE_CODE (TYPE_NAME (t)) == TYPE_DECL)) - ; + { + /* Array types aren't tagged types in the C sense so we force the + type to be associated with its typedef in the DWARF back-end, + in order to make sure that the latter is always preserved. */ + if (!DECL_ARTIFICIAL (decl) && TREE_CODE (t) == ARRAY_TYPE) + { + tree tt = build_distinct_type_copy (t); + TYPE_NAME (tt) = DECL_NAME (decl); + TYPE_STUB_DECL (tt) = TYPE_STUB_DECL (t); + DECL_ORIGINAL_TYPE (decl) = tt; + } + } else if (TYPE_IS_FAT_POINTER_P (t)) { tree tt = build_variant_type_copy (t); @@ -535,14 +546,15 @@ gnat_pushdecl (tree decl, Node_Id gnat_n } } -/* Record TYPE as a builtin type for Ada. NAME is the name of the type. */ +/* Record TYPE as a builtin type for Ada. NAME is the name of the type. + ARTIFICIAL_P is true if it's a type that was generated by the compiler. */ void -record_builtin_type (const char *name, tree type) +record_builtin_type (const char *name, tree type, bool artificial_p) { tree type_decl = build_decl (input_location, TYPE_DECL, get_identifier (name), type); - + DECL_ARTIFICIAL (type_decl) = artificial_p; gnat_pushdecl (type_decl, Empty); if (debug_hooks->type_decl) Index: gcc-interface/gigi.h === --- gcc-interface/gigi.h (revision 171818) +++ gcc-interface/gigi.h (working copy) @@ -504,8 +504,10 @@ extern void init_dummy_type (void); /* Make a dummy type corresponding to GNAT_TYPE. */ extern tree make_dummy_type (Entity_Id gnat_type); -/* Record TYPE as a builtin type for Ada. NAME is the name of the type. */ -extern void record_builtin_type (const char *name, tree type); +/* Record TYPE as a builtin type for Ada. NAME is the name of the type. + ARTIFICIAL_P is true if it's a type that was generated by the compiler. */ +extern void record_builtin_type (const char *name, tree type, + bool artificial_p); /* Given a record type RECORD_TYPE and a list of FIELD_DECL nodes FIELD_LIST, finish constructing the record or union type. If REP_LEVEL is zero, this Index: gcc-interface/trans.c === --- gcc-interface/trans.c (revision 171818) +++ gcc-interface/trans.c (working copy) @@ -308,10 +308,10 @@ gigi (Node_Id gnat_root, int max_gnat_no /* Record the builtin types. Define `integer' and `character' first so that dbx will output them first. */ - record_builtin_type ("integer", integer_type_node); - record_builtin_type ("character", unsigned_char_type_node); - record_builtin_type ("boolean", boolean_type_node); - record_builtin_type ("void", void_type_node); + record_builtin_type ("integer", integer_type_node, false); + record_builtin_type ("character", unsigned_char_type_node, false); + record_builtin_type ("boolean", boolean_type_node, false); + record_builtin_type ("void", void_type_node, false); /* Save the type we made for integer as the type for Standard.Integer. */ save_gnu_tree (Base_Type (standard_integer), @@ -397,7 +397,7 @@ gigi (Node_Id gnat_root, int max_gnat_no jmpbuf_type = build_array_type (gnat_type_for_mode (Pmode, 0), build_index_type (size_int (5))); - record_builtin_type ("JMPBUF_T", jmpbuf_type); + record_builtin_type ("JMPBUF_T", jmpbuf_type, true); jmpbuf_ptr_type = build_pointer_type (jmpbuf_type); /* Functions to get and set the jumpbuf pointer for the current thread. */ @@ -552,7 +552,7 @@ gigi (Node_Id gnat_root, int max_gnat_no } finish_record_type (fdesc_type_node, nreverse (field_list), 0, false); - record_builtin_type ("descriptor", fdesc_type_node); + record_builtin_type ("descriptor", fdesc_type_node, true); null_fdesc_node = gnat_build_constructor (fdesc_type_node, null_vec); } @@ -566,7 +566,8 @@ gigi (Node_Id gnat_root, int max_gnat_no longest_float_type_node = make
[Ada] Preserve Taft Amendment types in debug info
Taft Amendment types are incomplete types declared in the spec and whose completion is in the body of the package. As such, their full definition isn't visible from other compilation units. Therefore, they need a specific treatment to make sure that the definition is preserved in the debug info. Tested on i586-suse-linux, applied on the mainline. 2011-04-02 Eric Botcazou * gcc-interface/ada-tree.h (DECL_TAFT_TYPE_P): New flag. * gcc-interface/decl.c (gnat_to_gnu_entity) : Set it if this is a Taft amendment type and the full declaration is available. * gcc-interface/trans.c (process_type): Likewise. If there is an old type, mark the new one as used if DECL_TAFT_TYPE_P. (process_freeze_entity): Likewise. * gcc-interface/utils.c (dummy_global): New static variable. (gnat_write_global_declarations): If there are types declared as used at the global level, insert them in the global hash table. -- Eric Botcazou Index: gcc-interface/utils.c === --- gcc-interface/utils.c (revision 171880) +++ gcc-interface/utils.c (working copy) @@ -4736,9 +4736,28 @@ smaller_form_type_p (tree type, tree ori /* Perform final processing on global variables. */ +static GTY (()) tree dummy_global; + void gnat_write_global_declarations (void) { + /* If we have declared types as used at the global level, insert them in + the global hash table. We use a dummy variable for this purpose. */ + if (!VEC_empty (tree, types_used_by_cur_var_decl)) +{ + dummy_global + = build_decl (BUILTINS_LOCATION, VAR_DECL, NULL_TREE, void_type_node); + TREE_STATIC (dummy_global) = 1; + TREE_ASM_WRITTEN (dummy_global) = 1; + varpool_mark_needed_node (varpool_node (dummy_global)); + + while (!VEC_empty (tree, types_used_by_cur_var_decl)) + { + tree t = VEC_pop (tree, types_used_by_cur_var_decl); + types_used_by_var_decl_insert (t, dummy_global); + } +} + /* Proceed to optimize and emit assembly. FIXME: shouldn't be the front end's responsibility to call this. */ cgraph_finalize_compilation_unit (); Index: gcc-interface/decl.c === --- gcc-interface/decl.c (revision 171879) +++ gcc-interface/decl.c (working copy) @@ -4469,6 +4469,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entit we can do any needed updates when we see it. */ gnu_type = make_dummy_type (gnat_entity); gnu_decl = TYPE_STUB_DECL (gnu_type); + if (Has_Completion_In_Body (gnat_entity)) + DECL_TAFT_TYPE_P (gnu_decl) = 1; save_gnu_tree (full_view, gnu_decl, 0); break; } Index: gcc-interface/trans.c === --- gcc-interface/trans.c (revision 171880) +++ gcc-interface/trans.c (working copy) @@ -6609,11 +6609,17 @@ process_freeze_entity (Node_Id gnat_node && Root_Type (Class_Wide_Type (gnat_entity)) == gnat_entity) save_gnu_tree (Class_Wide_Type (gnat_entity), gnu_new, false); - /* If we've made any pointers to the old version of this type, we - have to update them. */ + /* If we have an old type and we've made pointers to this type, update those + pointers. If this is a Taft amendment type in the main unit, we need to + mark the type as used since other units referencing it don't see the full + declaration and, therefore, cannot mark it as used themselves. */ if (gnu_old) -update_pointer_to (TYPE_MAIN_VARIANT (TREE_TYPE (gnu_old)), - TREE_TYPE (gnu_new)); +{ + update_pointer_to (TYPE_MAIN_VARIANT (TREE_TYPE (gnu_old)), + TREE_TYPE (gnu_new)); + if (DECL_TAFT_TYPE_P (gnu_old)) + used_types_insert (TREE_TYPE (gnu_new)); +} } /* Elaborate decls in the lists GNAT_DECLS and GNAT_DECLS2, if present. @@ -7456,7 +7462,11 @@ process_type (Entity_Id gnat_entity) save_gnu_tree (gnat_entity, gnu_decl, false); if (IN (Ekind (gnat_entity), Incomplete_Or_Private_Kind) && Present (Full_View (gnat_entity))) - save_gnu_tree (Full_View (gnat_entity), gnu_decl, false); + { + if (Has_Completion_In_Body (gnat_entity)) + DECL_TAFT_TYPE_P (gnu_decl) = 1; + save_gnu_tree (Full_View (gnat_entity), gnu_decl, false); + } } return; @@ -7478,11 +7488,17 @@ process_type (Entity_Id gnat_entity) gnu_new = gnat_to_gnu_entity (gnat_entity, NULL_TREE, 1); gcc_assert (TREE_CODE (gnu_new) == TYPE_DECL); - /* If we have an old type and we've made pointers to this type, - update those pointers. */ + /* If we have an old type and we've made pointers to this type, update those + pointers. If this is a Taft amendment type in the main unit, we need to + mark the type as used since other units referencing it don't see the full + declaration and, therefore, cannot mark it as used themselves. */ if (gnu_old) -update_pointer_to (TYPE_
[Ada] Do not emit empty fat pointer types record in debug info
This makes it so that the Ada compiler doesn't emit empty fat pointer types in the debug info (DW_AT_declaration in DWARF). Fat pointers types are record types used to represent (pointers to) unconstrained array types. Tested on i586-suse-linux, applied on the mainline. 2011-04-02 Eric Botcazou * gcc-interface/gigi.h (get_dummy_type): Declare. (build_dummy_unc_pointer_types): Likewise. (finish_fat_pointer_type): Likewise. * gcc-interface/decl.c (gnat_to_gnu_entity) : If a dummy fat pointer type has been built, complete it in place. : Call build_dummy_unc_pointer_types to build dummy fat and thin pointers. Remove useless variable. (finish_fat_pointer_type): Make global and move to... * gcc-interface/utils.c (finish_fat_pointer_type): ...here. (get_dummy_type): New function. (build_dummy_unc_pointer_types): Likewise. (gnat_pushdecl): Propage the name to the anonymous variants only. (update_pointer_to): Only adjust the pointer types in the unconstrained array case. -- Eric Botcazou Index: gcc-interface/utils.c === --- gcc-interface/utils.c (revision 171881) +++ gcc-interface/utils.c (working copy) @@ -313,6 +313,57 @@ make_dummy_type (Entity_Id gnat_type) return gnu_type; } + +/* Return the dummy type that was made for GNAT_TYPE, if any. */ + +tree +get_dummy_type (Entity_Id gnat_type) +{ + return GET_DUMMY_NODE (gnat_type); +} + +/* Build dummy fat and thin pointer types whose designated type is specified + by GNAT_DESIG_TYPE/GNU_DESIG_TYPE and attach them to the latter. */ + +void +build_dummy_unc_pointer_types (Entity_Id gnat_desig_type, tree gnu_desig_type) +{ + tree gnu_template_type, gnu_ptr_template, gnu_array_type, gnu_ptr_array; + tree gnu_fat_type, fields, gnu_object_type; + + gnu_template_type = make_node (RECORD_TYPE); + TYPE_NAME (gnu_template_type) = create_concat_name (gnat_desig_type, "XUB"); + TYPE_DUMMY_P (gnu_template_type) = 1; + gnu_ptr_template = build_pointer_type (gnu_template_type); + + gnu_array_type = make_node (ENUMERAL_TYPE); + TYPE_NAME (gnu_array_type) = create_concat_name (gnat_desig_type, "XUA"); + TYPE_DUMMY_P (gnu_array_type) = 1; + gnu_ptr_array = build_pointer_type (gnu_array_type); + + gnu_fat_type = make_node (RECORD_TYPE); + /* Build a stub DECL to trigger the special processing for fat pointer types + in gnat_pushdecl. */ + TYPE_NAME (gnu_fat_type) += create_type_stub_decl (create_concat_name (gnat_desig_type, "XUP"), + gnu_fat_type); + fields = create_field_decl (get_identifier ("P_ARRAY"), gnu_ptr_array, + gnu_fat_type, NULL_TREE, NULL_TREE, 0, 0); + DECL_CHAIN (fields) += create_field_decl (get_identifier ("P_BOUNDS"), gnu_ptr_template, + gnu_fat_type, NULL_TREE, NULL_TREE, 0, 0); + finish_fat_pointer_type (gnu_fat_type, fields); + SET_TYPE_UNCONSTRAINED_ARRAY (gnu_fat_type, gnu_desig_type); + /* Suppress debug info until after the type is completed. */ + TYPE_DECL_SUPPRESS_DEBUG (TYPE_STUB_DECL (gnu_fat_type)) = 1; + + gnu_object_type = make_node (RECORD_TYPE); + TYPE_NAME (gnu_object_type) = create_concat_name (gnat_desig_type, "XUT"); + TYPE_DUMMY_P (gnu_object_type) = 1; + + TYPE_POINTER_TO (gnu_desig_type) = gnu_fat_type; + TYPE_OBJECT_RECORD_TYPE (gnu_desig_type) = gnu_object_type; +} /* Return nonzero if we are currently in the global binding level. */ @@ -522,6 +573,7 @@ gnat_pushdecl (tree decl, Node_Id gnat_n } else if (TYPE_IS_FAT_POINTER_P (t)) { + /* We need a variant for the placeholder machinery to work. */ tree tt = build_variant_type_copy (t); TYPE_NAME (tt) = decl; TREE_USED (tt) = TREE_USED (t); @@ -530,19 +582,20 @@ gnat_pushdecl (tree decl, Node_Id gnat_n DECL_ORIGINAL_TYPE (decl) = DECL_ORIGINAL_TYPE (TYPE_NAME (t)); else DECL_ORIGINAL_TYPE (decl) = t; - t = NULL_TREE; DECL_ARTIFICIAL (decl) = 0; + t = NULL_TREE; } else if (DECL_ARTIFICIAL (TYPE_NAME (t)) && !DECL_ARTIFICIAL (decl)) ; else t = NULL_TREE; - /* Propagate the name to all the variants. This is needed for - the type qualifiers machinery to work properly. */ + /* Propagate the name to all the anonymous variants. This is needed + for the type qualifiers machinery to work properly. */ if (t) for (t = TYPE_MAIN_VARIANT (t); t; t = TYPE_NEXT_VARIANT (t)) - TYPE_NAME (t) = decl; + if (!(TYPE_NAME (t) && TREE_CODE (TYPE_NAME (t)) == TYPE_DECL)) + TYPE_NAME (t) = decl; } } @@ -562,6 +615,28 @@ record_builtin_type (const char *name, t } /* Given a record type RECORD_TYPE and a list of FIELD_DECL nodes FIELD_LIST, + finish constructing the record type as a fat pointer type. */ + +void +finish_fat_pointer_type (tree record_type, tree field_list) +{ + /* Make sure we can put it into a register. */ + TYPE_ALIGN (r
[Ada] Preserve unconstrained array types in debug info
This makes it so that the Ada compiler preserves unconstrained array types in the debug info when they are declared in the sources and a constrained subtype is referenced in the same unit. Tested on i586-suse-linux, applied on the mainline. 2011-04-02 Eric Botcazou * gcc-interface/decl.c (gnat_to_gnu_entity) : Do not make fat pointer types artificial unconditionally. : Attach the base array type as a parallel type if it isn't artificial. -- Eric Botcazou Index: gcc-interface/decl.c === --- gcc-interface/decl.c (revision 171882) +++ gcc-interface/decl.c (working copy) @@ -2175,7 +2175,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entit else gnat_name = gnat_entity; create_type_decl (create_concat_name (gnat_name, "XUP"), - gnu_fat_type, NULL, true, + gnu_fat_type, NULL, !Comes_From_Source (gnat_entity), debug_info_p, gnat_entity); /* Create the type to be used as what a thin pointer designates: @@ -2537,14 +2537,25 @@ gnat_to_gnu_entity (Entity_Id gnat_entit add_parallel_type (TYPE_STUB_DECL (gnu_type), gnu_bound_rec); } - /* Otherwise, for a packed array, make the original array type a - parallel type. */ - else if (debug_info_p - && Is_Packed_Array_Type (gnat_entity) - && present_gnu_tree (Original_Array_Type (gnat_entity))) - add_parallel_type (TYPE_STUB_DECL (gnu_type), - gnat_to_gnu_type - (Original_Array_Type (gnat_entity))); + /* If this is a packed array type, make the original array type a + parallel type. Otherwise, do it for the base array type if it + isn't artificial to make sure it is kept in the debug info. */ + if (debug_info_p) + { + if (Is_Packed_Array_Type (gnat_entity) + && present_gnu_tree (Original_Array_Type (gnat_entity))) + add_parallel_type (TYPE_STUB_DECL (gnu_type), + gnat_to_gnu_type + (Original_Array_Type (gnat_entity))); + else + { + tree gnu_base_decl + = gnat_to_gnu_entity (Etype (gnat_entity), NULL_TREE, 0); + if (!DECL_ARTIFICIAL (gnu_base_decl)) + add_parallel_type (TYPE_STUB_DECL (gnu_type), + TREE_TYPE (TREE_TYPE (gnu_base_decl))); + } + } TYPE_CONVENTION_FORTRAN_P (gnu_type) = convention_fortran_p; TYPE_PACKED_ARRAY_TYPE_P (gnu_type)
[Ada] Do not make enumeration types always artificial
Self-explanatory. Tested on i586-suse-linux, applied on the mainline. 2011-04-02 Eric Botcazou * gcc-interface/decl.c (gnat_to_gnu_entity): Do not force the DECL_ARTIFICIAL flag on enumeration types. -- Eric Botcazou Index: gcc-interface/decl.c === --- gcc-interface/decl.c (revision 171883) +++ gcc-interface/decl.c (working copy) @@ -4960,9 +4960,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entit SET_TYPE_RM_MIN_VALUE (gnu_scalar_type, gnu_low_bound); SET_TYPE_RM_MAX_VALUE (gnu_scalar_type, gnu_high_bound); - /* Write full debugging information. Since this has both a - typedef and a tag, avoid outputting the name twice. */ - DECL_ARTIFICIAL (gnu_decl) = 1; + /* Write full debugging information. */ rest_of_type_decl_compilation (gnu_decl); }
[Ada] Emit named pointer types in debug info
This makes it so that the Ada compiler emits named pointer types in the debug info (DW_TAG_typedef in DWARF) for pointer types declared in the sources. Tested on i586-suse-linux, applied on the mainline. 2011-04-02 Eric Botcazou * gcc-interface/utils.c (gnat_pushdecl): If this is a non-artificial declaration of a pointer type, then set DECL_ORIGINAL_TYPE to a distinct copy. -- Eric Botcazou Index: gcc-interface/utils.c === --- gcc-interface/utils.c (revision 171882) +++ gcc-interface/utils.c (working copy) @@ -560,12 +560,16 @@ gnat_pushdecl (tree decl, Node_Id gnat_n if (!(TYPE_NAME (t) && TREE_CODE (TYPE_NAME (t)) == TYPE_DECL)) { - /* Array types aren't tagged types in the C sense so we force the + /* Array and pointer types aren't "tagged" types so we force the type to be associated with its typedef in the DWARF back-end, in order to make sure that the latter is always preserved. */ - if (!DECL_ARTIFICIAL (decl) && TREE_CODE (t) == ARRAY_TYPE) + if (!DECL_ARTIFICIAL (decl) + && (TREE_CODE (t) == ARRAY_TYPE + || TREE_CODE (t) == POINTER_TYPE)) { tree tt = build_distinct_type_copy (t); + if (TREE_CODE (t) == POINTER_TYPE) + TYPE_NEXT_PTR_TO (t) = tt; TYPE_NAME (tt) = DECL_NAME (decl); TYPE_STUB_DECL (tt) = TYPE_STUB_DECL (t); DECL_ORIGINAL_TYPE (decl) = tt;
[Ada] Re-enable -feliminate-unused-debug-types by default
The previous 7 patches paved the way to enabling -feliminate-unused-debug-types again by default in Ada. We measured a 12.5% reduction in debug info size on one big application (and an even larger one for another application), as well as a 0.5% reduction in compilation time at -O0 -g. Tested on i586-suse-linux, applied on the mainline. 2011-04-02 Eric Botcazou * gcc-interface/lang.opt (feliminate-unused-debug-types): Delete. * gcc-interface/misc.c (gnat_handle_option): Remove special handling code for -feliminate-unused-debug-types (gnat_post_options): Likewise. -- Eric Botcazou Index: gcc-interface/lang.opt === --- gcc-interface/lang.opt (revision 171818) +++ gcc-interface/lang.opt (working copy) @@ -1,5 +1,5 @@ ; Options for the Ada front end. -; Copyright (C) 2003, 2007, 2008, 2010 Free Software Foundation, Inc. +; Copyright (C) 2003, 2007, 2008, 2010, 2011 Free Software Foundation, Inc. ; ; This file is part of GCC. ; @@ -94,12 +94,6 @@ nostdlib Ada ; Don't look for object files -feliminate-unused-debug-types -Ada -; Effect documented for C - intercepted for Ada to force the associated flag -; not to be set by default, as it currently eliminates unreferenced parallel -; types we need for encoding descriptions to the debugger. - fRTS= Ada Joined RejectNegative ; Selects the runtime Index: gcc-interface/misc.c === --- gcc-interface/misc.c (revision 171862) +++ gcc-interface/misc.c (working copy) @@ -125,14 +125,6 @@ gnat_handle_option (size_t scode, const /* These are used in the GCC Makefile. */ break; -case OPT_feliminate_unused_debug_types: - /* We arrange for post_option to be able to only set the corresponding - flag to 1 when explicitly requested by the user. We expect the - default flag value to be either 0 or positive, and expose a positive - -f as a negative value to post_option. */ - flag_eliminate_unused_debug_types = -value; - break; - case OPT_gant: warning (0, "%<-gnat%> misspelled as %<-gant%>"); @@ -232,8 +224,7 @@ enum stack_check_type flag_stack_check = static bool gnat_post_options (const char **pfilename ATTRIBUTE_UNUSED) { - /* Excess precision other than "fast" requires front-end - support. */ + /* Excess precision other than "fast" requires front-end support. */ if (flag_excess_precision_cmdline == EXCESS_PRECISION_STANDARD && TARGET_FLT_EVAL_METHOD_NON_DEFAULT) sorry ("-fexcess-precision=standard for Ada"); @@ -245,14 +236,6 @@ gnat_post_options (const char **pfilenam /* No psABI change warnings for Ada. */ warn_psabi = 0; - /* Force eliminate_unused_debug_types to 0 unless an explicit positive - -f has been passed. This forces the default to 0 for Ada, which might - differ from the common default. */ - if (flag_eliminate_unused_debug_types < 0) -flag_eliminate_unused_debug_types = 1; - else -flag_eliminate_unused_debug_types = 0; - optimize = global_options.x_optimize; optimize_size = global_options.x_optimize_size; flag_compare_debug = global_options.x_flag_compare_debug;
[Ada] Fix orphaned DIE for access type to record type
This fixes the fallouts of the previous series of patches. Tested on i586-suse-linux, applied on the mainline. 2011-04-02 Eric Botcazou * gcc-interface/utils.c (update_pointer_to): Finalize named pointer types. 2011-04-02 Eric Botcazou * gnat.dg/debug2.ad[sb]: New test. * gnat.dg/debug2_pkg.ads: New helper. * gnat.dg/debug3.ad[sb]: New test. -- Eric Botcazou Index: gcc-interface/utils.c === --- gcc-interface/utils.c (revision 171885) +++ gcc-interface/utils.c (working copy) @@ -3559,7 +3559,12 @@ update_pointer_to (tree old_type, tree n for (; ptr; ptr = TYPE_NEXT_PTR_TO (ptr)) for (t = TYPE_MAIN_VARIANT (ptr); t; t = TYPE_NEXT_VARIANT (t)) TREE_TYPE (t) = new_type; - TYPE_POINTER_TO (old_type) = NULL_TREE; + + /* If we have adjusted named types, finalize them. This is necessary + since we had forced a DWARF typedef for them in gnat_pushdecl. */ + for (ptr = TYPE_POINTER_TO (old_type); ptr; ptr = TYPE_NEXT_PTR_TO (ptr)) + if (TYPE_NAME (ptr) && TREE_CODE (TYPE_NAME (ptr)) == TYPE_DECL) + rest_of_type_decl_compilation (TYPE_NAME (ptr)); /* Chain REF and its variants at the end. */ new_ref = TYPE_REFERENCE_TO (new_type); @@ -3576,6 +3581,8 @@ update_pointer_to (tree old_type, tree n for (; ref; ref = TYPE_NEXT_REF_TO (ref)) for (t = TYPE_MAIN_VARIANT (ref); t; t = TYPE_NEXT_VARIANT (t)) TREE_TYPE (t) = new_type; + + TYPE_POINTER_TO (old_type) = NULL_TREE; TYPE_REFERENCE_TO (old_type) = NULL_TREE; } -- { dg-do compile } -- { dg-options "-g" } with Debug2_Pkg; use Debug2_Pkg; package body Debug2 is procedure Proc is function F return String_List_Ptr is begin return new String_List'(Singleton); end; A : String_List_Ptr := F; begin null; end; function Get return Integer is begin return 0; end; Failed : exception; A: String_Ptr; begin declare Server_Args : Integer; begin Server_Args := Get; exception when X : Failed => A := To_Heap; end; end Debug2; package Debug2 is procedure Proc; end Debug2; package Debug2_Pkg is type String_Ptr is access all String; function To_Heap return String_Ptr; type String_List(Chars_Length: Positive) is private; type String_List_Ptr is access constant String_List; function Singleton return String_List; private type String_List(Chars_Length: Positive) is record Chars: String(1..Chars_Length); end record; end Debug2_Pkg; -- { dg-do compile } -- { dg-options "-g" } with Ada.Unchecked_Conversion; with System; package body Debug3 is type Rec is record I : Integer; end record; for Rec'Alignment use 1; type Ptr is access Rec; function To_Ptr is new Ada.Unchecked_Conversion(System.Address, Ptr); procedure Proc is function Get (S1 : String) return Ptr is begin return To_Ptr (S1'Address); end; M : Ptr; begin M := Get (""); end; end Debug3; package Debug3 is procedure Proc; end Debug3;
[Ada] Fix ICE on qualified aggregate of array type
The compiler aborts on the initialization of an access object to unconstrained array type with an allocator whose initializer is a qualified aggregate (with a constrained subtype of the array type), if the array type has an alignment clause that causes it to be more aligned than its component type. Fixed by removing old code. Tested on i586-suse-linux, applied on the mainline. 2011-04-02 Eric Botcazou * gcc-interface/utils2.c (build_allocator): In the unconstrained array type case, do not strip a padding type around the array type. 2011-04-02 Eric Botcazou * gnat.dg/specs/aggr2.ads: New test. -- Eric Botcazou -- { dg-do compile } package Aggr2 is type Buffer is array (Positive range <>) of Boolean; for Buffer'Alignment use 4; type Buffer_Ptr is access Buffer; subtype My_Buffer is Buffer (1 .. 2); P : Buffer_Ptr := new My_Buffer'(Others => False); end Aggr2; Index: gcc-interface/utils2.c === --- gcc-interface/utils2.c (revision 171818) +++ gcc-interface/utils2.c (working copy) @@ -2135,17 +2135,9 @@ build_allocator (tree type, tree init, t gnat_proc, gnat_pool, gnat_node); storage = convert (storage_ptr_type, gnat_protect_expr (storage)); - if (TYPE_IS_PADDING_P (type)) - { - type = TREE_TYPE (TYPE_FIELDS (type)); - if (init) - init = convert (type, init); - } - - /* If there is an initializing expression, make a constructor for - the entire object including the bounds and copy it into the - object. If there is no initializing expression, just set the - bounds. */ + /* If there is an initializing expression, then make a constructor for + the entire object including the bounds and copy it into the object. + If there is no initializing expression, just set the bounds. */ if (init) { VEC(constructor_elt,gc) *v = VEC_alloc (constructor_elt, gc, 2); @@ -2154,7 +2146,6 @@ build_allocator (tree type, tree init, t build_template (template_type, type, init)); CONSTRUCTOR_APPEND_ELT (v, DECL_CHAIN (TYPE_FIELDS (storage_type)), init); - return convert (result_type, build2 (COMPOUND_EXPR, storage_ptr_type,
fix PR libstdc++/48398
2011-04-02 Jonathan Wakely PR libstdc++/48398 * include/bits/unique_ptr.h (__tuple_type): Store pointer type. * testsuite/20_util/unique_ptr/modifiers/48398.cc: New. * testsuite/20_util/unique_ptr/requirements/pointer_type.cc: Remove unused parameter name. tested x86_64-linux and committed to 4.6 branch, will commit to trunk once I've built r171842 (before the bootstrap comparison failure) and tested. 48398.diff Description: Binary data
Re: [PATCH] Fix VTA updating in the combiner (PR debug/48343)
> Combiner has code to adjust this too (propagate_for_debug), but only > updates debug insns between i2 and i3 (resp. i3 and undobuf.other_insn). > The problem on the testcase is that this is a retry, so first > try_combine with a later i3 calls propagate_for_debug and changes debug > insns before that later i3, then returns an earlier insn that should be > retried and we stop adjusting debug insns at that earlier i3. > Unfortunately as later debug insns have been already updated earlier, they > need to be adjusted too. > > The following patch fixes that by always stopping on the latest i3 that has > been successfully combined into in the current bb, bootstrapped/regtested > on x86_64-linux and i686-linux, ok for trunk/4.6? This seems to be a rare problem though so I'm not sure we should directly go for an "always" approach. IIUC this can happen only when try_combine returns a NEXT to combine_instructions which is before INSN in the stream, right? Can't we precisely detect this case under the "retry:" label and pass an additional argument to try_combine? Do we really need to adjust all the calls to propagate_for_debug and not just the ones made for UNDO_MODE when the register is I2DEST? -- Eric Botcazou
Re: [PATCH] Fix VTA updating in the combiner (PR debug/48343)
On Sat, Apr 02, 2011 at 05:42:55PM +0200, Eric Botcazou wrote: > > Combiner has code to adjust this too (propagate_for_debug), but only > > updates debug insns between i2 and i3 (resp. i3 and undobuf.other_insn). > > The problem on the testcase is that this is a retry, so first > > try_combine with a later i3 calls propagate_for_debug and changes debug > > insns before that later i3, then returns an earlier insn that should be > > retried and we stop adjusting debug insns at that earlier i3. > > Unfortunately as later debug insns have been already updated earlier, they > > need to be adjusted too. > > > > The following patch fixes that by always stopping on the latest i3 that has > > been successfully combined into in the current bb, bootstrapped/regtested > > on x86_64-linux and i686-linux, ok for trunk/4.6? > > This seems to be a rare problem though so I'm not sure we should directly go > for an "always" approach. IIUC this can happen only when try_combine returns > a NEXT to combine_instructions which is before INSN in the stream, right? Yeah, but that is when in the patch i3 will differ from last_combined_insn. > Can't we precisely detect this case under the "retry:" label and pass an > additional argument to try_combine? Do we really need to adjust all the > calls We'd still need to do the LUID checking anyway, to find out when we still do retry earlier insns and when we return back to looking at new insns. Plus, I believe whenever we propagate_for_debug after i3 (the updating in between i3 and undobuf.other_insn, we need to adjust those insns too. > to propagate_for_debug and not just the ones made for UNDO_MODE when the > register is I2DEST? I think we need to update there in all cases. The reason we don't need to update beyond i3 resp. undobuf.other_insn is that DF guarantees us that there won't be debug insns referring to those pseudos afterwards, otherwise either the pseudo must be live afterwards in real code (then it wouldn't be a single use case), or debug insns would be reset, or a debug temporary would be created, where the temporary is set before last place where the pseudo is used in real code. Now, once we propagate_for_debug after some insn, DF hasn't been run in between and thus the pseudos might be live afterwards. If you just want to avoid a global variable, the code can be surely changed to have a local variable from combine_instructions and pass address to that to all try_combine calls, but other than that I think we should do what the patch does. Alex, do you agree? Jakub
Re: [PATCH, PR43920, 1/9] ARM specific part.
On 04/02/2011 09:47 AM, Richard Guenther wrote: > On Fri, Apr 1, 2011 at 6:06 PM, Tom de Vries wrote: >> On 04/01/2011 05:18 PM, Richard Earnshaw wrote: >>> >>> On Fri, 2011-04-01 at 16:45 +0200, Tom de Vries wrote: Reposting, with ChangeLog. >>> >>> #define BRANCH_COST(speed_p, predictable_p) \ >>> - (TARGET_32BIT ? 4 : (optimize > 0 ? 2 : 0)) >>> + (TARGET_32BIT ? (TARGET_THUMB2 && optimize_size ? 1 : 4) \ >>> + : (optimize > 0 ? 2 : 0)) >>> >>> Don't use optimize_size here, use !speed_p. >>> >>> Otherwise OK. >>> >> >> Replaced optimize_size by !speed_p. > > I wonder if we can add a code-size test harness. Using GNU size > for examle, if available and a new dg-final { object-size SIZE } that > fails when the size is greater than the specified one (of course all > object-size tests with specific target restrictions). like this? Thanks, - Tom 2011-04-01 Tom de Vries PR target/43920 * lib/scanasm.exp (object-size): New proc. * gcc.target/arm/pr43920-2.c: New test. Index: gcc/testsuite/lib/scanasm.exp === --- gcc/testsuite/lib/scanasm.exp (revision 170556) +++ gcc/testsuite/lib/scanasm.exp (working copy) @@ -315,6 +315,83 @@ proc scan-assembler-dem-not { args } { } } +# Call pass if object size is ok, otherwise fail. +# example: /* { dg-final { object-size text <= 54 } } */ +proc object-size { args } { +global size +global base_dir + +if { [llength $args] < 3 } { + error "object-size: too few arguments" +return +} +if { [llength $args] > 4 } { + error "object-size: too many arguments" + return +} +if { [llength $args] >= 4 } { + switch [dg-process-target [lindex $args 1]] { + "S" { } + "N" { return } + "F" { setup_xfail "*-*-*" } + "P" { } + } +} + +# Find size like we find g++ in g++.exp. +if ![info exists size] { + set size [findfile $base_dir/../../../binutils/size \ + $base_dir/../../../binutils/size \ + [findfile $base_dir/../../size $base_dir/../../size \ + [findfile $base_dir/size $base_dir/size \ + [transform size + verbose -log "size is $size" +} + +upvar 2 name testcase +set testcase [lindex $testcase 0] +set output_file "[file rootname [file tail $testcase]].o" +set output [remote_exec host "$size" "$output_file"] +set text [lindex $output 1] +set status [lindex $output 0] +if { $status != 0 } { +error "object-size: $size failed" +return +} + +set what [lindex $args 0] +switch $what { +total { set where 9 } +bss { set where 8 } +data { set where 7 } +text { set where 6 } +default { +error "object-size: illegal argument: $what" +return +} +} +set actual [lindex $text $where] +verbose -log "$what size is $actual" + +set cmp [lindex $args 1] +if { [lsearch { < > <= >= == != } $cmp] == -1 } { +error "object-size: illegal argument: $cmp" +return +} + +set with [lindex $args 2] +if { ![string is integer $with ] } { +error "object-size: illegal argument: $with" +return +} + +if { [expr $actual $cmp $with] } { + pass "$testcase object-size $what $cmp $with" +} else { + fail "$testcase object-size $what $cmp $with" +} +} + # Utility for testing that a function is defined on the current line. # Call pass if so, otherwise fail. Invoked directly; the file must # have been compiled with -g -dA. Index: gcc/testsuite/gcc.target/arm/pr43920-2.c === --- gcc/testsuite/gcc.target/arm/pr43920-2.c (revision 0) +++ gcc/testsuite/gcc.target/arm/pr43920-2.c (revision 0) @@ -0,0 +1,30 @@ +/* { dg-do assemble } */ +/* { dg-options "-mthumb -Os -save-temps" } */ +/* { dg-require-effective-target arm_thumb2_ok } */ + +#include + +int getFileStartAndLength (int fd, int *start_, size_t *length_) +{ + int start, end; + size_t length; + + start = lseek (fd, 0L, SEEK_CUR); + end = lseek (fd, 0L, SEEK_END); + + if (start == -1 || end == -1) + return -1; + + length = end - start; + if (length == 0) + return -1; + + *start_ = start; + *length_ = length; + + return 0; +} + +/* { dg-final { scan-assembler-times "pop" 2 } } */ +/* { dg-final { scan-assembler-times "beq" 3 } } */ +/* { dg-final { object-size text <= 54 } } */
Target header etc. cleanup patch
In the course of trying to work out exactly what target macros there are, I came across various oddities in target headers (and a few in target .c files) that are fixed by this patch. * Various targets use "struct rtx_def *" or "union tree_node *" in place of "rtx" or "tree". I think this must predate coretypes.h, which ensures the typedefs are always available (and should always be included before tm.h or tm_p.h). * Some targets went the other way and defined their own macros for various standard types. Some of those macros weren't even used. I don't think it makes sense for individual targets to define macros for use in their prototypes like that, so I removed those definitions (expanding the uses). * cris-protos.h had an unused STDIO_INCLUDED definition, which I removed. i386/cygming.h had a #undef of FILE, which doesn't make any sense (no code in GCC should be defining such a macro itself) so I removed that as well. * fr30.h defined inhibit_libc. This is normally defined by configure when appropriate (based on the configure options) and it doesn't make any sense for a single architecture to define it in its own headers instead so I removed it. * Testing showed that IRA_COVER_CLASSES had not been removed from pdp11.h when it was removed from other targets, so I removed it in this patch so that the other pdp11.h change could be tested. Tested building cc1 and xgcc for crosses to: alpha-linux-gnu bfin-elf cris-elf fr30-elf h8300-elf i686-cygwin iq2000-elf m32c-elf m32r-elf microblaze-elf mn10300-elf hppa-linux-gnu pdp11-none rx-elf sh-elf spu-elf v850-elf. OK to commit? 2011-04-02 Joseph Myers * config/alpha/alpha.c (struct machine_function): Use rtx, not struct rtx_def *. * config/bfin/bfin-protos.h (Mmode): Don't define. Expand definition where used. * config/bfin/bfin.h (bfin_cc_rtx, bfin_rets_rtx): Use rtx, not struct rtx_def *. * config/cris/cris-protos.h (STDIO_INCLUDED): Don't define. * config/fr30/fr30-protos.h (Mmode): Don't define. * config/fr30/fr30.h (inhibit_libc): Don't define. * config/h8300/h8300.h (struct cum_arg): Use rtx, not struct rtx_def *. * config/i386/cygming.h (union tree_node, TREE): Don't define or undefine. (FILE): Don't undefine. * config/iq2000/iq2000.h (struct iq2000_args): Use rtx, not struct rtx_def *. * config/m32c/m32c-protos.h (MM, UINT): Don't define. Expand definitions where used. * config/m32r/m32r-protos.h (Mmode): Don't define. Expand definition where used. * config/microblaze/microblaze.h (struct microblaze_args): Use rtx, not struct rtx_def *. * config/mn10300/mn10300-protos.h (Mmode, Cstar, Rclas): Don't define. Expand definitions where used. * config/pa/pa-protos.h (return_addr_rtx): Use rtx, not struct rtx_def *. * config/pa/pa.h (hppa_pic_save_rtx): Use rtx, not struct rtx_def *. * config/pdp11/pdp11.h (IRA_COVER_CLASSES): Remove. (cc0_reg_rtx): Use rtx, not struct rtx_def *. * config/rx/rx-protos.h (Mmode, Fargs, Rcode): Don't define. Expand definitions where used. * config/rx/rx.c (rx_is_legitimate_address, rx_function_arg_size, rx_function_arg, rx_function_arg_advance, rx_function_arg_boundary): Expand definitions of those macros. * config/sh/sh-protos.h (sfunc_uses_reg, get_fpscr_rtx): Use rtx, not struct rtx_def *. * config/sh/sh.h (sh_compare_op0, sh_compare_op1): Use rtx, not struct rtx_def *. * config/spu/spu-protos.h (spu_float_const): Use rtx, not struct rtx_def *. * config/spu/spu.c (spu_float_const): Use rtx, not struct rtx_def *. * config/v850/v850-protos.h (Mmode): Don't define. Expand definition where used. * config/v850/v850.h (GHS_default_section_names, GHS_current_section_names): Use tree, not union tree_node *. Index: gcc/config/alpha/alpha.c === --- gcc/config/alpha/alpha.c(revision 171804) +++ gcc/config/alpha/alpha.c(working copy) @@ -4606,7 +4606,7 @@ struct GTY(()) machine_function const char *some_ld_name; /* For TARGET_LD_BUGGY_LDGP. */ - struct rtx_def *gp_save_rtx; + rtx gp_save_rtx; /* For VMS condition handlers. */ bool uses_condition_handler; Index: gcc/config/m32c/m32c-protos.h === --- gcc/config/m32c/m32c-protos.h (revision 171804) +++ gcc/config/m32c/m32c-protos.h (working copy) @@ -1,5 +1,5 @@ /* Target Prototypes for R8C/M16C/M32C - Copyright (C) 2005, 2007, 2008, 2010 + Copyright (C) 2005, 2007, 2008, 2010, 2011 Free Software Foundation, Inc. Contributed by Red Hat. @@ -19,12 +19,9 @@ along with GCC; see the file CO
Re: [patch i386]: Set for method-functions default calling-convention to thiscall for 32-bit msabi
2011/4/1 Richard Henderson : > On 04/01/2011 11:36 AM, Kai Tietz wrote: >> It might be a good thing to extract those call-abi lookups into a >> specific function, which returns numbers for the selected on. By this >> we can avoid double lookup of attributes here. >> But I would like to do this in a separate patch. > > Sure. > > > r~ > Committed at revision 171890. Thanks, Kai
Re: Target header etc. cleanup patch
On Apr 2, 2011, at 1:05 PM, Joseph S. Myers wrote: > In the course of trying to work out exactly what target macros there > are, I came across various oddities in target headers (and a few in > target .c files) that are fixed by this patch > > * Testing showed that IRA_COVER_CLASSES had not been removed from > pdp11.h when it was removed from other targets, so I removed it in > this patch so that the other pdp11.h change could be tested. ... I did not realize that IRA_COVER_CLASSES had gone away. What replaces it? It wasn't that long ago that I put it in because it seemed that up to date targets were supposed to have this (and the internals manual implied as much). PDP11 looks good, thanks. paul
Re: [patch i386]: Set for method-functions default calling-convention to thiscall for 32-bit msabi
On Sat, Apr 2, 2011 at 10:09 AM, Kai Tietz wrote: > 2011/4/1 Richard Henderson : >> On 04/01/2011 11:36 AM, Kai Tietz wrote: >>> It might be a good thing to extract those call-abi lookups into a >>> specific function, which returns numbers for the selected on. By this >>> we can avoid double lookup of attributes here. >>> But I would like to do this in a separate patch. >> >> Sure. >> >> >> r~ >> > > Committed at revision 171890. > This caused: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48416 You changed ix86_function_arg_boundary: @@ -7441,8 +7485,10 @@ ix86_function_arg_boundary (enum machine_mode mode, const_tree type) warned = true; inform (input_location, "The ABI for passing parameters with %d-byte" - " alignment has changed in GCC 4.6", - align / BITS_PER_UNIT); + " alignment has changed in GCC 4.6 (mode:%u, %d saved", + align / BITS_PER_UNIT, + ix86_compat_function_arg_boundary (mode, type, saved_align), + mode, saved_align); } } But it isn't mentioned in ChangeLog nor your submission. Did you check it in by accident? -- H.J.
Re: [patch i386]: Set for method-functions default calling-convention to thiscall for 32-bit msabi
2011/4/2 H.J. Lu : > On Sat, Apr 2, 2011 at 10:09 AM, Kai Tietz wrote: >> 2011/4/1 Richard Henderson : >>> On 04/01/2011 11:36 AM, Kai Tietz wrote: It might be a good thing to extract those call-abi lookups into a specific function, which returns numbers for the selected on. By this we can avoid double lookup of attributes here. But I would like to do this in a separate patch. >>> >>> Sure. >>> >>> >>> r~ >>> >> >> Committed at revision 171890. >> > > This caused: > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48416 > > You changed ix86_function_arg_boundary: > > @@ -7441,8 +7485,10 @@ ix86_function_arg_boundary (enum machine_mode > mode, const_tree type) > warned = true; > inform (input_location, > "The ABI for passing parameters with %d-byte" > - " alignment has changed in GCC 4.6", > - align / BITS_PER_UNIT); > + " alignment has changed in GCC 4.6 (mode:%u, %d saved", > + align / BITS_PER_UNIT, > + ix86_compat_function_arg_boundary (mode, type, saved_align), > + mode, saved_align); > } > } > > > But it isn't mentioned in ChangeLog nor your submission. Did you check it > in by accident? Ups, yes. I'll correct it immediately Kai
Re: [patch i386]: Set for method-functions default calling-convention to thiscall for 32-bit msabi
2011/4/2 Kai Tietz : > 2011/4/2 H.J. Lu : >> On Sat, Apr 2, 2011 at 10:09 AM, Kai Tietz wrote: >>> 2011/4/1 Richard Henderson : On 04/01/2011 11:36 AM, Kai Tietz wrote: > It might be a good thing to extract those call-abi lookups into a > specific function, which returns numbers for the selected on. By this > we can avoid double lookup of attributes here. > But I would like to do this in a separate patch. Sure. r~ >>> >>> Committed at revision 171890. >>> >> >> This caused: >> >> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48416 >> >> You changed ix86_function_arg_boundary: >> >> @@ -7441,8 +7485,10 @@ ix86_function_arg_boundary (enum machine_mode >> mode, const_tree type) >> warned = true; >> inform (input_location, >> "The ABI for passing parameters with %d-byte" >> - " alignment has changed in GCC 4.6", >> - align / BITS_PER_UNIT); >> + " alignment has changed in GCC 4.6 (mode:%u, %d saved", >> + align / BITS_PER_UNIT, >> + ix86_compat_function_arg_boundary (mode, type, >> saved_align), >> + mode, saved_align); >> } >> } >> >> >> But it isn't mentioned in ChangeLog nor your submission. Did you check it >> in by accident? > > Ups, yes. I'll correct it immediately > > Kai > Corrected at revision 171891. Kai
Re: darwin LTO broken under Xcode 3.2.6/4.0
On Mon, 14 Mar 2011, Jack Howarth wrote: >Would someone please correct http://gcc.gnu.org/gcc-4.6/changes.html by > deleting > the reference to darwin LTO support. Specifically we should just kill the > line... Done thusly. Gerald Index: changes.html === RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.6/changes.html,v retrieving revision 1.124 diff -u -r1.124 changes.html --- changes.html22 Mar 2011 20:11:00 - 1.124 +++ changes.html2 Apr 2011 22:26:45 - @@ -974,8 +974,6 @@ context of format attributes and arguments (see the documentation for format attributes for limitations). At present, 8-bit character types are supported. - LTO-support.Darwin has benefited from ongoing work on - LTO; support for this is now stable and enabled by default. Object file size reduction. The Darwin zeroed memory allocators have been re-written to make more use of .zerofill sections. For non-debug code, this can
Re: [Ada] Re-enable -feliminate-unused-debug-types by default
On Sat, 2 Apr 2011, Eric Botcazou wrote: > The previous 7 patches paved the way to enabling > -feliminate-unused-debug-types again by default in Ada. We measured a > 12.5% reduction in debug info size on one big application (and an even > larger one for another application), as well as a 0.5% reduction in > compilation time at -O0 -g. Nice. I documented this for GCC 4.7 as follows. Gerald Index: changes.html === RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.7/changes.html,v retrieving revision 1.4 diff -u -r1.4 changes.html --- changes.html27 Mar 2011 18:57:39 - 1.4 +++ changes.html2 Apr 2011 22:50:50 - @@ -46,6 +46,13 @@ Ada + +The command-line option -feliminate-unused-debug-types + has been removed. Its behavior is the default now, leading to + a reduction in debug info size of 12% and more for relevant + cases. + + C family C++
Re: [PATCH] gcc is broken on i386 FreeBSD due to binutil upgrade
On Mon, 21 Feb 2011, Richard Guenther wrote: >> 2011-02-20 Steven G. Kargl >> >> * gcc/config.gcc: Include i386/t-crtstuff in the building of crtend.o > Wh! Updating from ancient to old! Yes, GPLv3 and the way FreeBSD is handling it are unfortunate. In any case, lang/gcc45 and other FreeBSD ports I maintain use binutils 2.21, but for the sake of the system compiler or some building GCC from scratch, can one of you guys approve Steven's patch for HEAD, 4.6 and 4.5? Gerald
Re: RFC: C++0x ABI PATCH to decltype handling
On Wed, 23 Feb 2011, Mark Mitchell wrote: >> Perhaps so; I'm not sure what the right answer is for the default ABI >> version. For now I've just made these changes ABI v6, and I'm checking >> in this patch. > That's good future-proofing. > > I know I'm being a bit pedantic, but I was just getting beat up about > GCC backwards-compatibility again today. It's possible to fix 100 bugs, > add 100 features, and still have an unhappy user if their code stops > working. Well, we've just done it once again. Quoting from the GCC 4.6 release notes: Most libstdc++ standard headers have been changed to no longer include the cstddef header as an implementation detail. Code that relied on that header being included as side-effect of including other standard headers will need to include cstddef explicitly. Gerald