[Patch, Fortran] Fix coarray's num_images()/this_image() variables
The global variables generated to store this_image/num_images were wrong in several ways: - translation-unit (TU) dependent name (could be same or different) - variable generated in every TU - and not only in one - not pushed - which could cause already failures with one TU Now, the variable is generated for the TU of the main program - and in the others declared as DECL_EXTERNAL, additionally the variable is pushed to make sure it is generated. Thanks to Jakub for the suggestions! Build and currently regtesting. OK for the trunk? Tobias 2011-05-04 Tobias Burnus bur...@net-b.de PR fortran/18918 * trans.h: Move gfc_init_coarray_decl prototype ... * gfortran.h: ... to here. * parse.c (translate_all_program_units): Call gfc_init_coarray_decl. (gfc_parse_file): Update translate_all_program_units call. * trans-decl.c (gfc_init_coarray_decl): Fix variable declaration, new argument whether DECL_EXTERNAL should be used. (create_main_function): Update gfc_init_coarray_decl call. * trans-intrinsic.c (trans_this_image, trans_image_index, conv_intrinsic_cobound): Ditto. diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h index b127f6f..92adf72 100644 --- a/gcc/fortran/gfortran.h +++ b/gcc/fortran/gfortran.h @@ -2851,6 +2851,7 @@ bool gfc_is_function_return_value (gfc_symbol *, gfc_namespace *); /* trans.c */ void gfc_generate_code (gfc_namespace *); void gfc_generate_module_code (gfc_namespace *); +void gfc_init_coarray_decl (bool); /* bbt.c */ typedef int (*compare_fn) (void *, void *); diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c index ff029bf..80fcf00 100644 --- a/gcc/fortran/parse.c +++ b/gcc/fortran/parse.c @@ -4231,13 +4231,19 @@ clean_up_modules (gfc_gsymbol *gsym) is active. This could be in a different order to resolution if there are forward references in the file. */ static void -translate_all_program_units (gfc_namespace *gfc_global_ns_list) +translate_all_program_units (gfc_namespace *gfc_global_ns_list, + bool main_in_tu) { int errors; gfc_current_ns = gfc_global_ns_list; gfc_get_errors (NULL, errors); + /* If the main program is in the translation unit and we have + -fcoarray=libs, generate the static variables. */ + if (gfc_option.coarray == GFC_FCOARRAY_LIB main_in_tu) +gfc_init_coarray_decl (true); + /* We first translate all modules to make sure that later parts of the program can use the decl. Then we translate the nonmodules. */ @@ -4475,7 +4481,7 @@ prog_units: } /* Do the translation. */ - translate_all_program_units (gfc_global_ns_list); + translate_all_program_units (gfc_global_ns_list, seen_program); termination: diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index f80c9db..727cc8c 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -4463,10 +4452,16 @@ add_argument_checking (stmtblock_t *block, gfc_symbol *sym) } +/* Generate the _gfortran_caf_this_image and _gfortran_caf_num_images + global variables for -fcoarray=lib. They are placed into the translation + unit of the main program. Make sure that in one TU (the one of the main + program), the first call to gfc_init_coarray_decl is done with true. + Otherwise, expect link errors. */ + void -gfc_init_coarray_decl (void) +gfc_init_coarray_decl (bool main_tu) { - tree save_fn_decl = current_function_decl; + tree save_fn_decl; if (gfc_option.coarray != GFC_FCOARRAY_LIB) return; @@ -4478,19 +4473,37 @@ gfc_init_coarray_decl (void) current_function_decl = NULL_TREE; push_cfun (cfun); - gfort_gvar_caf_this_image = gfc_create_var (integer_type_node, - PREFIX(caf_this_image)); + gfort_gvar_caf_this_image + = build_decl (input_location, VAR_DECL, + get_identifier (PREFIX(caf_this_image)), + integer_type_node); DECL_ARTIFICIAL (gfort_gvar_caf_this_image) = 1; TREE_USED (gfort_gvar_caf_this_image) = 1; TREE_PUBLIC (gfort_gvar_caf_this_image) = 1; - TREE_STATIC (gfort_gvar_caf_this_image) = 1; + TREE_READONLY (gfort_gvar_caf_this_image) = 0; - gfort_gvar_caf_num_images = gfc_create_var (integer_type_node, - PREFIX(caf_num_images)); + if (main_tu) +TREE_STATIC (gfort_gvar_caf_this_image) = 1; + else +DECL_EXTERNAL (gfort_gvar_caf_this_image) = 1; + + pushdecl_top_level (gfort_gvar_caf_this_image); + + gfort_gvar_caf_num_images + = build_decl (input_location, VAR_DECL, + get_identifier (PREFIX(caf_num_images)), + integer_type_node); DECL_ARTIFICIAL (gfort_gvar_caf_num_images) = 1; TREE_USED (gfort_gvar_caf_num_images) = 1; TREE_PUBLIC (gfort_gvar_caf_num_images) = 1; - TREE_STATIC (gfort_gvar_caf_num_images) = 1; + TREE_READONLY (gfort_gvar_caf_num_images) = 0; + + if (main_tu) +TREE_STATIC (gfort_gvar_caf_num_images) = 1; + else +DECL_EXTERNAL (gfort_gvar_caf_num_images) = 1; + + pushdecl_top_level (gfort_gvar_caf_num_images); pop_cfun ();
debug insns in SMS (was: Re: Debug_insn)
On May 3, 2011, Revital1 Eres e...@il.ibm.com wrote: Please let me know if you need any further info. No, thanks, that was all I needed. I think this will restore proper functioning to SMS in the presence of debug insns. A while ago, we'd never generate deps of non-debug insns on debug insns. I introduced them to enable sched to adjust (reset) debug insns when non-debug insns were moved before them. I believe it is safe to leave them out of the SCCs. Even though this will end up causing some loss of debug info, that's probably unavoidable, and the end result after this change is pobably the best we can hope for. Your thoughts? Is this ok to install if it regstraps successfully? for gcc/ChangeLog from Alexandre Oliva aol...@redhat.com * ddg.c (build_intra_loop_deps): Discard deps of nondebug on debug. Index: gcc/ddg.c === --- gcc/ddg.c.orig 2011-05-04 03:42:20.938013725 -0300 +++ gcc/ddg.c 2011-05-04 03:42:30.202253457 -0300 @@ -452,7 +452,12 @@ build_intra_loop_deps (ddg_ptr g) FOR_EACH_DEP (dest_node-insn, SD_LIST_BACK, sd_it, dep) { - ddg_node_ptr src_node = get_node_of_insn (g, DEP_PRO (dep)); + ddg_node_ptr src_node; + + if (DEBUG_INSN_P (DEP_PRO (dep)) !DEBUG_INSN_P (dest_node-insn)) + continue; + + src_node = get_node_of_insn (g, DEP_PRO (dep)); if (!src_node) continue; -- 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
Re: [PATCH] don't use TYPE_ARG_TYPES in the Ada FE
* gcc-interface/decl.c (intrin_arglists_compatible_p): Use iterators instead of accessing TYPE_ARG_TYPES directly. * gcc-interface/utils.c (handle_nonnull_attribute): Likewise. Probably fine, but please patch the C front-end first. I'm afraid that the coverage of this part of the gigi code by the Ada testsuite is zero and the second chunk is a copy of the equivalent C code. -- Eric Botcazou
Re: [trunk][RFA] Add __i686.get_pc_thunk.bx to libgcc i386 morestack.S
On Tue, May 3, 2011 at 16:39, Chris Demetriou c...@google.com wrote: It is also OK if you s/__i686/__x86/ to correspond to your earlier change. Either way is OK. Well, that change is not in trunk. Should that change move to trunk, yes, it's appropriate to change this as well (though strictly not *necessary*). *sigh* As it turns out, adding __i686.get_pc_thunk.bx to this assembly code -- *cough* this _preprocessed_ assembly code -- chokes in certain configurations. For instance, if you configure with: --with-arch-32=pentium3 then libgcc will build with -march=pentium3 The way the symbol-visibility files are built and processed, morestack.vis is generated from morestack.S, and contains: .hidden __i686.get_pc_thunk.bx morestack.vis is included via -include when compiling morestack.S. ./morestack.vis:4: Error: junk at end of line, first unrecognized character is `1' As someone smarter than me might have guessed... in this configuration, __i686 is defined to be '1'. So, even if the trunk get_thunk code continues to use __i686.get_pc_thunk.reg, it's necessary to use something different here. Kinda feels like I got smacked in the face by walking into my own rake... *sigh* Ian, per your previous comment (which I read as pre-approval for this change 8-), I'm planning to commit the attached as soon as it's done testing. chris - [libgcc/ChangeLog] 2011-05-04 Chris Demetriou c...@google.com * config/i386/morestack.S (__i686.get_pc_thunk.bx): Rename... (__x86.get_pc_thunk.bx): To this. (__morestack): Adjust for rename, remove undef of __i686. [libgcc/ChangeLog] 2011-05-04 Chris Demetriou c...@google.com * config/i386/morestack.S (__i686.get_pc_thunk.bx): Rename... (__x86.get_pc_thunk.bx): To this. (__morestack): Adjust for rename, remove undef of __i686. Index: libgcc/config/i386/morestack.S === --- libgcc/config/i386/morestack.S (revision 173355) +++ libgcc/config/i386/morestack.S (working copy) @@ -278,8 +278,7 @@ movl 4(%esp),%eax # Function argument. movl %eax,(%esp) #ifdef __PIC__ -#undef __i686 - call __i686.get_pc_thunk.bx # %ebx may not be set up for us. + call __x86.get_pc_thunk.bx # %ebx may not be set up for us. addl $_GLOBAL_OFFSET_TABLE_, %ebx call _Unwind_Resume@PLT # Resume unwinding. #else @@ -451,20 +450,19 @@ #if !defined(__x86_64__) defined(__PIC__) # Output the thunk to get PC into bx, since we use it above. -# (__i686 was already undef'd above; don't need to worry about it here.) - .section .text.__i686.get_pc_thunk.bx,axG,@progbits,__i686.get_pc_thunk.bx,comdat - .globl __i686.get_pc_thunk.bx - .hidden __i686.get_pc_thunk.bx + .section .text.__x86.get_pc_thunk.bx,axG,@progbits,__x86.get_pc_thunk.bx,comdat + .globl __x86.get_pc_thunk.bx + .hidden __x86.get_pc_thunk.bx #ifdef __ELF__ - .type __i686.get_pc_thunk.bx, @function + .type __x86.get_pc_thunk.bx, @function #endif -__i686.get_pc_thunk.bx: +__x86.get_pc_thunk.bx: .cfi_startproc movl (%esp), %ebx ret .cfi_endproc #ifdef __ELF__ - .size __i686.get_pc_thunk.bx, . - __i686.get_pc_thunk.bx + .size __x86.get_pc_thunk.bx, . - __x86.get_pc_thunk.bx #endif #endif
Re: C++ PATCHes relating to c++/48834, c++/40975 (array new)
Well, let's look at the users of copy_tree_r. cp/tree.c (bot_manip): The case I want to fix. Then I'd put the fix there. The old behaviour of copy_tree_r is IMO the most sensible one and its callers should cope, as almost all already do it seems. -- Eric Botcazou
Re: [PATCH, SMS] Avoid considering debug_insn when calculating SCCs
Hello, The following is a summary of discussion I had with Ayal regarding the patch: Some background: currently, SMS supports only targets where the doloop pattern is decoupled from the rest of the loop's instructions (for example PowerPC) (we'll call it 'case decoupled' for simplicity) In this case, the branch is not been scheduled with the rest of the instructions but rather placed in row ii-1 at the end of the scheduling procedure after all the rest of the instructions had been scheduled. The resulting kernel is optimal with respect to the Stage Count because min_cycle placed in row 0 after normalizing the cycles to start from cycle zero. This patch tries to extend SMS to support targets where the doloop pattern is not decoupled from the rest of the loop's instructions (name it 'case NEW' for simplicity). In this case the branch can not be placed wherever we want due to the fact it must honor dependencies and thus we schedule the branch instruction with the rest of the loop's instructions and rotate it to be in row ii-1 at the end of the scheduling procedure to make sure it's the last instruction in the iteration. The suggestion was to simplify the patch by always schedule the branch with the rest of the instructions. This should not effect performance but rather code size by increasing the SC by at most 1, which means adding instructions from at most one iteration to the prologue and epilogue; for case decoupled. (where we have the alternative of normalizing the cycles and achieve optimal SC). The following is my attempt to prove that the SC can increase by at most one: If the distance between min_cycle and max_cycle remains the same when considering the same loop with decoupled branch part, once scheduling the branch instruction with the rest of the loop's instructions and once ignoring it; it means that the SC is at most +1 for the first case. This is true in one direction as the branch instruction should not effect the scheduling window of any other instruction which is what we expect for case decoupled. The question is if there are cases where the branch can be scheduled outside the range of min_cycle and max_cycle. I think there is no such case because the branch will be scheduled in asap = 0 which means that it will fall in the range of min_cycle max_cycle. In practice there is edge between memory references and the branch instruction with latency zero which is inserted by haifa sched. Also, it might be that the branch will be scheduled outside the range of min_cycle and max_cycle due to resources constraints. For example, in PowerPC the issue rate in SMS in always 1 which forces the branch to be scheduled in a new cycle (and might also influence ii in artifact way). Example of resulting SMS kernel for the same loop: The SMS kernel for case NEW, resulting in SC of 3 and ii 5: cycle node -30 -2 -11 - start of SC 2 0 1 2 3 3 4 5 the branch - start of SC 3 5 4 The SMS kernel for case decoupled resulting in SC of 2 and ii 5: cycle node 00 1 2 1 3 3 4 2 - start of SC 2 5 6 3 Thanks, Revital
Re: [PATCH, SMS] Avoid considering debug_insn when calculating SCCs
My apologies, the previous email refers to the patch: http://gcc.gnu.org/ml/gcc-patches/2011-03/msg00350.html - Support closing_branch_deps and not to 'Avoid considering debug_insn when calculating SCCs' as the title implies. Thanks, Revital
[patch] Remove error from variable_size
Hi, on the heels of the discussion with Joseph, the attached patch removes the error issued by variable_size, as it appears to be totally useless at this point. FEs should be responsible for catching errors here. Tested on x86_64-suse-linux, OK for the mainline? 2011-05-04 Eric Botcazou ebotca...@adacore.com * stor-layout.c (variable_size): Do not issue errors. -- Eric Botcazou Index: stor-layout.c === --- stor-layout.c (revision 173209) +++ stor-layout.c (working copy) @@ -152,16 +152,6 @@ variable_size (tree size) that determine sizes for variable size objects. Trust it. */ return size; - if (lang_hooks.decls.global_bindings_p ()) -{ - if (TREE_CONSTANT (size)) - error (type size can%'t be explicitly evaluated); - else - error (variable-size type declared outside of any function); - - return size_one_node; -} - put_pending_size (save); return size;
Re: [google]: initialize language field for clone function struct
Well - the errors in variable_size aren't used by C any more (since 4.5), but I don't know whether any other languages use them. Apparently not, let's remove them. And pending sizes are used to a limited extent for C (to handle side effects in sizes of array parameters, as described in the comment /* ??? Insert the contents of the pending sizes list into the function to be evaluated. The only reason left to have this is void foo(int n, int array[n++]) because we throw away the array type in favor of a pointer type, and thus won't naturally see the SAVE_EXPR containing the increment. All other pending sizes would be handled by gimplify_parameters. */ ) although it would now be better to make use of the expr parameter to grokdeclarator to replace this residual use of the pending sizes global list. c-parser.c/c-decl.c are the only remaining users of pending sizes so it would indeed be desirable to change them so as to totally get rid of pending sizes. Actually, it will probably be possible the eliminate the function completely for C; there's no good reason to do more than calling save_expr directly. if (TREE_CONSTANT (size)) return size; Redundant, save_expr checks for constants. size = save_expr (size); The only necessary bit of c_variable_size once pending sizes are replaced by a better scheme. save = skip_simple_arithmetic (size); Premature optimization. if (cfun cfun-dont_save_pending_sizes_p) return size; if (!global_bindings_p ()) put_pending_size (save); No longer needed once pending sizes are replaced. return size; So this just becomes equivalent to save_expr. There is the CONTAINS_PLACEHOLDER_P check in the generic case but, yes, otherwise it's just a proxy for save_expr. -- Eric Botcazou
Re: debug insns in SMS
On May 4, 2011, Alexandre Oliva aol...@redhat.com wrote: I think this will restore proper functioning to SMS in the presence of debug insns. A while ago, we'd never generate deps of non-debug insns on debug insns. I introduced them to enable sched to adjust (reset) debug insns when non-debug insns were moved before them. I believe it is safe to leave them out of the SCCs. Even though this will end up causing some loss of debug info, that's probably unavoidable, and the end result after this change is pobably the best we can hope for. Your thoughts? Actually... We can probably do better. Leaving the debug insns out, we have no way to adjust (reset) them when non-debug insns that depended on them were moved across them, rendering the debug value incorrect. I'm now trying to find out some way to add the tracking of these deps to the DDG in a way that doesn't change the SCCs because of -g, but that enables us to adjust (or even modulo-schedule) debug insns accurately. Suggestions would be appreciated. -- 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
Re: [google] Add -fstrict-enum-precision flag (issue4433083)
On Tue, May 3, 2011 at 8:34 PM, Jason Merrill ja...@redhat.com wrote: On 04/28/2011 03:50 PM, Diego Novillo wrote: This patch from Silvius Rus adds a new flag (-fstrict-enum-precision). While porting the patch to 4.6, I noticed that the C++ FE now has a similar flag that seems to have similar semantics (-fstrict-enums). Silvius's patch is used to disable some switch() optimizations that assume enum types can *only* take values within that enum (Silvius, please correct me if I got this wrong). Jason, your -fstrict-enums only applies to the C++ front end. Silvius's variant affects VRP and gimplification of switches. Would it be better if we simply moved -fstrict-enums to common options and used that to decide whether to optimize switches in VRP and the gimplifier? We use it internally to disable this optimization for code that generates values outside of enum ranges. It seems that to me that this patch changes optimizations to not believe the lies of the C++ front end, whereas my patch changes the front end to not lie in the first place, making this patch unnecessary. Correct. Richard.
Re: [PING] [PATCH] PR debug/28767 (Support pointer-to-member-function)
On Tue, May 3, 2011 at 10:36 PM, Dodji Seketeli do...@seketeli.org wrote: FWIW, this was posted to http://gcc.gnu.org/ml/gcc-patches/2011-03/msg00949.html -- Forwarded message -- From: Dodji Seketeli do...@redhat.com To: Jason Merrill ja...@redhat.com Date: Wed, 16 Mar 2011 20:56:37 +0100 Subject: [PATCH] PR debug/28767 (Support pointer-to-member-function) Hello, This PR is an enhancement request to emit a DW_TAG_ptr_to_member_type DIE for pointer-to-member-function types. The patch below does add a new language hook to support this and adapts the existing code that emits DW_TAG_ptr_to_member_type for ponter-to-data-member types to handle pointer-to-member-function types as well. Tested on x86_64-unknown-linux-gnu against trunk. I am proposing this for 4.7. -- Dodji From 36d971de3a01c83f8e23c4016262ea73357f6bd6 Mon Sep 17 00:00:00 2001 From: Dodji Seketeli do...@redhat.com Date: Tue, 15 Mar 2011 16:50:30 +0100 Subject: [PATCH] PR debug/28767 (Support pointer-to-member-function) gcc/ * langhooks.h (struct lag_hooks_for_type)is_ptr_to_member: Declare New language hook. * hooks.h (hook_bool_const_tree_treeptr_false): Declare ... hooks.c (hook_bool_const_tree_treeptr_false): ... new default hook. * langhooks-def.h (LANG_HOOKS_IS_PTR_TO_MEMBER): Define new hook initializer. Ick. Can you please instead grab some available bit in TREE_TYPE instead of using a new langhook which makes it impossible to support this from LTO? Richard. (LANG_HOOKS_FOR_TYPES_INITIALIZER): Initialize the is_ptr_to_member field to LANG_HOOKS_IS_PTR_TO_MEMBER. * dwarf2out.c (gen_ptr_to_mbr_type_die): Handle pointer-to-member-function in addition to pointer-to-data-member. Both using the new language hook. (gen_type_die_with_usage): Handle pointer-to-member-function and pointer-to-data-member types with gen_ptr_to_mbr_type_die. gcc/cp/ * cp-lang.c (is_ptr_to_member): New language hook implementation for C++. (LANG_HOOKS_IS_PTR_TO_MEMBER): Initialize this language hook for C++. gcc/testsuite/ * g++.dg/debug/dwarf2/ptrmem-1.C: New test. --- gcc/cp/cp-lang.c | 39 +- gcc/dwarf2out.c | 58 -- gcc/hooks.c | 7 +++ gcc/hooks.h | 1 + gcc/langhooks-def.h | 2 + gcc/langhooks.h | 8 gcc/testsuite/g++.dg/debug/dwarf2/ptrmem-1.C | 20 + 7 files changed, 112 insertions(+), 23 deletions(-) create mode 100644 gcc/testsuite/g++.dg/debug/dwarf2/ptrmem-1.C diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c index e5c1c09..62faa1c 100644 --- a/gcc/cp/cp-lang.c +++ b/gcc/cp/cp-lang.c @@ -40,7 +40,7 @@ static enum classify_record cp_classify_record (tree type); static tree cp_eh_personality (void); static tree get_template_innermost_arguments_folded (const_tree); static tree get_template_argument_pack_elems_folded (const_tree); - +static bool is_ptr_to_member (const_tree, tree*); /* Lang hooks common to C++ and ObjC++ are declared in cp/cp-objcp-common.h; consequently, there should be very few hooks below. */ @@ -65,6 +65,9 @@ static tree get_template_argument_pack_elems_folded (const_tree); #undef LANG_HOOKS_GET_ARGUMENT_PACK_ELEMS #define LANG_HOOKS_GET_ARGUMENT_PACK_ELEMS \ get_template_argument_pack_elems_folded +#undef LANG_HOOKS_IS_PTR_TO_MEMBER +#define LANG_HOOKS_IS_PTR_TO_MEMBER \ + is_ptr_to_member #undef LANG_HOOKS_GENERIC_GENERIC_PARAMETER_DECL_P #define LANG_HOOKS_GENERIC_GENERIC_PARAMETER_DECL_P \ template_template_parameter_p @@ -238,5 +241,39 @@ get_template_argument_pack_elems_folded (const_tree t) return fold_cplus_constants (get_template_argument_pack_elems (t)); } +/* The C++ implementation of LANG_HOOKS_GET_PTRMEM_TYPES. + + Returns TRUE if T is a pointer-to-data-member or + a pointer-to-member-function. + + If PTRMEM_INFO is non-null and if T is a + pointer-to-member-function, *PTRMEM_INFO is set to a TREE_LIST + which TREE_PURPOSE is the METHOD_TYPE of member-function pointed + to. The TREE_VALUE is the class/struct type containing the member + function. If T is a pointer-to-member, *PTRMEM_INFO is set to a + TREE_LIST which TREE_PURPOSE is the type of the member, and which + TREE_VALUE is the class/strunct type containing the data member. + The TREE_TYPE is set to T. */ + +static bool +is_ptr_to_member (const_tree t, + tree *ptrmem_info) +{ + if (!t || !TYPE_PTR_TO_MEMBER_P (t)) + return false; + + if (ptrmem_info != NULL) + { + if (TYPE_PTRMEMFUNC_P (t)) + *ptrmem_info = build_tree_list
Re: [PATCH] less build_function_type usage in the Fortran FE
On 05/03/2011 09:06 PM, Nathan Froyd wrote: Testing in progress on x86_64-unknown-linux-gnu. OK to commit if testing successful? The Fortran part is OK. Thanks for the janitorial work. Tobias gcc/ * tree.h (build_function_type_array): Declare. (build_varargs_function_type_array): Declare. (build_function_type_vec, build_varargs_function_type_vec): Define. * tree.c (build_function_type_array_1): New function. (build_function_type_array): New function. (build_varargs_function_type_array): New function. gcc/fortran/ * trans-decl.c (build_library_function_decl_1): Call build_function_type_vec. Adjust argument list building accordingly. * trans-intrinsic.c (gfc_get_intrinsic_lib_fndecl): Likewise. * trans-types.c (gfc_get_function_type): Likewise.
Some backports from mainline to gcc 4.4 branch
Hi! And here are 3 backports to 4.4 branch, bootstrapped/regtested on x86_64-linux and i686-linux, committed to gcc-4_4-branch. Jakub 2011-05-04 Jakub Jelinek ja...@redhat.com Backported from mainline 2011-05-03 Uros Bizjak ubiz...@gmail.com Jakub Jelinek ja...@redhat.com PR target/48774 * config/i386/i386.c (ix86_match_ccmode): For CC{A,C,O,S}mode only succeed if req_mode is the same as set_mode. * gcc.dg/pr48774.c: New test. --- gcc/config/i386/i386.c (revision 173300) +++ gcc/config/i386/i386.c (revision 173301) @@ -17299,11 +17299,15 @@ ix86_match_ccmode (rtx insn, enum machin if (req_mode == CCZmode) return 0; /* FALLTHRU */ +case CCZmode: + break; + case CCAmode: case CCCmode: case CCOmode: case CCSmode: -case CCZmode: + if (set_mode != req_mode) + return 0; break; default: --- gcc/testsuite/gcc.dg/pr48774.c (revision 0) +++ gcc/testsuite/gcc.dg/pr48774.c (revision 173301) @@ -0,0 +1,38 @@ +/* PR target/48774 */ +/* { dg-do run } */ +/* { dg-options -O2 -funroll-loops } */ + +extern void abort (void); +unsigned long int s[24] + = { 12, ~1, 12, ~2, 12, ~4, 12, ~8, 12, ~16, 12, ~32, + 12, ~64, 12, ~128, 12, ~256, 12, ~512, 12, ~1024, 12, ~2048 }; +struct { int n; unsigned long *e[12]; } g + = { 12, { s[0], s[2], s[4], s[6], s[8], s[10], s[12], s[14], + s[16], s[18], s[20], s[22] } }; +int c[12]; + +__attribute__((noinline)) void +foo (void) +{ + int i, j; + for (i = 0; i g.n; i++) +for (j = 0; j g.n; j++) + { + if (i == j j g.e[0][0] (g.e[i][1] (1UL j))) + abort (); + if (j g.e[0][0] (g.e[i][1] (1UL j))) + c[i]++; + } +} + +int +main () +{ + int i; + asm volatile ( : +m (s), +m (g), +m (c)); + foo (); + for (i = 0; i 12; i++) +if (c[i] != 11) + abort (); + return 0; +} 2011-05-04 Jakub Jelinek ja...@redhat.com Backport from mainline 2011-04-30 Jakub Jelinek ja...@redhat.com PR tree-optimization/48809 * tree-switch-conversion.c (build_arrays): Compute tidx in unsigned type. (gen_inbound_check): Don't compute index_expr - range_min in utype again, instead reuse SSA_NAME initialized in build_arrays. Remove two useless gsi_for_stmt calls. * gcc.c-torture/execute/pr48809.c: New test. --- gcc/tree-switch-conversion.c(revision 173206) +++ gcc/tree-switch-conversion.c(revision 173207) @@ -519,7 +519,7 @@ static void build_arrays (gimple swtch) { tree arr_index_type; - tree tidx, sub; + tree tidx, sub, utype; gimple stmt; gimple_stmt_iterator gsi; int i; @@ -527,12 +527,20 @@ build_arrays (gimple swtch) gsi = gsi_for_stmt (swtch); arr_index_type = build_index_type (info.range_size); - tidx = make_rename_temp (arr_index_type, csti); - sub = fold_build2 (MINUS_EXPR, TREE_TYPE (info.index_expr), info.index_expr, -fold_convert (TREE_TYPE (info.index_expr), - info.range_min)); - sub = force_gimple_operand_gsi (gsi, fold_convert (arr_index_type, sub), - false, NULL, true, GSI_SAME_STMT); + + /* Make sure we do not generate arithmetics in a subrange. */ + if (TREE_TYPE (TREE_TYPE (info.index_expr))) +utype = lang_hooks.types.type_for_mode + (TYPE_MODE (TREE_TYPE (TREE_TYPE (info.index_expr))), 1); + else +utype = lang_hooks.types.type_for_mode + (TYPE_MODE (TREE_TYPE (info.index_expr)), 1); + + tidx = make_rename_temp (utype, csui); + sub = fold_build2 (MINUS_EXPR, utype, +fold_convert (utype, info.index_expr), +fold_convert (utype, info.range_min)); + sub = force_gimple_operand_gsi (gsi, sub, false, NULL, true, GSI_SAME_STMT); stmt = gimple_build_assign (tidx, sub); gsi_insert_before (gsi, stmt, GSI_SAME_STMT); @@ -641,10 +649,7 @@ gen_inbound_check (gimple swtch) gimple label1, label2, label3; tree utype; - tree tmp_u; - tree cast; - gimple cast_assign, minus_assign; - tree ulb, minus; + tree tidx; tree bound; gimple cond_stmt; @@ -657,49 +662,27 @@ gen_inbound_check (gimple swtch) gcc_assert (info.default_values); bb0 = gimple_bb (swtch); - /* Make sure we do not generate arithmetics in a subrange. */ - if (TREE_TYPE (TREE_TYPE (info.index_expr))) -utype = lang_hooks.types.type_for_mode - (TYPE_MODE (TREE_TYPE (TREE_TYPE (info.index_expr))), 1); - else -utype = lang_hooks.types.type_for_mode - (TYPE_MODE (TREE_TYPE (info.index_expr)), 1); + tidx = gimple_assign_lhs (info.arr_ref_first); + utype = TREE_TYPE (tidx); /* (end of) block 0 */ gsi = gsi_for_stmt (info.arr_ref_first); - tmp_u = make_rename_temp (utype, csui); - - cast = fold_convert (utype, info.index_expr); - cast_assign = gimple_build_assign
Re: [google] Patch to support calling multi-versioned functions via new GCC builtin. (issue4440078)
On Tue, May 3, 2011 at 11:57 PM, Xinliang David Li davi...@google.com wrote: On Tue, May 3, 2011 at 3:00 AM, Richard Guenther richard.guent...@gmail.com wrote: On Tue, May 3, 2011 at 1:07 AM, Xinliang David Li davi...@google.com wrote: On Mon, May 2, 2011 at 2:33 PM, Richard Guenther richard.guent...@gmail.com wrote: On Mon, May 2, 2011 at 6:41 PM, Xinliang David Li davi...@google.com wrote: On Mon, May 2, 2011 at 2:11 AM, Richard Guenther richard.guent...@gmail.com wrote: On Fri, Apr 29, 2011 at 6:23 PM, Xinliang David Li davi...@google.com wrote: Here is the background for this feature: 1) People relies on function multi-version to explore hw features and squeeze performance, but there is no standard ways of doing so, either a) using indirect function calls with function pointers set at program initialization; b) using manual dispatch at each callsite; b) using features like IFUNC. The dispatch mechanism needs to be promoted to the language level and becomes the first class citizen; You are not doing that, you are inventing a new (crude) GCC extension. To capture the high level semantics and prevent user from lowering the dispatch calls into forms compiler can not recognize, language extension is the way to go. I don't think so. With your patch only two passes understand the new high-level form, the rest of the gimple passes are just confused. There is no need for other passes to understand it -- just treat it as opaque calls. This is goodness otherwise other passes need to be modified. This is true (only some passes understand it) for things like __builtin_expect. Certainly __builtin_dispatch has to be understood by alias analysis and all other passes that care about calls (like all IPA passes). You can of course treat it conservatively (may call any function, even those which have their address not taken, clobber and read all memory, even that which doesn't escape the TU). Why obfuscate things when it is not necessary? MVed functions are usually non-trivial, so I doubt anything will be lost due to the obfuscation. It won't be too difficult to teach aliaser to 'merge' the attributes from target functions either. No that is not my argument. What I tried to say is it will be harder to achieve without high level semantics -- it requires more handshaking between compiler passes. Sure - that's life. We are looking at improving the life .. Which nobody will see benefit from unless they rewrite their code? The target users for the builtin include compiler itself -- it can synthesize dispatch calls. Hum. I'm not at all sure the dispatch calls are the best representation for the IL. The intension is to provide an interface at both C level (for programmers) and IL level. It does not have to be a builtin (both internally and externally) -- but it needs to map to some language construct. Well, I say if we can improve _some_ of the existing usages that's better than never doing wrong on a new language extension. This is independent. It is not. One that I'm not convinced is the way to go (you didn't address at all the inability to use float arguments and the ABI issues with using variadic arguments - after all you did a poor-mans language extension by using GCC builtins instead of inventing a true one). This is an independent issue that either needs to be addressed or marked as limitation. The key of the debate is whether source/IR annotation using construct with high level semantics helps optimizer. In fact this is common. Would it make any difference (in terms of acceptance) if the builtin is only used internally by the compiler and not exposed to the user? No. I don't see at all why having everything in a single stmt is so much more convenient. And I don't see why existing IL features cannot be used to make things a little more convenient. Why not? The high level construct is simpler to deal with. It is all about doing the right optimization at the right level of abstraction. Set aside the question whether using builtin for MV dispatch is the right high level construct, looking at gcc, we can find that gcc's IR is pretty low level resulting in missing optimizations. For instance, there is no high level doloop representation -- Fortran do-loop needs to be lowered and raised back again -- the consequence is that you may not raise the loop nest into the way it was originally written -- perfect nested loop become non-perfect loop nest -- blocking certain loop transformations. Not only that, I am not sure it is even possible to record any loop level information anywhere -- is it possible to have per loop attribute such as unroll factor? Assuming gcc can do full math function inlining (for common math routines) -- in this case, do we still want to do sin/cos optimization or rely on the scalar optimizer to optimize the inlined copies of sin and cos? Not sure about gcc, I remember that dead
Re: [google] Normalize version number for google/gcc-4_6 (issue4454049)
On Wed, May 4, 2011 at 12:20 AM, Matthias Klose d...@ubuntu.com wrote: On 05/02/2011 09:53 PM, Diego Novillo wrote: Since google/gcc-4_6 follows the 4.6 branch, changes in minor revisions cause unnecessary churn in directory names. Fixed with this. OK for google/gcc-4_6? Google ref 4335466. * BASE-VER: Change to 4.6.x-google. diff --git a/gcc/BASE-VER b/gcc/BASE-VER index 4110f74..33d4edd 100644 --- a/gcc/BASE-VER +++ b/gcc/BASE-VER @@ -1 +1 @@ -4.6.1-google +4.6.x-google is this enough? the subminor version number is encoded in more places, e.g. C++ headers, Go libraries, jar files. For the Debian/Ubuntu packaging I'm just using symlinks from 4.6.x to 4.6 to avoid this kind of dependency. Now that the -V option isn't supported anymore, maybe this could be addressed with something like a new configure option --version-alias=value, similar to the target alias. The SUSE packages introduce gcc/FULL-VER as copy of BASE-VER and strip the patch-level version from BASE-VER. Some (but not many) makefiles need to be adjusted to use FULL-VER but then everything else just falls out nicely (and you lose the ability to install 4.6.0 and 4.6.1 in parallel, of course). For some weird marketing reasons we also drop prerelease from the version string and drop the patch-level version down to the last release. Richard. Matthias
Re: debug insns in SMS (was: Re: Debug_insn)
Hello Alexandre I think this will restore proper functioning to SMS in the presence of debug insns. A while ago, we'd never generate deps of non-debug insns on debug insns. I introduced them to enable sched to adjust (reset) debug insns when non-debug insns were moved before them. I believe it is safe to leave them out of the SCCs. Even though this will end up causing some loss of debug info, that's probably unavoidable, and the end result after this change is pobably the best we can hope for. Your thoughts? Thanks for the patch! I actually discussed this issue with Ayal yesterday. Ayal also suggested to reconsider the edges that are created in the DDG between real instructions and debug_insns. Currently, we create bidirectional anti deps edges between them. This leads to the problem you were trying to solve in the current patch (described below) where these extra edges influence the construction of the strongly connected component and the code generated with and w\o -g. Your patch seems to solve this problem. However I can not approve it as I'm not the maintainer (Ayal is). Another problem with the handling of debug insns in SMS is that debug_insns instructions are been ignored while scheduling which means that they do not delimit the scheduling window of the real instructions they depend on. This could lead to a scenario where the dependencies between real instruction and debug_insn could be violated as we leave the debug_insns in their original place after scheduling. I'll try to send you an example of this problem as well. Example of code gen difference when using -g and without it which this patch tries to solve: The following nodes are all belong to the same SCC running with -g. node 1 is not present in this SCC when not using -g. (the nodes marked in [] are the one that do not exist with your patch and prevent from node 1 to be added to the SCC when compiling with -g) node 0 Debug_insn (ior(MEM(ivtmp.24),MEM(ivtmp.46)) in edges: 1-0, 2-0 out edges: [0-1], [0-4], [0-2] node 1 Reg 220 = MEM (pre_inc (ivtmp.24)) in edges: [0-1], 1-1 out edges: 1-0, 1-1, 1-3 node 2 Reg 221= MEM (pre_inc (ivtmp.46)) in edges: [0-2], 4-2, 2-2 out edges: 2-0, 2-3, 2-4, 2-2 node 3 Reg 222= ior (220,221) in edges: 2-3, 1-3 out edges: 3-4 node 4 MEM[pre_inc(196)] = 222 in edges: 3-4, 4-4, [0-4], 2-4 out edges: 4-4, 4-2 Thanks, Revital
Re: [PATCH, powerpc], Fix PR48857, pass/return V2DI as other vector types
On Wed, May 4, 2011 at 4:51 AM, David Edelsohn dje@gmail.com wrote: On Tue, May 3, 2011 at 5:27 PM, Michael Meissner meiss...@linux.vnet.ibm.com wrote: When I added VSX support to the powerpc, I overlooked passing and return V2DImode arguments, since the only machine operation that supports V2DI is vector floating point conversion. Consequentally, V2DI types were passed and returned in GPRs instead of the vector registers on power7. This patch fixes that so that V2DImode values are passed and returned like other vector types. I did a bootstrap and make check with no regressions, comparing it to a build without the patch. I also wrote a program that passed and returned every single type, and I compared the assembly ouptut. With the exception of functions that return or are passed V2DI arguments, the code is identical. I tested: -m64 (implies -mabi=altivec) -m32 -mabi=altivec -m32 -mabi=no-altivec (no difference here) Is this patch ok to install? I will also want to install it in the 4.6 and possibly 4.5 trees as well. [gcc] 2011-05-03 Michael Meissner meiss...@linux.vnet.ibm.com PR target/48857 * config/rs6000/rs6000.h (VSX_SCALAR_MODE): Delete. (VSX_MODE): Ditto. (VSX_MOVE_MODE): Ditto. (ALTIVEC_OR_VSX_VECTOR_MODE): New macro, combine all Altivec and VSX vector types. Add V2DImode. (HARD_REGNO_CALLER_SAVE_MODE): Use it instead of ALTIVEC_VECTOR_MODE and VSX_VECTOR_MODE calls. (MODES_TIEABLE_P): Ditto. * config/rs6000/rs6000.c (rs6000_emit_move): Use ALTIVEC_OR_VSX_MODE instead of ALTIVEC_VECTOR_MODE and VSX_VECTOR_MODE. (init_cumulative_args): Ditto. (rs6000_function_arg_boundary): Ditto. (rs6000_function_arg_advance_1): Ditto. (rs6000_function_arg): Ditto. (rs6000_function_ok_for_sibcall): Ditto. (emit_frame_save): Ditto. (rs6000_function_value): Ditto. (rs6000_libcall_value): Ditto. [gcc/testsuite] 2011-05-03 Michael Meissner meiss...@linux.vnet.ibm.com PR target/48857 * gcc.target/powerpc/pr48857.c: New file, make sure V2DI arguments are passed and returned in vector registers. What does this do to the ABI? Haven't we now broken the ABI and broken backwards compatibility? It at least looks like so. You need to add appropriate changes.html entries to all branches you apply this patch to. I suppose the new version matches what XLC does? Richard. - David
Re: [google]: initialize language field for clone function struct
On Tue, May 3, 2011 at 6:15 PM, Xinliang David Li davi...@google.com wrote: On Tue, May 3, 2011 at 3:55 AM, Jan Hubicka hubi...@ucw.cz wrote: Is this one ok? Hi, we did quite some work on removing a langhooks for LTO, where they become quite impossible So I would like to know what testcase causes the problem and why. In fold-const.c, there are many of calls to lang_hooks.decls.global_bindings_p, and the implementation of this in name-lookup.h will look at the the cfun-language Umm, I think most of them (if not all) are just bogus. If a FE doesn't want to fold some stuff when at global scope it should not call fold. But I'm not sure that is actually what it tries to do ... and the existing checks are far from consistently spread out in fold-const.c ... Richard.
Re: [PATCH] less build_function_type usage in the Fortran FE
On Wed, May 4, 2011 at 11:22 AM, Tobias Burnus bur...@net-b.de wrote: On 05/03/2011 09:06 PM, Nathan Froyd wrote: Testing in progress on x86_64-unknown-linux-gnu. OK to commit if testing successful? The Fortran part is OK. Thanks for the janitorial work. The middle-end parts are also ok. Richard. Tobias gcc/ * tree.h (build_function_type_array): Declare. (build_varargs_function_type_array): Declare. (build_function_type_vec, build_varargs_function_type_vec): Define. * tree.c (build_function_type_array_1): New function. (build_function_type_array): New function. (build_varargs_function_type_array): New function. gcc/fortran/ * trans-decl.c (build_library_function_decl_1): Call build_function_type_vec. Adjust argument list building accordingly. * trans-intrinsic.c (gfc_get_intrinsic_lib_fndecl): Likewise. * trans-types.c (gfc_get_function_type): Likewise.
Re: [PATCH, ARM] Reload register class fix for NEON constants
On Mon, 2011-04-25 at 19:39 +0400, Dmitry Melnik wrote: Hi All, The attached patch changes the reload class for NEON constant vectors from GENERAL_REGS to NO_REGS. The issue was found on this code from libevas: void _op_blend_p_caa_dp(unsigned *s, unsigned* e, unsigned *d, unsigned c) { while (d e) { *d = ( (*s) 8) 0x00ff00ff) * (c)) 0xff00ff00) + (*s) 0x00ff00ff) * (c)) 8) 0x00ff00ff) ); //*d = (*s) 0x00ff00ff; d++; s++; } } Original asm: .L4: adr r8, .L10 ldmia r8, {r8-fp} ... vmovd22, r8, r9 @ v4si vmovd23, sl, fp vandq12, q8, q11 ... bhi .L4 .L10: .word 16711935 @ 0xff00ff .word 16711935 .word 16711935 .word 16711935 Fixed asm: .L4: vmov.i16q11, #255 @ v4si ... vandq12, q8, q11 bhi .L4 This fix results in +3.7% gain for expedite (reduced) test suite, and up to 15% for affected tests. Ok for trunk? 2011-04-22 Sergey Grechanik mouseent...@ispras.ru * config/arm/arm.c (coproc_secondary_reload_class): Treat constant vectors the same way as memory locations to prevent loading them through the ARM general registers. Just say: * arm.c (coproc_secondary_reload_class): Return NO_REGS for constant vectors. Otherwise OK. R.
Re: [google]: initialize language field for clone function struct
Umm, I think most of them (if not all) are just bogus. If a FE doesn't want to fold some stuff when at global scope it should not call fold. That isn't so easy because fold is invoked on sizes of types by stor-layout.c and these sizes can be variable (at least in Ada). So I think that the calls to the hook are still needed. But: 1) The -1 thing should go and the hook return boolean. The prerequisite is to tidy up variable_size, 2) I think that the GIMPLE hook can return 0 unconditionally. But I'm not sure that is actually what it tries to do ... and the existing checks are far from consistently spread out in fold-const.c ... It prevents save_expr from being called at global level, since you cannot create SAVE_EXPRs outside functions. Likewise in variable_size. -- Eric Botcazou
[PATCH, i386]: Fix target/48860: bootstrap fails on x86_64-apple-darwin10; broken assembler edition.
Hello! Oh well... some broken assemblers got confused with movq %reg, %xmm DImode move mnemonic. movd works correctly as well, so use this form instead. 2011-05-04 Uros Bizjak ubiz...@gmail.com PR target/48860 * config/i386/i386.md (*movdi_internal_rex64) Use %vmovd for reg-xmm moves. * config/i386/sse.md (*vec_concatv2di_rex64_sse4_1): Ditto. (vec_concatv2di_rex64_sse): Ditto. (*sse2_storeq_rex64): Do not emit %v prefix for mov{q} mnemonic. (*vec_extractv2di_1_rex64): Ditto. Revert: 2011-05-02 Uros Bizjak ubiz...@gmail.com * config/i386/mmx.md (*movmode_internal_rex64): Use %vmovq for reg-xmm moves. (*movv2sf_internal_rex64): Use %vmovq for reg-xmm moves. Tested on x86_64-pc-linux-gnu, committed to mainline SVN. I will audit movq usage in other release branches as well. Uros. Index: config/i386/i386.md === --- config/i386/i386.md (revision 173353) +++ config/i386/i386.md (working copy) @@ -2001,11 +2001,13 @@ case TYPE_SSEMOV: if (get_attr_mode (insn) == MODE_TI) return %vmovdqa\t{%1, %0|%0, %1}; + /* Handle broken assemblers that reqire movd instead of movq. */ + if (GENERAL_REG_P (operands[0]) || GENERAL_REG_P (operands[1])) + return %vmovd\t{%1, %0|%0, %1}; return %vmovq\t{%1, %0|%0, %1}; case TYPE_MMXMOV: - /* Moves from and into integer register is done using movd -opcode with REX prefix. */ + /* Handle broken assemblers that reqire movd instead of movq. */ if (GENERAL_REG_P (operands[0]) || GENERAL_REG_P (operands[1])) return movd\t{%1, %0|%0, %1}; return movq\t{%1, %0|%0, %1}; @@ -3018,7 +3020,8 @@ case 11: case 12: -return %vmovd\t{%1, %0|%0, %1}; + /* Handle broken assemblers that reqire movd instead of movq. */ + return %vmovd\t{%1, %0|%0, %1}; default: gcc_unreachable(); @@ -3494,12 +3497,13 @@ case 9: case 10: case 14: case 15: return movd\t{%1, %0|%0, %1}; -case 12: case 13: - return %vmovd\t{%1, %0|%0, %1}; case 11: return movq\t{%1, %0|%0, %1}; +case 12: case 13: + return %vmovd\t{%1, %0|%0, %1}; + default: gcc_unreachable (); } Index: config/i386/mmx.md === --- config/i386/mmx.md (revision 173353) +++ config/i386/mmx.md (working copy) @@ -63,6 +63,7 @@ DONE; }) +;; movd instead of movq is required to handle broken assemblers. (define_insn *movmode_internal_rex64 [(set (match_operand:MMXMODEI8 0 nonimmediate_operand =rm,r,!?y,!y,!?y,m ,!y ,*Y2,x,x ,m,r ,Yi) @@ -82,8 +83,8 @@ %vpxor\t%0, %d0 %vmovq\t{%1, %0|%0, %1} %vmovq\t{%1, %0|%0, %1} -%vmovq\t{%1, %0|%0, %1} -%vmovq\t{%1, %0|%0, %1} +%vmovd\t{%1, %0|%0, %1} +%vmovd\t{%1, %0|%0, %1} [(set_attr type imov,imov,mmx,mmxmov,mmxmov,mmxmov,ssecvt,ssecvt,sselog1,ssemov,ssemov,ssemov,ssemov) (set_attr unit *,*,*,*,*,*,mmx,mmx,*,*,*,*,*) (set_attr prefix_rep *,*,*,*,*,*,1,1,*,1,*,*,*) @@ -155,6 +156,7 @@ DONE; }) +;; movd instead of movq is required to handle broken assemblers. (define_insn *movv2sf_internal_rex64 [(set (match_operand:V2SF 0 nonimmediate_operand =rm,r,!?y,!y,!?y,m ,!y ,*Y2,x,x,x,m,r ,Yi) @@ -175,8 +177,8 @@ %vmovaps\t{%1, %0|%0, %1} %vmovlps\t{%1, %d0|%d0, %1} %vmovlps\t{%1, %0|%0, %1} -%vmovq\t{%1, %0|%0, %1} -%vmovq\t{%1, %0|%0, %1} +%vmovd\t{%1, %0|%0, %1} +%vmovd\t{%1, %0|%0, %1} [(set_attr type imov,imov,mmx,mmxmov,mmxmov,mmxmov,ssecvt,ssecvt,ssemov,sselog1,ssemov,ssemov,ssemov,ssemov) (set_attr unit *,*,*,*,*,*,mmx,mmx,*,*,*,*,*,*) (set_attr prefix_rep *,*,*,*,*,*,1,1,*,*,*,*,*,*) Index: config/i386/sse.md === --- config/i386/sse.md (revision 173353) +++ config/i386/sse.md (working copy) @@ -6479,9 +6479,8 @@ @ # # - %vmov{q}\t{%1, %0|%0, %1} + mov{q}\t{%1, %0|%0, %1} [(set_attr type *,*,imov) - (set_attr prefix *,*,maybe_vex) (set_attr mode *,*,DI)]) (define_insn *sse2_storeq @@ -6516,12 +6515,12 @@ psrldq\t{$8, %0|%0, 8} vpsrldq\t{$8, %1, %0|%0, %1, 8} %vmovq\t{%H1, %0|%0, %H1} - %vmov{q}\t{%H1, %0|%0, %H1} + mov{q}\t{%H1, %0|%0, %H1} [(set_attr isa base,noavx,avx,base,base) (set_attr type ssemov,sseishft1,sseishft1,ssemov,imov) (set_attr length_immediate *,1,1,*,*) (set_attr memory *,none,none,*,*) - (set_attr prefix maybe_vex,orig,vex,maybe_vex,maybe_vex) + (set_attr prefix maybe_vex,orig,vex,maybe_vex,orig) (set_attr mode V2SF,TI,TI,TI,DI)]) (define_insn *vec_extractv2di_1_sse2 @@ -6687,6 +6686,7 @@ [(set_attr type sselog,ssemov,ssemov) (set_attr mode TI,V4SF,V2SF)]) +;; movd instead of movq is required to handle broken
Re: [PATCH, i386]: Fix target/48860: bootstrap fails on x86_64-apple-darwin10; broken assembler edition.
On Wed, May 04, 2011 at 12:02:17PM +0200, Uros Bizjak wrote: Tested on x86_64-pc-linux-gnu, committed to mainline SVN. I will audit movq usage in other release branches as well. s/reqire/require/g --- config/i386/i386.md (revision 173353) +++ config/i386/i386.md (working copy) @@ -2001,11 +2001,13 @@ case TYPE_SSEMOV: if (get_attr_mode (insn) == MODE_TI) return %vmovdqa\t{%1, %0|%0, %1}; + /* Handle broken assemblers that reqire movd instead of movq. */ + if (GENERAL_REG_P (operands[0]) || GENERAL_REG_P (operands[1])) + return %vmovd\t{%1, %0|%0, %1}; return %vmovq\t{%1, %0|%0, %1}; case TYPE_MMXMOV: - /* Moves from and into integer register is done using movd - opcode with REX prefix. */ + /* Handle broken assemblers that reqire movd instead of movq. */ if (GENERAL_REG_P (operands[0]) || GENERAL_REG_P (operands[1])) return movd\t{%1, %0|%0, %1}; return movq\t{%1, %0|%0, %1}; @@ -3018,7 +3020,8 @@ case 11: case 12: -return %vmovd\t{%1, %0|%0, %1}; + /* Handle broken assemblers that reqire movd instead of movq. */ + return %vmovd\t{%1, %0|%0, %1}; default: gcc_unreachable(); Jakub
Re: [PATCH 2/4] Docs: extend.texi: Remove trailing blanks from lines
On Tue, 3 May 2011, Gerald Pfeifer wrote: On Wed, 27 Apr 2011, Michael Witten wrote: sed -i s/[ $(printf '\t')]\{1,\}\$// trunk/gcc/doc/extend.texi I believe we usually don't do whitespace changes just for the sake of cleaning up things. Unless someone else indicates otherwise, I believe this patch is rejected. I think we *should* make such formatting cleanups (not just trailing whitespace removal, but other changes to match formatting conventions, including fixing leading whitespace in C code to use tabs where it doesn't as well as more visible changes) - as long as we are agreed on what the convention is to follow (see http://gcc.gnu.org/ml/gcc-patches/2011-04/msg00393.html and thread regarding conventions for whitespace after VEC etc., for example). (But not (a) in testcases, where I don't think there's any need to follow consistent conventions, and (b) in code imported from other upstream sources, where such fixes are not a good enough reason to diverge from upstream.) However, given the reaction when HJ checked in a trailing whitespace removal patch, it seems this is controversial. -- Joseph S. Myers jos...@codesourcery.com
RE: Move cgraph_node_set and varpool_node_set out of GGC and make them use pointer_map
Hi, I always considered the cgrpah_node_set/varpool_node_set to be overengineered but they also turned out to be quite ineffective since we do quite a lot of queries into them during stremaing out. This patch moves them to pointer_map, like I did for streamer cache. While doing so I needed to get the structure out of GGC memory since pointer_map is not ggc firendly. This is not a deal at all, because the sets can only point to live cgraph/varpool entries anyway. Pointing to removed ones would lead to spectacular failures in any case. Bootstrapped/regtested x86_64-linux, OK? Honza * cgraph.h (cgraph_node_set_def, varpool_node_set_def): Move out of GTY; replace hash by pointer map. (cgraph_node_set_element_def, cgraph_node_set_element, const_cgraph_node_set_element, varpool_node_set_element_def, varpool_node_set_element, const_varpool_node_set_element): Remove. (free_cgraph_node_set, free_varpool_node_set): New function. (cgraph_node_set_size, varpool_node_set_size): Use vector size. * tree-emutls.c: Free varpool node set. * ipa-utils.c (cgraph_node_set_new, cgraph_node_set_add, cgraph_node_set_remove, cgraph_node_set_find, dump_cgraph_node_set, debug_cgraph_node_set, free_cgraph_node_set, varpool_node_set_new, varpool_node_set_add, varpool_node_set_remove, varpool_node_set_find, dump_varpool_node_set, free_varpool_node_set, debug_varpool_node_set): Move here from ipa.c; implement using pointer_map * ipa.c (cgraph_node_set_new, cgraph_node_set_add, cgraph_node_set_remove, cgraph_node_set_find, dump_cgraph_node_set, debug_cgraph_node_set, varpool_node_set_new, varpool_node_set_add, varpool_node_set_remove, varpool_node_set_find, dump_varpool_node_set, debug_varpool_node_set): Move to ipa-uitls.c. * lto/lto.c (ltrans_partition_def): Remove GTY annotations. (ltrans_partitions): Move to heap. (new_partition): Update. (free_ltrans_partitions): New function. (lto_wpa_write_files): Use it. * passes.c (ipa_write_summaries): Update. This causes cross and native build of ARM Linux toolchain to fail: gcc -c -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wwrite- strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing- format-attribute -Wold-style-definition -Wc++-compat -fno-common - DHAVE_CONFIG_H -I. -Ilto - I/work/source/gcc - I/work/source/gcc/lto - I/work/source/gcc/../include - I/work/source/gcc/../libcpp/include - I/work/source/gcc/../libdecnumber - I/work/source/gcc/../libdecnumber/dpd -I../libdecnumber /work/source/gcc/lto/lto.c -o lto/lto.o /work/source/gcc/lto/lto.c:1163: warning: function declaration isn't a prototype /work/source/gcc/lto/lto.c: In function 'free_ltrans_partitions': /work/source/gcc/lto/lto.c:1163: warning: old-style function definition /work/source/gcc/lto/lto.c:1168: error: 'struct ltrans_partition_def' has no member named 'cgraph' /work/source/gcc/lto/lto.c:1168: error: 'set' undeclared (first use in this function) /work/source/gcc/lto/lto.c:1168: error: (Each undeclared identifier is reported only once /work/source/gcc/lto/lto.c:1168: error: for each function it appears in.) /work/source/gcc/lto/lto.c:1171: warning: implicit declaration of function 'VEC_latrans_partition_heap_free' make[2]: *** [lto/lto.o] Error 1 make[2]: *** Waiting for unfinished jobs rm gcov.pod gfdl.pod cpp.pod fsf-funding.pod gcc.pod make[2]: Leaving directory `/work/cross-build/trunk-r173334- thumb/arm-none-linux-gnueabi/obj/gcc1/gcc' make[1]: *** [all-gcc] Error 2 make[1]: Leaving directory `/work/cross-build/trunk-r173334- thumb/arm-none-linux-gnueabi/obj/gcc1' make: *** [all] Error 2 + exit But I see you fixed it up soon after (r173336), so no action is required now, but I figured it was worth letting people know anyway. Cheers, Ian
Re: [google]: initialize language field for clone function struct
On Wed, 4 May 2011, Eric Botcazou wrote: That isn't so easy because fold is invoked on sizes of types by stor-layout.c That's what we should phase out. The eventual aim should be for (a) folding on GIMPLE (gimple-fold etc. - working with SSA not combined trees) as an optimization and (b) folding done by front ends only when required for language semantics (e.g. constant expressions). If you want to optimize type sizes, look at where they are located in the GIMPLE IR, as a property of the IR rather than as a hook checking global state. -- Joseph S. Myers jos...@codesourcery.com
Re: [google]: initialize language field for clone function struct
That's what we should phase out. The eventual aim should be for (a) folding on GIMPLE (gimple-fold etc. - working with SSA not combined trees) as an optimization and (b) folding done by front ends only when required for language semantics (e.g. constant expressions). If you want to optimize type sizes, look at where they are located in the GIMPLE IR, as a property of the IR rather than as a hook checking global state. In Ada we simply don't want to emit raw type sizes in the GIMPLE IR, they are just too heavy to be manipulated up to there, even for moderately complex code. That's why we need them to be folded as soon as possible, and even factored out of the GENERIC IR into functions when they are self-referential. -- Eric Botcazou
Re: [google]: initialize language field for clone function struct
On Wed, May 4, 2011 at 12:00 PM, Eric Botcazou ebotca...@adacore.com wrote: Umm, I think most of them (if not all) are just bogus. If a FE doesn't want to fold some stuff when at global scope it should not call fold. That isn't so easy because fold is invoked on sizes of types by stor-layout.c and these sizes can be variable (at least in Ada). So I think that the calls to the hook are still needed. But: 1) The -1 thing should go and the hook return boolean. The prerequisite is to tidy up variable_size, 2) I think that the GIMPLE hook can return 0 unconditionally. But I'm not sure that is actually what it tries to do ... and the existing checks are far from consistently spread out in fold-const.c ... It prevents save_expr from being called at global level, since you cannot create SAVE_EXPRs outside functions. Likewise in variable_size. I see several places in fold-const.c that are not properly guarded then. But anyway, if it is supposed to protect SAVE_EXPRs then I'd have expected save_expr to contain that check and possibly return NULL if it can't save. And I'm not sure you can't do SAVE_EXPRs outside of functions - you could simply emit global temporaries. Richard. -- Eric Botcazou
Re: [build] mips-tfile.c, mips-tdump.c cleanup
Joseph S. Myers jos...@codesourcery.com writes: The most obvious other low-hanging fruit in the circumstances would be to stop these files being built for non-native as a fix for bug 3746, so that all-targets cross builds of make all-gcc (e.g. through Joern's config-list.mk, which is pending review) don't necessarily fall over on this target. I'll have a look one I return from vacation in two weeks. Since I don't expect gas/gld to be fixed to work on that target, there's no point in attempting a cross build with more than cc1 and friends. Btw., the bootstrap with my patch completed without regressions and no one objected, so I've checked it in. Rainer -- - Rainer Orth, Center for Biotechnology, Bielefeld University
Toplevel newlib/libgloss disabling cleanup
This patch separates cases disabling newlib and libgloss for various target OSes from the main toplevel case statement over targets. By doing so, the logic is significantly simplified; there is now a single case for all *-*-linux* targets that disables newlib and libgloss for them, for example. (The only Linux port of newlib is for x86, so it's correct the disable newlib for all Linux targets except for x86 where the existing logic is retained.) Most empty cases in the main case statement can now be removed because once this disabling is done consistently on a per-OS basis there is no longer a possibility that an empty case has a use to stop falling through to later cases such as *-*-linux*. (A few empty cases need to be kept to stop falling through to cases such as mips*-*-*, however.) Where newlib and libgloss were disabled for an OS on multiple architectures I generally wrote a patter that matched all architectures for that OS. For sparc-*-sunos4* the logic disabled them only for cross compilers, but newlib and libgloss are disabled by default for native compilers anyway so I didn't keep any such conditional when moving that disabling up. While there's certainly scope for more splitting up of the big toplevel case statement (so each project sharing the toplevel has its own case statement, eventually coming from a subdirectory file), I think this patch may be the last piece involving substantial simplification through splitting up case statements. OK to commit? 2011-05-04 Joseph Myers jos...@codesourcery.com * configure.ac (alpha*-dec-osf*, i[[3456789]]86-*-rdos*, sh*-*-pe|mips*-*-pe|arm-wince-pe, sparc-*-sunos4*, *-*-aix*, *-*-beos*, *-*-chorusos, *-*-dragonfly*, *-*-freebsd*, *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu, *-*-lynxos*, *-*-mingw*, *-*-netbsd*, *-*-netware*, *-*-tpf*, *-*-uclinux*, *-*-vxworks*): Disable newlib and libgloss in separate case statement. (i[[3456789]]86-*-linux*): Move logic allowing newlib to be built to separate case statement. (*-*-chorusos, *-*-dragonfly*, *-*-freebsd*, *-*-netbsd*, *-*-netware*, *-*-tpf*, *-*-uclinux*, *-*-vxworks*, alpha*-dec-osf*, alpha*-*-linux*, am33_2.0-*-linux*, sh-*-linux*, sh*-*-pe|mips*-*-pe|*arm-wince-pe, arm-*-coff, arm-*-elf* | arm*-*-eabi*, arm*-*-linux-gnueabi, arm*-*-symbianelf*, avr-*-*, bfin-*-*, cris-*-* | crisv32-*-*, frv-*-*, i[[3456789]]86-*-coff | i[[3456789]]86-*-elf, i[[3456789]]86-w64-mingw*, i[[3456789]]86-*-mingw*, x86_64-*-mingw*, i[[3456789]]86-*-interix*, i[[3456789]]86-*-beos*, i[[3456789]]86-*-rdos*, m32r-*-*, m68hc11-*-*|m6811-*-*|m68hc12-*-*|m6812-*-*, m68k-*-elf*, m68*-*-* | fido-*-*, powerpc-*-aix*, powerpc-*-beos*, powerpc-*-eabi, powerpc-*-eabi* | powerpcle-*-eabi* | powerpc-*-rtems*, rs6000-*-lynxos*, rs6000-*-aix*, mips*-*-linux*, sparclet-*-aout* | sparc86x-*-*, sparc-*-elf*, sparc64-*-elf*, sparclite-*-*, sparc-*-sunos4*, sparc-*-solaris* | sparc64-*-solaris* | sparcv9-*-solaris*, *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu, *-*-lynxos*, *-*-*): Don't disable newlib and libgloss in main case over targets. Remove most empty cases in main case over targets. * configure: Regenerate. Index: configure.ac === --- configure.ac(revision 173360) +++ configure.ac(working copy) @@ -744,10 +744,76 @@ ;; esac +# Disable newlib and libgloss for various target OSes. case ${target} in + alpha*-dec-osf*) +noconfigdirs=$noconfigdirs target-newlib target-libgloss +;; + i[[3456789]]86-*-linux*) +# This section makes it possible to build newlib natively on linux. +# If we are using a cross compiler then don't configure newlib. +if test x${is_cross_compiler} != xno ; then + noconfigdirs=$noconfigdirs target-newlib +fi +noconfigdirs=$noconfigdirs target-libgloss +# If we are not using a cross compiler, do configure newlib. +# Note however, that newlib will only be configured in this situation +# if the --with-newlib option has been given, because otherwise +# 'target-newlib' will appear in skipdirs. +;; + i[[3456789]]86-*-rdos*) +noconfigdirs=$noconfigdirs target-newlib target-libgloss +;; + sh*-*-pe|mips*-*-pe|arm-wince-pe) +noconfigdirs=$noconfigdirs target-newlib target-libgloss +;; + sparc-*-sunos4*) +noconfigdirs=$noconfigdirs target-newlib target-libgloss +;; + *-*-aix*) +noconfigdirs=$noconfigdirs target-newlib target-libgloss +;; + *-*-beos*) +noconfigdirs=$noconfigdirs target-newlib target-libgloss +;; *-*-chorusos) noconfigdirs=$noconfigdirs target-newlib target-libgloss ;; + *-*-dragonfly*) +noconfigdirs=$noconfigdirs target-newlib
Re: [google] Normalize version number for google/gcc-4_6 (issue4454049)
On Tue, May 3, 2011 at 18:20, Matthias Klose d...@ubuntu.com wrote: On 05/02/2011 09:53 PM, Diego Novillo wrote: Since google/gcc-4_6 follows the 4.6 branch, changes in minor revisions cause unnecessary churn in directory names. Fixed with this. OK for google/gcc-4_6? Google ref 4335466. * BASE-VER: Change to 4.6.x-google. diff --git a/gcc/BASE-VER b/gcc/BASE-VER index 4110f74..33d4edd 100644 --- a/gcc/BASE-VER +++ b/gcc/BASE-VER @@ -1 +1 @@ -4.6.1-google +4.6.x-google is this enough? the subminor version number is encoded in more places, e.g. C++ headers, Go libraries, jar files. It work here so far. All the places where the version number is encoded in ultimately get it from BASE-VER. For us, the important thing is to avoid the churn in installed directory names and such. What the version string says is not as important. Diego
Re: [google]: initialize language field for clone function struct
That's what we should phase out. The eventual aim should be for (a) folding on GIMPLE (gimple-fold etc. - working with SSA not combined trees) as an optimization and (b) folding done by front ends only when required for language semantics (e.g. constant expressions). Why? Isn't it always better to optimize as early as you can when it's easy? Why keep unfolded constants around at all?
Re: [SPARC] Hookize PRINT_OPERAND, PRINT_OPERAND_ADDRESS and PRINT_OPERAND_PUNCT_VALID_P
Joseph S. Myers jos...@codesourcery.com writes: What is so hard about running grep when removing/renaming symbols??? Generically, the presence of lots of nonobvious places that may turn out to use a symbol - ada/gcc-interface/, go/gofrontend, config/ for what one thinks of as front-end symbols, libgcc/ and other places outside of gcc/ (being outside gcc/ is probably how the remaining use of ROUND_TYPE_SIZE in libobjc was missed when that macro was removed from GCC in 2003), C symbols used directly in Ada source code, The ongoing work on narrowing interfaces (so that it's well-defined whether particular headers are used for the host or the target, tm.h isn't included in so many places, etc.) may help - though another thing to watch out for there is random declarations in .c files or inappropriate headers that mean that something uses a symbol from some part of the compiler despite not including the normal header that declares it (I found plenty of such cases when making options variables into macros). Help in cleaning up interfaces is always welcome - there's a lot to do (http://gcc.gnu.org/wiki/Top-Level_Libgcc_Migration has notes dealing with the very narrow area of target macros in code built for the target). certainly true in general, although grep -r over the whole tree isn't too hard to use either ;-) But in the case at hand, $ grep print_operand * in gcc/config/sparc would have turned up the problem at once, that's why I'm complaining. Your expansion of the wiki page on toplevel libgcc migration is certainly welcome: I hadn't seen before that *-unwind.h files and related macros can be moved over as well. Thanks. Rainer -- - Rainer Orth, Center for Biotechnology, Bielefeld University
rs6000_handle_option global state avoidance, part 1
This patch implements the simpler parts of stopping rs6000_handle_option from using global state. Many options are converted to use .opt features such as Var and Enum, replacing explicit code, while other code is changed to use the opts and opts_set pointers. -mabi=, -mcpu= and -mtune= will be dealt with in separate patches (this patch only does the more mechanical parts of stopping them from using global state). rs6000_explicit_options is replaced by use of global_options_set and the opts_set pointer. Two options, -mcmodel= and -mfpu=, had cases that fell through to the next case without comments to indicate if this was intended. I added comments to make the semantics explicit. Given the documentation, it may well be intentional for -mcmodel= but is more doubtful for -mfpu=. The On 64-bit Darwin, power alignment is ABI-incompatible check was moved to rs6000_option_override_internal because macros such as DEFAULT_ABI and TARGET_64BIT can implicitly use global state, and it's better to make such checks on the state after all options have been parsed (so they don't depend on the ordering of options on the command line) anyway. The commented-out RS6000_DEFAULT_LONG_DOUBLE_SIZE definition in eabispe.h (referencing an obsolete ABI version) was removed for the same reason (implicitly uses global state, which is inconsistent with how this macro is used). (A subsequent patch will arrange for automatically-generated macros such as TARGET_64BIT to have variants taking a pointer to a gcc_options structure, for use in the option override hook when that gets a part that works on options structures split out.) Tested building cc1 and xgcc for crosses to: powerpc-eabi powerpc-eabispe powerpc-linux-gnuspe powerpc-linux-gnu powerpc64-linux-gnu powerpc-darwin powerpc-ibm-aix4.3 powerpc-ibm-aix5.2.0 powerpc-ibm-aix5.3.0 powerpc-ibm-aix6.1. Also bootstrapped with no regressions on x86_64-unknown-linux-gnu to test the *.awk changes. Will commit to trunk in the absence of target maintainer objections. 2011-05-04 Joseph Myers jos...@codesourcery.com * opt-functions.awk (var_type_struct): Handle Enum options. * optc-gen.awk: Don't check range of variables of character type. * config/rs6000/rs6000.c (rs6000_sched_insert_nops_str, rs6000_sched_costly_dep_str, rs6000_recip_name, rs6000_abi_name, rs6000_sdata_name, rs6000_explicit_options): Remove. (rs6000_option_override_internal): Check for -malign-power here. Use global_options_set instead of rs6000_explicit_options. (rs6000_parse_fpu_option): Remove. (rs6000_handle_option): Access variables via opts and opts_set pointers. Use error_at and warning_at. Add fall-through comments. Don't handle OPT_mcmodel_, OPT_maix_struct_return, OPT_msvr4_struct_return, OPT_mvrsave, OPT_mspe, OPT_mcall_, OPT_msdata_, OPT_mtls_size_, OPT_mtraceback_, OPT_mfloat_gprs_, OPT_msched_costly_dep_, OPT_malign_ or OPT_mrecip_ explicitly here. Don't use rs6000_parse_fpu_option. * config/rs6000/rs6000.h (fpu_type): Remove declaration. * config/rs6000/rs6000.opt (rs6000_long_double_type_size, rs6000_spe, rs6000_float_gprs): Remove TargetVariable entries. (mrecip=): Use Var. (mspe): Use Var and Save. (mtraceback=): Use Enum and Var. (rs6000_traceback_type): New Enum and EnumValue entries. (mfloat-gprs=): Use Enum, Var and Save. (rs6000_float_gprs): New Enum and EnumValue entries. (mlong-double-): use Var and Save. (msched-costly-dep=, minsert-sched-nops=): Use Var. (malign-): Use Enum and Var. (rs6000_alignment_flags): New Enum and EnumValue entries. (mfpu=): Use Enum. (fpu_type_t): New Enum and EnumValue entries. * config/rs6000/aix43.h (SUBTARGET_OVERRIDE_OPTIONS): Use global_options_set instead of rs6000_explicit_options. * config/rs6000/aix52.h (SUBTARGET_OVERRIDE_OPTIONS): Use global_options_set instead of rs6000_explicit_options. * config/rs6000/aix53.h (SUBTARGET_OVERRIDE_OPTIONS): Use global_options_set instead of rs6000_explicit_options. * config/rs6000/aix61.h (SUBTARGET_OVERRIDE_OPTIONS): Use global_options_set instead of rs6000_explicit_options. * config/rs6000/e500-double.h (SUB3TARGET_OVERRIDE_OPTIONS): Use global_options_set instead of rs6000_explicit_options. * config/rs6000/eabispe.h (SUBSUBTARGET_OVERRIDE_OPTIONS): Use global_options_set instead of rs6000_explicit_options. (RS6000_DEFAULT_LONG_DOUBLE_SIZE): Remove commented-out definition. * config/rs6000/linux64.h (SUBSUBTARGET_OVERRIDE_OPTIONS): Use global_options_set instead of rs6000_explicit_options. * config/rs6000/linux64.opt (mcmodel=): Use Enum and Var. (rs6000_cmodel): New Enum and EnumValue entries. * config/rs6000/linuxspe.h
Re: [google]: initialize language field for clone function struct
Hi, On Wed, 4 May 2011, Richard Guenther wrote: It prevents save_expr from being called at global level, since you cannot create SAVE_EXPRs outside functions. Likewise in variable_size. I see several places in fold-const.c that are not properly guarded then. But anyway, if it is supposed to protect SAVE_EXPRs then I'd have expected save_expr to contain that check and possibly return NULL if it can't save. And I'm not sure you can't do SAVE_EXPRs outside of functions - you could simply emit global temporaries. It's not the temporary, but the evaluation that poses problems in global context. (you could add a global ctor to it, ugh) Ciao, Michael.
[Patch, Fortran+gcc/doc/invoke.texi] PR48864: -Ofast implies -fno-protect parens
As the example in the PR shows, using -fno-protect parens can make a huge difference. As -fno-protect is in the spirit of -Ofast, enable it with that option. Build on x86-64-linux. OK for the trunk? Tobias gcc/ 2011-05-04 Tobias Burnus bur...@net-b.de PR fortran/48864 * doc/invoke.texi (Ofast): Document that it enables Fortran's -fno-protect-parens. gcc/fortran 2011-05-04 Tobias Burnus bur...@net-b.de PR fortran/48864 * invoke.texi (fno-protect-parens): Document that -Ofast implies -fno-protect-parens. * options.c (gfc_init_options, gfc_post_options): Make -Ofast imply -fno-protect-parens. diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 8602923..9e27653 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -5999,7 +5999,8 @@ optimizations designed to reduce code size. Disregard strict standards compliance. @option{-Ofast} enables all @option{-O3} optimizations. It also enables optimizations that are not valid for all standard compliant programs. -It turns on @option{-ffast-math}. +It turns on @option{-ffast-math} and the Fortran-specific +@option{-fno-protect-parens}. If you use multiple @option{-O} options, with or without level numbers, the last such option is the one that is effective. diff --git a/gcc/fortran/invoke.texi b/gcc/fortran/invoke.texi index 0874e5c..d24c2f2 100644 --- a/gcc/fortran/invoke.texi +++ b/gcc/fortran/invoke.texi @@ -1488,7 +1488,8 @@ levels such that the compiler does not do any re-association. Using @option{-fno-protect-parens} allows the compiler to reorder @code{REAL} and @code{COMPLEX} expressions to produce faster code. Note that for the re-association optimization @option{-fno-signed-zeros} and @option{-fno-trapping-math} -need to be in effect. +need to be in effect. The parentheses protection is enabled by default, unless +@option{-Ofast} is given. @item -frealloc-lhs @opindex @code{frealloc-lhs} diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c index f56fad7..52422b1 100644 --- a/gcc/fortran/options.c +++ b/gcc/fortran/options.c @@ -151,7 +151,7 @@ gfc_init_options (unsigned int decoded_options_count, gfc_option.flag_init_character = GFC_INIT_CHARACTER_OFF; gfc_option.flag_init_character_value = (char)0; gfc_option.flag_align_commons = 1; - gfc_option.flag_protect_parens = 1; + gfc_option.flag_protect_parens = -1; gfc_option.flag_realloc_lhs = -1; gfc_option.flag_aggressive_function_elimination = 0; gfc_option.flag_frontend_optimize = -1; @@ -272,6 +272,9 @@ gfc_post_options (const char **pfilename) if (flag_associative_math == -1) flag_associative_math = (!flag_trapping_math !flag_signed_zeros); + if (gfc_option.flag_protect_parens == -1) +gfc_option.flag_protect_parens = optimize_fast ? 0 : 1; + /* By default, disable (re)allocation during assignment for -std=f95, and enable it for F2003/F2008/GNU/Legacy. */ if (gfc_option.flag_realloc_lhs == -1)
Re: [SPARC] Hookize PRINT_OPERAND, PRINT_OPERAND_ADDRESS and PRINT_OPERAND_PUNCT_VALID_P
On Wed, 4 May 2011, Rainer Orth wrote: Your expansion of the wiki page on toplevel libgcc migration is certainly welcome: I hadn't seen before that *-unwind.h files and related macros can be moved over as well. I've no idea whether they can be moved *at present*, but certainly the eventual aim should be to move them. Before more macros are moved to files in libgcc/config I'd really rather the libgcc headers go in a separate libgcc_tm_file or similar, not included on the host and with the moved macros poisoned in the host system.h, to avoid the situation listed on that page of RENAME_LIBRARY (in gcc/config/arm/symbian.h, otherwise moved to libgcc headers) where a macro is only partly migrated to the libgcc headers but this partial state isn't obvious. This has the advantage of avoiding the ../../libgcc/config/ kludge in tm_file as well. -- Joseph S. Myers jos...@codesourcery.com
Re: [google]: initialize language field for clone function struct
On Wed, May 4, 2011 at 1:56 PM, Michael Matz m...@suse.de wrote: Hi, On Wed, 4 May 2011, Richard Guenther wrote: It prevents save_expr from being called at global level, since you cannot create SAVE_EXPRs outside functions. Likewise in variable_size. I see several places in fold-const.c that are not properly guarded then. But anyway, if it is supposed to protect SAVE_EXPRs then I'd have expected save_expr to contain that check and possibly return NULL if it can't save. And I'm not sure you can't do SAVE_EXPRs outside of functions - you could simply emit global temporaries. It's not the temporary, but the evaluation that poses problems in global context. (you could add a global ctor to it, ugh) Well, a save-expr would only be created if evaluation is necessary anyway, so I don't see the issue really. Richard.
config/mep/mep.c: don't translate syntax description.
While checking the current german tanslations I noticed that mep_validate_vliw passes the syntax description directly to inform and thus they appear in the message catalogue which is IMO bogus. This patch makes the syntax descriptions untanslkatable. OK to check in? 2011-05-04 Philipp Thomas p...@suse.de * config/mep/mep.c (mep_validate_vliw): Syntax description should not be translated. Index: config/mep/mep.c === --- config/mep/mep.c(Revision 173334) +++ config/mep/mep.c(Arbeitskopie) @@ -4122,16 +4122,16 @@ if (TREE_CODE (*node) == POINTER_TYPE !gave_pointer_note) { - inform (input_location, to describe a pointer to a VLIW function, use syntax like this:); - inform (input_location, typedef int (__vliw *vfuncptr) ();); + inform (input_location, to describe a pointer to a VLIW function, use syntax like this: %s, + typedef int (__vliw *vfuncptr) ();); gave_pointer_note = 1; } if (TREE_CODE (*node) == ARRAY_TYPE !gave_array_note) { - inform (input_location, to describe an array of VLIW function pointers, use syntax like this:); - inform (input_location, typedef int (__vliw *vfuncptr[]) ();); + inform (input_location, to describe an array of VLIW function pointers, use syntax like this: %s, + typedef int (__vliw *vfuncptr[]) ();); gave_array_note = 1; } }
Re: [google]: initialize language field for clone function struct
On Wed, May 4, 2011 at 07:44, Richard Kenner ken...@vlsi1.ultra.nyu.edu wrote: That's what we should phase out. The eventual aim should be for (a) folding on GIMPLE (gimple-fold etc. - working with SSA not combined trees) as an optimization and (b) folding done by front ends only when required for language semantics (e.g. constant expressions). Why? Isn't it always better to optimize as early as you can when it's easy? Why keep unfolded constants around at all? There are pros and cons about early optimization, actually. Generating extremely optimized IL very early can actually tie up subsequent passes. For instance, loop unrolling and vectorization. There are others in the literature. Diego.
Re: [google]: initialize language field for clone function struct
There are pros and cons about early optimization, actually. Generating extremely optimized IL very early can actually tie up subsequent passes. For instance, loop unrolling and vectorization. There are others in the literature. Sure, in the sorts of examples you mention where there's a level of globality to it. But I don't see it in the types of things that fold does. How could it ever be better to leave a - a in the tree instead of 0?
Re: [google]: initialize language field for clone function struct
On Wed, May 4, 2011 at 08:30, Richard Kenner ken...@vlsi1.ultra.nyu.edu wrote: There are pros and cons about early optimization, actually. Generating extremely optimized IL very early can actually tie up subsequent passes. For instance, loop unrolling and vectorization. There are others in the literature. Sure, in the sorts of examples you mention where there's a level of globality to it. But I don't see it in the types of things that fold does. How could it ever be better to leave a - a in the tree instead of 0? Yes, that's true. Diego.
Re: [PATCH][ARM] RTABI half-precision conversion functions
On 27 April 2011 17:26, Andrew Stubbs a...@codesourcery.com wrote: On 21/04/11 16:58, Joseph S. Myers wrote: You need to add %inherit GCC_4.7.0 GCC_4.6.0 GCC_4.7.0 { } Ok, done. Is this OK now? I can't approve the target independent parts of this but as I said on IRC based on a brief look I'm not sure why the changes in fp16.c from unsigned short - unsigned int are needed in this case ? There is theoretically no reason for this change as far as the Runtime PCS is concerned. Richard ? cheers Ramana Andrew
[PATCH][C] Avoid passing NULL to build_int_cst
This is the C family parts, bootstrapped and tested on x86_64-unknown-linux-gnu. Ok for trunk? Thanks, Richard. 2011-05-04 Richard Guenther rguent...@suse.de * c-decl.c (check_bitfield_type_and_width): Do not pass NULL to build_int_cst. * c-typeck.c (really_start_incremental_init): Use bitsize_int for constructor indices. (push_init_level): Likewise. c-family/ * c-common.c (fix_string_type): Use size_int for index type bounds. (start_fname_decls): Do not pass NULL to build_int_cst. (c_init_attributes): Likewise. * c-lex.c (c_lex_with_flags): Likewise. Index: gcc/c-decl.c === *** gcc/c-decl.c(revision 173370) --- gcc/c-decl.c(working copy) *** check_bitfield_type_and_width (tree *typ *** 4717,4723 { error (width of %qs exceeds its type, name); w = max_width; ! *width = build_int_cst (NULL_TREE, w); } else w = tree_low_cst (*width, 1); --- 4717,4723 { error (width of %qs exceeds its type, name); w = max_width; ! *width = build_int_cst (integer_type_node, w); } else w = tree_low_cst (*width, 1); Index: gcc/c-typeck.c === *** gcc/c-typeck.c (revision 173370) --- gcc/c-typeck.c (working copy) *** really_start_incremental_init (tree type *** 6636,6642 { /* Vectors are like simple fixed-size arrays. */ constructor_max_index = ! build_int_cst (NULL_TREE, TYPE_VECTOR_SUBPARTS (constructor_type) - 1); constructor_index = bitsize_zero_node; constructor_unfilled_index = constructor_index; } --- 6636,6642 { /* Vectors are like simple fixed-size arrays. */ constructor_max_index = ! bitsize_int (TYPE_VECTOR_SUBPARTS (constructor_type) - 1); constructor_index = bitsize_zero_node; constructor_unfilled_index = constructor_index; } *** push_init_level (int implicit, struct ob *** 6805,6812 { /* Vectors are like simple fixed-size arrays. */ constructor_max_index = ! build_int_cst (NULL_TREE, TYPE_VECTOR_SUBPARTS (constructor_type) - 1); ! constructor_index = convert (bitsizetype, integer_zero_node); constructor_unfilled_index = constructor_index; } else if (TREE_CODE (constructor_type) == ARRAY_TYPE) --- 6805,6812 { /* Vectors are like simple fixed-size arrays. */ constructor_max_index = ! bitsize_int (TYPE_VECTOR_SUBPARTS (constructor_type) - 1); ! constructor_index = bitsize_int (0); constructor_unfilled_index = constructor_index; } else if (TREE_CODE (constructor_type) == ARRAY_TYPE) Index: gcc/c-family/c-common.c === *** gcc/c-family/c-common.c (revision 173370) --- gcc/c-family/c-common.c (working copy) *** start_fname_decls (void) *** 743,749 if (decl) { ! saved = tree_cons (decl, build_int_cst (NULL_TREE, ix), saved); *fname_vars[ix].decl = NULL_TREE; } } --- 743,750 if (decl) { ! saved = tree_cons (decl, build_int_cst (integer_type_node, ix), !saved); *fname_vars[ix].decl = NULL_TREE; } } *** fix_string_type (tree value) *** 946,952 construct the matching unqualified array type first. The C front end does not require this, but it does no harm, so we do it unconditionally. */ ! i_type = build_index_type (build_int_cst (NULL_TREE, nchars - 1)); a_type = build_array_type (e_type, i_type); if (c_dialect_cxx() || warn_write_strings) a_type = c_build_qualified_type (a_type, TYPE_QUAL_CONST); --- 947,953 construct the matching unqualified array type first. The C front end does not require this, but it does no harm, so we do it unconditionally. */ ! i_type = build_index_type (size_int (nchars - 1)); a_type = build_array_type (e_type, i_type); if (c_dialect_cxx() || warn_write_strings) a_type = c_build_qualified_type (a_type, TYPE_QUAL_CONST); *** c_init_attributes (void) *** 5670,5676 #define DEF_ATTR_NULL_TREE(ENUM) \ built_in_attributes[(int) ENUM] = NULL_TREE; #define DEF_ATTR_INT(ENUM, VALUE) \ ! built_in_attributes[(int) ENUM] = build_int_cst (NULL_TREE, VALUE); #define DEF_ATTR_IDENT(ENUM, STRING) \ built_in_attributes[(int) ENUM] = get_identifier (STRING); #define DEF_ATTR_TREE_LIST(ENUM, PURPOSE, VALUE, CHAIN) \ --- 5671,5677 #define DEF_ATTR_NULL_TREE(ENUM)
[commit, spu] Fix compiler crash on gcc.c-torture/compile/pr48767.c
Hello, the new gcc.c-torture/compile/pr48767.c test cases were all crashing the compiler on SPU, for a similar reason as on the SH where this problem was originally found. Fixed by calling the common code pass_by_reference routine instead of calling spu_pass_by_reference directly. The common code routine has additional checks that catch the case causing the crash. Tested on spu-elf, commited to mainline. Bye, Ulrich ChangeLog: * config/spu/spu.c (spu_gimplify_va_arg_expr): Call pass_by_reference instead of spu_pass_by_reference. Index: gcc/config/spu/spu.c === *** gcc/config/spu/spu.c(revision 173251) --- gcc/config/spu/spu.c(working copy) *** spu_gimplify_va_arg_expr (tree valist, t *** 4245,4252 /* if an object is dynamically sized, a pointer to it is passed instead of the object itself. */ ! pass_by_reference_p = spu_pass_by_reference (NULL, TYPE_MODE (type), type, ! false); if (pass_by_reference_p) type = build_pointer_type (type); size = int_size_in_bytes (type); --- 4245,4252 /* if an object is dynamically sized, a pointer to it is passed instead of the object itself. */ ! pass_by_reference_p = pass_by_reference (NULL, TYPE_MODE (type), type, ! false); if (pass_by_reference_p) type = build_pointer_type (type); size = int_size_in_bytes (type); -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE ulrich.weig...@de.ibm.com
[PATCH][Fortran] Avoid passing NULL to build_int_cst
Fortran parts. Bootstrapped on x86_64-unknown-linux-gnu, testing in progress, ok if it passes? Thanks, Richard. 2011-05-04 Richard Guenther rguent...@suse.de * trans-array.c (gfc_trans_array_constructor_value): Use size_int for bounds of range types. (gfc_trans_array_constructor_value): Use size_type_node for memcpy argument. * trans-common.c (build_field): Use gfc_charlen_type_node for lengths. * trans-openmp.c (gfc_trans_omp_clauses): Do not pass NULL as type to build_int_cst. * trans-const.c (gfc_build_string_const): Use size_int for bounds of range types. (gfc_build_wide_string_const): Likewise. * trans-stmt.c (gfc_trans_label_assign): Use gfc_charlen_type_node for lengths. (gfc_trans_character_select): Likewise. (gfc_trans_character_select): Do not pass NULL as type to build_int_cst. (gfc_trans_character_select): Use size_int for bounds of range types. * trans-io.c (gfc_build_io_library_fndecls): Likewise. (add_case): Do not pass NULL as type to build_int_cst. (transfer_expr): Likewise. (transfer_array_desc): Likewise. * trans-decl.c (gfc_add_assign_aux_vars): Use gfc_charlen_type_node for lengths. (gfc_trans_assign_aux_var): Likewise. (create_main_function): Use size_int for bounds of range types. * trans-intrinsic.c (gfc_conv_intrinsic_minmax_char): Do not pass NULL as type to build_int_cst. (gfc_conv_intrinsic_spacing): Likewise. (gfc_conv_intrinsic_rrspacing): Likewise. (gfc_conv_intrinsic_len): Use gfc_charlen_type_node for lengths. Index: gcc/fortran/trans-array.c === *** gcc/fortran/trans-array.c (revision 173370) --- gcc/fortran/trans-array.c (working copy) *** gfc_trans_array_constructor_value (stmtb *** 1364,1370 p = gfc_constructor_next (p); } ! bound = build_int_cst (NULL_TREE, n - 1); /* Create an array type to hold them. */ tmptype = build_range_type (gfc_array_index_type, gfc_index_zero_node, bound); --- 1364,1370 p = gfc_constructor_next (p); } ! bound = size_int (n - 1); /* Create an array type to hold them. */ tmptype = build_range_type (gfc_array_index_type, gfc_index_zero_node, bound); *** gfc_trans_array_constructor_value (stmtb *** 1390,1396 init = gfc_build_addr_expr (NULL_TREE, init); size = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (type)); ! bound = build_int_cst (NULL_TREE, n * size); tmp = build_call_expr_loc (input_location, built_in_decls[BUILT_IN_MEMCPY], 3, tmp, init, bound); --- 1390,1396 init = gfc_build_addr_expr (NULL_TREE, init); size = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (type)); ! bound = build_int_cst (size_type_node, n * size); tmp = build_call_expr_loc (input_location, built_in_decls[BUILT_IN_MEMCPY], 3, tmp, init, bound); Index: gcc/fortran/trans-common.c === *** gcc/fortran/trans-common.c (revision 173370) --- gcc/fortran/trans-common.c (working copy) *** build_field (segment_info *h, tree union *** 309,315 addr = gfc_create_var_np (pvoid_type_node, h-sym-name); TREE_STATIC (len) = 1; TREE_STATIC (addr) = 1; ! DECL_INITIAL (len) = build_int_cst (NULL_TREE, -2); gfc_set_decl_location (len, h-sym-declared_at); gfc_set_decl_location (addr, h-sym-declared_at); GFC_DECL_STRING_LEN (field) = pushdecl_top_level (len); --- 309,315 addr = gfc_create_var_np (pvoid_type_node, h-sym-name); TREE_STATIC (len) = 1; TREE_STATIC (addr) = 1; ! DECL_INITIAL (len) = build_int_cst (gfc_charlen_type_node, -2); gfc_set_decl_location (len, h-sym-declared_at); gfc_set_decl_location (addr, h-sym-declared_at); GFC_DECL_STRING_LEN (field) = pushdecl_top_level (len); Index: gcc/fortran/trans-openmp.c === *** gcc/fortran/trans-openmp.c (revision 173370) --- gcc/fortran/trans-openmp.c (working copy) *** gfc_trans_omp_clauses (stmtblock_t *bloc *** 948,954 if (clauses-collapse) { c = build_omp_clause (where.lb-location, OMP_CLAUSE_COLLAPSE); ! OMP_CLAUSE_COLLAPSE_EXPR (c) = build_int_cst (NULL, clauses-collapse); omp_clauses =
Re: [google]: initialize language field for clone function struct
Hi, On Wed, 4 May 2011, Richard Kenner wrote: There are pros and cons about early optimization, actually. Generating extremely optimized IL very early can actually tie up subsequent passes. For instance, loop unrolling and vectorization. There are others in the literature. Sure, in the sorts of examples you mention where there's a level of globality to it. But I don't see it in the types of things that fold does. How could it ever be better to leave a - a in the tree instead of 0? The former is not a constant expression in the C sense, hence folding it early disables required diagnostics; that's what Joseph means when he says that the frontends should fold only exactly those things that the language standard requires, implying not a general catch-all folder. After the frontend is ready with a construct we can do all kinds of foldings as early as we like. Ciao, Michael.
Re: [PATCH][Fortran] Avoid passing NULL to build_int_cst
On 05/04/2011 02:49 PM, Richard Guenther wrote: Fortran parts. Bootstrapped on x86_64-unknown-linux-gnu, testing in progress, ok if it passes? OK. Thanks for doing the janitorial work. Tobias 2011-05-04 Richard Guentherrguent...@suse.de * trans-array.c (gfc_trans_array_constructor_value): Use size_int for bounds of range types. (gfc_trans_array_constructor_value): Use size_type_node for memcpy argument. * trans-common.c (build_field): Use gfc_charlen_type_node for lengths. * trans-openmp.c (gfc_trans_omp_clauses): Do not pass NULL as type to build_int_cst. * trans-const.c (gfc_build_string_const): Use size_int for bounds of range types. (gfc_build_wide_string_const): Likewise. * trans-stmt.c (gfc_trans_label_assign): Use gfc_charlen_type_node for lengths. (gfc_trans_character_select): Likewise. (gfc_trans_character_select): Do not pass NULL as type to build_int_cst. (gfc_trans_character_select): Use size_int for bounds of range types. * trans-io.c (gfc_build_io_library_fndecls): Likewise. (add_case): Do not pass NULL as type to build_int_cst. (transfer_expr): Likewise. (transfer_array_desc): Likewise. * trans-decl.c (gfc_add_assign_aux_vars): Use gfc_charlen_type_node for lengths. (gfc_trans_assign_aux_var): Likewise. (create_main_function): Use size_int for bounds of range types. * trans-intrinsic.c (gfc_conv_intrinsic_minmax_char): Do not pass NULL as type to build_int_cst. (gfc_conv_intrinsic_spacing): Likewise. (gfc_conv_intrinsic_rrspacing): Likewise. (gfc_conv_intrinsic_len): Use gfc_charlen_type_node for lengths.
Re: [google]: initialize language field for clone function struct
On Wed, May 04, 2011 at 08:30:40AM -0400, Richard Kenner wrote: There are pros and cons about early optimization, actually. Generating extremely optimized IL very early can actually tie up subsequent passes. For instance, loop unrolling and vectorization. There are others in the literature. Sure, in the sorts of examples you mention where there's a level of globality to it. But I don't see it in the types of things that fold does. How could it ever be better to leave a - a in the tree instead of 0? If you ever want to do things beside compile the code--automated refactoring, renaming, pretty-printing, etc.--fidelity to the source is preferred. -Nathan
Re: [google]: initialize language field for clone function struct
On Wed, May 4, 2011 at 09:19, Nathan Froyd froy...@codesourcery.com wrote: On Wed, May 04, 2011 at 08:30:40AM -0400, Richard Kenner wrote: There are pros and cons about early optimization, actually. Generating extremely optimized IL very early can actually tie up subsequent passes. For instance, loop unrolling and vectorization. There are others in the literature. Sure, in the sorts of examples you mention where there's a level of globality to it. But I don't see it in the types of things that fold does. How could it ever be better to leave a - a in the tree instead of 0? If you ever want to do things beside compile the code--automated refactoring, renaming, pretty-printing, etc.--fidelity to the source is preferred. I think we may be talking at different levels. It's my impression that Richard K. was referring to local transformations like a - a - 0 once we are in the middle end. I agree that doing that transformation close to the FE is undesirable, but once we are in the middle end that should be fine. Diego.
Re: [google]: initialize language field for clone function struct
I think we may be talking at different levels. It's my impression that Richard K. was referring to local transformations like a - a - 0 once we are in the middle end. I agree that doing that transformation close to the FE is undesirable, but once we are in the middle end that should be fine. That's exactly what I mean. If the FE cares about no folding taking place, it shouldn't fold. But once we're past the point that it's doing syntax and semantic checking, there's no optimization benefit in deferring the folding until we get to SSA, for example.
Re: [PING] Fix PR46399 - missing mode promotion for libcall args
On Mon, Apr 18, 2011 at 10:17 AM, Andreas Krebbel kreb...@linux.vnet.ibm.com wrote: Hi, the attached patch uses the existing promote_function_mode hook. For a libcall neither TYPE nor FNTYPE is available so I had to change a few related function in order to deal with that. The patch also fixes the s390 DFP problems. Bye, -Andreas- 2011-04-18 Andreas Krebbel andreas.kreb...@de.ibm.com * calls.c (emit_library_call_value_1): Invoke promote_function_mode hook on libcall arguments. * explow.c (promote_function_mode, promote_mode): Handle TYPE argument being NULL. * targhooks.c (default_promote_function_mode): Lisewise. * config/s390/s390.c (s390_promote_function_mode): Likewise. * config/sparc/sparc.c (sparc_promote_function_mode): Likewise. * doc/tm.texi: Document that TYPE argument might be NULL. Index: gcc/calls.c === *** gcc/calls.c.orig --- gcc/calls.c *** emit_library_call_value_1 (int retval, r *** 3484,3489 --- 3484,3490 { rtx val = va_arg (p, rtx); enum machine_mode mode = (enum machine_mode) va_arg (p, int); + int unsigned_p = 0; /* We cannot convert the arg value to the mode the library wants here; must do it earlier where we know the signedness of the arg. */ *** emit_library_call_value_1 (int retval, r *** 3531,3539 val = force_operand (XEXP (slot, 0), NULL_RTX); } ! argvec[count].value = val; argvec[count].mode = mode; ! argvec[count].reg = targetm.calls.function_arg (args_so_far, mode, NULL_TREE, true); --- 3532,3540 val = force_operand (XEXP (slot, 0), NULL_RTX); } ! mode = promote_function_mode (NULL_TREE, mode, unsigned_p, NULL_TREE, 0); argvec[count].mode = mode; ! argvec[count].value = convert_modes (mode, GET_MODE (val), val, 0); argvec[count].reg = targetm.calls.function_arg (args_so_far, mode, NULL_TREE, true); Index: gcc/config/s390/s390.c === *** gcc/config/s390/s390.c.orig --- gcc/config/s390/s390.c *** s390_promote_function_mode (const_tree t *** 8742,8748 if (INTEGRAL_MODE_P (mode) GET_MODE_SIZE (mode) UNITS_PER_LONG) { ! if (POINTER_TYPE_P (type)) *punsignedp = POINTERS_EXTEND_UNSIGNED; return Pmode; } --- 8742,8748 if (INTEGRAL_MODE_P (mode) GET_MODE_SIZE (mode) UNITS_PER_LONG) { ! if (type != NULL_TREE POINTER_TYPE_P (type)) *punsignedp = POINTERS_EXTEND_UNSIGNED; return Pmode; } Index: gcc/explow.c === *** gcc/explow.c.orig --- gcc/explow.c *** enum machine_mode *** 771,776 --- 771,787 promote_function_mode (const_tree type, enum machine_mode mode, int *punsignedp, const_tree funtype, int for_return) { + /* Called without a type node for a libcall. */ + if (type == NULL_TREE) + { + if (INTEGRAL_MODE_P (mode)) + return targetm.calls.promote_function_mode (NULL_TREE, mode, + punsignedp, funtype, + for_return); + else + return mode; + } + switch (TREE_CODE (type)) { case INTEGER_TYPE: case ENUMERAL_TYPE: case BOOLEAN_TYPE: *** enum machine_mode *** 791,796 --- 802,813 promote_mode (const_tree type ATTRIBUTE_UNUSED, enum machine_mode mode, int *punsignedp ATTRIBUTE_UNUSED) { + /* For libcalls this is invoked without TYPE from the backends + TARGET_PROMOTE_FUNCTION_MODE hooks. Don't do anything in that + case. */ + if (type == NULL_TREE) + return mode; + This broke bootstrap /space/rguenther/src/svn/trunk/gcc/explow.c: In function 'promote_mode': /space/rguenther/src/svn/trunk/gcc/explow.c:815:3: error: ISO C90 forbids mixed declarations and code [-Werror=edantic] cc1: all warnings being treated as errors /* FIXME: this is the same logic that was there until GCC 4.4, but we probably want to test POINTERS_EXTEND_UNSIGNED even if PROMOTE_MODE is not defined. The affected targets are M32C, S390, SPARC. */ Index: gcc/config/sparc/sparc.c === *** gcc/config/sparc/sparc.c.orig --- gcc/config/sparc/sparc.c *** init_cumulative_args (struct sparc_args *** 4965,4977 /* Handle promotion of pointer and integer arguments. */ static enum machine_mode ! sparc_promote_function_mode (const_tree
Re: [PING] Fix PR46399 - missing mode promotion for libcall args
2011/5/4 Richard Guenther richard.guent...@gmail.com: On Mon, Apr 18, 2011 at 10:17 AM, Andreas Krebbel kreb...@linux.vnet.ibm.com wrote: Hi, the attached patch uses the existing promote_function_mode hook. For a libcall neither TYPE nor FNTYPE is available so I had to change a few related function in order to deal with that. The patch also fixes the s390 DFP problems. Bye, -Andreas- 2011-04-18 Andreas Krebbel andreas.kreb...@de.ibm.com * calls.c (emit_library_call_value_1): Invoke promote_function_mode hook on libcall arguments. * explow.c (promote_function_mode, promote_mode): Handle TYPE argument being NULL. * targhooks.c (default_promote_function_mode): Lisewise. * config/s390/s390.c (s390_promote_function_mode): Likewise. * config/sparc/sparc.c (sparc_promote_function_mode): Likewise. * doc/tm.texi: Document that TYPE argument might be NULL. Index: gcc/calls.c === *** gcc/calls.c.orig --- gcc/calls.c *** emit_library_call_value_1 (int retval, r *** 3484,3489 --- 3484,3490 { rtx val = va_arg (p, rtx); enum machine_mode mode = (enum machine_mode) va_arg (p, int); + int unsigned_p = 0; /* We cannot convert the arg value to the mode the library wants here; must do it earlier where we know the signedness of the arg. */ *** emit_library_call_value_1 (int retval, r *** 3531,3539 val = force_operand (XEXP (slot, 0), NULL_RTX); } ! argvec[count].value = val; argvec[count].mode = mode; ! argvec[count].reg = targetm.calls.function_arg (args_so_far, mode, NULL_TREE, true); --- 3532,3540 val = force_operand (XEXP (slot, 0), NULL_RTX); } ! mode = promote_function_mode (NULL_TREE, mode, unsigned_p, NULL_TREE, 0); argvec[count].mode = mode; ! argvec[count].value = convert_modes (mode, GET_MODE (val), val, 0); argvec[count].reg = targetm.calls.function_arg (args_so_far, mode, NULL_TREE, true); Index: gcc/config/s390/s390.c === *** gcc/config/s390/s390.c.orig --- gcc/config/s390/s390.c *** s390_promote_function_mode (const_tree t *** 8742,8748 if (INTEGRAL_MODE_P (mode) GET_MODE_SIZE (mode) UNITS_PER_LONG) { ! if (POINTER_TYPE_P (type)) *punsignedp = POINTERS_EXTEND_UNSIGNED; return Pmode; } --- 8742,8748 if (INTEGRAL_MODE_P (mode) GET_MODE_SIZE (mode) UNITS_PER_LONG) { ! if (type != NULL_TREE POINTER_TYPE_P (type)) *punsignedp = POINTERS_EXTEND_UNSIGNED; return Pmode; } Index: gcc/explow.c === *** gcc/explow.c.orig --- gcc/explow.c *** enum machine_mode *** 771,776 --- 771,787 promote_function_mode (const_tree type, enum machine_mode mode, int *punsignedp, const_tree funtype, int for_return) { + /* Called without a type node for a libcall. */ + if (type == NULL_TREE) + { + if (INTEGRAL_MODE_P (mode)) + return targetm.calls.promote_function_mode (NULL_TREE, mode, + punsignedp, funtype, + for_return); + else + return mode; + } + switch (TREE_CODE (type)) { case INTEGER_TYPE: case ENUMERAL_TYPE: case BOOLEAN_TYPE: *** enum machine_mode *** 791,796 --- 802,813 promote_mode (const_tree type ATTRIBUTE_UNUSED, enum machine_mode mode, int *punsignedp ATTRIBUTE_UNUSED) { + /* For libcalls this is invoked without TYPE from the backends + TARGET_PROMOTE_FUNCTION_MODE hooks. Don't do anything in that + case. */ + if (type == NULL_TREE) + return mode; + This broke bootstrap /space/rguenther/src/svn/trunk/gcc/explow.c: In function 'promote_mode': /space/rguenther/src/svn/trunk/gcc/explow.c:815:3: error: ISO C90 forbids mixed declarations and code [-Werror=edantic] cc1: all warnings being treated as errors /* FIXME: this is the same logic that was there until GCC 4.4, but we probably want to test POINTERS_EXTEND_UNSIGNED even if PROMOTE_MODE is not defined. The affected targets are M32C, S390, SPARC. */ Index: gcc/config/sparc/sparc.c === *** gcc/config/sparc/sparc.c.orig --- gcc/config/sparc/sparc.c *** init_cumulative_args (struct sparc_args *** 4965,4977 /* Handle promotion of pointer and integer arguments. */ static
Re: [PATCH] less build_function_type usage in the Fortran FE
On Wed, May 04, 2011 at 11:22:02AM +0200, Tobias Burnus wrote: On 05/03/2011 09:06 PM, Nathan Froyd wrote: Testing in progress on x86_64-unknown-linux-gnu. OK to commit if testing successful? The Fortran part is OK. Thanks for the janitorial work. Thanks for the review! We'll see if the janitorial work actually leads to something useful later on. :) I've committed the patch below as r173375; testing showed a couple failures. I had originally changed this bit in trans-types.c: if (typelist) typelist = chainon (typelist, void_list_node); else if (sym-attr.is_main_program || sym-attr.if_source != IFSRC_UNKNOWN) typelist = void_list_node; to this: if (typelist) is_varargs = false; else if (sym-attr.is_main_program || sym-attr.if_source != IFSRC_UNKNOWN) { VEC_free (tree, gc, typelist); typelist = NULL; } Except that change makes the 'else if' case create a varargs function where we weren't before. The VEC_free is totally pointless there, because typelist would be NULL anyway. And we ought to be testing with VEC_empty instead. A little thought shows that: if (!VEC_empty (tree, typelist) || sym-attr.is_main_program || sym-attr.if_source != IFSRC_UNKNOWN) is_varargs = false; is what we really want. -Nathan gcc/ * tree.h (build_function_type_array): Declare. (build_varargs_function_type_array): Declare. (build_function_type_vec, build_varargs_function_type_vec): Define. * tree.c (build_function_type_array_1): New function. (build_function_type_array): New function. (build_varargs_function_type_array): New function. gcc/fortran/ * trans-decl.c (build_library_function_decl_1): Call build_function_type_vec. Adjust argument list building accordingly. * trans-intrinsic.c (gfc_get_intrinsic_lib_fndecl): Likewise. * trans-types.c (gfc_get_function_type): Likewise. diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index f80c9db..dc381f9 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -2478,8 +2478,7 @@ static tree build_library_function_decl_1 (tree name, const char *spec, tree rettype, int nargs, va_list p) { - tree arglist; - tree argtype; + VEC(tree,gc) *arglist; tree fntype; tree fndecl; int n; @@ -2488,20 +2487,18 @@ build_library_function_decl_1 (tree name, const char *spec, gcc_assert (current_function_decl == NULL_TREE); /* Create a list of the argument types. */ - for (arglist = NULL_TREE, n = abs (nargs); n 0; n--) + arglist = VEC_alloc (tree, gc, abs (nargs)); + for (n = abs (nargs); n 0; n--) { - argtype = va_arg (p, tree); - arglist = gfc_chainon_list (arglist, argtype); -} - - if (nargs = 0) -{ - /* Terminate the list. */ - arglist = chainon (arglist, void_list_node); + tree argtype = va_arg (p, tree); + VEC_quick_push (tree, arglist, argtype); } /* Build the function type and decl. */ - fntype = build_function_type (rettype, arglist); + if (nargs = 0) +fntype = build_function_type_vec (rettype, arglist); + else +fntype = build_varargs_function_type_vec (rettype, arglist); if (spec) { tree attr_args = build_tree_list (NULL_TREE, diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index 10dadf7..bbbf64f 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -722,7 +722,7 @@ static tree gfc_get_intrinsic_lib_fndecl (gfc_intrinsic_map_t * m, gfc_expr * expr) { tree type; - tree argtypes; + VEC(tree,gc) *argtypes; tree fndecl; gfc_actual_arglist *actual; tree *pdecl; @@ -803,14 +803,13 @@ gfc_get_intrinsic_lib_fndecl (gfc_intrinsic_map_t * m, gfc_expr * expr) ts-kind); } - argtypes = NULL_TREE; + argtypes = NULL; for (actual = expr-value.function.actual; actual; actual = actual-next) { type = gfc_typenode_for_spec (actual-expr-ts); - argtypes = gfc_chainon_list (argtypes, type); + VEC_safe_push (tree, gc, argtypes, type); } - argtypes = chainon (argtypes, void_list_node); - type = build_function_type (gfc_typenode_for_spec (ts), argtypes); + type = build_function_type_vec (gfc_typenode_for_spec (ts), argtypes); fndecl = build_decl (input_location, FUNCTION_DECL, get_identifier (name), type); diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index 27dcf82..cc82037 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -2534,10 +2534,11 @@ tree gfc_get_function_type (gfc_symbol * sym) { tree type; - tree typelist; + VEC(tree,gc) *typelist; gfc_formal_arglist *f; gfc_symbol *arg; int alternate_return; + bool is_varargs = true; /* Make sure this symbol is a function, a subroutine or the main program. */ @@ -2548,13 +2549,11 @@ gfc_get_function_type
Re: [PING] Fix PR46399 - missing mode promotion for libcall args
On Wed, May 4, 2011 at 3:45 PM, Kai Tietz ktiet...@googlemail.com wrote: 2011/5/4 Richard Guenther richard.guent...@gmail.com: On Mon, Apr 18, 2011 at 10:17 AM, Andreas Krebbel kreb...@linux.vnet.ibm.com wrote: Hi, the attached patch uses the existing promote_function_mode hook. For a libcall neither TYPE nor FNTYPE is available so I had to change a few related function in order to deal with that. The patch also fixes the s390 DFP problems. Bye, -Andreas- 2011-04-18 Andreas Krebbel andreas.kreb...@de.ibm.com * calls.c (emit_library_call_value_1): Invoke promote_function_mode hook on libcall arguments. * explow.c (promote_function_mode, promote_mode): Handle TYPE argument being NULL. * targhooks.c (default_promote_function_mode): Lisewise. * config/s390/s390.c (s390_promote_function_mode): Likewise. * config/sparc/sparc.c (sparc_promote_function_mode): Likewise. * doc/tm.texi: Document that TYPE argument might be NULL. Index: gcc/calls.c === *** gcc/calls.c.orig --- gcc/calls.c *** emit_library_call_value_1 (int retval, r *** 3484,3489 --- 3484,3490 { rtx val = va_arg (p, rtx); enum machine_mode mode = (enum machine_mode) va_arg (p, int); + int unsigned_p = 0; /* We cannot convert the arg value to the mode the library wants here; must do it earlier where we know the signedness of the arg. */ *** emit_library_call_value_1 (int retval, r *** 3531,3539 val = force_operand (XEXP (slot, 0), NULL_RTX); } ! argvec[count].value = val; argvec[count].mode = mode; ! argvec[count].reg = targetm.calls.function_arg (args_so_far, mode, NULL_TREE, true); --- 3532,3540 val = force_operand (XEXP (slot, 0), NULL_RTX); } ! mode = promote_function_mode (NULL_TREE, mode, unsigned_p, NULL_TREE, 0); argvec[count].mode = mode; ! argvec[count].value = convert_modes (mode, GET_MODE (val), val, 0); argvec[count].reg = targetm.calls.function_arg (args_so_far, mode, NULL_TREE, true); Index: gcc/config/s390/s390.c === *** gcc/config/s390/s390.c.orig --- gcc/config/s390/s390.c *** s390_promote_function_mode (const_tree t *** 8742,8748 if (INTEGRAL_MODE_P (mode) GET_MODE_SIZE (mode) UNITS_PER_LONG) { ! if (POINTER_TYPE_P (type)) *punsignedp = POINTERS_EXTEND_UNSIGNED; return Pmode; } --- 8742,8748 if (INTEGRAL_MODE_P (mode) GET_MODE_SIZE (mode) UNITS_PER_LONG) { ! if (type != NULL_TREE POINTER_TYPE_P (type)) *punsignedp = POINTERS_EXTEND_UNSIGNED; return Pmode; } Index: gcc/explow.c === *** gcc/explow.c.orig --- gcc/explow.c *** enum machine_mode *** 771,776 --- 771,787 promote_function_mode (const_tree type, enum machine_mode mode, int *punsignedp, const_tree funtype, int for_return) { + /* Called without a type node for a libcall. */ + if (type == NULL_TREE) + { + if (INTEGRAL_MODE_P (mode)) + return targetm.calls.promote_function_mode (NULL_TREE, mode, + punsignedp, funtype, + for_return); + else + return mode; + } + switch (TREE_CODE (type)) { case INTEGER_TYPE: case ENUMERAL_TYPE: case BOOLEAN_TYPE: *** enum machine_mode *** 791,796 --- 802,813 promote_mode (const_tree type ATTRIBUTE_UNUSED, enum machine_mode mode, int *punsignedp ATTRIBUTE_UNUSED) { + /* For libcalls this is invoked without TYPE from the backends + TARGET_PROMOTE_FUNCTION_MODE hooks. Don't do anything in that + case. */ + if (type == NULL_TREE) + return mode; + This broke bootstrap /space/rguenther/src/svn/trunk/gcc/explow.c: In function 'promote_mode': /space/rguenther/src/svn/trunk/gcc/explow.c:815:3: error: ISO C90 forbids mixed declarations and code [-Werror=edantic] cc1: all warnings being treated as errors /* FIXME: this is the same logic that was there until GCC 4.4, but we probably want to test POINTERS_EXTEND_UNSIGNED even if PROMOTE_MODE is not defined. The affected targets are M32C, S390, SPARC. */ Index: gcc/config/sparc/sparc.c === *** gcc/config/sparc/sparc.c.orig --- gcc/config/sparc/sparc.c *** init_cumulative_args (struct sparc_args *** 4965,4977
Recognize -Ofast like -ffast-math for crtfastmath.o
Hi, -Ofast is intended to be -O3 plus -ffast-math. For the compiler proper this works, but under -ffast-math we add crtfastmath.o (or some equivalent) to the link command line on some targets. As usual for our specs this uses matching on command line arguments, hence we'll explicitely have to add Ofast. All these targets use the same idiom, so I hope it's okay if I'm testing only x86_64-linux (regstrapping in progress there). CCed the respective target maintainers. I wouldn't have anything against a global reviewer just acking the whole thing :) Ciao, Michael. * config/alpha/elf.h (ENDFILE_SPEC): Add Ofast. * config/alpha/osf5.h (ENDFILE_SPEC): Add Ofast. * config/alpha/netbsd.h (ENDFILE_SPEC): Add Ofast. * config/sparc/linux.h (ENDFILE_SPEC): Add Ofast. * config/sparc/sp64-elf.h (ENDFILE_SPEC): Add Ofast. * config/sparc/sp-elf.h (ENDFILE_SPEC): Add Ofast. * config/sparc/linux64.h (ENDFILE_SPEC): Add Ofast. * config/sparc/freebsd.h (ENDFILE_SPEC): Add Ofast. * config/sparc/sol2.h (ENDFILE_SPEC): Add Ofast. * config/i386/cygwin.h (ENDFILE_SPEC): Add Ofast. * config/i386/gnu-user.h (ENDFILE_SPEC): Add Ofast. * config/i386/gnu-user64.h (ENDFILE_SPEC): Add Ofast. * config/i386/darwin.h (ENDFILE_SPEC): Add Ofast. * config/i386/mingw32.h (ENDFILE_SPEC): Add Ofast. * config/ia64/linux.h (ENDFILE_SPEC): Add Ofast. * config/mips/linux.h (ENDFILE_SPEC): Add Ofast. Index: config/alpha/elf.h === --- config/alpha/elf.h (revision 173309) +++ config/alpha/elf.h (working copy) @@ -397,7 +397,7 @@ do { \ #undef ENDFILE_SPEC #define ENDFILE_SPEC \ - %{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ + %{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s /* Select a format to encode pointers in exception handling data. CODE Index: config/alpha/osf5.h === --- config/alpha/osf5.h (revision 173309) +++ config/alpha/osf5.h (working copy) @@ -102,7 +102,7 @@ along with GCC; see the file COPYING3. %{!shared:%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}} #define ENDFILE_SPEC \ - %{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} + %{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} #define MD_STARTFILE_PREFIX /usr/lib/cmplrs/cc/ Index: config/alpha/netbsd.h === --- config/alpha/netbsd.h (revision 173309) +++ config/alpha/netbsd.h (working copy) @@ -70,7 +70,7 @@ along with GCC; see the file COPYING3. #undef ENDFILE_SPEC #define ENDFILE_SPEC \ - %{ffast-math|funsafe-math-optimizations:crtfm%O%s} \ + %{Ofast|ffast-math|funsafe-math-optimizations:crtfm%O%s} \ %(netbsd_endfile_spec) Index: config/sparc/linux.h === --- config/sparc/linux.h(revision 173309) +++ config/sparc/linux.h(working copy) @@ -37,7 +37,7 @@ along with GCC; see the file COPYING3. #undef ENDFILE_SPEC #define ENDFILE_SPEC \ %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s\ - %{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} + %{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} /* This is for -profile to use -lc_p instead of -lc. */ #undef CC1_SPEC Index: config/sparc/sp64-elf.h === --- config/sparc/sp64-elf.h (revision 173309) +++ config/sparc/sp64-elf.h (working copy) @@ -60,7 +60,7 @@ crtbegin.o%s \ #undef ENDFILE_SPEC #define ENDFILE_SPEC \ - %{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ + %{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ crtend.o%s /* Use the default (for now). */ Index: config/sparc/sp-elf.h === --- config/sparc/sp-elf.h (revision 173309) +++ config/sparc/sp-elf.h (working copy) @@ -35,7 +35,7 @@ along with GCC; see the file COPYING3. #undef ENDFILE_SPEC #define ENDFILE_SPEC \ - %{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ + %{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ crtend.o%s crtn.o%s /* Don't set the target flags, this is done by the linker script */ Index: config/sparc/linux64.h === --- config/sparc/linux64.h (revision 173309) +++ config/sparc/linux64.h (working copy) @@ -59,7 +59,7 @@ along with GCC; see the file COPYING3. #undef ENDFILE_SPEC #define ENDFILE_SPEC \ %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s\ -
Re: [PATCH] Fix PR46399 - missing mode promotion for libcall args - updated
On 04/18/2011 10:26 AM, Andreas Krebbel wrote: If it is not for ABI differences anymore what's the reason for handling libcalls differently from normal calls anymore? Couldn't we get rid of all the special handling and deal with them like normal calls? That would be desirable IMO. Bernd
Re: [PATCH][C] Avoid passing NULL to build_int_cst
On Wed, 4 May 2011, Richard Guenther wrote: 2011-05-04 Richard Guenther rguent...@suse.de * c-decl.c (check_bitfield_type_and_width): Do not pass NULL to build_int_cst. * c-typeck.c (really_start_incremental_init): Use bitsize_int for constructor indices. (push_init_level): Likewise. c-family/ * c-common.c (fix_string_type): Use size_int for index type bounds. (start_fname_decls): Do not pass NULL to build_int_cst. (c_init_attributes): Likewise. * c-lex.c (c_lex_with_flags): Likewise. OK. -- Joseph S. Myers jos...@codesourcery.com
Re: Recognize -Ofast like -ffast-math for crtfastmath.o
Hi Michael, -Ofast is intended to be -O3 plus -ffast-math. For the compiler proper this works, but under -ffast-math we add crtfastmath.o (or some equivalent) to the link command line on some targets. As usual for our specs this uses matching on command line arguments, hence we'll explicitely have to add Ofast. All these targets use the same idiom, so I hope it's okay if I'm testing only x86_64-linux (regstrapping in progress there). CCed the respective target maintainers. I wouldn't have anything against a global reviewer just acking the whole thing :) I had noticed that duplication before. Rather than continue down that road, I'd rather have us introduce a new spec for this issue. Thanks. Rainer -- - Rainer Orth, Center for Biotechnology, Bielefeld University
Re: [google]: initialize language field for clone function struct
And I'm not sure you can't do SAVE_EXPRs outside of functions - you could simply emit global temporaries. How do you initialize global temporaries with non-trivial initializers? -- Eric Botcazou
Re: [PATCH] Cleanup expand_shift
2011-05-03 Richard Guenther rguent...@suse.de * expmed.c (expand_variable_shift): Rename to ... (expand_shift_1): ... this. Take an expanded shift amount. For rotates recurse directly not building trees for the shift amount. (expand_variable_shift): Wrap around expand_shift_1. (expand_shift): Adjust. Looks OK on principle, but... --- 2140,2161 code below. */ rtx subtarget = target == shifted ? 0 : target; ! rtx new_amount, other_amount; rtx temp1; ! ! new_amount = amount; other_amount ! = simplify_gen_binary (MINUS, GET_MODE (amount), !GEN_INT (GET_MODE_BITSIZE (mode)), !amount); ... why going back to AMOUNT? The old code uses OP1, which can be different from AMOUNT if SHIFT_COUNT_TRUNCATED is nonzero. -- Eric Botcazou
Re: [google] Check if the nonnull attribute is applied to 'this' (issue4446070)
On 05/04/2011 05:08 AM, Richard Guenther wrote: On Tue, May 3, 2011 at 10:10 PM,jason.merr...@gmail.com wrote: As I commented on the -Wnonnull patch, rather than complain about people getting the argument number wrong we should ignore 'this' (and other artificial parms) for attribute argument numbers. I don't think we can reasonably change that now for existing attributes ... Ah, no, I suppose not. Jason
Re: [PATCH] Cleanup expand_shift
On Wed, 4 May 2011, Eric Botcazou wrote: 2011-05-03 Richard Guenther rguent...@suse.de * expmed.c (expand_variable_shift): Rename to ... (expand_shift_1): ... this. Take an expanded shift amount. For rotates recurse directly not building trees for the shift amount. (expand_variable_shift): Wrap around expand_shift_1. (expand_shift): Adjust. Looks OK on principle, but... --- 2140,2161 code below. */ rtx subtarget = target == shifted ? 0 : target; ! rtx new_amount, other_amount; rtx temp1; ! ! new_amount = amount; other_amount ! = simplify_gen_binary (MINUS, GET_MODE (amount), ! GEN_INT (GET_MODE_BITSIZE (mode)), ! amount); ... why going back to AMOUNT? The old code uses OP1, which can be different from AMOUNT if SHIFT_COUNT_TRUNCATED is nonzero. I think I did it that way because the old code tried to re-construct the type of the original amount. I can surely simply use op1 here if that is preferred. Btw, do you happen to know any target that would excercise this code choosing from x86, ppc, s390 and ia64? Thanks, Richard.
Go patch committed: Use backend interface for named types
This patch to the Go frontend uses the backend interface for named types, and also array type. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline. Ian 2011-05-04 Ian Lance Taylor i...@google.com * go-gcc.cc (Gcc_backend::struct_type): Call fill_in_struct. (Gcc_backend::fill_in_struct): New function. (Gcc_backend::array_type): Implement. (Gcc_backend::fill_in_array): New function. (Gcc_backend::placeholder_pointer_type): New function. (Gcc_backend::set_placeholder_pointer_type): New function. (Gcc_backend::set_placeholder_function_type): New function. (Gcc_backend::placeholder_struct_type): New function. (Gcc_backend::set_placeholder_struct_type): New function. (Gcc_backend::placeholder_array_type): New function. (Gcc_backend::set_placeholder_array_type): New function. (Gcc_backend::named_type): New function. (Gcc_backend::circular_pointer_type): New function. (Gcc_backend::is_circular_pointer_type): New function. Index: gcc/go/go-gcc.cc === --- gcc/go/go-gcc.cc (revision 173004) +++ gcc/go/go-gcc.cc (working copy) @@ -161,8 +161,38 @@ class Gcc_backend : public Backend struct_type(const std::vectorBtyped_identifier); Btype* - array_type(const Btype* /* element_type */, const Bexpression* /* length */) - { gcc_unreachable(); } + array_type(Btype*, Bexpression*); + + Btype* + placeholder_pointer_type(const std::string, source_location, bool); + + bool + set_placeholder_pointer_type(Btype*, Btype*); + + bool + set_placeholder_function_type(Btype*, Btype*); + + Btype* + placeholder_struct_type(const std::string, source_location); + + bool + set_placeholder_struct_type(Btype* placeholder, + const std::vectorBtyped_identifier); + + Btype* + placeholder_array_type(const std::string, source_location); + + bool + set_placeholder_array_type(Btype*, Btype*, Bexpression*); + + Btype* + named_type(const std::string, Btype*, source_location); + + Btype* + circular_pointer_type(Btype*, bool); + + bool + is_circular_pointer_type(Btype*); // Statements. @@ -270,6 +300,12 @@ class Gcc_backend : public Backend Btype* make_type(tree t) { return new Btype(t); } + + Btype* + fill_in_struct(Btype*, const std::vectorBtyped_identifier); + + Btype* + fill_in_array(Btype*, Btype*, Bexpression*); }; // A helper function. @@ -453,7 +489,16 @@ Gcc_backend::function_type(const Btyped_ Btype* Gcc_backend::struct_type(const std::vectorBtyped_identifier fields) { - tree ret = make_node(RECORD_TYPE); + return this-fill_in_struct(this-make_type(make_node(RECORD_TYPE)), fields); +} + +// Fill in the fields of a struct type. + +Btype* +Gcc_backend::fill_in_struct(Btype* fill, + const std::vectorBtyped_identifier fields) +{ + tree fill_tree = fill-get_tree(); tree field_trees = NULL_TREE; tree* pp = field_trees; for (std::vectorBtyped_identifier::const_iterator p = fields.begin(); @@ -465,15 +510,192 @@ Gcc_backend::struct_type(const std::vect if (type_tree == error_mark_node) return this-error_type(); tree field = build_decl(p-location, FIELD_DECL, name_tree, type_tree); - DECL_CONTEXT(field) = ret; + DECL_CONTEXT(field) = fill_tree; *pp = field; pp = DECL_CHAIN(field); } - TYPE_FIELDS(ret) = field_trees; - layout_type(ret); + TYPE_FIELDS(fill_tree) = field_trees; + layout_type(fill_tree); + return fill; +} + +// Make an array type. + +Btype* +Gcc_backend::array_type(Btype* element_btype, Bexpression* length) +{ + return this-fill_in_array(this-make_type(make_node(ARRAY_TYPE)), + element_btype, length); +} + +// Fill in an array type. + +Btype* +Gcc_backend::fill_in_array(Btype* fill, Btype* element_type, + Bexpression* length) +{ + tree element_type_tree = element_type-get_tree(); + tree length_tree = length-get_tree(); + if (element_type_tree == error_mark_node || length_tree == error_mark_node) +return this-error_type(); + + gcc_assert(TYPE_SIZE(element_type_tree) != NULL_TREE); + + length_tree = fold_convert(sizetype, length_tree); + + // build_index_type takes the maximum index, which is one less than + // the length. + tree index_type_tree = build_index_type(fold_build2(MINUS_EXPR, sizetype, + length_tree, + size_one_node)); + + tree fill_tree = fill-get_tree(); + TREE_TYPE(fill_tree) = element_type_tree; + TYPE_DOMAIN(fill_tree) = index_type_tree; + TYPE_ADDR_SPACE(fill_tree) = TYPE_ADDR_SPACE(element_type_tree); + layout_type(fill_tree); + + if (TYPE_STRUCTURAL_EQUALITY_P(element_type_tree)) +SET_TYPE_STRUCTURAL_EQUALITY(fill_tree); + else if (TYPE_CANONICAL(element_type_tree) != element_type_tree + || TYPE_CANONICAL(index_type_tree) != index_type_tree) +TYPE_CANONICAL(fill_tree) = +
Re: C++ PATCHes relating to c++/48834, c++/40975 (array new)
On 05/04/2011 04:12 AM, Eric Botcazou wrote: Well, let's look at the users of copy_tree_r. cp/tree.c (bot_manip): The case I want to fix. Then I'd put the fix there. The old behaviour of copy_tree_r is IMO the most sensible one and its callers should cope, as almost all already do it seems. Well, I disagree. STATEMENT_LISTs are just another kind of thing you encounter in an expression; if a caller wants special handling, they can arrange for it. This is how things used to work before, but it broke when the tree-ssa merge switched from using TREE_CHAIN on statements to a separate STATEMENT_LIST. Jason
Re: [google]: initialize language field for clone function struct
On Wed, May 4, 2011 at 5:10 PM, Eric Botcazou ebotca...@adacore.com wrote: And I'm not sure you can't do SAVE_EXPRs outside of functions - you could simply emit global temporaries. How do you initialize global temporaries with non-trivial initializers? Actually it turns out that it doesn't matter. If we arrive here with something that needs a SAVE_EXPR we have to be able to generate code for it somewhere, where there would be obviously the possibility to also generate code for a SAVE_EXPR. No? Richard. -- Eric Botcazou
Re: [PATCH] Cleanup expand_shift
I think I did it that way because the old code tried to re-construct the type of the original amount. I can surely simply use op1 here if that is preferred. Right, but it used the value of OP1 so I think the new code should as well. Btw, do you happen to know any target that would excercise this code choosing from x86, ppc, s390 and ia64? All have rotate instructions so this seems to be a wash. -- Eric Botcazou
Don't use pending_sizes list for C
Following recent discussions of variable_size, this patch stops the C front end from using the global pending_sizes list, instead using the existing grokdeclarator support for tracking size expressions in the one case where pending sizes were still needed. c_variable_size is replaced by a call to save_expr. It way well be possible after this patch to eliminate the pending_sizes list and associated functions and the dont_save_pending_sizes_p field, but I don't plan to work on that. Bootstrapped with no regressions on x86_64-unknown-linux-gnu. Are the ObjC changes OK to commit? 2011-05-04 Joseph Myers jos...@codesourcery.com * c-decl.c (finish_decl): Don't call get_pending_sizes. (grokparm): Add parameter expr. Pass it to grokdeclarator. (push_parm_decl): Add parameter expr. Pass it to grokdeclarator. (c_variable_size): Remove. (grokdeclarator): Use save_expr instead of c_variable_size. Don't call put_pending_sizes. (get_parm_info): Add parameter expr. Use it to set arg_info-pending_sizes. (store_parm_decls): Use arg_info-pending_sizes instead or calling get_pending_sizes. * c-parser.c (c_parser_parms_declarator): Update call to c_parser_parms_list_declarator. (c_parser_parms_list_declarator): Take parameter expr. Update call to push_parm_decl. Update recursive call. Don't call get_pending_sizes. Update calls to get_parm_info. (c_parser_objc_method_definition): Update calls to c_parser_objc_method_decl and objc_start_method_definition. (c_parser_objc_methodproto): Update call to c_parser_objc_method_decl. (c_parser_objc_method_decl): Add parameter expr. Update call to grokparm. (c_parser_objc_try_catch_finally_statement): Update call to grokparm. * c-tree.h (struct c_arg_info.pending_sizes): Change to a tree. (get_parm_info, grokparm, push_parm_decl): Update prototypes. c-family: 2011-05-04 Joseph Myers jos...@codesourcery.com * c-objc.h (objc_start_method_definition): Update prototype. * stub-objc.c (objc_start_method_definition): Add extra parameter. cp: 2011-05-04 Joseph Myers jos...@codesourcery.com * parser.c (cp_parser_objc_method_definition_list): Update call to objc_start_method_definition. objc: 2011-05-04 Joseph Myers jos...@codesourcery.com * objc-act.c (objc_start_method_definition): Add parameter expr. Update call to start_method_def. (objc_generate_cxx_ctor_or_dtor, objc_synthesize_getter, objc_synthesize_setter) Update calls to objc_start_method_definition. (objc_get_parm_info): Add parameter expr. Update call to get_parm_info. (start_method_def): Add parameter expr. Update call to objc_get_parm_info. * objc-gnu-runtime-abi-01.c (build_module_initializer_routine): Update call to objc_get_parm_info. * objc-runtime-shared-support.h (objc_get_parm_info): Add extra parameter. Index: c-family/c-objc.h === --- c-family/c-objc.h (revision 173345) +++ c-family/c-objc.h (working copy) @@ -1,6 +1,6 @@ /* Definitions of Objective-C front-end entry points used for C and C++. Copyright (C) 1987, 1993, 1994, 1995, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. This file is part of GCC. @@ -75,7 +75,7 @@ extern void objc_finish_implementation ( extern void objc_set_visibility (objc_ivar_visibility_kind); extern tree objc_build_method_signature (bool, tree, tree, tree, bool); extern void objc_add_method_declaration (bool, tree, tree); -extern bool objc_start_method_definition (bool, tree, tree); +extern bool objc_start_method_definition (bool, tree, tree, tree); extern void objc_finish_method_definition (tree); extern void objc_add_instance_variable (tree); extern tree objc_build_keyword_decl (tree, tree, tree, tree); Index: c-family/stub-objc.c === --- c-family/stub-objc.c(revision 173345) +++ c-family/stub-objc.c(working copy) @@ -2,7 +2,7 @@ that are called from within the C and C++ front-ends, respectively. Copyright (C) 1991, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, - 2004, 2005, 2007, 2009, 2010 Free Software Foundation, Inc. + 2004, 2005, 2007, 2009, 2010, 2011 Free Software Foundation, Inc. This file is part of GCC. @@ -204,7 +204,8 @@ objc_add_method_declaration (bool ARG_UN bool objc_start_method_definition (bool ARG_UNUSED (is_class_method), tree ARG_UNUSED (signature), - tree ARG_UNUSED (attributes)) + tree ARG_UNUSED
Re: [Patch, Fortran+gcc/doc/invoke.texi] PR48864: -Ofast implies -fno-protect parens
Hi Tobias, As the example in the PR shows, using -fno-protect parens can make a huge difference. As -fno-protect is in the spirit of -Ofast, enable it with that option. Build on x86-64-linux. OK for the trunk? OK. Out of curiosity: Why do you do gfc_option.flag_protect_parens = optimize_fast ? 0 : 1; instead of gfc_option.flag_protect_parens = optimize_fast; ? Thanks for the patch! Thomas
[PATCH] don't use TYPE_ARG_TYPES in c-family/
As $SUBJECT suggests. The patch is somewhat larger than it needs to be due to reindenting c-common.c:check_main_parameter_types. Tested on x86_64-unknown-linux. OK to commit? -Nathan gcc/c-family/ * c-common.c (check_main_parameter_types): Reindent. Don't use TYPE_ARG_TYPES directly. (handle_nonnull_attribute): Likewise. (sync_resolve_params): Likewise. * c-format.c (handle_format_arg_attribute): Likewise. Adjust call to check_format_string. (handle_format_attribute): Likewise. (check_format_string): Take a function type to examine instead of a type list. Use a function_arg_iterator to step through argument types. diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 802040d..ca65d19 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -1662,45 +1662,44 @@ strict_aliasing_warning (tree otype, tree type, tree expr) void check_main_parameter_types (tree decl) { - tree args; + function_args_iterator iter; + tree type; int argct = 0; - for (args = TYPE_ARG_TYPES (TREE_TYPE (decl)); args; - args = TREE_CHAIN (args)) - { - tree type = args ? TREE_VALUE (args) : 0; - - if (type == void_type_node || type == error_mark_node ) - break; - - ++argct; - switch (argct) - { - case 1: - if (TYPE_MAIN_VARIANT (type) != integer_type_node) - pedwarn (input_location, OPT_Wmain, first argument of %q+D should be %int%, - decl); - break; - - case 2: - if (TREE_CODE (type) != POINTER_TYPE - || TREE_CODE (TREE_TYPE (type)) != POINTER_TYPE - || (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (type))) - != char_type_node)) - pedwarn (input_location, OPT_Wmain, second argument of %q+D should be %char **%, - decl); - break; - - case 3: - if (TREE_CODE (type) != POINTER_TYPE - || TREE_CODE (TREE_TYPE (type)) != POINTER_TYPE - || (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (type))) - != char_type_node)) - pedwarn (input_location, OPT_Wmain, third argument of %q+D should probably be - %char **%, decl); - break; - } - } + FOREACH_FUNCTION_ARGS (TREE_TYPE (decl), type, iter) +{ + /* XXX void_type_node belies the abstraction. */ + if (type == void_type_node || type == error_mark_node ) + break; + + ++argct; + switch (argct) + { + case 1: + if (TYPE_MAIN_VARIANT (type) != integer_type_node) + pedwarn (input_location, OPT_Wmain, first argument of %q+D should be %int%, +decl); + break; + + case 2: + if (TREE_CODE (type) != POINTER_TYPE + || TREE_CODE (TREE_TYPE (type)) != POINTER_TYPE + || (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (type))) + != char_type_node)) + pedwarn (input_location, OPT_Wmain, second argument of %q+D should be %char **%, +decl); + break; + + case 3: + if (TREE_CODE (type) != POINTER_TYPE + || TREE_CODE (TREE_TYPE (type)) != POINTER_TYPE + || (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (type))) + != char_type_node)) + pedwarn (input_location, OPT_Wmain, third argument of %q+D should probably be +%char **%, decl); + break; + } +} /* It is intentional that this message does not mention the third argument because it's only mentioned in an appendix of the @@ -7394,7 +7393,6 @@ handle_nonnull_attribute (tree *node, tree ARG_UNUSED (name), a pointer argument. */ for (attr_arg_num = 1; args; args = TREE_CHAIN (args)) { - tree argument; unsigned HOST_WIDE_INT arg_num = 0, ck_num; if (!get_nonnull_operand (TREE_VALUE (args), arg_num)) @@ -7405,18 +7403,21 @@ handle_nonnull_attribute (tree *node, tree ARG_UNUSED (name), return NULL_TREE; } - argument = TYPE_ARG_TYPES (type); - if (argument) + if (prototype_p (type)) { - for (ck_num = 1; ; ck_num++) + function_args_iterator iter; + tree argument; + + function_args_iter_init (iter, type); + for (ck_num = 1; ; ck_num++, function_args_iter_next (iter)) { - if (!argument || ck_num == arg_num) + argument = function_args_iter_cond (iter); + if (argument == NULL_TREE || ck_num == arg_num) break; - argument = TREE_CHAIN (argument); } if (!argument - || TREE_CODE (TREE_VALUE (argument)) == VOID_TYPE) + || TREE_CODE (argument) == VOID_TYPE) { error (nonnull argument with out-of-range operand number (argument %lu, operand %lu),
Re: [PATCH] don't use TYPE_ARG_TYPES in c-family/
On Wed, 4 May 2011, Nathan Froyd wrote: As $SUBJECT suggests. The patch is somewhat larger than it needs to be due to reindenting c-common.c:check_main_parameter_types. Tested on x86_64-unknown-linux. OK to commit? Since you're reindenting you should also wrap the pedwarn calls in the reindented code so they don't go over 80 columns, i.e. move the string to the next line. OK with that change. -- Joseph S. Myers jos...@codesourcery.com
Re: [Patch, Fortran+gcc/doc/invoke.texi] PR48864: -Ofast implies -fno-protect parens
On 05/04/2011 06:43 PM, Thomas Koenig wrote: Out of curiosity: Why do you do gfc_option.flag_protect_parens = optimize_fast ? 0 : 1; instead of gfc_option.flag_protect_parens = optimize_fast; I found it more clearer than = !optimize_fast (note the !), but that's seemingly not the case. I thus changed it to the latter. Committed as Rev. 173385. Thanks for the review! Tobias
Re: [google]: initialize language field for clone function struct
Actually it turns out that it doesn't matter. If we arrive here with something that needs a SAVE_EXPR we have to be able to generate code for it somewhere, where there would be obviously the possibility to also generate code for a SAVE_EXPR. The transformations done in fold are optimizations that duplicate things, hence the need to protect them from multiple evaluations. If you cannot easily do so (e.g. at global level), you just don't do the optimizations. But, yes, there is something true. If you have variable sizes at the global level, they need to be evaluated once for all (unless self-referential, but this is another subject) so you need to do it somewhere. But you cannot do it with SAVE_EXPRs since they would end up being shared across functions. -- Eric Botcazou
[obv] remove gfc_chainon_list
As promised in http://gcc.gnu.org/ml/gcc-patches/2011-05/msg00211.html . Tested by building f951. Committed as r173386. -Nathan gcc/fortran/ * trans.h (gfc_chainon_list): Delete. * trans.c (gfc_chainon_list): Delete. Index: gcc/fortran/ChangeLog === Index: gcc/fortran/trans.c === --- gcc/fortran/trans.c (revision 173382) +++ gcc/fortran/trans.c (working copy) @@ -63,19 +63,6 @@ gfc_advance_chain (tree t, int n) } -/* Wrap a node in a TREE_LIST node and add it to the end of a list. */ - -tree -gfc_chainon_list (tree list, tree add) -{ - tree l; - - l = tree_cons (NULL_TREE, add, NULL_TREE); - - return chainon (list, l); -} - - /* Strip off a legitimate source ending from the input string NAME of length LEN. */ Index: gcc/fortran/trans.h === --- gcc/fortran/trans.h (revision 173382) +++ gcc/fortran/trans.h (working copy) @@ -319,9 +319,6 @@ void gfc_conv_string_parameter (gfc_se * /* Compare two strings. */ tree gfc_build_compare_string (tree, tree, tree, tree, int, enum tree_code); -/* Add an item to the end of TREE_LIST. */ -tree gfc_chainon_list (tree, tree); - /* When using the gfc_conv_* make sure you understand what they do, i.e. when a POST chain may be created, and what the returned expression may be used for. Note that character strings have special handling. This
Re: [google]: initialize language field for clone function struct
Joseph I don't know if Fortran, Java or Go use variable-size types at Joseph all. Java doesn't have variable-size types. AFAIK, gcj does not generate them internally for anything, either. Tom
Re: [PATCH, powerpc], Fix PR48857, pass/return V2DI as other vector types
On Wed, 2011-05-04 at 11:33 +0200, Richard Guenther wrote: On Wed, May 4, 2011 at 4:51 AM, David Edelsohn dje@gmail.com wrote: On Tue, May 3, 2011 at 5:27 PM, Michael Meissner meiss...@linux.vnet.ibm.com wrote: This patch fixes that so that V2DImode values are passed and returned like other vector types. [snip] What does this do to the ABI? Haven't we now broken the ABI and broken backwards compatibility? It at least looks like so. You need to add appropriate changes.html entries to all branches you apply this patch to. I suppose the new version matches what XLC does? Yes, XLC passes V2DI parameters and return values in Altivec registers as per the ABI, so we're the buggy ones. Peter
Re: [SPARC] Hookize PRINT_OPERAND, PRINT_OPERAND_ADDRESS and PRINT_OPERAND_PUNCT_VALID_P
Hi Anatoly, Sorry for my mistake. I think that the patch is obvious, but I have no capability to test it. * config/sparc/sol.h (ASM_OUTPUT_CALL): Use print_operand target hook. Index: gcc/config/sparc/sol2.h === --- gcc/config/sparc/sol2.h (revision 173212) +++ gcc/config/sparc/sol2.h (working copy) @@ -172,7 +172,7 @@ do \ { \ fprintf (FILE, \tcall\t); \ - print_operand (FILE, XEXP (DECL_RTL (FN), 0), 0);\ + targetm.asm_out.print_operand (FILE, XEXP (DECL_RTL (FN), 0), 0); \ fprintf (FILE, \n\tnop\n); \ } \ while (0) I thought so, too, but you also need to include target.h in config/sol2.c. I'm currently testing such a patch; will commit tomorrow if bootstrap passes. You could at least test it by cross-building cc1 for sparc-sun-solaris2.10, which failed to link. Rainer -- - Rainer Orth, Center for Biotechnology, Bielefeld University
Re: [RFC PATCH] Typed DWARF stack
Should DW_OP_bra be restricted to integral types? Several other opcodes are restricted in this way, and it seems like an oversight to me that DW_OP_bra is lacking this restriction. (I've added this restriction in GDB.) Yes, that was an oversight. Currently, the comparison operators are all defined as performing signed operations. So, what should happen in this case: DW_OP_lit0 DW_OP_GNU_convert unsigned int DW_OP_GNU_const_type unsigned int -1 DW_OP_gt That is, should this ignore the type (perhaps just using the type width), or is this a bug in the spec? Either answer here has problems. You can't really ignore the type, because that rules out floating point comparisons. I suppose you could special-case integral types. However, since ordinary (that is, pre-typed-DWARF) DWARF values do not have a consistent type, I think answering bug means having a special case for such values -- because they are treated as unsigned in most places, but signed in a few, and signed/unsigned type conversion should presumably only be done for such typeless values, not all values. I think I will implement the latter (bug) approach. Yes, another oversight; I should have removed the sentence The comparisons are done as signed operations. For untyped values, it should be reasonable to treat them as signed integers here as you propose. Technically, there weren't supposed to be untyped values at all in this proposal; I should have also gone through and specified an explicit type for each of the legacy operators that push a value onto the stack, but signed-vs-unsigned is such a mess that I didn't bother to go that far for a draft proposal that didn't get very far in committee. I think a signed/unsigned cleanup in DWARF would have to go far beyond the expression evaluation mechanism. -cary
Re: [PATCH 2/4] Docs: extend.texi: Remove trailing blanks from lines
On May 4, 2011, at 3:08 AM, Joseph S. Myers wrote: On Tue, 3 May 2011, Gerald Pfeifer wrote: On Wed, 27 Apr 2011, Michael Witten wrote: sed -i s/[ $(printf '\t')]\{1,\}\$// trunk/gcc/doc/extend.texi I believe we usually don't do whitespace changes just for the sake of cleaning up things. Unless someone else indicates otherwise, I believe this patch is rejected. I think we *should* make such formatting cleanups (not just trailing whitespace removal, but other changes to match formatting conventions, including fixing leading whitespace in C code to use tabs where it doesn't as well as more visible changes) gcc had that policy for years and years. To return to that, we just need a maintainer to approve or pre-approve these changes. :-) Then, buy some popcorn and watch the fight (if any).
Re: [PATCH 2/4] Docs: extend.texi: Remove trailing blanks from lines
On Wed, 4 May 2011, Joseph S. Myers wrote: I believe we usually don't do whitespace changes just for the sake of cleaning up things. Unless someone else indicates otherwise, I believe this patch is rejected. I think we *should* make such formatting cleanups (not just trailing whitespace removal, but other changes to match formatting conventions, including fixing leading whitespace in C code to use tabs where it doesn't as well as more visible changes) - as long as we are agreed on what the convention is to follow Joseph, if you'd like to approave Michael's patch, I explicitly non-object. On Wed, 4 May 2011, Mike Stump wrote: gcc had that policy for years and years. To return to that, we just need a maintainer to approve or pre-approve these changes. :-) Documentation may be a bit more relaxed, and if you have one doc maintainer approve and the other abstain that may be more boring that you might hope for. :-) Unless others strongly disagree, of course, still got respective area maintainers and global reviewers. Gerald
Re: [PR debug/47590] rework md option overriding to delay var-tracking
On 04/02/2011 10:15 AM, Alexandre Oliva wrote: 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? @@ -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. */ This comment looks very weird when added to ia64_option_override (likewise for other targets). Is there a reason it's not true anymore? Bernd
Re: [PATCH 2/4] Docs: extend.texi: Remove trailing blanks from lines
On Wed, 4 May 2011, Gerald Pfeifer wrote: On Wed, 4 May 2011, Joseph S. Myers wrote: I believe we usually don't do whitespace changes just for the sake of cleaning up things. Unless someone else indicates otherwise, I believe this patch is rejected. I think we *should* make such formatting cleanups (not just trailing whitespace removal, but other changes to match formatting conventions, including fixing leading whitespace in C code to use tabs where it doesn't as well as more visible changes) - as long as we are agreed on what the convention is to follow Joseph, if you'd like to approave Michael's patch, I explicitly non-object. I explicitly approve trailing whitespace removal from all .texi files and other documentation not imported from upstream sources outside of GCC (subject to handling generated files properly, so any changes to tm.texi should be done by changing source files such as tm.texi.in and then regenerating tm.texi). -- Joseph S. Myers jos...@codesourcery.com
[PATCH, i386 testsuite]: Cleanup gcc.target/i386/ for AVX targets a bit
Hello! This patch increases/decreases array sizes a bit to prevent loop unrolling and adds appropriate -no-* ABI flags. 2011-05-04 Uros Bizjak ubiz...@gmail.com * gcc.target/i386/recip-vec-divf.c: Decrease array sizes. * gcc.target/i386/recip-vec-sqrtf.c: Ditto. * gcc.target/i386/recip-vec-divf-avx.c: Increase array sizes. * gcc.target/i386/recip-vec-sqrtf-avx.c: Ditto. Update scan times. * gcc.target/i386/ssefn-1.c: Add -mno-sse2 to dg-options. * gcc.target/i386/pr38824.c: Ditto. * gcc.target/i386/vecinit-1.c: Add -mno-sse4 to dg-options. * gcc.target/i386/vecinit-2.c: Ditto. * gcc.target/i386/sse-19.c: Add -mno-ssse3 to dg-options. * gcc.target/i386/parity-1.c: Add -mno-popcnt to dg-options. * gcc.target/i386/parity-2.c: Ditto. * gcc.target/i386/incoming-8.c: Add -mno-avx to dg-options. Tested on x86_64-pc-linux-gnu {,-m32} AVX and non-AVX target, committed to mainline SVN. Uros. Index: recip-vec-divf-avx.c === --- recip-vec-divf-avx.c(revision 173376) +++ recip-vec-divf-avx.c(working copy) @@ -1,15 +1,15 @@ /* { dg-do compile } */ /* { dg-options -O2 -ffast-math -ftree-vectorize -mavx -mtune=generic -mfpmath=sse -mrecip } */ -float a[16]; -float b[16]; -float r[16]; +float a[32]; +float b[32]; +float r[32]; void t1(void) { int i; - for (i = 0; i 16; i++) + for (i = 0; i 32; i++) r[i] = a[i] / b[i]; } Index: ssefn-1.c === --- ssefn-1.c (revision 173376) +++ ssefn-1.c (working copy) @@ -8,7 +8,7 @@ /* { dg-final { scan-assembler-not movsd } } */ /* { dg-final { scan-assembler-not mulsd } } */ /* { dg-skip-if { i?86-*-* x86_64-*-* } { -march=* } { -march=i386 } } */ -/* { dg-options -O2 -march=i386 -msse -mfpmath=sse -fno-inline } */ +/* { dg-options -O2 -march=i386 -msse -mno-sse2 -mfpmath=sse -fno-inline } */ static float xs (void) { Index: parity-1.c === --- parity-1.c (revision 173376) +++ parity-1.c (working copy) @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options -O2 -march=k8 } */ +/* { dg-options -O2 -march=k8 -mno-popcnt } */ /* { dg-final { scan-assembler setnp } } */ int foo(unsigned int x) Index: vecinit-2.c === --- vecinit-2.c (revision 173376) +++ vecinit-2.c (working copy) @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options -O2 -march=k8 -msse2 } */ +/* { dg-options -O2 -march=k8 -msse2 -mno-sse4 } */ #define vector __attribute__((vector_size(16))) Index: sse-19.c === --- sse-19.c(revision 173376) +++ sse-19.c(working copy) @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-skip-if { i?86-*-* x86_64-*-* } { -march=* } { -march=x86-64 } } */ -/* { dg-options -O3 -march=x86-64 -msse2 } */ +/* { dg-options -O3 -march=x86-64 -msse2 -mno-ssse3 } */ /* { dg-final { scan-assembler punpcklbw } } */ extern void abort(); #include emmintrin.h Index: recip-vec-sqrtf.c === --- recip-vec-sqrtf.c (revision 173376) +++ recip-vec-sqrtf.c (working copy) @@ -1,9 +1,9 @@ /* { dg-do compile } */ /* { dg-options -O2 -ffast-math -ftree-vectorize -msse -mfpmath=sse -mrecip } */ -float a[16]; -float b[16]; -float r[16]; +float a[4]; +float b[4]; +float r[4]; extern float sqrtf (float); @@ -11,7 +11,7 @@ { int i; - for (i = 0; i 16; i++) + for (i = 0; i 4; i++) r[i] = a[i] / sqrtf (b[i]); } @@ -19,7 +19,7 @@ { int i; - for (i = 0; i 16; i++) + for (i = 0; i 4; i++) r[i] = sqrtf (a[i] / b[i]); } @@ -27,7 +27,7 @@ { int i; - for (i = 0; i 16; i++) + for (i = 0; i 4; i++) r[i] = sqrtf (a[i]); } Index: vecinit-1.c === --- vecinit-1.c (revision 173376) +++ vecinit-1.c (working copy) @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options -O2 -march=k8 -msse2 } */ +/* { dg-options -O2 -march=k8 -msse2 -mno-sse4 } */ #define vector __attribute__((vector_size(16))) Index: pr38824.c === --- pr38824.c (revision 173376) +++ pr38824.c (working copy) @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options -O2 -msse } */ +/* { dg-options -O2 -msse -mno-sse2 } */ typedef float v4sf __attribute__ ((__vector_size__ (16))); Index: parity-2.c === --- parity-2.c (revision 173376) +++ parity-2.c (working copy) @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options -O2 -march=k8 } */ +/* { dg-options -O2 -march=k8 -mno-popcnt } */ /* { dg-final { scan-assembler setnp } } */ int foo(unsigned long long int
[SPARC] Remove unused macros
Hi. This patch remove some unused macros from sparc.h. The RTX_OK_FOR_OFFSET_P and RTX_OK_FOR_OLO10_P macros is used only in sparc_legitimate_address_p function and moved to sparc.c. Bootstrapped on sparc64-unknown-linux-gnu. OK to install? * config/sparc/sparc.h (REG_OK_FOR_INDEX_P, REG_OK_FOR_BASE_P, SYMBOLIC_CONST, RTX_OK_FOR_BASE_P, RTX_OK_FOR_INDEX_P): Remove. (RTX_OK_FOR_OFFSET_P, RTX_OK_FOR_OLO10_P): Move to... * config/sparc/sparc.c (RTX_OK_FOR_OFFSET_P, RTX_OK_FOR_OLO10_P): ...here. (sparc_mode_dependent_address_p): Use symbolic_operand instead of SYMBOLIC_CONST. Index: gcc/config/sparc/sparc.c === --- gcc/config/sparc/sparc.c(revision 173212) +++ gcc/config/sparc/sparc.c(working copy) @@ -3110,6 +3110,12 @@ return true; } +#define RTX_OK_FOR_OFFSET_P(X) \ + (CONST_INT_P (X) INTVAL (X) = -0x1000 INTVAL (X) 0x1000 - 8) + +#define RTX_OK_FOR_OLO10_P(X) \ + (CONST_INT_P (X) INTVAL (X) = -0x1000 INTVAL (X) 0xc00 - 8) + /* Return nonzero if ADDR is a valid memory address. STRICT specifies whether strict register checking applies. */ @@ -3706,7 +3712,7 @@ rtx op0 = XEXP (addr, 0); rtx op1 = XEXP (addr, 1); if (op0 == pic_offset_table_rtx - SYMBOLIC_CONST (op1)) + symbolic_operand (op1, VOIDmode)) return true; } Index: gcc/config/sparc/sparc.h === --- gcc/config/sparc/sparc.h(revision 173212) +++ gcc/config/sparc/sparc.h(working copy) @@ -1538,41 +1538,6 @@ addresses which require two reload registers. */ #define LEGITIMATE_PIC_OPERAND_P(X) legitimate_pic_operand_p (X) - -/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx - and check its validity for a certain class. - We have two alternate definitions for each of them. - The usual definition accepts all pseudo regs; the other rejects - them unless they have been allocated suitable hard regs. - The symbol REG_OK_STRICT causes the latter definition to be used. - - Most source files want to accept pseudo regs in the hope that - they will get allocated to the class that the insn wants them to be in. - Source files for reload pass need to be strict. - After reload, it makes no difference, since pseudo regs have - been eliminated by then. */ - -#ifndef REG_OK_STRICT - -/* Nonzero if X is a hard reg that can be used as an index - or if it is a pseudo reg. */ -#define REG_OK_FOR_INDEX_P(X) \ - (REGNO (X) 32 \ - || REGNO (X) == FRAME_POINTER_REGNUM\ - || REGNO (X) = FIRST_PSEUDO_REGISTER) - -/* Nonzero if X is a hard reg that can be used as a base reg - or if it is a pseudo reg. */ -#define REG_OK_FOR_BASE_P(X) REG_OK_FOR_INDEX_P (X) - -#else - -/* Nonzero if X is a hard reg that can be used as an index. */ -#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X)) -/* Nonzero if X is a hard reg that can be used as a base reg. */ -#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X)) - -#endif /* Should gcc use [%reg+%lo(xx)+offset] addresses? */ @@ -1582,31 +1547,6 @@ #define USE_AS_OFFSETABLE_LO10 0 #endif -/* On SPARC, the actual legitimate addresses must be REG+REG or REG+SMALLINT - ordinarily. This changes a bit when generating PIC. The details are - in sparc.c's implementation of TARGET_LEGITIMATE_ADDRESS_P. */ - -#define SYMBOLIC_CONST(X) symbolic_operand (X, VOIDmode) - -#define RTX_OK_FOR_BASE_P(X) \ - ((GET_CODE (X) == REG REG_OK_FOR_BASE_P (X)) \ - || (GET_CODE (X) == SUBREG \ - GET_CODE (SUBREG_REG (X)) == REG \ - REG_OK_FOR_BASE_P (SUBREG_REG (X - -#define RTX_OK_FOR_INDEX_P(X) \ - ((GET_CODE (X) == REG REG_OK_FOR_INDEX_P (X)) \ - || (GET_CODE (X) == SUBREG \ - GET_CODE (SUBREG_REG (X)) == REG \ - REG_OK_FOR_INDEX_P (SUBREG_REG (X - -#define RTX_OK_FOR_OFFSET_P(X) \ - (GET_CODE (X) == CONST_INT INTVAL (X) = -0x1000 INTVAL (X) 0x1000 - 8) - -#define RTX_OK_FOR_OLO10_P(X) \ - (GET_CODE (X) == CONST_INT INTVAL (X) = -0x1000 INTVAL (X) 0xc00 - 8) - - /* Try a machine-dependent way of reloading an illegitimate address operand. If we find one, push the reload and jump to WIN. This macro is used in only one place: `find_reloads_address' in reload.c. */ Anatoly.
Remove obsolete compiler settings in toplevel configure
In http://gcc.gnu.org/ml/gcc-patches/2011-04/msg00061.html I noted a couple of bits of code in the toplevel configure.ac that appeared to be doing things that are properly the responsibility of autoconf. This patch removes them. OK to commit? (Along with http://gcc.gnu.org/ml/gcc-patches/2011-05/msg00277.html I think this concludes for now my present series of toplevel configure cleanups, though there is plenty more there for interested people to clean up.) 2011-05-04 Joseph Myers jos...@codesourcery.com * configure.ac: Remove code setting special library locations for hppa*64*-*-hpux11*. Remove code setting compiler for sparc-sun-solaris2*. * configure: Regenerate. Index: configure.ac === --- configure.ac(revision 173360) +++ configure.ac(working copy) @@ -2334,14 +2334,6 @@ esac fi -# hpux11 in 64bit mode has libraries in a weird place. Arrange to find -# them automatically. -case ${host} in - hppa*64*-*-hpux11*) -extra_host_args=$extra_host_args -x-libraries=/usr/lib/pa20_64 -x-includes=/usr/X11R6/include -;; -esac - # Some systems (e.g., one of the i386-aix systems the gas testers are # using) don't handle \$ correctly, so don't use it here. tooldir='${exec_prefix}'/${target_noncanonical} @@ -2385,34 +2377,6 @@ esac rm -f conftest* -# The Solaris /usr/ucb/cc compiler does not appear to work. -case ${host} in - sparc-sun-solaris2*) - CCBASE=`echo ${CC-cc} | sed 's/ .*$//'` - if test `type $CCBASE | sed 's/^[[^/]]*//'` = /usr/ucb/cc ; then - could_use= - test -d /opt/SUNWspro/bin could_use=/opt/SUNWspro/bin - if test -d /opt/cygnus/bin ; then - if test $could_use = ; then - could_use=/opt/cygnus/bin - else - could_use=$could_use or /opt/cygnus/bin - fi - fi -if test $could_use = ; then -echo Warning: compilation may fail because you're using -echo /usr/ucb/cc. You should change your PATH or CC -echo variable and rerun configure. -else -echo Warning: compilation may fail because you're using -echo /usr/ucb/cc, when you should use the C compiler from -echo $could_use. You should change your -echo PATH or CC variable and rerun configure. -fi - fi - ;; -esac - # Decide which environment variable is used to find dynamic libraries. case ${host} in *-*-hpux*) RPATH_ENVVAR=SHLIB_PATH ;; -- Joseph S. Myers jos...@codesourcery.com
[google/main][RFA] backport trunk morestack changes (issue4465045)
Diego, Testing w/ ubuntu lucid native bootstrap + check (C/C++), with --with-pic and numerous other flags, looking good. OK for google/main (assuming tests succeed)? chris -- [libgcc/ChangeLog.google-main] 2011-05-04 Chris Demetriou c...@google.com Backport from trunk r173391: 2011-05-04 Chris Demetriou c...@google.com * config/i386/morestack.S (__i686.get_pc_thunk.bx): Rename to... (__x86.get_pc_thunk.bx): ...this. (__morestack): Adjust for rename, remove undef of __i686. Backport from trunk r173345: 2011-05-03 Chris Demetriou c...@google.com * config/i386/morestack.S (__i686.get_pc_thunk.bx): New. Index: libgcc/config/i386/morestack.S === --- libgcc/config/i386/morestack.S (revision 173353) +++ libgcc/config/i386/morestack.S (working copy) @@ -278,8 +278,7 @@ movl4(%esp),%eax# Function argument. movl%eax,(%esp) #ifdef __PIC__ -#undef __i686 - call__i686.get_pc_thunk.bx # %ebx may not be set up for us. + call__x86.get_pc_thunk.bx # %ebx may not be set up for us. addl$_GLOBAL_OFFSET_TABLE_, %ebx call_Unwind_Resume@PLT # Resume unwinding. #else @@ -449,6 +448,23 @@ .size __morestack, . - __morestack #endif +#if !defined(__x86_64__) defined(__PIC__) +# Output the thunk to get PC into bx, since we use it above. + .section .text.__x86.get_pc_thunk.bx,axG,@progbits,__x86.get_pc_thunk.bx,comdat + .globl __x86.get_pc_thunk.bx + .hidden __x86.get_pc_thunk.bx +#ifdef __ELF__ + .type __x86.get_pc_thunk.bx, @function +#endif +__x86.get_pc_thunk.bx: + .cfi_startproc + movl(%esp), %ebx + ret + .cfi_endproc +#ifdef __ELF__ + .size __x86.get_pc_thunk.bx, . - __x86.get_pc_thunk.bx +#endif +#endif # The exception table. This tells the personality routine to execute # the exception handler. -- This patch is available for review at http://codereview.appspot.com/4465045
Re: [RFC PATCH] Typed DWARF stack
Jakub == Jakub Jelinek ja...@redhat.com writes: Tom Should DW_OP_bra be restricted to integral types? Several other opcodes Jakub Yes. If you want to test other types, just compare them against 0 Jakub using DW_OP_ne etc. Great, thanks. Tom Currently, the comparison operators are all defined as performing signed Tom operations. So, what should happen in this case: Tom Tom DW_OP_lit0 Tom DW_OP_GNU_convert unsigned int Tom DW_OP_GNU_const_type unsigned int -1 Tom DW_OP_gt Tom Tom That is, should this ignore the type (perhaps just using the type Tom width), or is this a bug in the spec? Jakub Whenever you have explicit type, use that type for comparisons, Jakub including its signedness. DW_OP_mod also need special treatment. What my patch does now is that it generally uses a signed integer type of the appropriate width for legacy DWARF values. Then, for mod, if the value's type is this special type, it converts it to an identically-sized unsigned type, and converts back after the operation. For DW_OP_shr, I always convert the LHS to an appropriately-sized unsigned type first. Tom
[pph] Add streamer hook for preloading common nodes (issue4478043)
This patch adds a new streamer hook to populate the streamer cache with common nodes. The nodes we populate for GIMPLE in lto_get_common_nodes is not sufficient for C++, unsurprisingly. The patch fixes these regressions in pph.exp: FAIL: g++.dg/pph/p1stdlib.cc -fpph-map=pph.map -I. (test for excess errors) FAIL: g++.dg/pph/p1stdlib.cc , PPH assembly missing There is a second part to this patch to handle INTEGER_CSTs as regular trees (so they can be cached). This would allow us to handle special constants in the C++ FE like void_zero_node, but that's giving me some trouble with LTO tests. Tested on x86_64. Committed to the branch. Diego. ChangeLog.pph * Makefile.in (cgraphunit.o): Add dependency on LTO_STREAMER_H. * cgraphunit.c: Include lto-streamer.h (cgraph_finalize_compilation_unit): Call gimple_streamer_hooks_init if LTO is enabled. * lto-streamer-out.c (lto_output): Move call to gimple_streamer_hooks_init to cgraph_finalize_compilation_unit. * lto-streamer.c (lto_get_common_nodes): Remove if0 hack. (lto_streamer_cache_create): Call streamer_hooks.get_common_nodes instead of lto_get_common_nodes. (gimple_streamer_hooks_init): Set h-get_common_nodes to lto_get_common_nodes. * lto-streamer.h (struct lto_streamer_hooks): Add field get_common_nodes. cp/ChangeLog.pph * pph-streamer.c (pph_get_common_nodes): New. (pph_stream_hooks_init): Set it in h-get_common_nodes. diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 0af93ba..f96e059 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -3001,7 +3001,7 @@ cgraphunit.o : cgraphunit.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(TREE_FLOW_H) $(TREE_PASS_H) debug.h $(DIAGNOSTIC_H) \ $(FIBHEAP_H) output.h $(PARAMS_H) $(RTL_H) $(TIMEVAR_H) $(IPA_PROP_H) \ gt-cgraphunit.h tree-iterator.h $(COVERAGE_H) $(TREE_DUMP_H) \ - tree-pretty-print.h gimple-pretty-print.h + tree-pretty-print.h gimple-pretty-print.h $(LTO_STREAMER_H) cgraphbuild.o : cgraphbuild.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(TREE_H) langhooks.h $(CGRAPH_H) intl.h pointer-set.h $(GIMPLE_H) \ $(TREE_FLOW_H) $(TREE_PASS_H) $(IPA_UTILS_H) $(EXCEPT_H) \ diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index 3dbfc2b..0d1ec89 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -138,6 +138,7 @@ along with GCC; see the file COPYING3. If not see #include output.h #include coverage.h #include plugin.h +#include lto-streamer.h static void cgraph_expand_all_functions (void); static void cgraph_mark_functions_to_output (void); @@ -1062,6 +1063,10 @@ cgraph_finalize_compilation_unit (void) { timevar_push (TV_CGRAPH); + /* If LTO is enabled, initialize the streamer hooks needed by GIMPLE. */ + if (flag_lto) +gimple_streamer_hooks_init (); + /* If we're here there's no current function anymore. Some frontends are lazy in clearing these. */ current_function_decl = NULL; diff --git a/gcc/cp/pph-streamer.c b/gcc/cp/pph-streamer.c index 5f2112e..c363c06 100644 --- a/gcc/cp/pph-streamer.c +++ b/gcc/cp/pph-streamer.c @@ -55,6 +55,36 @@ pph_indexable_with_decls_p (tree t) } +/* Generate a vector of common nodes that should always be streamed as + indexes into the streamer cache. These nodes are always built by + the front end, so there is no need to emit them. */ + +static VEC(tree,heap) * +pph_get_common_nodes (void) +{ + unsigned i; + VEC(tree,heap) *common_nodes = NULL; + + for (i = itk_char; i itk_none; i++) +VEC_safe_push (tree, heap, common_nodes, integer_types[i]); + + for (i = 0; i TYPE_KIND_LAST; i++) +VEC_safe_push (tree, heap, common_nodes, sizetype_tab[i]); + + /* global_trees[] can have NULL entries in it. Skip them. */ + for (i = 0; i TI_MAX; i++) +if (global_trees[i]) + VEC_safe_push (tree, heap, common_nodes, global_trees[i]); + + /* c_global_trees[] can have NULL entries in it. Skip them. */ + for (i = 0; i CTI_MAX; i++) +if (c_global_trees[i]) + VEC_safe_push (tree, heap, common_nodes, c_global_trees[i]); + + return common_nodes; +} + + /* Initialize all the streamer hooks used for streaming ASTs. */ static void @@ -62,6 +92,9 @@ pph_stream_hooks_init (void) { lto_streamer_hooks *h = streamer_hooks_init (); h-name = C++ AST; + h-get_common_nodes = pph_get_common_nodes; h-is_streamable = pph_is_streamable; h-write_tree = pph_stream_write_tree; h-read_tree = pph_stream_read_tree; diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c index c26de5d..b578419 100644 --- a/gcc/lto-streamer-out.c +++ b/gcc/lto-streamer-out.c @@ -2198,7 +2198,6 @@ lto_output (cgraph_node_set set, varpool_node_set vset) int i, n_nodes; lto_cgraph_encoder_t encoder = lto_get_out_decl_state ()-cgraph_node_encoder; - gimple_streamer_hooks_init (); lto_writer_init (); n_nodes = lto_cgraph_encoder_size (encoder); diff --git
Re: Remove obsolete compiler settings in toplevel configure
On 05/04/2011 09:12 PM, Joseph S. Myers wrote: -# hpux11 in 64bit mode has libraries in a weird place. Arrange to find -# them automatically. - -# The Solaris /usr/ucb/cc compiler does not appear to work. Ok. Paolo
Re: Don't use pending_sizes list for C
Following recent discussions of variable_size, this patch stops the C front end from using the global pending_sizes list, instead using the existing grokdeclarator support for tracking size expressions in the one case where pending sizes were still needed. c_variable_size is replaced by a call to save_expr. Thanks for doing this. It way well be possible after this patch to eliminate the pending_sizes list and associated functions and the dont_save_pending_sizes_p field, but I don't plan to work on that. The corresponding patch has been written and tested on top of yours. The next step will be to clean up things related to global_bindings_p. -- Eric Botcazou
Re: [google/main][RFA] backport trunk morestack changes (issue4465045)
On Wed, May 4, 2011 at 15:50, Chris Demetriou c...@google.com wrote: 2011-05-04 Chris Demetriou c...@google.com Backport from trunk r173391: 2011-05-04 Chris Demetriou c...@google.com * config/i386/morestack.S (__i686.get_pc_thunk.bx): Rename to... (__x86.get_pc_thunk.bx): ...this. (__morestack): Adjust for rename, remove undef of __i686. Backport from trunk r173345: 2011-05-03 Chris Demetriou c...@google.com * config/i386/morestack.S (__i686.get_pc_thunk.bx): New. OK. Diego.
Re: [google] Patch to support calling multi-versioned functions via new GCC builtin. (issue4440078)
On Wed, May 4, 2011 at 15:35, Sriraman Tallam tmsri...@google.com wrote: * tree-pass.h (pass_tree_convert_builtin_dispatch): New pass. (pass_ipa_multiversion_dispatch): New pass. * builtin-types.def (BT_PTR_FN_INT): New pointer type. (BT_FN_INT_PTR_FN_INT_PTR_PTR_VAR): New function type for __builtin_dispatch. * builtins.def (BUILT_IN_DISPATCH): New builtin to support multi-version calls. * mversn-dispatch.c: New file. * timevar.de (TV_MVERSN_DISPATCH): New time var. * common.opt (fclone-hot-version-paths): New flag. * Makefile.in (mversn-dispatch.o): New rule. * passes.c (init_optimization_passes): Add the new multi-version and dispatch passes to the pass list. * params.def (PARAM_NUMBER_OF_MVERSN_CLONES): Define. (PARAM_MVERSN_CLONE_CGRAPH_DEPTH): Define. * doc/invoke.texi (mversn-clone-depth): Document. (num-mversn-clones): Document. (fclone-hot-version-paths): Document. * testsuite/gcc.dg/mversn7.c: New test. * testsuite/gcc.dg/mversn4.c: New test. * testsuite/gcc.dg/mversn4.h: New test. * testsuite/gcc.dg/mversn4a.c: New test. * testsuite/gcc.dg/torture/mversn1.c: New test. * testsuite/gcc.dg/mversn2.c: New test. * testsuite/gcc.dg/mversn6.c: New test. * testsuite/gcc.dg/mversn3.c: New test. * testsuite/g++.dg/mversn8.C: New test. * testsuite/g++.dg/mversn10a.C: New test. * testsuite/g++.dg/mversn14a.C: New test. * testsuite/g++.dg/tree-prof/mversn13.C: New test. * testsuite/g++.dg/tree-prof/mversn15.C: New test. * testsuite/g++.dg/tree-prof/mversn15a.C: New test. * testsuite/g++.dg/mversn9.C: New test. * testsuite/g++.dg/mversn10.C: New test. * testsuite/g++.dg/mversn12.C: New test. * testsuite/g++.dg/mversn14.C: New test. * testsuite/g++.dg/mversn16.C: New test. * testsuite/g++.dg/torture/mversn11.C: New test. * testsuite/g++.dg/torture/mversn5.C: New test. * testsuite/g++.dg/torture/mversn5.h: New test. * testsuite/g++.dg/torture/mversn5a.C: New test. * c-family/c-common.c (handle_version_selector_attribute): New function. (c_common_attribute_table): New attribute version_selector. OK. Thanks for the quick fix! Diego.
Re: [google] Patch to support calling multi-versioned functions via new GCC builtin. (issue4440078)
I submitted the patch. Thanks, -Sri. On Wed, May 4, 2011 at 3:13 PM, Diego Novillo dnovi...@google.com wrote: On Wed, May 4, 2011 at 15:35, Sriraman Tallam tmsri...@google.com wrote: * tree-pass.h (pass_tree_convert_builtin_dispatch): New pass. (pass_ipa_multiversion_dispatch): New pass. * builtin-types.def (BT_PTR_FN_INT): New pointer type. (BT_FN_INT_PTR_FN_INT_PTR_PTR_VAR): New function type for __builtin_dispatch. * builtins.def (BUILT_IN_DISPATCH): New builtin to support multi-version calls. * mversn-dispatch.c: New file. * timevar.de (TV_MVERSN_DISPATCH): New time var. * common.opt (fclone-hot-version-paths): New flag. * Makefile.in (mversn-dispatch.o): New rule. * passes.c (init_optimization_passes): Add the new multi-version and dispatch passes to the pass list. * params.def (PARAM_NUMBER_OF_MVERSN_CLONES): Define. (PARAM_MVERSN_CLONE_CGRAPH_DEPTH): Define. * doc/invoke.texi (mversn-clone-depth): Document. (num-mversn-clones): Document. (fclone-hot-version-paths): Document. * testsuite/gcc.dg/mversn7.c: New test. * testsuite/gcc.dg/mversn4.c: New test. * testsuite/gcc.dg/mversn4.h: New test. * testsuite/gcc.dg/mversn4a.c: New test. * testsuite/gcc.dg/torture/mversn1.c: New test. * testsuite/gcc.dg/mversn2.c: New test. * testsuite/gcc.dg/mversn6.c: New test. * testsuite/gcc.dg/mversn3.c: New test. * testsuite/g++.dg/mversn8.C: New test. * testsuite/g++.dg/mversn10a.C: New test. * testsuite/g++.dg/mversn14a.C: New test. * testsuite/g++.dg/tree-prof/mversn13.C: New test. * testsuite/g++.dg/tree-prof/mversn15.C: New test. * testsuite/g++.dg/tree-prof/mversn15a.C: New test. * testsuite/g++.dg/mversn9.C: New test. * testsuite/g++.dg/mversn10.C: New test. * testsuite/g++.dg/mversn12.C: New test. * testsuite/g++.dg/mversn14.C: New test. * testsuite/g++.dg/mversn16.C: New test. * testsuite/g++.dg/torture/mversn11.C: New test. * testsuite/g++.dg/torture/mversn5.C: New test. * testsuite/g++.dg/torture/mversn5.h: New test. * testsuite/g++.dg/torture/mversn5a.C: New test. * c-family/c-common.c (handle_version_selector_attribute): New function. (c_common_attribute_table): New attribute version_selector. OK. Thanks for the quick fix! Diego.
Re: [google] Patch to support calling multi-versioned functions via new GCC builtin. (issue4440078)
I can think of some more-or-less obvious high-level forms, one would for example simply stick a new DISPATCH tree into gimple_call_fn (similar to how we can have OBJ_TYPE_REF there), the DISPATCH tree would be of variable length, first operand the selector function and further operands function addresses. That would keep the actual call visible (instead of a fake __builtin_dispatch call), something I'd really like to see. This sounds like a good long term solution. Restricting ourselves to use the existing target attribute at the beginning (with a single, compiler-generated selector function) is probably good enough to get a prototype up and running. Extending it to arbitrary selector-function, value pairs using a new attribute is then probably easy (I don't see the exact use-case for that yet, but I suppose it exists if you say so). For the use cases, CPU model will be looked at instead of just the core architecture -- this will give use more information about the numbrer of cores, size of caches etc. Intel's runtime library does this checkiing at start up time so that the multi-versioned code can look at those and make the appropriate decisions. It will be even more complicated for arm processors -- which can have the same processor cores but configured differently w.r.t VFP, NEON etc. For the overloading to work we probably have to force that the functions are local (so we can mangle them arbitrarily) and that if the function should be visible externally people add an externally visible dispatcher (foo in the above example would be one). For most of the cases, probably only the primary/default version needs to be publicly visible .. Thanks, David Now, a language extension to support multi-versioning should be completely independent on any IL representation - with using a builtin you are tying them together with the only convenient mechanism we have - a mechanism that isn't optimal for either side IMNSHO. Yes -- they don't have to be tied -- they just happen to suite the needs of both ends -- but I see the value of the latest proposal (overloading) above. I did realize that using builtins was convenient (been there and done the same for some experiments ...). Richard.
C++ PATCH for c++/48749 (ICE regression in template)
The problem was that fixed_type_or_null was looking closely at things that aren't meant to be looked at closely when we're in templates, namely a COMPONENT_REF where operand 1 is an IDENTIFIER. In a template we're going to discard the conversion anyway once we decide it's OK, so we might as well take the easy way out. Tested x86_64-pc-linux-gnu, applying to trunk. commit 58f7b3e610d3fcc14e2c29ae6acf62c0c8a938bc Author: Jason Merrill ja...@redhat.com Date: Wed May 4 15:45:12 2011 -0400 PR c++/48749 * class.c (resolves_to_fixed_type_p): Don't look closely in templates. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 9af238b..a67b34a 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -5980,7 +5980,17 @@ resolves_to_fixed_type_p (tree instance, int* nonnull) { tree t = TREE_TYPE (instance); int cdtorp = 0; - tree fixed = fixed_type_or_null (instance, nonnull, cdtorp); + tree fixed; + + if (processing_template_decl) +{ + /* In a template we only care about the type of the result. */ + if (nonnull) + *nonnull = true; + return true; +} + + fixed = fixed_type_or_null (instance, nonnull, cdtorp); if (fixed == NULL_TREE) return 0; if (POINTER_TYPE_P (t)) diff --git a/gcc/testsuite/g++.dg/conversion/base1.C b/gcc/testsuite/g++.dg/conversion/base1.C new file mode 100644 index 000..e236504 --- /dev/null +++ b/gcc/testsuite/g++.dg/conversion/base1.C @@ -0,0 +1,20 @@ +// PR c++/48749 + +struct Tuple3 +{ + float x; +}; + +struct Pos: virtual Tuple3 { }; + +struct TexCoords +{ + Pos pos; +}; + +template class T +void eval (const TexCoords coords) +{ + const Pos pos = coords.pos; + pos.x; +}
Minor inliner speedup
Hi, this patch makes inliner more selective about when to test can_inline_edge_p and when to reset edge caches. The first appears quite hot in Mozilla LTO build profiles now, since we used to do way too many resets even when not neccesary. After inlining function A to B, we need: 1) reset edge info on all callers of B, because B is now bigger function and may not be so cool to inline (or it may actually get smaller and cooler, who knows). We also want to re-check can_inline_edge_p and want_inline_small_function_p and if needed compensate the priority queue: remove the no longer inlinable entries and add new inlineable entries. 2) reset edge info on all callees of new copy of A. Those now have more calls than before and might become less cool candidates to inline. 3) reset node growth for B (it has changed) 4) reset node growth of all calles of A (we may have more calls). When A was last copy of function, we might mage callees of A hotter candidates for inlining, because their growth estimates actually reduce. This imply that all edges to those callees needs updating, this is what update_all_callee_keys does. We don't do that in other case as they become cooler, instead we lazilly update the queue later. This is all somewhat complex. Last paragraph can actually imply quite considerable quadratic compilation time problems and to some degree it does (it is why this whole thing is critical for WPA). It would become mood if growth for inlining all calls was not part of badness computation. We discussed this with Richard and it may make sense. It is there to drive inliner to prioritize inlining functions called fewer times where it has more chance to inline all calls and to understand when offline copy will disappear from program. This seems desirable thing to do, so I am keeping the logic in code until later when we will re-tune the heuristic and figure out where we want to go. The quadratic time issues can also be avoided by simply not doing the busy work when there are too many edges to update and allowing priority queue to not be 100% in shape in those cases. Bootstrapped/regtested x86_64-linux, will commit it shortly. Honza * ipa-inline.c (reset_edge_caches): New function. (update_caller_keys): Add check_inlinablity_for; do not reset edge caches; remove now unnecesary loop. (update_callee_keys): Add comments; reset node_growth_cache of callee. (update_all_callee_keys): Likewise. (inline_small_functions): Sanity check cache; update code recomputing it. Index: ipa-inline.c === --- ipa-inline.c(revision 173332) +++ ipa-inline.c(working copy) @@ -850,11 +850,64 @@ update_edge_key (fibheap_t heap, struct } } -/* Recompute heap nodes for each of caller edge. */ + +/* NODE was inlined. + All caller edges needs to be resetted because + size estimates change. Similarly callees needs reset + because better context may be known. */ + +static void +reset_edge_caches (struct cgraph_node *node) +{ + struct cgraph_edge *edge; + struct cgraph_edge *e = node-callees; + struct cgraph_node *where = node; + + if (where-global.inlined_to) +where = where-global.inlined_to; + + /* WHERE body size has changed, the cached growth is invalid. */ + reset_node_growth_cache (where); + + for (edge = where-callers; edge; edge = edge-next_caller) +if (edge-inline_failed) + reset_edge_growth_cache (edge); + + if (!e) +return; + + while (true) +if (!e-inline_failed e-callee-callees) + e = e-callee-callees; +else + { + if (e-inline_failed) + reset_edge_growth_cache (e); + if (e-next_callee) + e = e-next_callee; + else + { + do + { + if (e-caller == node) + return; + e = e-caller-callers; + } + while (!e-next_callee); + e = e-next_callee; + } + } +} + +/* Recompute HEAP nodes for each of caller of NODE. + UPDATED_NODES track nodes we already visited, to avoid redundant work. + When CHECK_INLINABLITY_FOR is set, re-check for specified edge that + it is inlinable. Otherwise check all edges. */ static void update_caller_keys (fibheap_t heap, struct cgraph_node *node, - bitmap updated_nodes) + bitmap updated_nodes, + struct cgraph_edge *check_inlinablity_for) { struct cgraph_edge *edge; @@ -864,32 +917,29 @@ update_caller_keys (fibheap_t heap, stru return; if (!bitmap_set_bit (updated_nodes, node-uid)) return; - reset_node_growth_cache (node); - /* See if there is something to do. */ for (edge = node-callers; edge; edge = edge-next_caller) if (edge-inline_failed) - break; - if (!edge) -return; - - for (; edge; edge = edge-next_caller) -if
Re: C++ PATCHes relating to c++/48834, c++/40975 (array new)
Well, I disagree. STATEMENT_LISTs are just another kind of thing you encounter in an expression; if a caller wants special handling, they can arrange for it. But you're unilaterally choosing one special handling (copying) among several ones (copying, not copying, aborting) just because of one caller, for no good reason IMO. This is how things used to work before, but it broke when the tree-ssa merge switched from using TREE_CHAIN on statements to a separate STATEMENT_LIST. Well, the assertion certainly wasn't put there by accident. -- Eric Botcazou
[v3] libstdc++/47913 (again)
Hi, Marc kindly contributed the below rewrite of std::ratio_add (and ratio_less), algorithmically derived from the macro __udiv_qrnnd_c in gcc's longlong.h, which amounts to the best behavior in terms of accepted inputs: a pair of std::ratio is *never* rejected unless the resulting std::ratio would not be legal. Tested x86_64-linux multilib, committed to mainline. Paolo. / 2011-05-04 Marc Glisse marc.gli...@normalesup.org PR libstdc++/47913 (again) * include/std/ratio (ratio_add, ratio_less): Rewrite. * testsuite/20_util/ratio/operations/47913.cc: Extend. * testsuite/20_util/ratio/cons/cons_overflow_neg.cc: Adjust dg-error line numbers. * testsuite/20_util/ratio/operations/ops_overflow_neg.cc: Likewise. Index: include/std/ratio === --- include/std/ratio (revision 173386) +++ include/std/ratio (working copy) @@ -98,41 +98,154 @@ static const uintmax_t __b1 = __static_abs_Qn::value / __c; static_assert(__a1 == 0 || __b1 == 0, -overflow in multiplication); + overflow in multiplication); static_assert(__a0 * __b1 + __b0 * __a1 (__c 1), -overflow in multiplication); + overflow in multiplication); static_assert(__b0 * __a0 = __INTMAX_MAX__, -overflow in multiplication); - static_assert((__a0 * __b1 + __b0 * __a1) * __c = -__INTMAX_MAX__ - __b0 * __a0, overflow in multiplication); + overflow in multiplication); + static_assert((__a0 * __b1 + __b0 * __a1) * __c + = __INTMAX_MAX__ - __b0 * __a0, + overflow in multiplication); public: static const intmax_t value = _Pn * _Qn; }; - // Helpers for __safe_add - templateintmax_t _Pn, intmax_t _Qn, bool -struct __add_overflow_check_impl -: integral_constantbool, (_Pn = __INTMAX_MAX__ - _Qn) + // Some double-precision utilities, where numbers are represented as + // __hi*2^(8*sizeof(uintmax_t)) + __lo. + templateuintmax_t __hi1, uintmax_t __lo1, uintmax_t __hi2, uintmax_t __lo2 +struct __big_less +: integral_constantbool, (__hi1 __hi2 + || (__hi1 == __hi2 __lo1 __lo2)) { }; - templateintmax_t _Pn, intmax_t _Qn -struct __add_overflow_check_impl_Pn, _Qn, false -: integral_constantbool, (_Pn = -__INTMAX_MAX__ - _Qn) -{ }; + templateuintmax_t __hi1, uintmax_t __lo1, uintmax_t __hi2, uintmax_t __lo2 +struct __big_add +{ + static constexpr uintmax_t __lo = __lo1 + __lo2; + static constexpr uintmax_t __hi = (__hi1 + __hi2 + +(__lo1 + __lo2 __lo1)); // carry +}; - templateintmax_t _Pn, intmax_t _Qn -struct __add_overflow_check -: __add_overflow_check_impl_Pn, _Qn, (_Qn = 0) -{ }; + // Subtract a number from a bigger one. + templateuintmax_t __hi1, uintmax_t __lo1, uintmax_t __hi2, uintmax_t __lo2 +struct __big_sub +{ + static_assert(!__big_less__hi1, __lo1, __hi2, __lo2::value, + Internal library error); + static constexpr uintmax_t __lo = __lo1 - __lo2; + static constexpr uintmax_t __hi = (__hi1 - __hi2 - +(__lo1 __lo2)); // carry +}; - templateintmax_t _Pn, intmax_t _Qn -struct __safe_add + // Same principle as __safe_multiply. + templateuintmax_t __x, uintmax_t __y +struct __big_mul { - static_assert(__add_overflow_check_Pn, _Qn::value != 0, -overflow in addition); +private: + static constexpr uintmax_t __c = uintmax_t(1) (sizeof(intmax_t) * 4); + static constexpr uintmax_t __x0 = __x % __c; + static constexpr uintmax_t __x1 = __x / __c; + static constexpr uintmax_t __y0 = __y % __c; + static constexpr uintmax_t __y1 = __y / __c; + static constexpr uintmax_t __x0y0 = __x0 * __y0; + static constexpr uintmax_t __x0y1 = __x0 * __y1; + static constexpr uintmax_t __x1y0 = __x1 * __y0; + static constexpr uintmax_t __x1y1 = __x1 * __y1; + static constexpr uintmax_t __mix = __x0y1 + __x1y0; // possible carry... + static constexpr uintmax_t __mix_lo = __mix * __c; + static constexpr uintmax_t __mix_hi + = __mix / __c + ((__mix __x0y1) ? __c : 0); // ... added here + typedef __big_add__mix_hi, __mix_lo, __x1y1, __x0y0 _Res; +public: + static constexpr uintmax_t __hi = _Res::__hi; + static constexpr uintmax_t __lo = _Res::__lo; +}; - static const intmax_t value = _Pn + _Qn; + // Adapted from __udiv_qrnnd_c in longlong.h + // This version assumes that the high bit of __d is 1. + templateuintmax_t __n1, uintmax_t __n0, uintmax_t __d +struct __big_div_impl +{ +private: + static_assert(__d = (uintmax_t(1) (sizeof(intmax_t) * 8 - 1)), + Internal
Re: PR 47793 - Support relative paths using -fprofile-generate
Is this patch ok for trunk? Allowing relative path in -fprofile-generate= is very useful when running the program remotely -- the profile data will be just dumped in the dir relative to the working dir in the remote machine. Using GCOV_PREFIX_STRIP can workaround the problem, but it is not always to pass environment around. Thanks, David On Wed, Feb 23, 2011 at 3:37 PM, Martin Thuresson mart...@google.com wrote: On Wed, Feb 23, 2011 at 10:21 AM, Martin Thuresson mart...@google.com wrote: Change 165596 and 168475 updated the code for handling gcda-paths. As part of this change, relative paths stopped working. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47793 This patch adds a guard so that / is not added when no prefix is given. The added testcase uses the path ../gcc/. This puts the gcda in the same directory, so that the cleanup-coverage-files will find them. I have tested the patch using make bootstrap; make -k check with target x86_64-unknown-linux-gnu and saw no additional test failures. Let me know if there is any other testing I should do. ChangeLog gcc/ 2011-02-23 Martin Thuresson mart...@google.com PR gcov-profile/47793 * libgcov.c (gcov_exit): Support relative profile paths. gcc/testsuite/ 2011-02-23 Martin Thuresson mart...@google.com PR gcov-profile/47793 * gcc.dg/pr47793.c: New. Thanks, Martin