avr-gcc: direct register access suppresses optimization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The follwing example contains functional identicaal code:

<1> uses direct register access
<2> uses structure mapping

But <1> suppresses the hoist/sink of the loads/stores to variable g out of the loop. In case <2> this optimization is done (and is correct).

What does avr-gcc hinder to do this optimization in case <1>?

#include <avr/io.h>
#include <stdint.h>

static uint16_t g;

int main() {
    for(uint8_t i = 0; i < 20; i++) {
        ++g;
//        VPORTA_DIR; // <1> suppresses optimization
        VPORTA.DIR; // <2>
    }
}



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux