I have a particular function call. The first instruction of the function is missing in the instruction cache more often than I'd like. Due to the places where the instruction/function is called from, code layout optimization is not a great idea. These insights come after extensive profiling and execution trace analysis.
Is there any way to prefetch for the instruction cache in software? Something like __builtin_prefetch(&function)
. But that is for data cache - can I induce a prefetch for the instruction cache in the source code?
To be clear, calling the function will give me something like call 0x555
in the assembly, where 0x555
is the address of the function, and I want to ensure 0x555
it is in the instruction cache before call 0x555
.