Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker!spdcc!esegue!compilers-sender From: worley@compass.com (Dale Worley) Newsgroups: comp.compilers Subject: Register allocation in the presence of pointers Message-ID: <1990Feb22.180326.11309@esegue.segue.boston.ma.us> Date: 22 Feb 90 18:03:26 GMT Sender: compilers-sender@esegue.segue.boston.ma.us Reply-To: worley@compass.com (Dale Worley) Organization: Compilers Central Lines: 19 Approved: compilers@esegue.segue.boston.ma.us Mohd Hanafiah b. Abdullah writes: > How does one perform register allocation on scalar variables that may > be pointed to by others? The usual strategy is to never leave the value of the variable in a register, since it may be fetched or modified at any time via the pointer. On some hardware, registers have addresses and this conservative strategy may not be needed. A more interesting approach would be to analyze which parts of the program might reference the variable through a pointer and which can not -- then you know in which parts of the program you have to leave the value in its "official" location and in which parts you can leave the variable in a register. This requires serious global data-flow analysis, which, although possible, is rarely implemented. Dale Worley Compass, Inc. worley@compass.com -- Send compilers articles to compilers@esegue.segue.boston.ma.us {spdcc | ima | lotus}!esegue. Meta-mail to compilers-request@esegue. Please send responses to the author of the message, not the poster.