I'm trying to understand why to align functions. For example there's -falign-functions
option in gcc, which aligns functions to n-byte boundaries, but what's the purpose?
Asked
Active
Viewed 83 times
0

Michal Špondr
- 1,337
- 2
- 21
- 44
-
2presumably as an optimization on some platforms. oh, would you look at that. it's listed under "Options That Control Optimization". – Cheers and hth. - Alf Feb 23 '15 at 10:50
-
1Depends on the processor. For Intel's, this is covered by chapter 3.4.1.5 of the optimization manual, recommending alignment of branch targets to 16 bytes. Nice for the instruction prefetcher. – Hans Passant Feb 23 '15 at 10:54