GCC inline a optimalizace
Miroslav Mraz
mrazik na volny.cz
Sobota Srpen 13 09:34:31 CEST 2016
Mně se to chová normálně. gcc version 4.9.3, -Os.
20000370 <SysTick_Handler>:
volatile int criticalNesting = 0;
static const int CRITICAL_INT_PRIORITY = 95;
inline void EnterCritical() {
__asm volatile (
20000370: f04f 005f mov.w r0, #95 ; 0x5f
20000374: f380 8811 msr BASEPRI, r0
" mov r0, %0 \n"
" msr basepri, r0 \n"
::"i" (CRITICAL_INT_PRIORITY) :"r0"
);
criticalNesting++;
20000378: 4b0a ldr r3, [pc, #40] ; (200003a4 <SysTick_Handler+0x34>)
2000037a: 681a ldr r2, [r3, #0]
2000037c: 3201 adds r2, #1
2000037e: 601a str r2, [r3, #0]
volatile uint64_t sysTicksCounter;
void SysTick_Handler (void) {
EnterCritical();
sysTicksCounter++;
20000380: 4a09 ldr r2, [pc, #36] ; (200003a8 <SysTick_Handler+0x38>)
20000382: e9d2 0100 ldrd r0, r1, [r2]
20000386: 3001 adds r0, #1
20000388: f141 0100 adc.w r1, r1, #0
2000038c: e9c2 0100 strd r0, r1, [r2]
);
criticalNesting++;
}
inline void ExitCritical() {
criticalNesting--;
20000390: 681a ldr r2, [r3, #0]
20000392: 3a01 subs r2, #1
20000394: 601a str r2, [r3, #0]
if (criticalNesting == 0) {
20000396: 681b ldr r3, [r3, #0]
20000398: b91b cbnz r3, 200003a2 <SysTick_Handler+0x32>
__asm volatile (
2000039a: f04f 0000 mov.w r0, #0
2000039e: f380 8811 msr BASEPRI, r0
200003a2: 4770 bx lr
200003a4: 200003c8 .word 0x200003c8
200003a8: 200003d0 .word 0x200003d0
Mrazík
Dne 13.8.2016 v 07:47 Jaroslav Buchta napsal(a):
> Zdravim,
>
> nevim jak donutit compiler, aby mi neprehazel posloupnost operaci v
> nasledujici funkci
>
> inline void EnterCritical() __attribute__( ( always_inline ) );
> inline void ExitCritical() __attribute__( ( always_inline ) );
>
> ...
Další informace o konferenci Hw-list