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


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

Re: make call to _main() part of the main() ``prologue''


Alexandre Oliva <aoliva@redhat.com> writes:

> @@ -6435,7 +6435,22 @@ expand_main_function (void)
>  #endif
>  
>  #ifndef HAS_INIT_SECTION
> -  emit_library_call (init_one_libfunc (NAME__MAIN), LCT_NORMAL, VOIDmode, 0);
> + {
> +   rtx seq, tmp;
> +
> +   start_sequence ();
> +   emit_library_call (init_one_libfunc (NAME__MAIN), LCT_NORMAL, VOIDmode, 0);
> +   seq = get_insns ();
> +   end_sequence ();
> +   
> +   for (tmp = get_last_insn (); tmp; tmp = PREV_INSN (tmp))
> +     if (NOTE_P (tmp) && NOTE_LINE_NUMBER (tmp) == NOTE_INSN_FUNCTION_BEG)
> +       break;
> +   if (tmp)
> +     emit_insn_before (seq, tmp);
> +   else
> +     emit_insn (seq);

IMVHO this piece of code deserves a comment on what this is actually doing
and why.  Such things should not be buried in the change log.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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