Re: Prolog to WAM Register Allocation?

"Ivan A. Kosarev" <>
17 Jan 2006 21:41:51 -0500

          From comp.compilers

Related articles
Prolog to WAM Register Allocation? (Ludwig Wittgenstein) (2006-01-12)
Re: Prolog to WAM Register Allocation? (2006-01-17)
Re: Prolog to WAM Register Allocation? (Jens Kilian) (2006-01-17)
Re: Prolog to WAM Register Allocation? (Ivan A. Kosarev) (2006-01-17)
Re: Prolog to WAM Register Allocation? (russell kym horsell) (2006-01-19)
| List of all articles for this month |

From: "Ivan A. Kosarev" <>
Newsgroups: comp.compilers
Date: 17 Jan 2006 21:41:51 -0500
Organization: Compilers Central
References: 06-01-040
Keywords: prolog
Posted-Date: 17 Jan 2006 21:41:51 EST


"Ludwig Wittgenstein" <> wrote
> I'm currently studying how Prolog compiles its source into Warren
> Abstract Machine code and I was wondering what kind of algorithm does
> Prolog use to assign variables and constants to X and Y registers?
> For instance, predicate(X,Y,john) allocates X1 for X, X2 for Y, and X3
> for john ? or, when I pass a query ?- lives_in(john, X) Do I assume
> that X variable is bound value is in X1 or X2?

I'm not sure it would be reasonable to perform register allocation
directly from Prolog programs, since they are more likely databases,
not execution paths. Generally, what way a Prolog program will execute
depends from a goal a Prolog machine should solve, not the program

> I've seen numerous literature on code generation/register allocation
> for imperative languages (on register-based machines and stack-based
> machines) but there seems to be no literature at all on how Prolog code
> generation against Warren Abstract machines (Ait-Kaci's book barely
> touches on this subject). Any idea on where such information could be
> found?

Will you know how to construct a CFG for a Prolog program, the totally
same principles would be used to write a register allocation mechanism
for your Prolog compiler.
Unicals Group -- Development Tools for OEMs

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.