This is the mail archive of the
mailing list for the GCC project.
Re: Bypassing jump optimization
- To: Casper Hornstrup <chorns at users dot sourceforge dot net>
- Subject: Re: Bypassing jump optimization
- From: Jan Hubicka <jh at suse dot cz>
- Date: Sat, 13 Oct 2001 11:16:25 +0200
- Cc: gcc at gcc dot gnu dot org
- References: <firstname.lastname@example.org>
> I'm implementing structured exception handling in gcc. What is the correct
> way (if any exist) to bypass jump optimization on a range of insns?
> If I have gcc to generate code like this:
> <protected code>
> jmp after_exception_handler
> movl $0, %eax
> <exception handler code>
> then gcc optimizes all the code above away. This happens even if using the
> -O0 option to disable optimization.
> If I use LABEL_PRESERVE_P(<label>) = 1 on all labels, then the labels are
> preserved, but the code is still removed.
You need to modify the CFG building code to add the needed edges from the
places that can throw into exception_handler. See our existing EH code
how it is done.
Also note that 3.1 code came trought major reorganization, so in case you
want to merge your work to the mainline, you should probably use it as a base,
to avoid headaches later.
> I'm using gcc-3.0-release.
> Casper Hornstrup