This is the mail archive of the
mailing list for the GCC project.
Re: Marking a builtin function as `noreturn'.
- From: Ian Lance Taylor <ian at airs dot com>
- To: Daniel Towner <daniel dot towner at picochip dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: 01 Mar 2006 17:44:31 -0800
- Subject: Re: Marking a builtin function as `noreturn'.
- References: <4405ACFA.email@example.com>
Daniel Towner <firstname.lastname@example.org> writes:
> I maintain a port of gcc for an embedded processor which has a HALT
> instruction. This instruction stops the processor, and generates an
> appropriate interrupt to indicate to its parent system that it has
> stopped. The instruction is accessed by the programmer using a
> port-specific builtin, which can then be used, amongst other things,
> to implement the `assert' macro.
> At the moment, whenever a HALT instruction is emitted, the compiler
> still seems to assume that execution will continue after the HALT
> instruction has executed (e.g., the compiler emits branches to the
> function epilogue, etc.). I would like the compiler to treat the
> builtin instruction as though it had the attribute `noreturn'. I have
> added this attribute to the builtin declaration in the
> TARGET_INIT_BUILTINS function, but it appears to make no difference. I
> may have got the code wrong, but assuming the code is correct, should
> gcc allow a builtin to be marked as a noreturn? Should a builtin
> marked in this way stop any code flow after the HALT? Is there another
> way to achieve the effect I am after?
Define the builtin function to first emit the HALT instruction and
then call emit_barrier().