This is the mail archive of the gcc@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: Marking a builtin function as `noreturn'.


Daniel Towner <daniel.towner@picochip.com> 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().

Ian


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