align_stack

Enables stack alignment.

Syntax

  -[no]align_stack

Arguments

None

Default

  -noalign_stack

Define

None

Scope

This option should only be enabled when optimizing for speed (-opt speed or -opt nospace in the compiler command line). If enabled when optimizing for size (-opt space or -opt nospeed), the option has no effect.

Description

This option enables stack alignment.

The S12Z compiler can optimize either for code size (default) or for execution speed. Since the S12Z CPU data bus operates on 32-bit address boundaries, one way to improve execution time is to ensure that no stack access is such that the corresponding data transfer needs to be split into two consecutive bus accesses. This can be accomplished by aligning the stack, i.e. making sure that:
Note: When stack alignment is enabled, function parameters are no longer passed according to the default calling convention. Padding will be inserted, if necessary, in order to (1) align the parameters that must be passed on stack and (2) make sure that, following the function call, the stack pointer will be aligned to 4 (i.e. the stack effect is a multiple of 4). A linker warning will be reported when mixing user code and library code that was not compiled with the same stack alignment setting (on/off).