On 2/2/2015 9:15 AM, Johannes Pfau wrote:
It's also necessary that the compiler
knows after inlining that the address is a literal. Loading data from
fixed literal addresses produces different, more efficient code than
loading from an runtime address. As the function code will generally be
written for runtime values the compiler must optimize after inlining
to recognize the inlined code deals with literals.


  import core.bitop;
  uint test() {
    return volatileLoad(cast(uint *)0x1234);
  }
  ---
  dmd -c foo
  ---
  _D3foo4testFZkL:
        mov     EAX,01234h
        mov     EAX,[EAX]
        ret

Note that was an unoptimized build.

Reply via email to