5.7.7.10 Align-labels Option

The -falign-labels=n:m:n2:m2 option aligns all branch targets to the next power of two greater than n, skipping up to m-1 bytes. For instance, -falign-labels=8 aligns labels to the next 8-byte boundary; -falign-labels=9 aligns labels to the next 16-byte boundary but only if this can be done by skipping no more than 9 bytes.

All arguments are optional. Arguments preceding any argument that is specified are mandatory. If m is not specified, it defaults to n. . The -fno-align-labels form of this option is equivalent to -falign-labels=1, which implies that the label is not aligned. If n is not specified or is zero, a default of alignment of 1 byte is used, which implies that the label is not aligned. If the options -falign-loops or -falign-jumps have also been specified and either of their arguments are greater than n, their argument values are used to determine the label alignment instead. For PIC32C/SAM devices, nmust not exceed 64. If n is not a power of 2, the alignment value is rounded up.

For instance, -falign-labels=32 aligns labels to the next 32-byte boundary; -falign-labels=24 aligns labels to the next 32-byte boundary but only if this can be done by skipping no more than 23 bytes; -falign-jumps=32:7 aligns to the next 32-byte boundary only if this can be done by skipping 6 bytes or fewer.

The second pair of n2:m2 values allows you to specify a secondary alignment: -falign-labels=64:7:32:3 aligns to the next 64-byte boundary if this can be done by skipping 6 bytes or fewer, otherwise aligns to the next 32-byte boundary if this can be done by skipping 2 bytes or fewer. If m2 is not specified, it defaults to n2

This option can easily make code slower, because it must insert dummy operations for when the branch target is reached in the usual flow of the code.

If the options -falign-loops or -falign-jumps have been used and either of their arguments are greater than n, then their argument values are used to determine the label alignment instead.

This option is automatically enabled at optimization levels -O2 and -O3.

The -fno-align-labels form of this option is equivalent to -falign-labels=1 and implies that labels are not aligned. The -falign-labels form of this option (with no argument) also performs no alignment.