Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!ima!johnl From: johnl@ima.UUCP Newsgroups: comp.compilers Subject: Re: Static analysis of code for "flop counting"? Message-ID: <552@ima.UUCP> Date: Wed, 22-Apr-87 02:03:43 EST Article-I.D.: ima.552 Posted: Wed Apr 22 02:03:43 1987 Date-Received: Thu, 23-Apr-87 23:47:01 EST References: <1299@ames.UUCP> Sender: johnl@ima.UUCP Lines: 26 Approved: compilers@ima.UUCP > ... Another approach that > I have seen is to run the source program through a preprocessor which adds > tracing code into the source, then compile the resulting program with the > regular compiler. Yet another approach, used (although not for this purpose, I suspect) by the MIPSCo people, is to run the object program through a postprocessor that inserts tracing code. For example, before every "add float" instruction, insert an instruction that bumps an "add float" counter. (I suggest "before" rather than "after" because then the condition codes don't get messed up, or at least not as badly -- beware optimizing compilers rearranging code!) If you did it at the assembler level rather than the binary level, this might not be too hard. That might be awkward if libraries are involved, though. This gets you fast, accurate counts without compiler cooperation. Henry Spencer @ U of Toronto Zoology {allegra,ihnp4,decvax,pyramid}!utzoo!henry -- Send compilers articles to ima!compilers or, in a pinch, to Levine@YALE.ARPA Plausible paths are { ihnp4 | decvax | cbosgd | harvard | yale | cca}!ima Please send responses to the originator of the message -- I cannot forward mail accidentally sent back to compilers. Meta-mail to ima!compilers-request