Related articles |
---|
Stack-based IR vs. Register-based IR evan@top.cis.syr.edu (Evan Cheng) (1996-07-20) |
Stack-based IR vs. Register-based IR gough@dstc.qut.edu.au (John Gough) (1996-07-22) |
Re: Stack-based IR vs. Register-based IR patrick_d_logan@ccm.hf.intel.com (Patrick Logan) (1996-07-23) |
Re: Stack-based IR vs. Register-based IR anton@a0.complang.tuwien.ac.at (1996-07-26) |
From: | anton@a0.complang.tuwien.ac.at (Anton Ertl) |
Newsgroups: | comp.compilers |
Date: | 26 Jul 1996 23:22:02 -0400 |
Organization: | Institut fuer Computersprachen, Technische Universitaet Wien |
References: | 96-07-137 |
Keywords: | optimize |
Evan Cheng <evan@top.cis.syr.edu> writes:
|> I am hoping to induce some discussion on the merits (or lack of)
|> of stack-based intermediate representations and register-based ones.
It depends on the purpose. If you want to use the intermediate
representation for interpreting, then a stack-based IR is best, if
your source language translates easily into it. You can find my
arguments on this in
@InProceedings{ertl95pldi,
author = "M. Anton Ertl",
title = "Stack Caching for Interpreters",
crossref = "sigplan95",
pages = "315--327",
url = "http://www.complang.tuwien.ac.at/papers/ertl95pldi.ps.gz",
abstract = "An interpreter can spend a significant part of its
execution time on arguments of virtual machine
instructions. This paper explores two methods to
reduce this overhead for virtual stack machines by
caching top-of-stack values in (real machine)
registers. The {\em dynamic method} is based on
having, for every possible state of the cache, one
specialized version of the whole interpreter; the
execution of an instruction usually changes the
state of the cache and the next instruction is
executed in the version corresponding to the new
state. In the {\em static method} a state machine
that keeps track of the cache state is added to the
compiler. Common instructions exist in specialized
versions for several states, but it is not necessary
to have a version of every instruction for every
cache state. Stack manipulation instructions are
optimized away."
}
If, OTOH I need a sequentialized intermediate representation for the
optimization stage of a compiler targetting a register machine (and
probably even for other architecture classes), I would use a an IR
with an infinte number of registers. Such a representation makes it
easier to reorder code and to introduce new values (e.g., in strength
reduction).
- anton
--
M. Anton Ertl
anton@mips.complang.tuwien.ac.at
http://www.complang.tuwien.ac.at/anton/home.html
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.