This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Exception/instruction barrier
- From: Hendrik Greving <hendrik dot greving dot intel at gmail dot com>
- To: Rob <robpilling at gmail dot com>
- Cc: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Tue, 3 Sep 2013 08:45:08 -0700
- Subject: Re: Exception/instruction barrier
- Authentication-results: sourceware.org; auth=none
- References: <CANc4vhr8hQ=xnttsx_8iR1jCM-heTTTfaVhhhOLZypa5V22oyw at mail dot gmail dot com> <20130831111604 dot GA2468 at jeffraw>
Yes it would. But some instructions following these semantics also
have output operands, and this not supported afaik.
On Sat, Aug 31, 2013 at 4:16 AM, Rob <robpilling@gmail.com> wrote:
> On Fri, Aug 30, 2013 at 10:41:47AM -0700, Hendrik Greving wrote:
>> Following problem: Below, the instruction
>> my_insn_can_jump_to_coolLabel is an instruction that can raise a
>> fault, that is subsequently handled by a higher OS like code, that
>> then will always jump to B3. I believe similar stuff exists in the
>> Linux kernel. What happens is that some code from B3 gets hoisted to
>> B1' (some base address from a complex address in B3, I suspect CSE).
>> The base address is then missing in case we 'jump' to B3 if an
>> exception had been raised.
>>
> ...
>>
>> Is there anything like instruction barriers I can somehow support at
>> codeLabel maybe? How does the Linux kernel do this (if so)?
>
> Will asm goto() help here? gcc assumes asm statements don't affect
> program flow when it reorders basic blocks. You should use asm goto()
> with a list of labels at the end if your asm statement will jump around.
>
> Or alternatively you could give gcc -fno-reorder-blocks to stop it
> shifting code around.
>
> Thanks,
> Rob