Path: utzoo!utgpu!water!watmath!clyde!rutgers!cmcl2!nrl-cmf!ames!lll-lcc!pyramid!prls!mips!mash From: mash@mips.COM (John Mashey) Newsgroups: comp.arch Subject: Re: FREQUENCY statements: fill a much-needed gap Message-ID: <1385@winchester.mips.COM> Date: 21 Jan 88 21:54:31 GMT References: <839@ima.ISC.COM> <28200085@ccvaxa> <1267@winchester.UUCP> <2861@clash.rutgers.edu> <1722@faline.bellcore.com> Reply-To: mash@winchester.UUCP (John Mashey) Organization: MIPS Computer Systems, Sunnyvale, CA Lines: 38 In article <1722@faline.bellcore.com> hammond@faline.UUCP (Rich A. Hammond) writes: >In this case the programmer could be relatively certain of the >frequency (or alternatively doesn't care if the error recovery is >slower) and the compiler could put code, such as save all the registers >before the error routine calls, that would enable better code for the >case that we wish to go quickly. This is a specific instance of the general idea of moving register saves and restores around when possible. Rich's case is: glurp() { if (something) { low-frequency-function-call } else { a few statements } } You could move at least a return-address register-save/restore around the function call (which our compiler folks some-times call "shrink-wrapping" it.) However, the idea really has nothing to do with function calls: it could just as well be: glurp() { if (something) { simple statment that needs few registers } else { a whole bunch of code that needs many regs } } In this case, you move any save/restore code into the "else" part. Has anybody actually implemented this? (we haven't yet) -- -john mashey DISCLAIMER: UUCP: {ames,decwrl,prls,pyramid}!mips!mash OR mash@mips.com DDD: 408-991-0253 or 408-720-1700, x253 USPS: MIPS Computer Systems, 930 E. Arques, Sunnyvale, CA 94086