Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!uunet!world!iecc!compilers-sender From: mike@taumet.com (Michael S. Ball) Newsgroups: comp.compilers Subject: Re: Parameter Passing Via Registers Keywords: optimize, registers, Pascal, Modula Message-ID: <698@taumet.com> Date: 30 Apr 91 16:03:50 GMT References: <1991Apr30.022048.4539@iecc.cambridge.ma.us> Sender: compilers-sender@iecc.cambridge.ma.us Reply-To: mike@taumet.com (Michael S. Ball) Organization: Taumetric Corporation, San Diego Lines: 27 Approved: compilers@iecc.cambridge.ma.us In article <1991Apr30.022048.4539@iecc.cambridge.ma.us> Chuck Lins writes: >Does anyone know how nested procedures affect the ability to pass parameters >via registers? If there was no up-level access everything would work fine, >but with this facility you get all sorts of problems. Uplevel access would >also seem to affect dataflow analysis (the compiler could think that a >variable is 'dead' when in reality it's going to get accessed by a nested >local procedure. Actually, since you have the bodies of the nested procedures available before compiling the body of the enclosing procedure you have all of the data necessary to do a good job. Any register parameter which is used by uplevel reference is simply stored on the stack, just as it would be in a C function using varargs. I don't know that Pascal and Modula compilers pass parameters on the stack any more than C compilers do. My experience is that they use the calling sequence established by the execution environment. Of course with languages like Pascal which encourage internal linkage, compilers are able to establish their own sequences, and on machines like the VAX, where calls are expensive, they frequently do. You can do the same with C, but static functions seem to be rare. -- Michael S. Ball mike@taumet.com TauMetric Corporation (619)697-7607 -- Send compilers articles to compilers@iecc.cambridge.ma.us or {ima | spdcc | world}!iecc!compilers. Meta-mail to compilers-request.