#pragma NO_ENTRY: No Entry Code

Scope

Function

Syntax

#pragma NO_ENTRY

Synonym

None

Arguments

None

Default

None

Description

This pragma suppresses the generation of entry code and is useful for inline assembler functions. The entry code prepares subsequent C code to run properly. It usually consists of pushing register arguments on the stack (if necessary), and allocating the stack space used for local variables and temporaries and storing callee saved registers according to the calling convention.

The main purpose of this pragma is for functions which contain only High-Level Inline (HLI) assembler code to suppress the compiler generated entry code.

One use of this pragma is in the startup function _Startup. At the start of this function the stack pointer is not yet defined. It has to be loaded by custom HLI code first.

Note: C code inside of a function compiled with #pragma NO_ENTRY generates independently of this pragma. The resulting C code may not work since it could access unallocated variables in memory.

This pragma is safe in functions with only HLI code. In functions that contain C code, using this pragma is a very advanced topic. Usually this pragma is used together with the pragma NO_FRAME.

Tip: Use a #pragma NO_ENTRY and a #pragma NO_EXIT with HLI-only functions to avoid generation of any additional frame instructions by the compiler.

The code generated in a function with #pragma NO_ENTRY may be unreliable. It is assumed that the user ensures correct memory use.

Warning: Not all backends support this pragma. Some may still generate entry code even if this pragma is specified.
Example

The following listing shows how to use the NO_ENTRY pragma (along with others) to avoid any generated code by the compiler. All code is written in inline assembler.

Listing: Blocking compiler-generated function-management instructions


#pragma NO_ENTRY #pragma NO_EXIT 
#pragma NO_FRAME 
#pragma NO_RETURN 
void Func0(void) { 
  __asm {/* No code should be written by the compiler.*/ 
    ... 
  } 
} 
See also

#pragma NO_EXIT: No Exit Code

#pragma NO_FRAME: No Frame Code

#pragma NO_RETURN: No Return Instruction