Newsgroups: comp.arch Path: utzoo!utgpu!jarvis.csri.toronto.edu!godzilla.ele.toronto.edu!glenn From: glenn@godzilla.ele.toronto.edu (Glenn Mackintosh) Subject: Re: FREQUENCY statements: fill a much-needed gap Message-ID: <1988Jan13.232930.7936@jarvis.csri.toronto.edu> Organization: EECG, University of Toronto References: <839@ima.ISC.COM> <28200085@ccvaxa> <1267@winchester.UUCP> <6107@oberon.USC.EDU> Date: Wed, 13-Jan-88 23:29:29 EST In article <6107@oberon.USC.EDU> blarson@skat.usc.edu (Bob Larson) writes: >Programmers often don't realy know how their code will be used. This >means that not only will their intuitive guesses on how frequently >sections of code will be used will be bad, but also they may not be >able to pick a reasonable set of cases to profile. (Would you like to >see various versions of a product based on what profiles were fead to >the optomizer?) > >Also, there are times where the most common case is not the one that >needs optimization. Would you want a missle tracking system optimized >for the case where there are no incoming missles? (Many such >real-time applications are coded in assembler, but more and more are >now in high-level languages.) I'm not really sure which side your arguing for here. Maybe you were trying to say what I'm about to and I missed it. The first paragraph sounds like an argument against things like the FREQUENCY statement but the second paragraph seems like a good argument for them. In the above missile example the programmers knowledge of which direction MUST be optimized is probably far more important and more correct than any specific group of test cases could be. Even a group of simulated attacks would likely not cover all the cases and in fact they might tend to cancel each other out. Therefore good use can be made of profiling but you may still need to force it to optimize in a specific direction. My personal opinion is that hints from the programmer can be useful and should be taken into account by the compiler. The optimizer should weigh this against things it discovers from profiling or other techniques and possibly choose to go the opposite way. The example above illustrates that it can be important to be able to override the compiler though. Glenn Mackintosh (@ University of Toronto) Standard disclaimer applies.