[llvm-commits] [PATCH] Support for instruction cache flushing on Windows

NAKAMURA Takumi geek4civic at gmail.com
Sun Sep 18 23:53:42 PDT 2011


Aaron, I am sorry for long delay.

2011/8/26 Aaron Ballman <aaron at aaronballman.com>:
> On Windows, there was no implementation for
> llvm::sys::Memory::InvalidateInstructionCache, which I've rectified
> with this patch.  Tested with Visual Studio 2010 and MinGW, though I
> will admit that it shows no functional differences on my particular
> hardware.  That doesn't mean it won't be useful on other hardware
> though.

In fact;

  - x86 and x86-64 does not need explicit icache flushing on its
microarchitecture.
  - in llvm::sys::Memory::InvalidateInstructionCache(),
    no operations would be executed on any x86-based hosts.

I think this patch could be applied by the person who would develop
for {ppc|arm}-win32.
Though I don't have a strong opinion, it would be redundant and would
affect a little worse for performance for now.

FYI, you should not give GetModuleHandle(NULL), but
GetCurrentProcess() to 1st argument of FlushInstructionCache(). As an
implementation, GetModuleHandl(NULL) represents virtual base addr of
the process (eg. 0x00400000) and GetCurrentProcess() does the magic
number (eg. 0xFFFFFFFF).

...Takumi




More information about the llvm-commits mailing list