Dear Amoss,
I have got the following specialized program:
%%%%%%%%%%%%%%%%%% :- module( _exec, [addvals/3], [assertions] ).
:- entry addvals(x,y,x).
addvals(x,y,x) :- movf(10,0), addwf(13,0), movwf(10), movf(11,0), addwf(14,0), movwf(11), movf(12,0), addwf(15,0), movwf(12). %%%%%%%%%%%%%%%%%%%
which is, I believe, what you want.
I have done a couple of changes to your initial program, though.
- I have uncommented the use_module(pic), which is needed - I have replaced the initial module declaration:
:- module(_,_).
with
:- module(_,[addvals/3]).
The difference is that the first declaration means that all predicates in the module are exported (regardless of whether you later add entry declarations for them or not).
If you only want to specialize the program for predicate addvals, then the second declaration is what you want. Note that otherwise the rest of predicates in the module cannot be safely considered dead code because they are exported and they are potentially used from outside.
Ah, I had a hunch that would do it. This is fine for now but later we may need to specialise predicates that are in other modules, is there an easy way to do this?
There are two ways. One is to add "eval" assertions for exported predicates which allow the partial evaluator to fully compute calls to predicates in other modules.
Another possibility is to ask ciaopp to generate a monolithic program from a set of modules. In that program, all predicate names are module qualified an all code can live in a single module.
German