[Simh] clang (was Re: XCode and LTO)

Sergey Oboguev oboguev at yahoo.com
Fri Apr 27 14:35:05 EDT 2012


Splitting into separate files won't override optimization in LTO case since 
(tautologically) it is link-time.



----- Original Message ----
From: Nelson H. F. Beebe <beebe at math.utah.edu>
To: Sergey Oboguev <oboguev at yahoo.com>; "simh at trailing-edge.com" 
<simh at trailing-edge.com>
Cc: beebe at math.utah.edu
Sent: Fri, April 27, 2012 10:48:42 AM
Subject: Re: [Simh] clang (was Re: XCode and LTO)

>> Declaring "loopval" as volatile (and perhaps global, rather than on-stack, to 

>> reduce chances of compiler disregarding volatile declaration) might do the 
>> trick.

Yes, that should work if the compiler obeys volatile declarations.  Otherwise,
a store subterfuge will work too:

(a)    volatile int foo;

(b)    int foo;
    ...
    store(&foo);

    In another file:
    void store(int *x) { }

Both cases should force the compiler to load foo from memory, and
not optimize it away.

-------------------------------------------------------------------------------
- Nelson H. F. Beebe                    Tel: +1 801 581 5254                  -
- University of Utah                    FAX: +1 801 581 4148                  -
- Department of Mathematics, 110 LCB    Internet e-mail: beebe at math.utah.edu  -
- 155 S 1400 E RM 233                      beebe at acm.org  beebe at computer.org -
- Salt Lake City, UT 84112-0090, USA    URL: http://www.math.utah.edu/~beebe/ -
-------------------------------------------------------------------------------




More information about the Simh mailing list