Path: utzoo!utgpu!water!watmath!clyde!rutgers!paul.rutgers.edu!segall From: segall@clash.rutgers.edu (Ed Segall) Newsgroups: comp.arch Subject: Re: FREQUENCY statements: fill a much-needed gap Message-ID: <2861@clash.rutgers.edu> Date: 12 Jan 88 20:16:12 GMT References: <839@ima.ISC.COM> <28200085@ccvaxa> <1267@winchester.UUCP> Organization: Rutgers Univ., New Brunswick, N.J. Lines: 50 > 4) Features like FREQUENCY are a crutch to fill the gap between > what a human knows and what the compiler can do. C's "register" > declaration was such a crutch, appropriate at the time, since it > made a big difference, and optimizing compilers were not as widely > available as they are today. Many current compilers almost ignore > "register" in favor of their own allocation. > > FREQUENCY is like that, but not as useful, since it isn't spanning > much of gap, as current leading-edge software technology is quite > capable of gathering and using the needed information. > It is a feature that "fills a much-needed gap" (in the words of Ken T.) Aaarrrggghh! Yes, it would be really nice to have a compiler figure everything out in advance, and I wish the greatest encouragement to those who can get a compiler to figure out which branch is most likely to be taken. Yes, it it true that profiling (with appropriate input data, for programs with data-dependent profiles) is the best way to do this. However, predicting the most likely branch is not the only reason to include a directive in a language to tell the compiler which branch to optimize. Perhaps FREQUENCY is a misnomer. May I propose MAKE_FASTEST_BRANCH, instead? This is only half-serious, of course, and I hope the choice of a name doesn't turn into a "this name is better than that name" contest, but there is an important semantic difference between the two. I think the missle example showed it best (to paraphrase: you don't want to optimize for the most common case, when no missles are coming in. You'd be better off optimizing the very uncommon case when they are). So, in mine humble opinion, it is a Very Good Thing to have a compiler figure out (guess, usually) which branch is going to be executed most frequently, and to use that information, but it is a Very Bad Thing to ignore the need for communicating as much useful information as possible to the compiler. Sure, most such features would go unused most of the time, often when used they would be wrong, and the code clutter would be horrendous if they are used extensively, (sounds like a candidate for Hypertext-style programming) but please don't say they shouldn't be developed and used. --Ed -- uucp: ...{harvard, ut-sally, sri-iu, ihnp4!packard}!topaz!caip!segall arpa: SEGALL@CAIP.RUTGERS.EDU