[Simh] clang (was Re: XCode and LTO)
Sergey Oboguev
oboguev at yahoo.com
Fri Apr 27 13:44:03 EDT 2012
Declaring "loopval" as volatile (and perhaps global, rather than on-stack, to
reduce chances of compiler disregarding volatile declaration) might do the
trick.
----- Original Message ----
From: Craig A. Berry <craigberry at mac.com>
Subject: [Simh] clang (was Re: XCode and LTO)
The comments in the code say, "To avoid smart compilers, the loopval variable is
referenced in the function arguments so that the function expression is not loop
invariant," which led me to the lucky guess that the compiler was inlining the
function and then optimizing away the inlined code. So I made the following
(non-portable) change:
[...]
If anyone knows of a more portable way to prevent inlining of rom_swapb(), it
seems like it would be a good idea to do so.
More information about the Simh
mailing list