This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: make call to _main() part of the main() ``prologue''
- From: Andreas Schwab <schwab at suse dot de>
- To: Alexandre Oliva <aoliva at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 01 Jun 2004 22:47:16 +0200
- Subject: Re: make call to _main() part of the main() ``prologue''
- References: <orekozf3dc.fsf@free.redhat.lsd.ic.unicamp.br>
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."