[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
A question about tweaking the 3600 Lisp Compiler
I am doing some experiments where I compile SAT problems
(Boolean satisfiability) and CSP problems (Constraint Satisfaction
problems) directly into very tight Lisp code. The code is very simple.
It is not very Lisp-like and ressembles Assembler code. It is all one
large PROG with lots of IF-EQ-GOTOs and some SETQs to local variables.
I can generate such code from the SAT/CSP problems quite quickly. The good
thing about such code is that once it is compiled it runs exceedingly
quickly (about 10,000 times faster than other more sophisticated SAT/CSP
solvers which I have tried). The only problem is that the 3600 Lisp compiler
takes forever to compile the large proceedures which my SAT/CSP-Lisp translater
generates because of all of the optimization which is being done. All of
that optimization is useless for this application as the code which I
generate has a trivial one-to-one correspondence to the most optimal
3600 machine instruction sequences which the compiler ends up prducing.
I tried setting both COMPILER:*PHASE-1-OPTIMIZE-P* and COMPILER:*RUN-PHASE-3*
to NIL. That helped a bit but not enough.
Question 1: How do I turn off ALL optimizations.
Question 2: I know the machine code sequences which I want to generate.
There are only two general templates of length 6 and 2 instructions
respectively. Can I use an assembler directly and I how do I do that?
Question 3: Is there an indirect GOTO instruction? If there is, how do I
access it directly from lisp? I also need to be able to compare two
PCs as integers and determine which is larger before I branch indirectly
to one of of them. How can I do that?
Below is a sample piece of code which my SAT translater generates:
(PROG (RESULTS P0001 P0002 P0003)
(SETQ RESULTS 'NIL)
(SETQ P0001 NIL)
F0005 (IF P0001 (RETURN RESULTS))
(SETQ P0001 T)
N0004 (IF (NOT P0001) (GO S0006))
S0006 (SETQ P0002 NIL)
F0008 (IF P0002 (GO F0005))
(SETQ P0002 T)
N0007 (IF P0001 (GO S0009))
(IF (NOT P0002) (GO S0009))
S0009 (SETQ P0003 NIL)
F0011 (IF P0003 (GO F0008))
(SETQ P0003 T)
N0010 (IF P0002 (GO S0012))
(IF (NOT P0003) (GO S0012))
S0012 (PUSH (LIST (CONS 'A (IF P0001 :TRUE :FALSE))
(CONS 'B (IF P0002 :TRUE :FALSE))
(CONS 'C (IF P0003 :TRUE :FALSE)))
(IF ALL? (GO F0011) (RETURN RESULTS))))
Please respond to Qobi@XX.LCS.MIT.EDU and NOT Siskind.PA@Xerox.COM as I
am leaving PARC today to return to MIT.