2024 Commits

Author SHA1 Message Date
cvs2hg
42e84d8dd2 fixup commit for tag 'distr3' 1989-10-04 10:56:17 +00:00
ceriel
81b1d21c35 Initial revision 1987-04-13 10:32:47 +00:00
ceriel
5fde79eab8 3rd distribution 1987-04-13 10:31:48 +00:00
ceriel
d94970b0ed bug fix 1987-04-13 08:22:22 +00:00
ceriel
ecf8a9b28f Allow for cumulative -V flags. 1987-04-10 18:03:12 +00:00
ceriel
5fbe427853 variable length names 1987-04-09 14:15:25 +00:00
ceriel
9ff877dce5 final update before distribution 3! 1987-04-09 10:08:52 +00:00
ceriel
0177bf59ff Bug fixes and made faster on PDP-11 1987-04-08 17:15:30 +00:00
ceriel
53a6ded473 fix; %ld is not proper for an int 1987-04-08 15:10:26 +00:00
ceriel
651e3d05e4 don't use $?, it does not work properly (?) 1987-04-08 08:56:34 +00:00
ceriel
bfa97d2311 *** empty log message *** 1987-04-07 11:00:10 +00:00
ceriel
7a8485f425 correction for access systemcall 1987-04-07 10:01:57 +00:00
ceriel
924d580670 yet another bug fix 1987-04-07 09:57:50 +00:00
ceriel
e98dffbb1d undid a fix. Actually, the fix was wrong 1987-04-07 09:08:28 +00:00
ceriel
8ebc170ec0 st_blksize does only exist on 4.2 systems 1987-04-07 08:46:15 +00:00
ceriel
a71813b911 Some more bug fixes 1987-04-06 17:59:57 +00:00
ceriel
a30cbae14d Ported to sun 1987-04-06 13:03:05 +00:00
ceriel
6f1166bcce bug fix 1987-04-06 12:33:28 +00:00
ceriel
e04b39f7a2 Added Pascal library 1987-04-06 07:56:49 +00:00
ceriel
7af2ecb17f minor bug fix 1987-04-03 20:13:08 +00:00
ceriel
a85ecb6719 use LDFLAGS, not LFLAGS 1987-04-03 19:58:39 +00:00
ceriel
aad62add90 Bug fix: a character was compared to op_lab, which is >= 128. 1987-04-03 16:48:53 +00:00
ceriel
80ff3e60c4 2 last minute-additions (oh dear ...) 1987-04-03 16:21:24 +00:00
ceriel
4fd846804a Seemed to prefer reg_any registers, which caused addresses of procedures
to end up in data registers on the m68020. This is temporarily fixed,
but actually, the descriptor files could be somewhat more general.
1987-04-03 15:38:52 +00:00
ceriel
e8bc890c10 improved somewhat 1987-04-03 15:06:25 +00:00
ceriel
f31c9f2a67 target optimizer must be installed before trying to install libraries! 1987-04-03 13:24:20 +00:00
ceriel
e4758a2c48 -K becomes -KR 1987-04-03 13:18:38 +00:00
ceriel
86b0bd5df3 Added some more documentation on the global optimizer 1987-04-03 13:14:37 +00:00
ceriel
96d15a6c05 minor mod 1987-04-03 11:18:49 +00:00
ceriel
4b30a95d7a minor mods 1987-04-03 11:16:46 +00:00
ceriel
e0c5bb9ffe some more fixes 1987-04-03 10:51:37 +00:00
ceriel
924f463126 some more corrections 1987-04-02 16:59:27 +00:00
ceriel
5f0802bd2c correct interpreter description files on SYStem V or Sun machines 1987-04-02 14:26:58 +00:00
ceriel
c42541c99b Added declaration for malloc 1987-04-02 14:12:21 +00:00
ceriel
8675bc2b01 bug fixes 1987-04-02 14:09:21 +00:00
ceriel
75a8a6cc64 some bug fixes 1987-04-02 14:04:17 +00:00
ceriel
1fdfb2b738 improved call to C_lin 1987-04-02 13:02:16 +00:00
ceriel
c73f576314 "word" is always a long 1987-04-02 10:26:42 +00:00
ceriel
d2734bbdd9 "word" is always a long 1987-04-02 10:17:06 +00:00
ceriel
5889533297 "word" now is always a long 1987-04-02 10:07:10 +00:00
ceriel
410bfa3cb2 "word" is always a "long" 1987-04-02 10:04:25 +00:00
ceriel
af7b083fd8 "word" is now always a "long" 1987-04-02 09:54:41 +00:00
ceriel
ab6816c074 Allow "|" in "system" lines, must be in quotes 1987-04-02 09:07:05 +00:00
ceriel
22c23521a3 corrected for 4.2 bsd 1987-04-01 15:37:14 +00:00
ceriel
f76127e364 updated for 3rd distribution 1987-04-01 13:50:18 +00:00
ceriel
75cd05c50e Adapted for distribution 3 1987-04-01 13:47:09 +00:00
ceriel
11db9b8fdc Added EMHOME 1987-04-01 08:54:00 +00:00
ceriel
d9f3663dcc Initial revision 1987-04-01 08:28:20 +00:00
ceriel
395b1bc424 Changed strategy somewhat 1987-04-01 08:20:39 +00:00
ceriel
6eee593f31 Initial revision 1987-03-31 22:17:51 +00:00
ceriel
dec576c89d improved "clean" entry 1987-03-31 13:11:31 +00:00
ceriel
1da25fb7a5 minor change to manual page 1987-03-31 12:44:15 +00:00
ceriel
82f042ba98 Also install manual page 1987-03-31 12:33:23 +00:00
ceriel
e97f144bf4 Initial revision 1987-03-31 12:14:08 +00:00
ceriel
8b90e3480a Added Rcs Id 1987-03-31 11:09:18 +00:00
ceriel
e80b36ded2 Added copyright notice 1987-03-31 11:06:20 +00:00
ceriel
b46981f4ce converted to 4-4 1987-03-31 10:58:30 +00:00
ceriel
5d32d4987e Added copyright notice 1987-03-31 10:50:20 +00:00
ceriel
94f87e3557 replaced copyright notice 1987-03-31 10:45:54 +00:00
ceriel
400c036c67 Added Rcs Id 1987-03-31 10:45:53 +00:00
ceriel
9dbda2e573 *** empty log message *** 1987-03-31 10:34:14 +00:00
ceriel
2fba4e5e99 made more portable 1987-03-31 10:05:26 +00:00
ceriel
bc6486d7b0 Ported to other m68000 systems 1987-03-31 09:23:20 +00:00
ceriel
526d769271 *** empty log message *** 1987-03-31 08:42:07 +00:00
ceriel
f67bfc485c moer robust version 1987-03-31 08:16:41 +00:00
ceriel
b53a5e2540 more robust version 1987-03-31 08:15:22 +00:00
ceriel
23aff10b83 Made to work on system V and SUN 1987-03-31 08:05:50 +00:00
ceriel
f18ec81394 *** empty log message *** 1987-03-31 08:02:40 +00:00
ceriel
0bf8f8ce34 layout improvements 1987-03-31 07:56:14 +00:00
ceriel
ceb3fb4ed3 dispatch tables generated now, layout improvements 1987-03-31 07:54:43 +00:00
ceriel
8e4718c760 modified to generate dispatch tables automatically 1987-03-31 07:51:34 +00:00
ceriel
b578202876 minor layout improvements 1987-03-31 07:45:17 +00:00
ceriel
7a583a86ef don't use /usr/lib/ditroff 1987-03-31 07:43:56 +00:00
ceriel
838e83c1f3 minor improvement in layout 1987-03-31 07:42:10 +00:00
ceriel
49e292676e Some improvements 1987-03-31 07:40:45 +00:00
ceriel
2e3f2a4a62 tail_em must be scanned twice, because tail_mon contains C-routines 1987-03-31 07:30:44 +00:00
ceriel
2e948de48c *** empty log message *** 1987-03-31 07:28:06 +00:00
ceriel
8d209d8e01 umount, NOT unmount! 1987-03-31 07:28:05 +00:00
ceriel
2cc1d41f57 Pass preprocessor flags 1987-03-30 13:20:05 +00:00
ceriel
8d5be706a8 No line directives 1987-03-30 13:18:10 +00:00
ceriel
18e5f78f21 Don't use reghp 1987-03-30 12:40:09 +00:00
ceriel
e07da4cad3 don't use reghp 1987-03-30 12:35:46 +00:00
ceriel
3233aaf5a5 renamed systemcalls 1987-03-30 09:39:38 +00:00
ceriel
3f4f469489 moved the mantra part to another place, because it now
also contains the interpreter part.
1987-03-30 09:19:00 +00:00
ceriel
0036c7bd8a Added interpreter 1987-03-30 09:18:03 +00:00
ceriel
db437cbda8 moved interpreter to another place 1987-03-30 09:05:14 +00:00
ceriel
6c84dcbf80 Initial revision 1987-03-30 08:02:43 +00:00
ceriel
44089a20ab Added occam 1987-03-30 08:00:59 +00:00
ceriel
8e8b8c27d7 use own occam library 1987-03-30 07:59:57 +00:00
ceriel
70c76be920 Use own occam library 1987-03-30 07:55:12 +00:00
ceriel
0170bb504b Added Occam 1987-03-30 07:51:20 +00:00
ceriel
0adc61842f Added ICRNL 1987-03-30 07:48:19 +00:00
ceriel
a0542acab4 removed ".byte" 1987-03-29 13:39:14 +00:00
ceriel
9c0aa5e7a3 updated 1987-03-29 13:33:37 +00:00
ceriel
4f41981cd8 modified to do more in the presence of errors 1987-03-29 13:07:44 +00:00
ceriel
a7c65b091b use print library 1987-03-29 13:00:40 +00:00
ceriel
c6cf0725d0 bug fixes 1987-03-29 12:55:25 +00:00
ceriel
de8fb5d489 Minor fixes 1987-03-27 16:39:57 +00:00
ceriel
5458134efb *** empty log message *** 1987-03-27 15:13:05 +00:00
ceriel
e3043b7dcb minor adaption, to close filedescriptor immediatelym if possible 1987-03-27 15:11:06 +00:00
ceriel
19d29e4018 changd values somewhat, added values for small machines 1987-03-27 13:56:50 +00:00
ceriel
1d443b6b4b bug fix 1987-03-27 13:34:46 +00:00
ceriel
ecc1b3b971 .fat --> .fatal 1987-03-27 12:43:17 +00:00
ceriel
dc44540ee8 *** empty log message *** 1987-03-27 12:27:17 +00:00
ceriel
fa4dfdf813 minor fix to LLlex.h 1987-03-27 10:37:58 +00:00
ceriel
46a405c131 *** empty log message *** 1987-03-27 10:06:59 +00:00
ceriel
129343dc94 Franks version 1987-03-27 10:05:53 +00:00
ceriel
0cc30a7e49 franks version 1987-03-27 09:58:03 +00:00
ceriel
2aa64be3a6 Franks version 1987-03-27 09:55:28 +00:00
ceriel
13c208de3b Fraks version 1987-03-27 09:50:57 +00:00
ceriel
ac395ba4a6 Initial revision 1987-03-27 09:47:16 +00:00
ceriel
3177072e2f Frans doodemans version 1987-03-27 09:33:02 +00:00
ceriel
2febff1a79 Frans Doodemans version 1987-03-27 09:28:16 +00:00
ceriel
f4fb73386e fixed 1987-03-27 09:21:14 +00:00
ceriel
cf8d769c73 fixed 1987-03-27 09:06:28 +00:00
ceriel
9c8b34c47d remainder now returned in d0 1987-03-27 08:57:38 +00:00
ceriel
ea63596eb3 remainder now is returned in d0. 1987-03-27 08:49:14 +00:00
ceriel
db5b8614f3 *** empty log message *** 1987-03-26 17:54:45 +00:00
ceriel
e190db8128 Initial revision 1987-03-26 17:36:49 +00:00
ceriel
da28bdd2f0 Adapted for system V 1987-03-26 17:33:23 +00:00
ceriel
21e0bd5996 Initial revision 1987-03-26 17:30:29 +00:00
ceriel
4e19ece566 another fix for an illegal initialisation struct 1987-03-26 16:16:21 +00:00
ceriel
bac2a42c82 added estack.str, minor fix 1987-03-26 15:32:26 +00:00
ceriel
044587ec57 added index 1987-03-26 15:28:08 +00:00
ceriel
32d12a9c7a Another adaption for small machines 1987-03-26 12:45:16 +00:00
ceriel
f37189ba9b modification to make it easier to edit 1987-03-26 12:44:04 +00:00
ceriel
1cfa4a7bec Don't use ranges in the "tr" command. They work differently on
System V
1987-03-26 11:16:28 +00:00
ceriel
4eb84b928b align parameters on word_size, not word_align 1987-03-26 11:05:28 +00:00
ceriel
2f74f819d4 Use "myecho" when using -n option 1987-03-26 10:33:30 +00:00
ceriel
09125cce6b redesign of ival, other minor changes 1987-03-25 23:14:43 +00:00
ceriel
db666da35a improved the "clean" entry 1987-03-25 22:48:25 +00:00
ceriel
8c20d513fd updated 1987-03-25 22:43:09 +00:00
ceriel
c65803b306 made a bit more verbose 1987-03-25 22:26:46 +00:00
ceriel
0cd2bbdc09 updated 1987-03-25 18:52:04 +00:00
ceriel
8a5f7d09c9 minor mods 1987-03-25 17:54:24 +00:00
ceriel
528ec8869b install a smaller malloc 1987-03-25 17:39:18 +00:00
ceriel
e5116f86dc Fixed a problem with SRU: no regs available 1987-03-25 16:26:58 +00:00
ceriel
3e694c1b9d made names of dynamically varying length 1987-03-25 16:24:41 +00:00
ceriel
eeb5148f29 BMASK was unsigned, which caused problems with some C compilers (ours) 1987-03-25 15:57:22 +00:00
ceriel
7f60f6f8c1 Added possibility to pass -V option to compilers 1987-03-25 12:42:12 +00:00
ceriel
032929c22c changed IDL 1987-03-25 10:53:47 +00:00
ceriel
9748f946ce Allow ANY to be used in a constraint 1987-03-25 08:35:01 +00:00
ceriel
a0897e2ed3 Generated illegal initialization constants. 1987-03-25 07:53:57 +00:00
ceriel
f408948925 description of asopt apparently has to be in front of the one for as. 1987-03-25 07:49:59 +00:00
ceriel
1dd241938c replaced cc by $(CC) 1987-03-24 11:10:23 +00:00
ceriel
34f41d7bf1 bug fix 1987-03-24 08:41:44 +00:00
ceriel
43c55159d6 more porting to pdp 11 1987-03-23 23:27:03 +00:00
ceriel
e67b672727 more porting to vu45 1987-03-23 23:22:54 +00:00
ceriel
91b39c7df7 Replaced comment char '#' with '!'.
Some shells use # as a comment char.
1987-03-23 21:01:36 +00:00
ceriel
1694c10f39 Adapted for new distribution 1987-03-23 21:00:02 +00:00
ceriel
391f6cc9ea could not be handled by MINIX pre-processor 1987-03-23 14:48:56 +00:00
ceriel
375b5e9182 Bug fix in BLM 1987-03-20 19:21:23 +00:00
ceriel
4e03fc78dd many minor fixes and modifications 1987-03-20 08:30:31 +00:00
ceriel
73818f1a53 bug fix 1987-03-19 11:21:54 +00:00
ceriel
bcd037018f still does not fit. Delete bitfields 1987-03-19 10:51:40 +00:00
ceriel
878cbab737 deleted "unsigned chars" 1987-03-19 10:20:40 +00:00
ceriel
b86dc9f84d adapted for 7 character significance 1987-03-19 10:16:56 +00:00
ceriel
8829d77144 made name shorter 1987-03-19 10:15:58 +00:00
ceriel
88db8b43da Added distr entry 1987-03-19 10:12:51 +00:00
ceriel
fd1682052d contained a switch on a long 1987-03-19 10:08:31 +00:00
ceriel
74a1a176c5 em?.o and C_failed.o must be at the end of the archive 1987-03-18 19:20:38 +00:00
ceriel
dcf7aa2723 Also install manual page 1987-03-18 19:15:56 +00:00
ceriel
80fd06aa6a Added LDFLAGS 1987-03-18 09:50:46 +00:00
ceriel
bede819e42 Made the dummy ranlib more verbose 1987-03-18 09:44:56 +00:00
ceriel
5fe6bf0fcd made to work on pdp-11 1987-03-18 09:35:31 +00:00
ceriel
8e9f1f781c changed some names of field selectors 1987-03-18 09:29:56 +00:00
ceriel
50a71251a1 contained calls of non-functions 1987-03-17 22:54:16 +00:00
ceriel
717af548d5 improved userhook handling, requiring a change in LLnext and LLskip 1987-03-17 22:50:40 +00:00
ceriel
451c0d6679 improved userhook handling, This required some changes in the semantics
of LLnext and LLskip.
1987-03-17 22:41:18 +00:00
ceriel
78303cdc07 improved storage allocation 1987-03-17 22:31:43 +00:00
ceriel
10080ca0f2 deleted exit.c 1987-03-17 22:28:15 +00:00
ceriel
f95c97b38c Use LDFLAGS 1987-03-17 16:37:04 +00:00
ceriel
bbce3bd894 use LDFLAGS 1987-03-17 16:33:55 +00:00
ceriel
15382edbd6 *** empty log message *** 1987-03-17 16:24:42 +00:00
ceriel
b7cd38ab12 Use LDFLAGS 1987-03-17 16:18:08 +00:00
ceriel
2d9f4d8c03 LDFLAGS: -i 1987-03-17 16:15:32 +00:00
ceriel
ee4d170525 Made constants dependant on size of machine 1987-03-17 14:42:12 +00:00
ceriel
a6b6375985 Don't switch on longs! 1987-03-17 11:12:09 +00:00
ceriel
e203ddb7b6 Don't use the -n option! 1987-03-17 11:02:37 +00:00
ceriel
321fa30a5f bug fix 1987-03-17 10:44:16 +00:00
ceriel
d676a5df2a Bug fix 1987-03-17 10:39:18 +00:00
ceriel
58923cbcc0 prevent use of ranlib on pdp-11's 1987-03-17 00:33:41 +00:00
ceriel
2e7ca940c2 many changes for installing 3rd distribution 1987-03-17 00:14:10 +00:00
ceriel
49714af3e6 *** empty log message *** 1987-03-17 00:13:03 +00:00
ceriel
c5b11f6ad3 Initial revision 1987-03-16 23:53:04 +00:00
ceriel
89c7440c0d Initial revision 1987-03-16 23:32:34 +00:00
ceriel
c41f370421 Added LEXLIB 1987-03-16 22:35:21 +00:00
ceriel
52cc95b957 Added a %p (number of positions). The BSD 2.9 lex has a too small default. 1987-03-16 22:28:27 +00:00
ceriel
9a07fc841f Default paths were computed wrong. This is corrected. 1987-03-16 22:26:03 +00:00
ceriel
d52e25949a Indirect function calls should be just that! 1987-03-16 15:14:52 +00:00
ceriel
e140a87a6b bug fix 1987-03-16 15:11:51 +00:00
ceriel
617303659c Deleted reference to unused varaibles 1987-03-16 15:09:36 +00:00
ceriel
2135ccd420 %c does not work with null-bytes on some systems (BSD 2.9) 1987-03-16 08:56:31 +00:00
ceriel
909a82d2d7 updated 1987-03-12 23:46:19 +00:00
ceriel
dbfe40a080 The updated installation guide for distribution 3 1987-03-12 23:44:29 +00:00
ceriel
3f75d2b08f Added -Dvoid=int to CFLAGS 1987-03-12 22:50:03 +00:00
ceriel
21b427d4df made just a little bit more robust 1987-03-12 22:29:25 +00:00
ceriel
4549b5129d don't use "void"! 1987-03-12 22:24:19 +00:00
ceriel
60f9d1b6c6 don't use void! 1987-03-12 22:23:17 +00:00
ceriel
9ab7bf2408 Bug fixes 1987-03-12 19:18:59 +00:00
ceriel
755ea27d46 Added room for data, made room for rom smaller 1987-03-12 17:53:32 +00:00
ceriel
3f566164c2 Bug fixed that prevented "aal x" from working properly 1987-03-12 17:16:04 +00:00
ceriel
dbac04eb47 removed the "void" stuff. Some compilers just don't digest it. 1987-03-12 11:33:24 +00:00
ceriel
991c568ee4 moved the definition of sys_filesize. It had a funny place. 1987-03-12 09:30:03 +00:00
ceriel
9d744c31c3 Replaced the comment character by a !.
The #-character caused problems.
1987-03-12 08:46:58 +00:00
ceriel
7ae0622730 replaced copyright notice 1987-03-12 08:25:15 +00:00
ceriel
e0aa93de4c replaced copyright 1987-03-12 08:23:08 +00:00
ceriel
d8463c9bc4 it's --> its 1987-03-11 21:47:25 +00:00
ceriel
4bbe1cfa65 Added ashow 1987-03-11 17:12:38 +00:00
ceriel
9a3d983659 Initial revision 1987-03-11 17:12:23 +00:00
ceriel
1452a26361 minor mod 1987-03-11 16:15:16 +00:00
ceriel
bdebe50836 *** empty log message *** 1987-03-11 15:55:51 +00:00
ceriel
edcea8f6db Updated for 3rd distribution 1987-03-11 15:51:35 +00:00
ceriel
50b2140d46 Adapted to current situation 1987-03-11 15:41:52 +00:00
ceriel
e2eeea5162 remove regnoglob.c and regglob.c before copying to them 1987-03-11 15:39:01 +00:00
ceriel
35f5f8e187 *** empty log message *** 1987-03-11 15:16:01 +00:00
ceriel
f8e02e5d4c Added arch.5 1987-03-11 15:09:25 +00:00
ceriel
32fa870855 Initial revision 1987-03-11 15:07:29 +00:00
ceriel
b99a714497 minor changes 1987-03-11 14:54:29 +00:00
ceriel
778948b661 Working version 1987-03-11 14:30:13 +00:00
ceriel
f6083608f9 minor change 1987-03-11 14:19:02 +00:00
ceriel
f694435063 minor change 1987-03-11 13:56:17 +00:00
ceriel
e86b8463ea minor change 1987-03-11 13:34:07 +00:00
ceriel
9d24b2a46b *** empty log message *** 1987-03-11 13:13:49 +00:00
ceriel
9e0913d6e4 Initial revision 1987-03-11 13:13:36 +00:00
ceriel
e03d11afa2 Bug fix. 1987-03-11 11:13:55 +00:00
ceriel
7aa7619c4e *** empty log message *** 1987-03-11 11:05:32 +00:00
ceriel
9db939f74e Added sun2 1987-03-11 09:50:23 +00:00
ceriel
96fd613e89 Added a "distr" entry 1987-03-11 09:49:33 +00:00
ceriel
8a9b2379dc Bug fixed that was introduced by Kees Visser's modifications 1987-03-11 09:23:23 +00:00
ceriel
07f5d3cce4 Fixed a bug with line-directives, added copyright notice 1987-03-10 17:51:10 +00:00
ceriel
94ff96cf1f bug fix 1987-03-10 17:41:37 +00:00
ceriel
fb775d4ead Bug fix 1987-03-10 17:38:55 +00:00
ceriel
12f56d6501 Initial revision 1987-03-10 16:49:13 +00:00
ceriel
b234851f00 Deleted -DUSG 1987-03-10 15:55:39 +00:00
ceriel
6338348877 Added __USG 1987-03-10 15:54:32 +00:00
ceriel
c6dee66c71 Deleted -DBSD4_2 1987-03-10 15:45:38 +00:00
ceriel
4cf6acb1e2 *** empty log message *** 1987-03-10 15:44:25 +00:00
ceriel
8fb04a83bc Removed -DBSD4_2 1987-03-10 15:41:20 +00:00
ceriel
587c766673 Added CC_ALIGN 1987-03-10 15:40:20 +00:00
ceriel
76fea1fbca __USG and __BSD4_2 introduced, dysize added 1987-03-10 15:07:26 +00:00
ceriel
6852a8ef39 use __BSD4_2 1987-03-10 14:50:48 +00:00
ceriel
517baed1b1 use __BSD4_2 and __USG 1987-03-10 14:49:29 +00:00
ceriel
2e4cf6fe8c Added a define for __BSD4_2 1987-03-10 14:14:38 +00:00
ceriel
85d5cf1407 ino_t is a long on 4.2 systems 1987-03-10 14:10:34 +00:00
ceriel
053564d9e9 Added Rcs Id 1987-03-10 11:58:22 +00:00
ceriel
6eaf182cee Added Rcs Id 1987-03-10 11:49:39 +00:00
ceriel
16687889e3 *** empty log message *** 1987-03-10 10:27:24 +00:00
ceriel
32ca133da5 Initial revision 1987-03-10 10:23:19 +00:00
ceriel
a18b0fbcff Initial revision 1987-03-10 10:09:07 +00:00
ceriel
4f0cb4abe1 Added Rcs Id 1987-03-10 09:24:02 +00:00
ceriel
6c812387fd Added copyright notice 1987-03-10 01:42:07 +00:00
ceriel
5537abbdfb Added copyright notice 1987-03-10 01:26:51 +00:00
ceriel
7649bba8f5 Added copyright notice 1987-03-10 00:12:40 +00:00
ceriel
0772a09303 *** empty log message *** 1987-03-09 23:50:41 +00:00
ceriel
b43fed4fbc Added copyright notice 1987-03-09 23:47:46 +00:00
ceriel
7270bbb7f0 Added copyright notice 1987-03-09 22:11:47 +00:00
ceriel
a0eea34497 Added copyright notice 1987-03-09 22:06:21 +00:00
ceriel
49ac6c4e07 Added copyright notice 1987-03-09 21:59:22 +00:00
ceriel
462cb0421f Added copyright notice 1987-03-09 21:33:18 +00:00
ceriel
d6e4d5a18c Added copyright notice 1987-03-09 21:20:21 +00:00
ceriel
815166e421 Added copyright notice 1987-03-09 19:15:41 +00:00
ceriel
7880748ecd Added copyright notice 1987-03-09 16:02:32 +00:00
ceriel
aae2cebccd Initial revision 1987-03-09 15:53:04 +00:00
ceriel
f43b2cb2bd Adapted for new version 1987-03-09 15:48:43 +00:00
ceriel
4e5611ac7b Added copyright notice 1987-03-09 15:22:58 +00:00
ceriel
b8835cee3f Added copyright notice 1987-03-09 15:15:03 +00:00
ceriel
c428b33acc replaced return by exit 1987-03-09 14:22:45 +00:00
ceriel
262490efaa Replaced return from main by exit 1987-03-09 13:29:04 +00:00
ceriel
11af9f9716 replaced returns from main by exits (bloody SUN) 1987-03-09 13:25:44 +00:00
ceriel
bb787ae7cb Added exit from main 1987-03-09 13:22:45 +00:00
ceriel
2fba9c579e Added exit to main program of tab.c 1987-03-09 13:19:38 +00:00
ceriel
1583b4191a Added an exit from main 1987-03-09 13:14:32 +00:00
ceriel
1fdc5a5fe6 replaced returns from main by exits (bloody SUN) 1987-03-09 13:07:42 +00:00
ceriel
717baa8bd8 Added exit to main 1987-03-09 13:04:58 +00:00
ceriel
0bec865e32 Added an exit from main 1987-03-09 13:01:51 +00:00
ceriel
29a4a0266b exit from main, instead of return (bloody SUN) 1987-03-09 12:59:18 +00:00
ceriel
40424d5864 exit from main instead of return (bloody SUN) 1987-03-09 12:55:24 +00:00
ceriel
ead0c95f43 Added an exit form main 1987-03-09 12:54:03 +00:00
ceriel
839be66f85 exit from main instead of return 1987-03-09 12:52:10 +00:00
ceriel
8fc79aa735 to3dig did not give a return value 1987-03-09 12:47:23 +00:00
ceriel
c094aebd80 Select did not handle these HOL's 1987-03-09 12:42:42 +00:00
ceriel
dea6cc76e3 exits instead of returns from main (bloody SUN) 1987-03-09 11:45:49 +00:00
ceriel
236c6c40f0 Added a warning for floating point constants 1987-03-09 11:25:28 +00:00
ceriel
49fc462ee5 *** empty log message *** 1987-03-09 10:43:44 +00:00
ceriel
fa0f6cd0c6 Lindseys fix to a bug with nested procedures 1987-03-09 10:15:51 +00:00
ceriel
539c95237e remove dummy when cleaning 1987-03-06 16:40:56 +00:00
ceriel
eef81c09bb Initial revision 1987-03-06 16:36:16 +00:00
ceriel
742a4d91d4 Initial revision 1987-03-06 14:41:52 +00:00
ceriel
1be18e9a48 Initial revision 1987-03-06 09:02:15 +00:00
ceriel
3c9b5ad0bd deleted idepth 1987-03-06 08:38:29 +00:00
ceriel
5f15b0bce0 Now really NOFLOAT 1987-03-06 00:00:34 +00:00
ceriel
f1f98288e0 Handle NOFLOAT 1987-03-05 19:55:40 +00:00
ceriel
4539fd3e09 bug fix 1987-03-05 19:27:53 +00:00
ceriel
a39c668bab *** empty log message *** 1987-03-05 19:24:35 +00:00
ceriel
1a5d5ddec2 procentry/procexit were not called properly 1987-03-05 19:22:33 +00:00
ceriel
f36ee6de55 could loop again 1987-03-05 17:40:48 +00:00
ceriel
7559525e48 ADB dumped core on the SUN, because of 0-indexes in the symbol table.
They are replaced by pointers to null-strings
1987-03-05 15:44:17 +00:00
ceriel
a1c73c0335 main exits instead of returns. Bloody SUNs 1987-03-05 15:22:05 +00:00
ceriel
1ac5d646cf *** empty log message *** 1987-03-05 15:04:44 +00:00
ceriel
6ac8c31b76 Improved installation procedure 1987-03-05 15:00:13 +00:00
ceriel
8fbd81a884 A wrong flag is no longer fatal 1987-03-05 14:57:15 +00:00
ceriel
11ef9eed01 divu.l, etc where encoded wrong. 1987-03-05 11:21:34 +00:00
ceriel
66c5ebf42f Only echo the newlines in comments, no formfeeds, etc, because
you don't know what you are preprocessing.
1987-03-05 11:07:16 +00:00
ceriel
3e68ea031b Bug fix in LIM instruction 1987-03-05 11:02:05 +00:00
ceriel
bb51b8f4c0 *** empty log message *** 1987-03-05 10:59:57 +00:00
ceriel
f87e83c697 ??? 1987-03-05 10:57:33 +00:00
ceriel
a3426ca0e2 *** empty log message *** 1987-03-04 16:43:03 +00:00
ceriel
8c3fc983bc Also remove "main" when making clean 1987-03-04 15:46:02 +00:00
ceriel
5380ae4768 Set "saveemp" before calling compute. compute might need it. 1987-03-04 10:34:57 +00:00
ceriel
0b92bc0cd7 Set saveemp before calling "compute". "compute" might need it! 1987-03-04 10:32:22 +00:00
ceriel
48296556f5 fixed typo 1987-03-04 10:14:13 +00:00
ceriel
55b3557f22 *** empty log message *** 1987-03-04 10:01:01 +00:00
ceriel
25dfa91caa *** empty log message *** 1987-03-04 09:54:23 +00:00
ceriel
bb6058feaa Remove .c files after making "all" 1987-03-03 15:52:36 +00:00
ceriel
a2da7ad5f8 Don't remove .c files 1987-03-03 15:52:09 +00:00
ceriel
b7ee0bf85e *** empty log message *** 1987-03-03 11:22:29 +00:00
ceriel
652354e59d Replaced returns from main by exits (bloody suns!) 1987-03-03 11:13:52 +00:00
ceriel
48cc05ccf2 *** empty log message *** 1987-03-03 11:11:39 +00:00
ceriel
004f017550 Initial revision 1987-03-03 10:59:52 +00:00
ceriel
4d4c8b45fb *** empty log message *** 1987-03-03 10:49:10 +00:00
ceriel
295380491f Initial revision 1987-03-03 10:44:56 +00:00
ceriel
2d362c2274 Added Henri's article 1987-03-03 10:43:03 +00:00
ceriel
fcaf807aed Initial revision 1987-03-03 10:25:25 +00:00
ceriel
2f9ab80205 Initial revision 1987-03-03 09:46:29 +00:00
ceriel
c32da75ccd Initial revision 1987-03-03 09:37:26 +00:00
ceriel
1194f5f28c Initial revision 1987-03-03 08:48:53 +00:00
ceriel
c4a8f2371d *** empty log message *** 1987-03-03 08:43:46 +00:00
ceriel
c5f0e41be9 clean up the mess after compiling 1987-03-02 19:30:24 +00:00
ceriel
154bb5df06 Now uses BIGMACHINE from local.h 1987-03-02 17:30:37 +00:00
ceriel
30d1a948c8 Added "BIGMACHINE" 1987-03-02 17:28:50 +00:00
ceriel
5097663cb8 Bug foix 1987-03-02 17:18:11 +00:00
ceriel
04618dbe64 Don't pass -O to lint. 1987-03-02 16:48:46 +00:00
ceriel
721de974ee Bug fix 1987-03-02 16:43:19 +00:00
ceriel
70a459a112 Be a bit more tolerant about line directives. 1987-03-02 16:40:14 +00:00
ceriel
cc70e683c7 Adapted for new framework. 1987-03-02 16:22:15 +00:00
ceriel
eb5d7ef3fe Improved userhooks 1987-03-02 16:15:07 +00:00
ceriel
b457c3dc09 Adapted to current situation 1987-03-02 13:30:52 +00:00
ceriel
27a779e535 Adapted to current situation and format 1987-03-02 13:13:24 +00:00
ceriel
e41a9f5b9c Added manual pages 1987-03-02 13:08:51 +00:00
ceriel
f9b1523794 Initial revision 1987-03-02 13:06:23 +00:00
ceriel
033000c4e1 Added manaul page 1987-03-02 13:03:17 +00:00
ceriel
a08ef0e369 *** empty log message *** 1987-03-02 12:54:52 +00:00
ceriel
bc1fb58cd6 SHARE --> SHR 1987-03-02 12:42:38 +00:00
ceriel
a584a04f03 fixed typo 1987-03-02 12:31:44 +00:00
ceriel
b0d2a7c913 Initial revision 1987-03-02 11:28:52 +00:00
ceriel
e4af749931 Adapted to current situation 1987-03-02 10:35:44 +00:00
ceriel
611c948140 reordering, becaiuseuse "cmisc" utilities were needed before "modules" 1987-03-02 09:09:16 +00:00
ceriel
f1fc51c85c Sun defines tmpfile in stdio.h. Renamed Tmpfile 1987-03-02 09:06:26 +00:00
ceriel
1e10c0cf98 maxchunk definition made static 1987-03-02 08:55:23 +00:00
ceriel
b10452c2dc Forced first linedirective with source filename 1987-03-02 08:50:08 +00:00
ceriel
8ed274e96e *** empty log message *** 1987-03-02 08:48:36 +00:00
ceriel
3115fb5402 Initial revision 1987-02-27 17:11:54 +00:00
ceriel
a40c4a87ba Patched to work also on machines on which the shell "remembers"
where a command is. (Bloody Sun).
1987-02-27 17:10:36 +00:00
bruce
2f204ff2ca Initial revision 1987-02-27 16:04:07 +00:00
ceriel
d0103bd7d9 *** empty log message *** 1987-02-27 13:07:49 +00:00
ceriel
a3d34a0e63 *** empty log message *** 1987-02-27 12:54:03 +00:00
ceriel
13a3574979 used to dump core on empty files 1987-02-27 09:54:23 +00:00
ceriel
f5099e7d9a *** empty log message *** 1987-02-26 19:54:57 +00:00
ceriel
f8204dc8a9 newer version 1987-02-26 19:49:42 +00:00
ceriel
7932234ed8 Added Occam 1987-02-26 19:47:01 +00:00
ceriel
59de9303c5 Initial revision 1987-02-26 19:46:35 +00:00
ceriel
e10e56542d *** empty log message *** 1987-02-26 19:41:49 +00:00
ceriel
474d2fb2c6 Ported to System V 1987-02-26 17:58:55 +00:00
ceriel
45bae5569b Deleed mantra4 1987-02-26 16:31:26 +00:00
ceriel
eee1d86fc3 *** empty log message *** 1987-02-26 16:22:08 +00:00
ceriel
d35866d832 Added cv 1987-02-26 16:18:39 +00:00
ceriel
5939ce9331 Added the cv program 1987-02-26 16:05:00 +00:00
ceriel
a7329c38e3 Updated 1987-02-26 15:44:00 +00:00
ceriel
0e0071d790 Added another pattern 1987-02-26 15:40:44 +00:00
ceriel
8c0d727dc1 Bug fix in strswap 1987-02-26 14:08:16 +00:00
ceriel
509439d906 Added ocm, m2, ego, opt2, . 1987-02-26 12:45:37 +00:00
ceriel
63f1aea871 Added the SUFFIX variable 1987-02-26 12:44:11 +00:00
ceriel
c4e1e516ee Adapted to current situation 1987-02-26 10:29:12 +00:00
ceriel
690cd32023 Initial revision 1987-02-26 10:26:19 +00:00
ceriel
00b8ca7b58 Added Occam 1987-02-26 10:24:07 +00:00
ceriel
f06b2707b9 Added Occam 1987-02-26 10:06:50 +00:00
ceriel
51eff14456 Initial revision 1987-02-26 09:55:46 +00:00
ceriel
84e04a4859 Added Occam 1987-02-25 19:45:49 +00:00
ceriel
cfd7ba8bbb *** empty log message *** 1987-02-25 19:45:18 +00:00
ceriel
4922093f24 Initial revision 1987-02-25 19:45:17 +00:00
ceriel
897d312a1d Adeded Occam 1987-02-25 19:44:22 +00:00
ceriel
457e3f6033 Added OPccam 1987-02-25 19:40:22 +00:00
ceriel
59e9948aac Initial revision 1987-02-25 19:16:28 +00:00
ceriel
3ab2228a8b *** empty log message *** 1987-02-25 19:10:01 +00:00
ceriel
992a6a39c5 Added occam 1987-02-25 19:05:21 +00:00
ceriel
b66b1b1965 adapted for new C-compiler 1987-02-25 19:00:04 +00:00
ceriel
3b2e80225a *** empty log message *** 1987-02-25 18:54:14 +00:00
ceriel
1fddbd0ee3 Initial revision 1987-02-25 18:30:22 +00:00
ceriel
32be4760cd Initial revision 1987-02-25 17:14:10 +00:00
ceriel
cc60420184 *** empty log message *** 1987-02-25 16:58:32 +00:00
ceriel
a5d96ae90f my version (CJ) 1987-02-25 16:56:31 +00:00
ceriel
cf04776017 *** empty log message *** 1987-02-25 16:42:41 +00:00
ceriel
0d6d5ff541 Initial revision 1987-02-25 16:41:54 +00:00
ceriel
362378a94a my version (CJ) 1987-02-25 16:41:09 +00:00
ceriel
59fd6b0334 *** empty log message *** 1987-02-25 13:47:15 +00:00
ceriel
a2c18875f6 *** empty log message *** 1987-02-25 11:04:30 +00:00
ceriel
c57a723546 *** empty log message *** 1987-02-24 18:41:53 +00:00
ceriel
2eeacf071a Initial revision 1987-02-24 18:36:02 +00:00
ceriel
bc94559e4d Initial revision 1987-02-24 17:05:53 +00:00
ceriel
a731f979b0 many new things 1987-02-24 16:41:01 +00:00
ceriel
7dc1c84031 Adapted to new distr3 1987-02-24 16:36:22 +00:00
ceriel
c05eb0a5c7 *** empty log message *** 1987-02-24 16:07:04 +00:00
ceriel
3edd0994c6 Added ncgg.6 1987-02-24 15:47:05 +00:00
ceriel
e51bf3a056 *** empty log message *** 1987-02-24 15:44:46 +00:00
ceriel
3a91ff6da5 renamed a parameters because a local had the same name 1987-02-24 15:41:16 +00:00
ceriel
ac7976eea9 *** empty log message *** 1987-02-24 15:36:34 +00:00
ceriel
40a36c570e vi Ma 1987-02-24 15:32:48 +00:00
ceriel
0d6f436e2f *** empty log message *** 1987-02-24 13:47:23 +00:00
ceriel
9cab0b0105 *** empty log message *** 1987-02-24 13:10:59 +00:00
ceriel
5817719a7c An #endif was missing 1987-02-24 12:38:21 +00:00
ceriel
c24b0dad86 Initial revision 1987-02-24 11:17:50 +00:00
ceriel
fef3cce6e0 solved some problems with include files 1987-02-24 10:54:20 +00:00
ceriel
45bffe9e26 solved a problem with include files 1987-02-24 10:49:54 +00:00
ceriel
141753d598 still referred to BadAssertion.c instead of BadAssert.c 1987-02-24 10:45:54 +00:00
ceriel
4c11fded37 4/4, new C compiler 1987-02-24 10:15:46 +00:00
ceriel
bbcf72b0e4 4/4, new C cmpiler 1987-02-24 10:00:37 +00:00
ceriel
ea8fd6991c *** empty log message *** 1987-02-23 23:35:42 +00:00
ceriel
aa2add89cd *** empty log message *** 1987-02-23 23:28:06 +00:00
ceriel
780c7ba10d *** empty log message *** 1987-02-23 22:49:20 +00:00
em
eb02375ee5 do not generate .c files when cleaninmg up 1987-02-23 22:38:45 +00:00
em
7a946c5bf4 cleanup --> clean 1987-02-23 22:35:21 +00:00
ceriel
98654d6c0f *** empty log message *** 1987-02-23 19:48:17 +00:00
ceriel
47d61c3ae9 Initial revision 1987-02-23 19:47:00 +00:00
ceriel
4fe6ea9c8a *** empty log message *** 1987-02-23 19:39:57 +00:00
ceriel
f8b59e9308 Initial revision 1987-02-23 19:38:14 +00:00
ceriel
3baea33f46 *** empty log message *** 1987-02-23 19:18:57 +00:00
ceriel
d640f098b9 updated to current situation 1987-02-23 19:15:33 +00:00
ceriel
75cfdc06c6 Initial revision 1987-02-23 19:14:34 +00:00
ceriel
a8ef006163 *** empty log message *** 1987-02-23 19:08:18 +00:00
ceriel
5bb235c02a Initial revision 1987-02-23 19:04:27 +00:00
ceriel
4ffb6fe8bd Initial revision 1987-02-23 18:58:58 +00:00
ceriel
318e1bfec8 *** empty log message *** 1987-02-23 18:28:42 +00:00
ceriel
925ec7555f bug fix 1987-02-23 15:48:27 +00:00
ceriel
e2ab98dea0 *** empty log message *** 1987-02-23 14:22:16 +00:00
ceriel
3ce0d62f83 Initial revision 1987-02-23 14:14:35 +00:00
ceriel
96f6adb74b *** empty log message *** 1987-02-23 14:06:17 +00:00
ceriel
ca1655c25e bug fixes:
- assignment operators for bit fields were wrong
- some conversions for characters were wrong
- result of assignment operator sometimes had wrong size
- character constant \377 was 255, not -1
- string constant generation was clumsy
1987-02-23 13:08:54 +00:00
ceriel
af2b497fdf Initial revision 1987-02-23 11:38:21 +00:00
ceriel
398021e77a Added No_Mem 1987-02-23 11:38:15 +00:00
ceriel
f98832f587 *** empty log message *** 1987-02-23 11:23:46 +00:00
ceriel
35e75e3d55 Added a dependency 1987-02-23 11:02:31 +00:00
ceriel
6f9a14000c Some minor improvements 1987-02-23 11:01:13 +00:00
ceriel
74be3a448f *** empty log message *** 1987-02-23 10:50:15 +00:00
ceriel
c6b3fb3aef Initial revision 1987-02-23 09:22:33 +00:00
ceriel
a7c40760cd Current results 1987-02-23 09:21:29 +00:00
ceriel
2d34e6f839 Delete temporary 1987-02-23 09:18:41 +00:00
ceriel
8a407d5ee9 remove temporary 1987-02-22 15:56:31 +00:00
ceriel
0c7c379d46 better versions, bug fixes in compiler 1987-02-22 15:28:26 +00:00
ceriel
0a70c8f525 Initial revision 1987-02-21 22:26:39 +00:00
ceriel
f2a77335b0 An attempt to make "erasereg" a little more efficient, as it seems
often to be called to erase the condition codes.
1987-02-21 22:20:10 +00:00
ceriel
d493ffcfde bug fix 1987-02-20 17:35:08 +00:00
ceriel
a3c78bffe6 Bug fix 1987-02-20 17:33:06 +00:00
ceriel
8612a70ea3 Initial revision 1987-02-20 14:36:01 +00:00
ceriel
429502815f Added description of strzero 1987-02-19 11:28:14 +00:00
ceriel
80fe557cf3 *** empty log message *** 1987-02-18 16:41:57 +00:00
ceriel
3e3ebc6b8b cardinality of sets was wrong! 1987-02-18 10:47:55 +00:00
ceriel
c3ae096e67 *** empty log message *** 1987-02-17 15:07:15 +00:00
ceriel
a08f3c3e9c Added doc on %onerror, and some other minor mods 1987-02-16 21:42:18 +00:00
ceriel
3f6a8abe1b adapted to allow for user intervention before error recovery 1987-02-16 21:38:52 +00:00
ceriel
255884b3fb Another adaption to allow for user intervention BEFORE error recovery 1987-02-16 21:36:05 +00:00
ceriel
e796cb0f27 Prevented looping of the code generator on illegal zer instructions 1987-02-16 09:49:32 +00:00
ceriel
428b24d51b minor update 1987-02-13 15:30:27 +00:00
ceriel
2238500f22 Added "standard" entries, rerun mkdep 1987-02-13 15:27:35 +00:00
ceriel
b9be625e9b Added a "-f" flag to the "rm" 1987-02-13 14:20:10 +00:00
ceriel
90cae7c6a5 Adapted to search for description files in either
~em/lib/descr/<file> or ~em/lib/<file>/descr
1987-02-13 13:39:30 +00:00
ceriel
04d031d33d Added some buffering for writes 1987-02-13 12:44:33 +00:00
ceriel
629c0a315c Some extra patterns added. 1987-02-13 12:41:31 +00:00
ceriel
3378831ba5 Made to work with some other compilers 1987-02-13 09:40:08 +00:00
ceriel
0905b2ba25 forgot a continue. 1987-02-12 13:54:37 +00:00
ceriel
a2f665de76 exporting EODDZ, etc 1987-02-12 13:36:55 +00:00
ceriel
71e01b58c0 Initial revision 1987-02-12 10:56:16 +00:00
ceriel
1706552f25 bug fix: csa descriptors contained upb instead of upb - lwb. 1987-02-11 16:05:25 +00:00
ceriel
55abae9d4f *** empty log message *** 1987-02-11 15:41:09 +00:00
ceriel
063bfe6cb7 other place for include files 1987-02-11 14:49:14 +00:00
ceriel
a6d90aaeec many bug fixes 1987-02-11 14:29:27 +00:00
ceriel
f18da9078c when printing floats in "e"-format, trailing zeros are significant! 1987-02-11 12:47:45 +00:00
ceriel
0f49b18986 *** empty log message *** 1987-02-10 17:18:16 +00:00
ceriel
9a64c052cc Added some code to handle -Oego,opt,asopt etc 1987-02-10 16:51:57 +00:00
ceriel
2295cd130a Added some code to handle -Oego,opt,asopt and the like.
By default, optimizers can be excluded by giving them a negative
priority in the description files. This is currently done for
the global optimizer
1987-02-10 16:50:32 +00:00
ceriel
5ab4d1d2f8 removed some %0's 1987-02-10 12:49:08 +00:00
ceriel
cd1007a972 removed some %0 stuff 1987-02-10 09:49:50 +00:00
ceriel
9a7949c79d Removed some more "%...D"s 1987-02-10 09:39:40 +00:00
ceriel
7cf87cb2a3 *** empty log message *** 1987-02-10 09:34:45 +00:00
ceriel
e04aa9639e Initial revision 1987-02-10 09:27:44 +00:00
ceriel
ad72edfa49 many changes: fixes and efficiency-oriented 1987-02-09 23:19:42 +00:00
ceriel
2f8580c380 replaced some more %D's 1987-02-09 22:48:14 +00:00
bruce
25a7b2ae22 Added local optimization of lin to lni. 1987-02-09 17:55:46 +00:00
ceriel
ced0ffabbd removed some %0 stuff 1987-02-09 17:41:25 +00:00
ceriel
522039cb60 replaced a %D 1987-02-09 17:31:25 +00:00
ceriel
17ddf81681 replaced some %D's 1987-02-09 17:28:22 +00:00
ceriel
8b15b193a2 replaced a %04x 1987-02-09 17:10:29 +00:00
ceriel
4793d80775 replaced some %D's by %ld 1987-02-09 17:06:20 +00:00
ceriel
1e0aef10d8 made to work on system V 1987-02-09 17:00:23 +00:00
ceriel
2556a95c48 make to work on System V 1987-02-09 16:57:40 +00:00
ceriel
0d1c90a23e Adapted to new assembler 1987-02-09 16:49:13 +00:00
ceriel
4d10540d8d removed %0 stuff 1987-02-09 16:47:04 +00:00
ceriel
e83991f533 *** empty log message *** 1987-02-09 16:39:05 +00:00
ceriel
78a60d9959 %03x --> %x_, because the former does not work on System V 1987-02-09 16:35:24 +00:00
ceriel
cea6f4751e removed something that would not work on System V 1987-02-09 16:33:49 +00:00
ceriel
6d0a4a9ce0 changed directory: nas --> as 1987-02-09 16:29:15 +00:00
ceriel
4be7b3dfa5 Removed a %03x, which does not work on USG systems 1987-02-09 16:26:56 +00:00
ceriel
3588a1599f Initial revision 1987-02-09 15:26:16 +00:00
ceriel
fa59fc325e changed so that it prints a separate line for each dependancy 1987-02-09 15:06:09 +00:00
ceriel
375e023d8b Initial revision 1987-02-09 14:55:59 +00:00
ceriel
97e0fbea33 *** empty log message *** 1987-02-09 14:54:29 +00:00
ceriel
21fbc5d6a6 belonging to new version of pascal compiler 1987-02-09 10:46:18 +00:00
ceriel
8f4a99cc24 The added ',' separator in token declarations did not work
(reported by Kees Bot, Edwin Scheffer). This is corrected (I hope).
1987-02-07 03:56:34 +00:00
ceriel
13d59d1427 Added cpp to the "clean" entry 1987-02-07 02:58:47 +00:00
ceriel
8360226526 Added "opt2" to the clean entry 1987-02-07 02:57:09 +00:00
ceriel
2c29e9f07c Changed an assertion that was no longer valid 1987-02-07 01:50:48 +00:00
ceriel
7dfb3c92ba target optimizer directory name is "top", not "opt" 1987-02-07 00:56:42 +00:00
ceriel
6d1f518209 Remove .m files before recreating them. The existing ones might
have another owner, so that you cannot write them
1987-02-07 00:52:30 +00:00
ceriel
3fc90a8000 Added some patterns, and avoided a bug in the VAX assembler 1987-02-07 00:45:06 +00:00
ceriel
729490c212 *** empty log message *** 1987-02-07 00:35:16 +00:00
ceriel
a1c7298f9d changed hash function 1987-02-07 00:14:51 +00:00
ceriel
622530ae68 Changed hash function, added "registers" 1987-02-07 00:13:56 +00:00
ceriel
4d92d60469 Added some "registers" 1987-02-07 00:04:05 +00:00
ceriel
ce47e41665 Another one. 1987-02-06 23:40:25 +00:00
ceriel
bdef113184 Bug fix (INPUT, not STDIN !!!) 1987-02-06 23:38:35 +00:00
ceriel
254364ca11 bug fix 1987-02-06 14:50:57 +00:00
ceriel
77f33b6762 did not work with bloody vax assemblerr 1987-02-06 14:44:56 +00:00
bruce
dd673a426f Changed name from .c to .r and now in format required by awk. 1987-02-06 14:21:04 +00:00
bruce
8248a41994 Initial revision 1987-02-06 14:15:49 +00:00
bruce
d5e9250405 Use awk program to generate distinct C_xxx routines in separate files. 1987-02-06 14:13:22 +00:00
ceriel
102790400d bug fix 1987-02-06 13:28:01 +00:00
ceriel
63af2a556b bug fix 1987-02-06 11:09:26 +00:00
ceriel
17a2c4977e bug fix 1987-02-06 10:37:09 +00:00
ceriel
e60f0f3981 bug fix 1987-02-06 10:27:57 +00:00
ceriel
d3f3afa6e7 bug fix 1987-02-06 10:03:18 +00:00
ceriel
010a311ab7 bug fixes 1987-02-05 21:36:42 +00:00
ceriel
3cddcb4482 typo 1987-02-05 21:07:09 +00:00
ceriel
775e473fb0 *** empty log message *** 1987-02-05 21:04:40 +00:00
ceriel
c6a224a6d1 output buffer is now called _sobuf 1987-02-05 20:56:06 +00:00
ceriel
c4b53d0710 buffer names: _sibuf and _sobuf 1987-02-05 20:54:27 +00:00
ceriel
060a309f82 array bound check added 1987-02-05 20:47:30 +00:00
ceriel
ac77d6c7fe Bug fix 1987-02-05 20:39:11 +00:00
ceriel
e0b23bbaea Added code to kill regvar(...) 1987-02-05 19:20:54 +00:00
ceriel
b11e35b7d4 Adapted some constants 1987-02-05 19:19:01 +00:00
ceriel
74b078c3f1 just for fun: do not call empty rules. 1987-02-05 19:14:55 +00:00
ceriel
4860deacf8 another bug fix 1987-02-05 18:37:12 +00:00
ceriel
d5d4c551c5 bug fix 1987-02-05 18:33:44 +00:00
ceriel
f5f7a6cb2a *** empty log message *** 1987-02-05 17:02:16 +00:00
ceriel
70fb5304d0 new dependencies 1987-02-05 17:01:12 +00:00
ceriel
a40ec68883 Added another structure for improved recursion detection 1987-02-05 17:00:14 +00:00
ceriel
d0d5c84689 bug fix 1987-02-05 16:39:39 +00:00
ceriel
46cfcbdf43 bug fix 1987-02-05 16:22:42 +00:00
ceriel
75e9a65bcd Added line_prefix.h 1987-02-05 14:58:24 +00:00
ceriel
78aae09a09 Initial revision 1987-02-05 14:47:47 +00:00
ceriel
467f680968 Adapted to the use of "convert.c" 1987-02-05 14:47:22 +00:00
ceriel
862e62b9e4 *** empty log message *** 1987-02-05 14:47:04 +00:00
ceriel
10f6d88ba1 *** empty log message *** 1987-02-05 14:11:46 +00:00
ceriel
49b619cec2 Added manual page 1987-02-05 13:20:03 +00:00
ceriel
439bf558cc *** empty log message *** 1987-02-05 13:17:00 +00:00
ceriel
5afc7363f0 *** empty log message *** 1987-02-04 17:43:20 +00:00
ceriel
45105f16c6 Added a few "nocoercions :" 1987-02-04 17:22:08 +00:00
ceriel
5627bb850e Initial revision 1987-02-04 16:44:15 +00:00
ceriel
b6a56fb7e8 *** empty log message *** 1987-02-04 16:21:03 +00:00
ceriel
6ce38d28ae fixed error in call of C_con_scon 1987-02-04 16:03:54 +00:00
ceriel
694f7dfee4 Added asopt 1987-02-04 15:55:32 +00:00
ceriel
59a5eb4591 Added libsys, top 1987-02-04 15:51:35 +00:00
ceriel
199f9d38ea archive name change 1987-02-04 15:47:57 +00:00
ceriel
2ca7e7e2b3 Added definition for ASAR 1987-02-04 15:41:00 +00:00
ceriel
827f3da238 Name change of archive 1987-02-04 15:39:00 +00:00
ceriel
41cdf11b46 *** empty log message *** 1987-02-04 15:31:50 +00:00
ceriel
fe3fe78538 Added some neccessary NC's 1987-02-04 15:11:51 +00:00
ceriel
a0dad9f908 adapted to new assembler syntax 1987-02-04 15:09:31 +00:00
ceriel
6dcf1995c1 Initial revision 1987-02-04 13:10:17 +00:00
ceriel
b5d0c2797b *** empty log message *** 1987-02-04 13:09:02 +00:00
ceriel
a3aa9aac88 removed the lflag, added check for '/' in filenames 1987-02-04 13:04:51 +00:00
ceriel
60cf3639ce Added "pr" and "opr" entries 1987-02-04 12:54:03 +00:00
ceriel
3c387987ed Added "cmp" entry 1987-02-04 12:51:31 +00:00
ceriel
b536e4101d Initial revision 1987-02-04 12:45:43 +00:00
ceriel
1b071fe5a2 Initial revision 1987-02-04 10:40:32 +00:00
ceriel
0cf7165841 *** empty log message *** 1987-02-04 10:39:27 +00:00
ceriel
23bbc93a92 Initial revision 1987-02-04 10:35:30 +00:00
ceriel
85830c5f63 Strings and character constants now stop at end-of-line, unless escaped
by a backslash
1987-02-03 23:28:09 +00:00
ceriel
f3b298586f Initial revision 1987-02-03 14:59:54 +00:00
ceriel
9b2329a49b *** empty log message *** 1987-02-03 14:57:24 +00:00
ceriel
eab8db26fe new include directories 1987-02-03 14:55:15 +00:00
ceriel
73e1381194 *** empty log message *** 1987-02-03 14:50:30 +00:00
ceriel
755170f752 Added pascal lib 1987-02-03 14:47:45 +00:00
ceriel
3a75a34c31 *** empty log message *** 1987-02-03 14:36:29 +00:00
ceriel
b69fd5feb8 adapted to new assembler syntax 1987-02-03 13:32:24 +00:00
ceriel
fe53d6ed3f adapted to new assembler syntax 1987-02-03 13:23:38 +00:00
ceriel
2ed0d80be5 lock ??? 1987-02-03 13:09:27 +00:00
ceriel
ea78c81da9 int --> int22 1987-02-03 09:57:57 +00:00
ceriel
6f1f0ef1bf int --> int44 1987-02-03 09:55:47 +00:00
ceriel
4ed7c62cca int22 --> int44 1987-02-03 09:55:06 +00:00
ceriel
5ac74e31e0 int22 --> int24 1987-02-03 09:53:20 +00:00
ceriel
6b753378bc int --> int24 1987-02-03 09:52:40 +00:00
ceriel
40dd8e2702 *** empty log message *** 1987-02-03 09:50:31 +00:00
ceriel
74114081ef ??? 1987-02-02 21:49:57 +00:00
ceriel
d76349f200 pdp instead of pdp11 1987-02-02 21:01:10 +00:00
ceriel
a8820459d5 obeyed a warning 1987-02-02 20:54:56 +00:00
ceriel
d70c1e2149 ASP with negative argument wasn't accepted 1987-02-02 20:48:02 +00:00
ceriel
1672c06a36 backend must accept .g files 1987-02-02 20:40:59 +00:00
ceriel
9abc993f08 back-end must accept .g files 1987-02-02 20:40:04 +00:00
ceriel
f5c1d53512 added asopt 1987-02-02 20:36:15 +00:00
ceriel
04a416828b *** empty log message *** 1987-02-02 20:31:55 +00:00
ceriel
836fc810b3 Added target optimizer 1987-02-02 20:23:42 +00:00
ceriel
3515a1818a Initial revision 1987-02-02 20:14:16 +00:00
ceriel
f67cdb8e44 Initial revision 1987-02-02 19:18:49 +00:00
ceriel
22a6938332 *** empty log message *** 1987-02-02 17:40:30 +00:00
ceriel
e471d036d1 Added pc 1987-02-02 17:37:18 +00:00
ceriel
319d1508c2 Initial revision 1987-02-02 16:57:13 +00:00
ceriel
0a4b847f50 new definition of ISALNUM 1987-02-02 16:37:59 +00:00
ceriel
78a61585ce *** empty log message *** 1987-02-02 16:27:36 +00:00
ceriel
19a0a9b769 *** empty log message *** 1987-02-02 16:21:59 +00:00
ceriel
3c210cae1e Name change in library 1987-02-02 16:19:04 +00:00
ceriel
d80d2a4c35 Initial revision 1987-02-02 16:12:55 +00:00
ceriel
563a799de2 Initial revision 1987-02-02 16:06:51 +00:00
ceriel
93ac463920 *** empty log message *** 1987-02-02 16:04:52 +00:00
ceriel
9ce25b36c4 library name change 1987-02-02 16:04:16 +00:00
ceriel
14138da395 bug fix 1987-02-02 15:28:31 +00:00
ceriel
ca1654eae2 Initial revision 1987-02-02 13:36:33 +00:00
ceriel
1ac26f9b67 new version for .o 1987-02-02 13:30:20 +00:00
ceriel
9cd6325ee1 Initial revision 1987-02-02 13:11:35 +00:00
ceriel
3feb7454c5 Added clean-entry, tail_mon --> tail_sys 1987-02-02 13:09:17 +00:00
ceriel
b96babed0a generating .o files 1987-02-02 13:07:28 +00:00
ceriel
345609b5ac version for new assembler 1987-02-02 12:44:39 +00:00
ceriel
d8e018a044 *** empty log message *** 1987-02-02 11:22:47 +00:00
ceriel
c51a2b3a6c *** empty log message *** 1987-02-02 11:15:48 +00:00
ceriel
60c746ed21 *** empty log message *** 1987-02-02 11:07:21 +00:00
ceriel
8ac474583b New version with new assembler, link editor 1987-02-02 10:55:41 +00:00
em
dc6b14760d *** empty log message *** 1987-02-02 10:52:23 +00:00
ceriel
8340d30d77 new version for new assembler and new c library 1987-02-02 10:50:09 +00:00
ceriel
b7477f4654 Initial revision 1987-02-02 10:45:26 +00:00
ceriel
e024792e68 Initial revision 1987-02-02 10:25:38 +00:00
ceriel
e41a2618f8 Made floating point stuff depend on a #define: FPPSIM 1987-02-02 10:16:40 +00:00
ceriel
ae3c81e0a6 Made floating point stuff depend on a #define: FPPSIM 1987-02-02 09:59:02 +00:00
ceriel
237d56ac16 *** empty log message *** 1987-02-01 22:32:23 +00:00
ceriel
60f9744253 Adapted to current situation 1987-02-01 22:13:26 +00:00
ceriel
ec29d3b4a1 Initial revision 1987-02-01 21:53:24 +00:00
ceriel
7ab43d62db *** empty log message *** 1987-02-01 21:27:52 +00:00
ceriel
e08ea100a4 Initial revision 1987-02-01 21:04:49 +00:00
ceriel
e5238c6fcf *** empty log message *** 1987-01-30 20:50:31 +00:00
ceriel
496bba9475 New version 1987-01-30 20:48:31 +00:00
ceriel
923a85f5cc *** empty log message *** 1987-01-30 20:39:45 +00:00
ceriel
2b9c2283db *** empty log message *** 1987-01-30 20:27:28 +00:00
ceriel
095367ac29 machine name change: l68k2 --> m68k2 1987-01-30 20:24:35 +00:00
ceriel
47a1e91c19 name change of lib 1987-01-30 20:23:09 +00:00
ceriel
f648d5d0ab Name change of lib, added head_em 1987-01-30 20:22:52 +00:00
ceriel
f88e8c3ba4 1987-01-30 20:06:04 +00:00
ceriel
471884cdf4 *** empty log message *** 1987-01-30 19:58:55 +00:00
ceriel
9dd16696ef *** empty log message *** 1987-01-30 19:31:26 +00:00
ceriel
c03c2ef9f2 Adapted to new assembler syntax 1987-01-30 19:20:31 +00:00
ceriel
1b09e55129 new assembler syntax 1987-01-30 18:41:42 +00:00
ceriel
5e36fd3351 Made more like other Makefiles 1987-01-30 18:24:42 +00:00
ceriel
7e68455893 *** empty log message *** 1987-01-30 18:15:22 +00:00
ceriel
076354168e error exit when compilation fails 1987-01-30 18:12:57 +00:00
ceriel
9390536d79 Error exit when compilation failes 1987-01-30 18:11:08 +00:00
ceriel
4b489cd254 Initial revision 1987-01-30 17:10:51 +00:00
ceriel
3c60c1918e changed #define m68020 to TBL68020.
Could otherwize cause problems when translated with ack
1987-01-30 10:57:17 +00:00
ceriel
4fb87d7c87 Initial revision 1987-01-30 10:49:21 +00:00
ceriel
0adac61dad *** empty log message *** 1987-01-30 10:18:40 +00:00
ceriel
ae504890c7 bug fix 1987-01-30 09:45:41 +00:00
ceriel
0452b7c326 *** empty log message *** 1987-01-29 23:30:46 +00:00
ceriel
e9d7db6f61 Initial revision 1987-01-29 23:25:01 +00:00
ceriel
0a279ebbbd Initial revision 1987-01-29 22:45:44 +00:00
ceriel
153e30bb1c Initial revision 1987-01-29 22:36:35 +00:00
ceriel
945d6a0188 Initial revision 1987-01-29 22:10:18 +00:00
ceriel
31b5e111bf Initial revision 1987-01-29 20:15:14 +00:00
ceriel
62746ef4ff Initial revision 1987-01-29 20:03:43 +00:00
ceriel
d0894b8c33 deleted NOFLOAT 1987-01-29 19:58:10 +00:00
ceriel
39bc96fbd1 Deleted NOFLOAT 1987-01-29 19:56:16 +00:00
ceriel
27e48672bb no F_DUM in dummy float 1987-01-29 19:49:35 +00:00
ceriel
536611f0a2 Initial revision 1987-01-29 19:42:53 +00:00
ceriel
c5897a8f81 Initial revision 1987-01-29 19:37:49 +00:00
ceriel
bfb89ae937 Added a check for unresolved references 1987-01-29 17:13:37 +00:00
ceriel
59a08bb733 Changed to handle new ack object format 1987-01-29 15:54:46 +00:00
ceriel
c9fce4aff9 typo fix 1987-01-29 14:54:26 +00:00
ceriel
91463b5a4e Initial revision 1987-01-29 14:17:23 +00:00
ceriel
3d00f0ea37 Adapted to current situation 1987-01-29 13:20:23 +00:00
ceriel
bc8229b952 don't use a sgttyb struct 1987-01-29 13:01:28 +00:00
ceriel
ef85335f8f name change of lib, moved head_em.s to libsys 1987-01-29 11:03:30 +00:00
ceriel
9871983602 Name change of lib 1987-01-29 11:01:27 +00:00
ceriel
7c658fff27 Name change of lib, added head_em 1987-01-29 10:47:27 +00:00
ceriel
de343361e5 Name change. 1987-01-29 10:46:53 +00:00
ceriel
1bbe040688 PC/IX is system 3, not V7 1987-01-29 10:33:53 +00:00
ceriel
c6f26eff9e Corrected syntax error 1987-01-29 09:43:40 +00:00
ceriel
0331b0a1e2 Added IOR, AND, XOR, COM without parameters, because the
Pascal runtime system needs at least one of them.
Also deleted some old bug circumvention
1987-01-28 23:22:07 +00:00
ceriel
7be94f7d44 more corrections 1987-01-28 22:54:52 +00:00
ceriel
eb0030af45 generate .o files 1987-01-28 22:26:27 +00:00
ceriel
e69ccee1f7 syntax error correction 1987-01-28 22:23:14 +00:00
ceriel
beaaa19ada generate .o files 1987-01-28 22:17:36 +00:00
ceriel
6aa3769e9f generating .o files 1987-01-28 22:14:40 +00:00
ceriel
1e5253e9e5 For generating .o files, aal archives 1987-01-28 22:14:12 +00:00
ceriel
f35c426e26 .byte --> .data1 1987-01-28 19:02:25 +00:00
ceriel
0bbda61037 adapted to new assembler 1987-01-28 18:57:04 +00:00
ceriel
eb703a6d80 Initial revision 1987-01-28 18:52:12 +00:00
ceriel
3bb50c7b8a endbss - begbss is no longer computable by the assembler 1987-01-28 18:49:59 +00:00
ceriel
de51d1ee8e Improvement of conversions 1987-01-28 17:36:21 +00:00
ceriel
a5c0f64d5e return exit status 1 when compilation failes 1987-01-28 17:26:52 +00:00
ceriel
160770d979 Bug fix: the STR instruction caused a translation with syntax errors 1987-01-28 17:22:25 +00:00
ceriel
f3a6d7c3ce correction of syntax error 1987-01-28 17:05:02 +00:00
ceriel
fc2e88758f declaration of gmtime added 1987-01-28 17:02:56 +00:00
ceriel
d35a16c30f Bug fix: %f did not work, if no width was specified 1987-01-28 16:52:16 +00:00
ceriel
f78cbc818f Avoid bug in VAX assembler. But i don't know what is happening. 1987-01-28 16:22:30 +00:00
bruce
9e61390e78 Corrected clean option to remove libopt.a 1987-01-28 15:39:10 +00:00
ceriel
aeacaeb08f Initial revision 1987-01-28 15:29:13 +00:00
ceriel
7cfd88dab7 Adapted to new assembler producing .o files 1987-01-28 15:27:59 +00:00
ceriel
187b008eb2 archive name change: tail --> libem_s.a 1987-01-28 15:23:22 +00:00
ceriel
aab8668d4b Bug fix 1987-01-28 15:15:28 +00:00
ceriel
50b2d9f4b8 Initial revision 1987-01-28 15:06:28 +00:00
ceriel
c996384000 Adapted for new assembler syntax 1987-01-28 15:06:01 +00:00
ceriel
0930a80dd3 adapted to new assembler syntax 1987-01-28 15:03:39 +00:00
ceriel
212579440e bug fix 1987-01-28 14:38:38 +00:00
ceriel
132ed11e0e _doprint -->_doprnt 1987-01-28 14:28:45 +00:00
ceriel
ce561e5f3a made stdin, stdout, and stderr into compile time constants 1987-01-28 14:21:56 +00:00
ceriel
fb8fc4e07c Fixed introduced bug 1987-01-28 13:00:33 +00:00
ceriel
ebd44261fe cc --> $(CC), added -O flag to CFLAGS 1987-01-28 12:49:42 +00:00
ceriel
77e82ac376 floating point constants are no longer fatal 1987-01-28 00:11:28 +00:00
ceriel
5f7937dd33 Added action for pc runtime library 1987-01-27 23:38:02 +00:00
ceriel
ca796567f3 errno was'nt exported 1987-01-27 22:58:33 +00:00
ceriel
c5fe8ce4dc new version for assembler producing .o files 1987-01-27 20:37:46 +00:00
ceriel
c69f56bd2f By default only install tail_cc.1s and tail_cc.2g 1987-01-27 20:09:55 +00:00
ceriel
846f27eebc Added some system V things 1987-01-27 16:51:19 +00:00
ceriel
846d9a0c2d Initial revision 1987-01-27 16:44:28 +00:00
ceriel
3ea542769f Initial revision 1987-01-27 16:33:21 +00:00
ceriel
c1bae75a85 Initial revision 1987-01-27 16:21:02 +00:00
ceriel
b5c4cd7a00 Initial revision 1987-01-27 15:57:55 +00:00
bruce
6fb688f882 Ported code to Mantra and general clean up. 1987-01-27 14:15:23 +00:00
bruce
bbd5b115dd Changed to reflect location of EMHOME and conform to standard syntax. 1987-01-27 11:42:08 +00:00
ceriel
884a281dd4 Improved "clean" entry" 1987-01-27 10:52:09 +00:00
ceriel
89bbe4c782 correction of syntax errors 1987-01-27 10:50:43 +00:00
ceriel
e969c006b7 Contained syntax errors 1987-01-27 10:45:01 +00:00
ceriel
cfb3324b6f Better "clean" entry" 1987-01-27 10:41:19 +00:00
ceriel
145326b368 Adaption to new assembler generating .o files 1987-01-26 22:35:41 +00:00
ceriel
5abd614e01 Initial revision 1987-01-26 22:33:58 +00:00
ceriel
55f63a8a12 system call numbers are longwords 1987-01-26 22:15:21 +00:00
ceriel
4133a3cbc3 Initial revision 1987-01-26 21:51:58 +00:00
ceriel
6db629db4d Added stty, gtty 1987-01-26 21:47:59 +00:00
ceriel
0b484452fd Initial revision 1987-01-26 21:43:12 +00:00
ceriel
2c2688a680 adapted to new assembler syntax 1987-01-26 21:22:23 +00:00
ceriel
0991948d3e Removed all those ../../.. references 1987-01-26 16:35:04 +00:00
ceriel
640f958d26 Improved "element size" handling. 1987-01-26 16:16:12 +00:00
ceriel
edae1fc950 Added a check that a tokenset in a stackpattern contains tokens
that all have the same size.
1987-01-26 16:14:39 +00:00
ceriel
88ea6fb11d new dependency 1987-01-26 15:01:25 +00:00
ceriel
74d48b9b91 bug fix for EM_MESARG 1987-01-26 14:04:33 +00:00
ceriel
80d363eac5 bug fixes in RMI and EXG 1987-01-26 13:36:40 +00:00
ceriel
8116e3181f now uses alloc module, bug fixes, -N option under USE_TMP, to not do so 1987-01-24 00:25:56 +00:00
ceriel
b4e4250144 added EM_wordsize, EM_pointersize 1987-01-23 16:15:57 +00:00
ceriel
df1b8c8f71 corrected typo 1987-01-23 16:04:20 +00:00
ceriel
872cd52f99 Bug fix: EM_MESARG gives em_arg, not em_args! 1987-01-23 16:00:37 +00:00
bruce
f4e7c2f6ce Fixed up indentation of trans.c output. 1987-01-22 14:27:02 +00:00
bruce
819136660e Don't put out "return" in outputtrans if action is not tested
otherwise compiling trans.c give warning about statment not reached.
1987-01-21 15:36:18 +00:00
ceriel
9acc354608 adapted to new assembler syntax 1987-01-21 15:21:49 +00:00
bruce
959800d9b5 Version that implements a C_XXX to O_XXX library interface. 1987-01-21 14:27:04 +00:00
ceriel
93c2a95860 new assembler producing .o files 1987-01-20 14:53:11 +00:00
ceriel
4f94fb9ea0 Bug fix (?) 1987-01-20 14:47:49 +00:00
ceriel
32f1fc504c new assembler producing .o files 1987-01-20 14:20:33 +00:00
ceriel
3a2030f3b6 assembler now produces .o format 1987-01-20 14:14:19 +00:00
ceriel
6c762a19e7 Changed /lib/cpp to ../../../lib/cpp 1987-01-20 13:09:56 +00:00
ceriel
feea5a269f Adapted to new assembler syntax 1987-01-20 10:04:32 +00:00
ceriel
a410519ff5 Bug fix
Under the '-x' option, the archive was opened in "APPEND" mode.
1987-01-20 09:53:32 +00:00
ceriel
9f47676fa3 Bug fix in translation of "cms" 1987-01-20 09:31:31 +00:00
ceriel
ba75d4c907 end.s separate from libem_s.a 1987-01-19 15:20:49 +00:00
ceriel
08ca9ba4a4 *** empty log message *** 1987-01-19 10:53:45 +00:00
ceriel
bd56763235 Added exit in case of compilation failure 1987-01-19 10:52:25 +00:00
ceriel
433346583e new version for new assembler syntax 1987-01-19 10:51:50 +00:00
ceriel
d899835b31 bug fix 1987-01-19 10:42:34 +00:00
ceriel
4d4854d610 ASAR=aal 1987-01-19 10:37:38 +00:00
ceriel
4dda9a5183 exit on compilation error 1987-01-19 10:36:27 +00:00
ceriel
035c115ca8 exit when compilation fails 1987-01-19 10:33:24 +00:00
ceriel
4e17f5b9a5 Initial revision 1987-01-19 10:32:32 +00:00
ceriel
f72b739e21 Initial revision 1987-01-19 10:26:43 +00:00
ceriel
6de2acea83 Improved "make clean" 1987-01-19 10:19:56 +00:00
ceriel
fcd2e936b4 Improved the "make clean" 1987-01-19 10:17:58 +00:00
ceriel
41622dc2a9 Added c-flag 1987-01-19 09:41:49 +00:00
ceriel
0efc7ae07d Added 'c'-flag 1987-01-19 09:36:35 +00:00
ceriel
4489801c4f New version 1987-01-16 19:25:44 +00:00
ceriel
faa0c191a4 minor bug fix 1987-01-16 19:20:58 +00:00
ceriel
f9f1db874f conversion to new assembler syntax 1987-01-16 17:17:12 +00:00
ceriel
c6ace07201 new archive name. 1987-01-16 17:04:03 +00:00
ceriel
649a32fa82 conversion to new assembler syntax 1987-01-16 16:59:41 +00:00
ceriel
8dc5f90a88 new name for archive 1987-01-16 16:51:14 +00:00
ceriel
08cc79e513 new version for generating .o files 1987-01-16 16:50:50 +00:00
ceriel
d2014ff946 conversion to new assembler format 1987-01-16 16:49:46 +00:00
ceriel
d5148e0b0f Initial revision 1987-01-16 16:49:12 +00:00
ceriel
a3b0f08d57 conversion to new assembler format 1987-01-16 16:34:45 +00:00
ceriel
8f27f92269 Bug fix with WorkingDir 1987-01-16 16:14:22 +00:00
ceriel
e346f6fc74 version generating .o files 1987-01-16 15:40:01 +00:00
ceriel
3e2d693b37 as --> nas 1987-01-16 15:21:51 +00:00
ceriel
e4a90bc417 Bug fix. 1987-01-16 13:59:02 +00:00
ceriel
0b941ef495 Bug fixes 1987-01-16 13:51:45 +00:00
ceriel
45238eea0f Some bug fixes and minor extensions 1987-01-16 13:51:42 +00:00
ceriel
382c88eb17 Using object library 1987-01-15 22:06:16 +00:00
bruce
97cd4953b0 Initial revision 1987-01-15 18:12:26 +00:00
ceriel
ece95a2ee4 Some bug fixes 1987-01-15 17:36:26 +00:00
ceriel
8af94099a3 Replaced an occurrence of EOI by EOF. 1987-01-14 21:37:22 +00:00
ceriel
324cbd8327 Fixed a minor problem with off_fmt, when it did not produce
a '-' sign when neccesary
1987-01-14 17:49:19 +00:00
ceriel
9877db53d9 Fixed a minor problem with off_fmt, when this format would not
produce the '-' sign.
1987-01-14 17:47:31 +00:00
ceriel
493efb1bf7 added EX_SIDEEFFECTS, options['p'] --> ! options['L'], fixed some bugs 1987-01-14 09:58:51 +00:00
ceriel
0ffdfb4f76 Added rd_fd and wr_fd. 1987-01-13 15:10:23 +00:00
ceriel
b2c0f64992 *** empty log message *** 1987-01-13 13:13:50 +00:00
ceriel
e6f18b2838 Initial revision 1987-01-13 11:31:24 +00:00
ceriel
630e5d8082 Initial revision 1987-01-13 11:01:26 +00:00
ceriel
6d499785be Initial revision 1987-01-13 10:53:33 +00:00
ceriel
424337507d Added standard entries 1987-01-13 10:43:12 +00:00
ceriel
876369b2f1 Added standard entries 1987-01-13 10:30:06 +00:00
ceriel
692d3702a1 Added "standard" entries 1987-01-13 10:08:47 +00:00
ceriel
3cb30fa873 Added a "clean" entry. 1987-01-13 10:07:25 +00:00
ceriel
673b1d79e2 Initial revision 1987-01-13 10:01:07 +00:00
ceriel
28b3286e21 Added "standard" entries install, cmp, opr 1987-01-13 09:56:17 +00:00
ceriel
177e335cad Initial revision 1987-01-13 09:24:13 +00:00
ceriel
3c7511780b Initial revision 1987-01-12 17:21:59 +00:00
ceriel
6adc4ef78b Added documentation on EM_wordsize and EM_pointersize. 1987-01-12 15:54:16 +00:00
ceriel
9639f0a87b Also export EM_wordsize and EM_pointersize. 1987-01-12 15:42:38 +00:00
ceriel
e77bde5e75 Added TABLEFLAGS and CGGFLAGS. 1987-01-12 15:10:49 +00:00
ceriel
031d26deb4 Preprocess table. 1987-01-12 14:50:25 +00:00
ceriel
9e528bef6f Allow reading from standard input 1987-01-12 14:38:45 +00:00
ceriel
5ddf83ab5a force first line directive 1987-01-12 14:21:14 +00:00
ceriel
281f83968c This one works. 1987-01-12 14:06:47 +00:00
ceriel
cb2b167849 New Makefile, also generating opt2 (t.i. peephole optimizer after global ..) 1987-01-12 14:01:26 +00:00
ceriel
896de3243e Corrected the "install" entry. 1987-01-12 12:30:16 +00:00
ceriel
961d298b3f In some cases, the number after a HOL was'nt accurate. 1987-01-09 15:16:22 +00:00
ceriel
77f4f0f0c9 Bug fix. 1987-01-09 14:11:59 +00:00
ceriel
7d4d9c5c34 %c did not work on systems that have their bytes or their words reversed. 1987-01-08 17:40:25 +00:00
ceriel
5a0140cf3a Bug fix: order in archive longs is PDP-11 order! 1987-01-08 17:39:37 +00:00
ceriel
3ca2fcad1c added doc for C_init 1987-01-08 16:35:00 +00:00
ceriel
6f5afaa410 Added C_init 1987-01-08 16:20:59 +00:00
ceriel
0a8436a862 Added C_init. 1987-01-08 16:19:16 +00:00
ceriel
a26a4f7c9d arhdr --> ar_hdr.
updated docs on rd_arhdr.
1987-01-08 16:05:52 +00:00
ceriel
4219306f55 rd_arhdr now returns 1 if it succeeds, and 0 at end-of-file. 1987-01-08 16:04:20 +00:00
ceriel
ecf93dbf4f made error in macro parameter count into a warning 1987-01-08 14:57:18 +00:00
ceriel
3245258560 Added exclusive or operator 1987-01-08 14:27:07 +00:00
ceriel
e5820bdbaa Added bitwise operators 1987-01-08 14:22:32 +00:00
ceriel
0a237df13d Added xor-oprator 1987-01-08 14:21:56 +00:00
ceriel
ceee24a4cd Added bitwise and and or operators 1987-01-08 14:11:23 +00:00
ceriel
01ac83b971 fix to prevent loop resulting in stack overflow 1987-01-08 14:10:02 +00:00
ceriel
bfb60b8a33 small adaption to "awayreg". 1987-01-08 14:09:14 +00:00
ceriel
1239449207 Added bitwise EX_OR and EX_AND. 1987-01-08 14:03:43 +00:00
ceriel
cfc9f38ccd Generate line directives that are similar to the ones generated
by the Reiser preprocessor.
1987-01-08 12:42:44 +00:00
ceriel
0c5feb7493 wrong number of parameters no longer is an error. 1987-01-08 12:38:05 +00:00
ceriel
61158d4693 New description file, using LED. 1987-01-08 11:22:44 +00:00
ceriel
97f8083ee0 adapted to get .o files 1987-01-08 11:09:06 +00:00
ceriel
8f8e0242d8 "l86" --> "i86". 1987-01-08 11:04:25 +00:00
ceriel
c2805a25bd Initial revision 1987-01-08 10:41:08 +00:00
ceriel
037c2426ab Adapted to get .o files. 1987-01-08 10:29:45 +00:00
ceriel
669c5cf23f use "compare" shell script 1987-01-08 10:28:26 +00:00
ceriel
1a6f092a39 Initial revision 1987-01-08 10:21:35 +00:00
ceriel
9c50da1e82 changed name back: libem_s.a --> tail_em.a 1987-01-08 10:19:47 +00:00
ceriel
c754f6ca69 adapted to new assembler syntax 1987-01-08 10:13:48 +00:00
ceriel
5cc2c0ccfc Initial revision 1987-01-08 10:07:43 +00:00
ceriel
11695db3e3 I don't know! but it was changed. 1987-01-08 09:56:17 +00:00
ceriel
0fd6417833 Adapted to new assembler syntax. 1987-01-08 09:39:54 +00:00
ceriel
18376b38cf Initial revision 1987-01-07 17:13:41 +00:00
ceriel
be68581019 *** empty log message *** 1987-01-07 11:10:33 +00:00
ceriel
debef378c9 3 --> 3ACK 1987-01-06 18:54:48 +00:00
ceriel
ceff6f834a Removed a bug that led to infinite looping in obscure cases. 1987-01-06 18:49:00 +00:00
ceriel
300ac178de Initial revision 1987-01-06 18:45:35 +00:00
ceriel
70f8f5e921 Initial revision 1987-01-06 18:31:02 +00:00
ceriel
143b2531bb Initial revision 1987-01-06 15:16:53 +00:00
ceriel
56c9ada9e0 Initial revision 1987-01-06 14:04:26 +00:00
ceriel
ec678ff800 removed the Xmalloc entry 1987-01-06 13:46:48 +00:00
ceriel
9cb5c80981 Initial revision 1987-01-06 13:42:33 +00:00
ceriel
0f42cf1bd9 Added a "pr" and an "opr" entry. 1987-01-06 12:59:16 +00:00
ceriel
3d5a9bc78c Added a "pr" and an "opr" entry. 1987-01-06 12:42:31 +00:00
ceriel
a7aa5d93ff Initial revision 1987-01-06 11:41:50 +00:00
ceriel
3788350d7c Initial revision 1987-01-06 11:25:09 +00:00
ceriel
56a28240ff Initial revision 1987-01-06 11:05:35 +00:00
ceriel
cb96da9bfa Initial revision 1987-01-05 17:37:37 +00:00
ceriel
b63bf2720c Initial revision 1987-01-05 17:31:38 +00:00
ceriel
eb28fd80f9 Initial revision 1987-01-05 17:20:13 +00:00
ceriel
0de3e4a0af Initial revision 1987-01-05 14:56:11 +00:00
ceriel
2254b35256 Initial revision 1987-01-05 14:44:25 +00:00
ceriel
26326c178e Initial revision 1987-01-05 13:26:29 +00:00
ceriel
8addf6e9a5 Initial revision 1987-01-05 12:59:41 +00:00
ceriel
da3976277f Extended for new read_em module. 1987-01-05 12:51:37 +00:00
ceriel
0329b9ef9a added cleanup.c 1987-01-05 11:12:55 +00:00
ceriel
e32480406f Initial revision 1987-01-05 11:08:47 +00:00
ceriel
caeb6b311d Initial revision 1987-01-05 10:58:34 +00:00
ceriel
a92c8bf067 D_BUSY added, to check recursive deps in def modules 1986-12-16 15:22:33 +00:00
ceriel
33a89a8684 bug fix in LLlex.c, "string_token" 1986-12-16 14:30:33 +00:00
ceriel
9919cc1ba6 Introduced EMHOME. 1986-12-16 13:50:54 +00:00
ceriel
974e2f7d4a Added exit.c stty.c gtty.c 1986-12-16 10:25:44 +00:00
ceriel
7e78bd904d Initial revision 1986-12-16 10:23:21 +00:00
dick
78aaf2fd9d some small changes, asm() yields error message 1986-12-13 20:57:40 +00:00
ceriel
5bbac46b88 No longer use the "system-independant" tail_mon. 1986-12-12 17:56:05 +00:00
ceriel
70df23f6f8 head_em now resides in system dependant library. 1986-12-12 17:54:21 +00:00
ceriel
595cc41d9c Removed almost the whole file, as we now use assembly routines to
interface the systemcalls.
1986-12-12 17:51:03 +00:00
ceriel
184f06453a Initial revision 1986-12-12 16:12:19 +00:00
ceriel
cb19bd1dd4 Bloody assembler does not recognize ',' in .globl 1986-12-12 14:45:20 +00:00
ceriel
980953f861 .globl does not accept comma's 1986-12-12 14:40:25 +00:00
ceriel
d62336a718 Initial revision 1986-12-12 13:43:06 +00:00
ceriel
4c956c400e Initial revision 1986-12-12 12:49:50 +00:00
ceriel
9e6fe01229 Improved testing for 0-strings in the routine "mycat". 1986-12-11 17:04:40 +00:00
ceriel
e98c02b831 Corrected a typo. 1986-12-11 17:03:11 +00:00
ceriel
c6a49a018f Entry for "top", different entry for "LLgen". 1986-12-10 16:53:24 +00:00
ceriel
7d1822d04e Added EMHOME. 1986-12-10 15:30:42 +00:00
ceriel
19477f95a9 Adapted to typesetter and added a reference for LLgen. 1986-12-10 15:28:30 +00:00
ceriel
fcaf1a73b4 Added a reference for LLgen. 1986-12-10 15:28:06 +00:00
ceriel
0159b3297d Adapted to possible use of troff 1986-12-10 15:27:36 +00:00
ceriel
9ddde1cf40 Documented LLmessage(-1). 1986-12-10 15:26:10 +00:00
ceriel
cb6b68a05f added nmclash.c, mods to Makefile/Resolve 1986-12-10 15:13:04 +00:00
ceriel
42162f7b37 simplified 0-padding, minor cosmetic changes 1986-12-10 12:00:55 +00:00
ceriel
df86573d4c Initial revision 1986-12-10 11:40:00 +00:00
ceriel
96d9890d86 minor mods. 1986-12-10 11:31:35 +00:00
ceriel
1335534aae Initial revision 1986-12-10 10:38:42 +00:00
ceriel
c501c762cf removed the -n flag, but not its effect. The generated parser will
call LLmessage(-1) when saying "garbage at end of input".
1986-12-10 09:32:57 +00:00
ceriel
fe2e67d1c6 minor fixes 1986-12-09 17:41:06 +00:00
ceriel
7752bb27f6 Adapted to new assembler 1986-12-09 11:13:14 +00:00
erikb
8a95b29c86 added: file_info.h 1986-12-09 08:19:55 +00:00
ceriel
a6ecac6f1d Only call "newrelo" when needed. 1986-12-08 10:39:13 +00:00
ceriel
6bf947ee6e *** empty log message *** 1986-12-08 09:24:58 +00:00
erikb
ad5c92044c corrected basename() 1986-12-08 08:58:21 +00:00
ceriel
8702a522d8 *** empty log message *** 1986-12-05 17:18:54 +00:00
ceriel
4b3e6a8ab6 Working version. 1986-12-05 17:17:03 +00:00
ceriel
8fd1977ab0 *** empty log message *** 1986-12-05 17:12:24 +00:00
ceriel
b2f0b281cd Initial revision 1986-12-05 17:10:12 +00:00
ceriel
555c29971f initial version 1986-12-05 17:09:41 +00:00
ceriel
9aac83a83e *** empty log message *** 1986-12-05 16:59:51 +00:00
ceriel
28036b3741 Initial revision 1986-12-05 16:58:29 +00:00
ceriel
13a63ae5fe ??? 1986-12-05 16:36:40 +00:00
ceriel
947461e31f Removed DUK 1986-12-04 16:35:04 +00:00
ceriel
53d6dfcb6b version using input module and detecting preprocessor loops 1986-12-04 16:29:44 +00:00
ceriel
91aad0b28e Improved relocation reading code for the !incore strategy. 1986-12-03 13:09:15 +00:00
ceriel
24b7ad602a Improved compactification code. It was much to persistent, and
also too greedy. This causes long LONG linking times.
The current version is less greedy, but also gives up more
easily. Linking times are acceptable now.
1986-12-03 13:06:48 +00:00
ceriel
db43d1d8a7 Added definitions for "alloc", "hard_alloc". 1986-12-03 13:02:37 +00:00
ceriel
3e4629b077 made to work on small machines. 1986-12-02 16:16:08 +00:00
ceriel
abc2ba9a3c bug fix: size 0 error messages also appeared for labels 1986-12-02 11:39:34 +00:00
ceriel
149c764ca1 Added -i to LDFLAGS. 1986-12-02 11:25:51 +00:00
ceriel
e188fe0956 Version that uses libobject.a 1986-12-01 15:41:29 +00:00
ceriel
b44e39cce8 Version that uses libobject.a. 1986-12-01 15:35:28 +00:00
ceriel
c57d4ff268 some minor bug fixes 1986-12-01 10:06:53 +00:00
ceriel
ad40a77afd handle void properly, avoid 0-alignments, handle #if defined(..) 1986-12-01 10:00:23 +00:00
ceriel
36adbe54a5 Removed some signal handling stuff. The Ack-program should do that. 1986-12-01 09:43:00 +00:00
sater
59861f883b added support for modhead 1986-11-28 13:47:44 +00:00
sater
17f5bc21e7 debugging stuff happened to end up on stdout instead of stderr. 1986-11-28 13:41:09 +00:00
ceriel
a0c21bf820 many bug fixes, and added flexibility in alignments 1986-11-28 11:59:08 +00:00
ceriel
da54801353 newer version 1986-11-26 16:40:45 +00:00
ceriel
552f5a3f61 Initial revision 1986-11-24 21:52:09 +00:00
ceriel
8b718ee54b Initial revision 1986-11-24 21:45:03 +00:00
ceriel
dbb351f078 Handled gen.c wrong. This is corrected. 1986-11-24 21:30:57 +00:00
ceriel
00a2314999 make to work with newer version of LLgen. 1986-11-24 21:24:42 +00:00
ceriel
7c5553640e Added -DNDEBUG 1986-11-24 21:01:42 +00:00
ceriel
5ced6d6aef Initial revision 1986-11-24 20:58:35 +00:00
ceriel
3b2d51a96b Initial revision 1986-11-24 20:42:13 +00:00
ceriel
eba14fa801 Bug fix in "inc loc adi" patterns and the like. 1986-11-24 10:42:29 +00:00
ceriel
596c631a71 Check more, when an error occurred 1986-11-17 13:08:18 +00:00
ceriel
9d0ee46068 Trying to check more of an expression, giving some more sophisticated error messages,and be less wasteful with space for subranges 1986-11-17 11:41:28 +00:00
erikb
22d4d72ef4 adapted default IDEPTH value 1986-11-14 08:16:38 +00:00
ceriel
86018d09e1 changed sizes of labstr and argstr to accomodate longer identifiers. 1986-11-12 21:14:05 +00:00
ceriel
f7a6dc503c Changed sizes of "argstr" and "labstr", to accomodate longer
identifiers.
1986-11-12 21:04:38 +00:00
erikb
ed106b7feb removed the debug message for encountering STRING-type Values 1986-11-12 09:55:28 +00:00
erikb
d51281b576 updated the manual pages 1986-11-12 09:53:18 +00:00
erikb
f784236908 merged the vax and mantra versions 1986-11-11 13:47:58 +00:00
ceriel
45f608bac0 Initial revision 1986-11-11 13:44:58 +00:00
ceriel
fb16148641 Adapted to use of GCIPM. 1986-11-11 13:44:13 +00:00
ceriel
3bc3818955 Adapted to use General C Identifier processing Module (GCIPM).
Also changed so that output for "cid" or "cpp" is in alphabetical order.
1986-11-11 13:42:42 +00:00
ceriel
3860ab6f68 Adapted to new versions of programs 1986-11-11 13:42:16 +00:00
ceriel
94634ace27 Initial revision 1986-11-11 13:34:20 +00:00
erikb
6f8b72bfb3 corrected the treatment of static functions declared on non-global level 1986-11-10 09:16:27 +00:00
erikb
3ebe2a7176 use programs and modules from ACK instead of local versions 1986-11-10 09:14:29 +00:00
ceriel
87af36724b Avoid a bug in the C-optimizer of 4.1 BSD. 1986-11-07 17:54:30 +00:00
ceriel
7fd4e395da Constants changed to more sensible values. 1986-11-07 16:20:33 +00:00
ceriel
981bea82f4 Added "register" to a declaration. 1986-11-07 16:01:45 +00:00
ceriel
a761166dfa *** empty log message *** 1986-11-05 21:31:23 +00:00
ceriel
9291d87dab Several bug fixes 1986-11-05 14:33:00 +00:00
ceriel
97e027db33 Added some code to skip to EOF with LL_NEWMESS. 1986-11-03 14:09:28 +00:00
ceriel
7d2ee932e9 That was: LL_NEWMESS, not LL_NEWMESSAGE! 1986-11-03 10:28:21 +00:00
sater
79a736a9f6 Output was wrong with maxmembers<2 1986-11-03 09:13:32 +00:00
ceriel
541f3caf50 Removed the integer overflow check, as it is'nt checked by
"cg".
1986-10-30 15:44:25 +00:00
ceriel
162eb9bb70 forgot to restore return address in case ".trp" is called. 1986-10-30 15:01:16 +00:00
ceriel
a0a3f2d2b6 Added code that calls LLmessage(-1) when needed, and when LL_NEWMESS is
defined.
1986-10-29 11:30:50 +00:00
ceriel
eedc332a04 Added "nflag". 1986-10-29 11:29:47 +00:00
ceriel
ee27adc926 Added nflag, that allows the LLmessage(-1) call, to indicate garbage
at end of program.
1986-10-29 11:27:47 +00:00
ceriel
de5ac65dd6 Bug fix. Error recovery did not always work as expected. The generated
parser sometimes assumed that a token would not be deleted, and inserted
tokens in front of it, and then deleted the token after all. It should
at each error, first delete, and then insert.
1986-10-29 11:16:55 +00:00
ceriel
200034075d Some name changes in ../../modules/lib. 1986-10-28 17:04:40 +00:00
ceriel
f793e823ec Made the trap message more readable. 1986-10-27 10:17:36 +00:00
ceriel
3d016f7385 Did not work properly, printed wrong trap number. Does not work
properly now, because it does no save the registers.
1986-10-27 09:57:42 +00:00
sater
02ff84337a Typo corrected 1986-10-24 16:58:46 +00:00
ceriel
ca44bfc681 newer version with some bug fixes 1986-10-22 15:38:24 +00:00
ceriel
aac1207beb Error messages are printed differently now. A '%' in an error message
used to cause difficulties.
1986-10-22 15:30:46 +00:00
ceriel
c19358ee50 Bug fix involving '\\'. 1986-10-22 13:36:22 +00:00
ceriel
0595f74596 minor simplification. 1986-10-22 13:36:04 +00:00
ceriel
f932863ee1 minor fix to LLlex.c 1986-10-21 14:45:43 +00:00
ceriel
5f638d7aac newer version 1986-10-20 17:40:41 +00:00
ceriel
697ea6d946 Added an entry for the util/cmisc directory. 1986-10-20 15:00:14 +00:00
ceriel
cb2543df8a Improved the "clean"-entry 1986-10-20 14:58:25 +00:00
ceriel
8129bf95a4 Initial revision 1986-10-20 14:56:37 +00:00
ceriel
991df05826 *** empty log message *** 1986-10-20 14:42:41 +00:00
ceriel
83e08e04d7 Added "Modules" 1986-10-20 14:09:09 +00:00
ceriel
d8ba814b26 Adapted to the use of ../../modules/lib/libstr.a 1986-10-20 13:59:14 +00:00
ceriel
11d442c0a0 Use our own string-routines "strindex" and "strrindex". At least we
know their name!
1986-10-20 13:52:16 +00:00
ceriel
784bd9ec54 Use our own string routines strindex and strrindex. At least we know
their name!
1986-10-20 13:48:26 +00:00
ceriel
84f0869fde Fixed a bug: ack could not see the difference between ".mod" and ".m".
This is corrected.
1986-10-20 13:47:26 +00:00
ceriel
3a076895bb Caused a core dump on 68000-based machines (read: non-VAX) when called
at a certain (high) level of verbosity, -v5 for instance.
Cause: a null-reference. This is fixed.
1986-10-20 13:28:59 +00:00
ceriel
b8bb269c72 Replaced a few "bss 2" by "bss EM_WSIZE". 1986-10-20 11:28:29 +00:00
ceriel
baf5b74da2 A new version, that no longer tries to move all null parts to the end
of a segment. It also uses the "object" library to read and write ACK-
object files and libraries.
1986-10-20 10:17:57 +00:00
ceriel
8ffde3c86a I don't really know why, but the file was changed. 1986-10-20 09:35:51 +00:00
ceriel
e0926981a4 Deleted the #ifdef JOHAN stuff, and
added a #define MAXSECT.
1986-10-16 16:36:00 +00:00
ceriel
908eeaf9cd Removed some ridiculous code. 1986-10-15 13:58:51 +00:00
ceriel
b40489973e Removed part of test 127. It tried a LFR after doing a LOC and an ASS.
This is of course not allowed.
1986-10-13 14:45:18 +00:00
ceriel
256847556e Added a NOFLOAT define. (Taken from Koen Langendoen) 1986-10-13 14:42:31 +00:00
ceriel
36ef5b504b Apparently, ex_ap disappeared. Put it in again. 1986-10-10 15:21:35 +00:00
ceriel
1d0f716a4e Oops, forgot to remove the id_first definition. 1986-10-10 15:09:34 +00:00
ceriel
a43d257715 Added a "fmt_id" define, to prevent that no '_' is placed in front
of an identifier longer than 8 characters.
1986-10-10 15:05:10 +00:00
sater
2672c87f68 empty string was returned when it was not so good. 1986-10-09 16:15:00 +00:00
sater
ae2f236663 nullpointer and empty string were confused.
Long live the PDP and VAX
1986-10-09 16:12:24 +00:00
ceriel
703eb4e7a0 Added RANLIB 1986-10-09 13:21:33 +00:00
ceriel
591a0db767 Removed the "wordsize" variable. it was'nt needed, as we also have
EM_WSIZE.
1986-10-09 11:44:28 +00:00
ceriel
ec2b3e61c6 Addition of some changes by Kees Visser.
In packed structures, subrange types now occupy 1 byte if they fit in
1 byte, they occupy 2 bytes if they fit in 2, etc.
1986-10-09 11:09:27 +00:00
ceriel
9d54fe57f8 Changed a test that was word_size and alignment dependant. 1986-10-09 10:37:56 +00:00
ceriel
3030eb8cae newer version 1986-10-06 20:36:30 +00:00
ceriel
f3bf7cd5bc There was an error in test 026. It used local variables but declared none.
This is corrected.
1986-09-30 11:13:44 +00:00
erikb
5af21dfc79 modified the treatment of op=, ++ and -- operators 1986-09-29 14:01:34 +00:00
erikb
42112db262 modified the treatment of op=, ++ and -- operators 1986-09-29 13:16:11 +00:00
dick
66c247ba9c some very minor changes 1986-09-28 20:33:15 +00:00
ceriel
c3d4d40d1b many bug fixes 1986-09-25 19:39:06 +00:00
erikb
c967d1ab3a put heavily used pointer variables in registers 1986-09-24 13:53:16 +00:00
ceriel
bfad7d30f0 Added a pattern for "ldc ads". 1986-09-24 12:17:25 +00:00
ceriel
6a4a13d041 Initial revision 1986-09-24 11:24:37 +00:00
ceriel
a2599744f0 Addition of new patterns. 1986-09-23 09:41:47 +00:00
sater
9092e509c6 changed ad2str function not to add +0 at labels 1986-09-22 13:15:15 +00:00
sater
b5009c57b4 made debiug output better 1986-09-22 13:14:54 +00:00
erikb
f21743e213 if NOPP: made #line directives treated correctly 1986-09-22 13:04:04 +00:00
erikb
dad1ab3b22 some minor fixes 1986-09-17 12:31:45 +00:00
erikb
a968ce8437 changed some large static data structures into STATIC 1986-09-15 08:47:53 +00:00
erikb
225f1fb724 added one byte to ibuf 1986-09-12 12:58:22 +00:00
erikb
c6a51a39f0 built in the compile time flag NOFLOAT to get rid of the float stuff 1986-09-12 09:16:07 +00:00
ceriel
b6dde9472f Bug fix: The "cmp.l" instruction was sometimes used in an illegal way. 1986-09-10 16:03:11 +00:00
erikb
ecf5219493 corrected the treatment of the <<= and >>= operators 1986-09-10 10:23:26 +00:00
erikb
b9bce39f1e simplified the return expression in loadbuf() 1986-09-09 13:49:46 +00:00
em
c685aa11b5 set limit on optimization passes to prevent loop
in optimizer in case of bad table.
1986-09-09 13:10:15 +00:00
erikb
d7716c5e5a corrected the compile-time evaluation of ~<unsigned value> 1986-09-09 09:47:43 +00:00
ceriel
9dbd1060ad An improvement to prevent calls to the .cuu routine. 1986-09-05 16:35:12 +00:00
erikb
5927f264a8 various null-dereference problems fixed 1986-09-02 15:22:54 +00:00
erikb
c84c57be67 added some LINT facilities 1986-09-02 15:00:50 +00:00
sater
14b982346f Error fixed where w==2 was assumed 1986-08-28 10:28:42 +00:00
erikb
361613bb23 first operand to intexpr is arith typed 1986-08-26 14:59:36 +00:00
ceriel
a0db745586 newer version with bug fixes 1986-08-26 14:33:24 +00:00
erikb
e1c67b1fba unknown-sized locals retain their type 1986-08-26 10:30:39 +00:00
erikb
901d1b3af8 generate a con instruction for each character in a string constant 1986-08-25 08:47:07 +00:00
erikb
fc9f365b47 some minor bugs 1986-08-22 09:20:13 +00:00
erikb
06c0a20b4d made less environ and machine dependent 1986-08-22 09:10:12 +00:00
erikb
a7e97524e4 revised the treatment of "e op= f" expression 1986-08-13 10:05:39 +00:00
erikb
8217bef1eb added some #ifdef USE_TMP lines 1986-07-29 12:49:38 +00:00
erikb
7f74cabf12 added -T<path> option: create temporary file(s) in directory <path> 1986-07-29 11:46:00 +00:00
ceriel
cf8e8a5b96 Added a test for BLS with a blockmove of wordsize bytes. 1986-07-25 16:08:56 +00:00
ceriel
023073b422 Bug fix: the BLS instruction did'nt work with block moves of one word. 1986-07-25 15:57:03 +00:00
ceriel
6dd1a052d3 inn and set must be word-orientated, not byte-orientated. 1986-07-25 15:01:15 +00:00
ceriel
c422c4e130 Bug fix 1986-07-25 14:17:23 +00:00
ceriel
37320faecc Bug fix 1986-07-25 13:19:51 +00:00
ceriel
f68d0ffb7d Made tail_mon dependant on tail_mon.a 1986-07-23 11:06:29 +00:00
ceriel
79eab3513d Added a ".sect .text". The text "landed" in the bss segment. 1986-07-23 11:04:40 +00:00
ceriel
5d188dee44 Bug fix. It just did'nt work. 1986-07-22 15:11:09 +00:00
ceriel
729774d6f8 *** empty log message *** 1986-07-22 14:49:46 +00:00
ceriel
a067d1bc0d Adapted to the use of the new assembler. 1986-07-22 13:42:21 +00:00
ceriel
399a46eb92 Adapted to new assembler and made re-entrant. 1986-07-22 13:37:16 +00:00
ceriel
f514411cea Adapted to use of new assembler. 1986-07-22 13:23:14 +00:00
ceriel
aee6a1648a Initial revision 1986-07-22 11:07:48 +00:00
ceriel
f45f393b71 replaced all occurrences of "cc" by "$(CC)". 1986-07-22 11:01:54 +00:00
ceriel
2acc260239 Adapted so that anybody can do "make install". 1986-07-22 10:47:51 +00:00
ceriel
a184032321 Changed default machine to "vax4". 1986-07-22 10:36:04 +00:00
ceriel
4f3b82565f Added code to use different integer constants when compiled with
word_size >= 4.
1986-07-21 12:26:38 +00:00
ceriel
2934d628b5 Added -Vi... flag to Pascal compiler options. 1986-07-21 09:58:19 +00:00
ceriel
3c76cbaa1e Some changes needed for the new 4-4 Pascal compiler. 1986-07-21 09:53:44 +00:00
ceriel
83d21d8076 Added instructions to make pem44.m 1986-07-21 09:40:20 +00:00
ceriel
d0fdcb18db This is the result of the merging of 2.5 with 2.4.1.1, with some
minor fixes.
1986-07-21 09:30:11 +00:00
ceriel
5fd9c608ed Temporary variables are no longer overlapping. The operlapping caused
problems with register variables.
Also, code is added to prevent the generation of static exchanges.
only included if the preprocessor-constant
NO_EXC is defined.
1986-07-21 09:23:39 +00:00
dick
3434e1c53f some leaks plugged (as detected by the leak detector) 1986-07-18 22:23:23 +00:00
dick
824293a681 some leaks plugged (as detected by the leak detector) 1986-07-18 21:10:42 +00:00
dick
c9a188825d option NORCSID for lint in Makefile is nonsense 1986-07-17 22:17:59 +00:00
ceriel
d5a95fcac0 Some bug fixes 1986-07-14 15:00:08 +00:00
ceriel
832bdeb3be better compatibility between CARDINAL and ADDRESS 1986-07-10 16:27:26 +00:00
ceriel
965e75761d newer version 1986-07-08 14:59:02 +00:00
ceriel
bcfca75b56 newer version 1986-06-26 09:39:36 +00:00
ceriel
9932033365 newer version 1986-06-20 14:36:49 +00:00
ceriel
a9dfdc494b newer version 1986-06-17 12:04:05 +00:00
sater
f1a0c90fb1 removed sanity checking on result from sprintf
System IIIish systems seem to have their own idea.
1986-06-17 09:13:11 +00:00
sater
4398053245 Conversions from 1 byte integers were wrong.
Only discovered after new C-frontend.
1986-06-16 11:35:12 +00:00
ceriel
ec528b797e newer version 1986-06-10 13:18:52 +00:00
ceriel
966213238a There was a bug in the printing of the trap number.
This is corrected.
1986-06-06 23:35:42 +00:00
ceriel
7a9d436a56 newer version 1986-06-06 09:35:11 +00:00
ceriel
caf99ea472 newer version 1986-06-06 02:22:09 +00:00
ceriel
db258b68ea Increased the size of the expression node table. 1986-06-05 13:56:31 +00:00
ceriel
f12ea12eda Rediscovered a bug in the VAX 4.1 UNIX assembler. It handles $0f0.0 wrong!
The changes is the table insure that $0f0.0 is never generated.
1986-06-05 12:43:56 +00:00
ceriel
9e0ab0029b first, almost complete, version 1986-06-04 09:01:48 +00:00
ceriel
db795bc07a newer version 1986-05-30 18:48:00 +00:00
ceriel
6382054ae5 newer version 1986-05-28 18:36:51 +00:00
erikb
441ba991fa revised the type checking of expr in "switch (expr)" 1986-05-28 08:40:06 +00:00
ceriel
f56f8f56f3 newer version 1986-05-23 19:25:21 +00:00
ceriel
1cfe2b5dac newer version 1986-05-23 09:46:31 +00:00
ceriel
0f04bc72bd newer version 1986-05-21 18:32:20 +00:00
sater
5a84f07281 Non existing token fields in the format string caused memfaults
because fields were checked beyond the end of the tokeninfo. Fixed.
1986-05-21 15:08:57 +00:00
ceriel
a4887558b8 newer version 1986-05-16 17:15:36 +00:00
ceriel
15896e422c newer version 1986-05-14 09:03:51 +00:00
ceriel
0bf57a9c64 newer version 1986-05-01 19:06:53 +00:00
ceriel
53e3cd60d0 newer version 1986-04-28 18:06:58 +00:00
erikb
dd5b8dfabf various small layout corrections 1986-04-28 09:56:33 +00:00
ceriel
4173e3c487 newer version 1986-04-25 10:14:08 +00:00
ceriel
a254a8acb1 newer version 1986-04-23 22:12:22 +00:00
ceriel
ce160b4f1a newer version 1986-04-22 23:22:19 +00:00
ceriel
fef8659bf1 newer version 1986-04-22 22:36:16 +00:00
keie
de21842485 Added EODDZ to the exported externals.
It should have been there from the start.
1986-04-22 10:40:29 +00:00
ceriel
674791bf91 newer version 1986-04-21 17:27:06 +00:00
ceriel
6715e3b171 newer version 1986-04-18 17:53:47 +00:00
erikb
53255dcf48 various small corrections 1986-04-17 14:42:54 +00:00
ceriel
d3d6e637d6 newer version 1986-04-17 09:28:09 +00:00
ceriel
426c273de8 newer version 1986-04-15 17:51:53 +00:00
ceriel
7d76f2829a newer version 1986-04-12 02:21:24 +00:00
ceriel
64a9f1e5d7 newer version 1986-04-11 11:57:19 +00:00
ceriel
ba47f9fe7c newer version 1986-04-10 01:08:49 +00:00
ceriel
d1a2112163 safety commit 1986-04-09 18:14:49 +00:00
ceriel
b853ce1546 newer version 1986-04-08 23:51:11 +00:00
ceriel
6ff4d852e1 newer version 1986-04-08 23:34:10 +00:00
ceriel
629b8fdb88 newer version 1986-04-08 18:15:46 +00:00
ceriel
3de71150a6 newer version 1986-04-07 22:15:08 +00:00
ceriel
f2b68c8261 newer version 1986-04-07 17:40:38 +00:00
ceriel
376c47c98f newer version, partial parse trees 1986-04-06 17:42:56 +00:00
ceriel
0e4311490c A newer version 1986-04-04 13:47:04 +00:00
erikb
b5e1097890 corrected the treatment of PREDEF-ed macros 1986-04-04 11:31:03 +00:00
erikb
bb8d6b5143 revised the treatment of strings in initialisations 1986-04-04 09:54:50 +00:00
ceriel
c8453bb3f7 newer version, safety commit 1986-04-03 17:41:26 +00:00
erikb
4c75213caa adapted to print(3L) module 1986-04-03 14:32:56 +00:00
erikb
725d3fa6ea revised check_ival() (among some other small changes) 1986-04-03 11:33:32 +00:00
ceriel
52d743f223 Newer version, safety commit 1986-04-03 00:44:39 +00:00
ceriel
b89155a64a newer version, safety commit 1986-04-02 17:34:21 +00:00
erikb
66c571d217 revised the administration of Value expressions 1986-04-02 08:37:17 +00:00
ceriel
fac31cce07 Newer version, safety commit 1986-03-29 01:04:49 +00:00
dick
ad1feaf35c expression nodes now can have a flag EX_ERROR 1986-03-27 18:17:48 +00:00
ceriel
f2764393be safety commit, newer version 1986-03-27 17:37:41 +00:00
sater
851a68883c repaired inreg() pseudofunction, it delivered total nonsense 1986-03-27 15:49:16 +00:00
erikb
5bdb108e47 modified the string-constant printing routines; bts2str() is invoked 1986-03-27 11:01:12 +00:00
ceriel
f2ff7661e4 safety commit, newer version 1986-03-26 22:46:48 +00:00
ceriel
4a91a6bf4b newer version, safety commit 1986-03-26 17:53:13 +00:00
erikb
e8505e4434 introduced the string(3L) module 1986-03-26 16:58:43 +00:00
ceriel
7f174a46c3 A newer version, safety commit 1986-03-26 15:11:02 +00:00
dick
8546fbe868 identifier pfd_type renamed to fdtpp 1986-03-26 14:01:10 +00:00
erikb
80155f7b4c introduced the em_code(3L) and em_mes(3L) modules 1986-03-25 16:40:43 +00:00
erikb
1afbf0e20f adapted to the system(3L) interface 1986-03-25 10:39:23 +00:00
ceriel
0e39681621 some improvements 1986-03-24 17:29:57 +00:00
erikb
0d63470af3 fixed a garbage collection problem 1986-03-21 13:26:28 +00:00
ceriel
b683a21217 Initial version 1986-03-20 14:52:03 +00:00
erikb
9f8f8c1a9c fixed a bug in check_*_expr() 1986-03-20 13:09:47 +00:00
sater
5c71bad6e1 Relaxed input syntax for from STACK coercions
No gen clause is necessary anymore.
1986-03-19 16:14:12 +00:00
erikb
ea73b04ef3 improved lay-out 1986-03-19 16:07:32 +00:00
erikb
f14b5ead0e Added C_init(), an empty-bodied routine 1986-03-19 12:36:02 +00:00
erikb
48cbb00cbe Recovered from some inconsistencies. 1986-03-19 12:31:05 +00:00
erikb
fe073353c0 last modifications in order to introduce the EM library mechanism 1986-03-18 09:01:59 +00:00
dick
5880700ab4 some long lines split 1986-03-17 17:47:04 +00:00
dick
021d8d1fec more calls of expr_error() for better error reporting 1986-03-15 18:16:30 +00:00
dick
c80f2c0817 improved error reporting for initialization expressions
miscellaneous changes
1986-03-14 16:15:16 +00:00
erikb
6e53274b6a simplified the EM con/rom functions (86/03/13) 1986-03-13 13:27:44 +00:00
erikb
43e75cec60 renamed some EM code functions according to the 86/03/11 EMCODE definition 1986-03-11 15:21:30 +00:00
erikb
4b2ac75e94 added the possibility to prepend your own libc.a before the default 1986-03-11 14:46:46 +00:00
erikb
5f734a6210 removed a reference to declarator.str 1986-03-10 15:59:43 +00:00
erikb
c0becb6dc7 Introduced the ALLOCDEF mechanism 1986-03-10 15:20:30 +00:00
erikb
3dbb828d82 Introduction of ALLOCDEF 1986-03-10 15:18:00 +00:00
erikb
69e7c2d0ae introduced the ALLOCDEF mechanism 1986-03-10 15:16:33 +00:00
erikb
5d1e9f0c86 renamed declarator.h as declar.h 1986-03-10 15:10:56 +00:00
erikb
787061ffd4 *** empty log message *** 1986-03-10 13:15:40 +00:00
erikb
bc296e2dcc *** empty log message *** 1986-03-10 13:07:55 +00:00
em
c21def03db updated 1986-03-05 17:12:39 +00:00
dick
916a65f5d6 generated itables no longer in RCS; avoid overflow in app.codes.pr 1986-03-05 16:58:40 +00:00
em
c2dc6da49f Added the possibility of a third field in the pseudo-instruction
description.
This change is upwards compatible with the previous version, t.i., it still
works the same with the previous version of "em_table".
1986-03-05 14:27:08 +00:00
em
0f84a92306 Added a third field to the pseudos indicating the type(s) of argument(s).
New types are:
	t	cst	{0,1}
	a	par
	v	val
	e	dlb
Also added : ?, * and +, having the usual regular expression meaning.
1986-03-05 13:45:38 +00:00
dick
f0cb9591ec adapting to phototypesetter 1986-03-04 15:30:45 +00:00
ceriel
249314e586 Bug fix: The "calls" instruction could be called with
first argument > 255. This is corrected.
1986-03-04 11:39:22 +00:00
dick
10569743c8 adapting to phototypesetter 1986-02-28 18:02:00 +00:00
dick
1cd71875ac small adjustments 1986-02-28 17:46:09 +00:00
dick
43fd3df629 entry clean added 1986-02-27 14:57:35 +00:00
keie
7592c2cb1a Adapted to our ack environment. 1986-02-11 11:22:43 +00:00
keie
7606d347a0 Added a warning message. 1986-02-11 11:18:57 +00:00
keie
9c10e17f06 Ack is using good old cpp again. 1986-02-11 11:15:19 +00:00
keie
2d429613e6 *** empty log message *** 1986-02-11 11:14:11 +00:00
keie
2ff183fd2a Too long ago. 1986-02-11 11:13:41 +00:00
bal
b48d45c38d increased STACK_DEPTH from 50 to 250 1986-02-10 11:04:33 +00:00
ceriel
e2cfecffe3 Added some new patterns involving multiplies with 0, 1 etc. 1986-02-10 10:14:41 +00:00
ceriel
847de065d6 A minor improvement. 1986-02-10 10:08:27 +00:00
dick
9694054674 updated for photo-typesetter 1986-02-04 17:37:41 +00:00
em
f3e2248cc4 fixed bug in number() -- hex letters mistreated 1986-02-03 14:30:19 +00:00
sater
ef48465b2a Hex numbers didn't work. Corrected bug in myatoi(). 1986-01-24 16:08:34 +00:00
dick
d112eb710c adapted to phototypesetter 1986-01-20 20:39:09 +00:00
sater
144ef77113 Some old changes by keie, plus added tbl to ncg.doc 1985-12-04 16:08:21 +00:00
sater
5c0660793d Changed to be printed on laserprinter.
Removed paragraph about bug, since bug is now solved
1985-12-04 15:52:51 +00:00
sater
a91e33ce96 Corrected error in otime of initialisation of booleans 1985-12-02 13:55:06 +00:00
ceriel
5b09f4211d A minor change in the LL.output format. 1985-11-26 13:27:51 +00:00
ceriel
4b31842ecc Remove targets before installing new ones 1985-11-25 16:26:59 +00:00
ceriel
7e978197d2 New manual page for a completely new version of LLgen. 1985-11-25 16:00:18 +00:00
ceriel
1284cf0187 Changed dependancies 1985-11-25 15:57:43 +00:00
ceriel
fb36b6b633 New version of LLgen, new version of this Makefile ... 1985-11-25 15:52:56 +00:00
ceriel
8b48512de7 New version, with a much faster parser. 1985-11-25 15:50:51 +00:00
ceriel
70a5d416d1 New version, much faster 1985-11-25 15:50:19 +00:00
ceriel
42d0e056fb Completely new version, generating a much faster parser 1985-11-25 15:48:42 +00:00
ceriel
f055d610d3 Completely new version, generating a much faster parser. 1985-11-25 15:47:51 +00:00
bal
5ac646f89f Yet another bug reported by sater. 1985-11-18 16:55:53 +00:00
keie
b493f98f39 The extra BSD4.2 code caused two branches to be out of range. 1985-10-15 15:53:48 +00:00
keie
2e947a5e91 BSD4.3 size returns an error when it cannot find one of
its arguments.
1985-10-15 15:47:12 +00:00
bal
c9c168d853 Several optimization patterns for DAS (Delftse Ada Subset) frontend added. 1985-10-14 09:27:24 +00:00
ceriel
e494e09063 Initial revision 1985-10-03 18:31:47 +00:00
ceriel
aab6140bfa different interface. 1985-10-03 17:19:14 +00:00
bal
98d06cffb2 0 / -1 confusion for properties (bug reported by sater). 1985-10-03 14:47:28 +00:00
bal
de79024451 0 / -1 confusion for properties (2 bugs reported by sater). 1985-10-03 14:45:53 +00:00
bal
dcb4b71a3d 0 / -1 confusion for properties (bug reported by sater). 1985-10-03 14:41:44 +00:00
ceriel
d07e8114c6 More safety, also after terms and nonterminals. 1985-10-03 12:38:55 +00:00
ceriel
67beb0c4d5 *** empty log message *** 1985-10-03 10:36:07 +00:00
ceriel
ca4cc6fe80 Initial revision 1985-10-03 10:35:55 +00:00
ceriel
4ed4dab397 *** empty log message *** 1985-10-03 10:25:40 +00:00
ceriel
6b74749c12 Initial revision 1985-10-03 10:25:23 +00:00
ceriel
b83ab7873e A more precise safety after a term. 1985-10-02 22:49:16 +00:00
ceriel
73153b484b Initial revision 1985-10-02 22:20:04 +00:00
ceriel
40915d76c6 Name change : tail_em.vend -> end_em.s 1985-09-19 14:03:13 +00:00
bal
8668e313f8 bug fixed: same problem as in r1.3, now with csb.
Solution: only do block fusion if first block end on bra.
1985-09-19 11:14:55 +00:00
bal
a18c5dd9c4 bug fixed: last instruction of first block in block fusion optimization
can be a conditional branch. (bug detected by Ceriel).
1985-09-18 16:27:29 +00:00
bal
53f6b51cde sprintf does not return pointer to string so the assert(s==string) does
not make any sense.
1985-09-06 11:39:06 +00:00
bal
6a4d9703cc exit(0) added (trouble with make) 1985-09-06 11:38:00 +00:00
bal
0d9459bdd6 MAXSTAB set to 2500 (problem with argument list of ROM for new C front-end). 1985-09-06 11:06:32 +00:00
bal
57a2371a16 bug fixed: null-pointer dereference. 1985-08-13 14:03:23 +00:00
em
cd5fb7ea8c Added str0 and str 1. 1985-07-26 17:38:22 +00:00
em
8ebd47f7d7 The identifier ns occurs in C programs. 1985-07-26 17:15:15 +00:00
em
bccc87a808 Annita's versie 1985-07-26 17:14:13 +00:00
em
478209a840 This one works correctly for programs failing to translate. 1985-07-26 17:04:31 +00:00
em
1c5cb87985 removed a superfluous line. 1985-07-26 15:37:11 +00:00
em
83103c314b Initial revision 1985-07-26 12:52:13 +00:00
em
bc759a2903 *** empty log message *** 1985-07-26 12:51:45 +00:00
em
6bdc39213b Initial revision 1985-07-26 11:56:24 +00:00
em
0e7eb937b4 Not using libmon. 1985-07-26 11:47:54 +00:00
em
e63968056e Added RCSID 1985-07-26 11:45:49 +00:00
em
9ef57888fa Initial revision 1985-07-26 11:38:59 +00:00
em
6710f21388 *** empty log message *** 1985-07-26 11:29:08 +00:00
em
b5efab645f Initial revision 1985-07-26 11:05:30 +00:00
ceriel
5d86ead6c0 There was a bug in the "str $1==0" instruction. It said:
str $1==0	| source4 |
			remove(ALL) "jsb\t.strlb"	|	| |
It should of course have been
str $1==0	| STACK |	jsb\t.strlb"	|	| |
1985-07-21 11:34:33 +00:00
bal
7b4b53af21 bugs for ngf 8 and fif 4 fixed (asp 16 --> asp 8). 1985-07-19 18:02:25 +00:00
bal
2e5bf801a0 patterns for "loc loc cii/cui/ciu/cuu $1==$2" added. 1985-07-19 17:58:34 +00:00
bal
04cee55976 .sect .text added 1985-07-19 13:43:03 +00:00
bal
479827380c .sect .text added 1985-07-18 14:52:56 +00:00
keie
6f22e5b7d9 %D => %ld 1985-06-21 12:55:17 +00:00
keie
6de8b41da2 *** empty log message *** 1985-06-19 13:42:49 +00:00
keie
3e6e781c8d Now using AALMAG instead of ARMAG for led libraries. 1985-06-12 10:31:28 +00:00
keie
57acada057 *** empty log message *** 1985-06-10 16:57:01 +00:00
keie
68e92c8319 *** empty log message *** 1985-06-10 16:05:04 +00:00
keie
1b972eff60 *** empty log message *** 1985-06-10 15:32:18 +00:00
keie
b11d9ce683 *** empty log message *** 1985-06-10 14:52:43 +00:00
keie
1c19000977 *** empty log message *** 1985-06-10 13:55:48 +00:00
keie
eea5656df7 *** empty log message *** 1985-06-10 13:50:36 +00:00
keie
8749fb1da8 Using new magic number for 'aal' archives. 1985-06-10 12:41:51 +00:00
keie
a90254c045 Added AALMAG, for making distiction between 'led' archives
with SYMDEF and archives made/altered with 'arch'.
1985-06-10 11:28:06 +00:00
keie
dacde83aae Removed debugging printout. 1985-06-10 11:23:22 +00:00
keie
42c2a9754f Adapted by Sjoerd to amoeba. 1985-06-10 10:53:15 +00:00
keie
44ccf469d9 Changed to get led working under amoeba.
Author: K.S. Mullender.
1985-06-10 10:48:49 +00:00
keie
1c9723afd7 Using new assembler & linker. 1985-06-04 11:43:01 +00:00
keie
23bf60a80e Adapated to use of new linker & assembler. 1985-06-04 11:30:54 +00:00
keie
04e97ce36b *** empty log message *** 1985-06-04 11:18:43 +00:00
keie
0370ea6d61 Adapted to use of the new assembler & linker 1985-06-04 11:18:09 +00:00
keie
a9bbf81f93 Adapted to use of new assembler & linker 1985-06-04 10:57:42 +00:00
keie
fa2547ddf7 Adapted to use of new linker & assembler. 1985-06-04 10:44:10 +00:00
keie
a26a8318da Adapted to using the new assembler & linker. 1985-06-04 10:40:50 +00:00
keie
206c33b6bc Added a module for fake floating point. 1985-06-04 10:39:45 +00:00
keie
5acb12ebe0 Now prevents inclusion of failed compilations into libraries. 1985-06-04 10:32:27 +00:00
keie
040aa7115c Adapted to use of new assmbler and linker. 1985-06-04 10:32:07 +00:00
keie
531353e14d More adapted to use by march. 1985-06-04 10:30:18 +00:00
keie
3f83d34dd9 Adapted to use of the new assembler and linker. 1985-06-04 10:29:56 +00:00
keie
5fc5b3c32d A version that tells march to not try to include objects
of modules that failed to translate in the library.
1985-06-04 10:26:06 +00:00
keie
227a684c70 Adapted tu use new assembler & linker. 1985-06-04 10:25:30 +00:00
keie
be932f0f5b 1 - Changed %D into %ld.
2 - Adapted to the new linker.
1985-06-04 10:21:15 +00:00
em
37c3bced4b Adapted to using the new linker. 1985-06-04 09:48:00 +00:00
em
4eed0fe226 Added one remark intended for bug circumvention. 1985-05-28 15:57:52 +00:00
em
4d183a3757 *** empty log message *** 1985-05-23 13:56:24 +00:00
keie
177af75c93 *** empty log message *** 1985-05-13 11:19:24 +00:00
keie
f90babad30 Adapted to installation in the EM tree. 1985-05-13 11:09:53 +00:00
keie
8cbd17b1ba *** empty log message *** 1985-05-13 11:06:30 +00:00
bal
0db1db10b8 Bug fixed: cg generated instructions like "and.l #2,a4", which are
not allowed on the 68000.
The condition "inreg($...) < 2" is added to every EM-pattern that
accesses local non-register variables. So the ordering of the
patterns for regvar/non-regvar is no longer important.
1985-05-01 12:53:33 +00:00
keie
eb025dae5c Added a message to the effect that 'local commons' can not be handled. 1985-04-29 11:55:30 +00:00
keie
cec503a1b4 Changed trap number into bit shifted by number for ignore mask.
The whole example is, at leat, unclear.
The trap for EFOVL never occurs!
1985-04-25 13:37:59 +00:00
keie
5472fafa56 Add hoc solution of .align problem. 1985-04-23 12:55:01 +00:00
em
a0a7a48c3b The reading of the input is now machine independent. 1985-04-22 15:13:24 +00:00
em
89a37681fc *** empty log message *** 1985-04-22 14:12:26 +00:00
keie
7b6ed6733f Added assignment for debuuging info. 1985-04-19 13:28:56 +00:00
keie
78961d37c1 Now using out.h from ../../h 1985-04-18 15:22:22 +00:00
keie
b391be598b Now using arch.h, out.h and ranlib.h from ../../h 1985-04-18 15:21:16 +00:00
bal
d0e857ddb2 Initial revision 1985-04-18 15:14:37 +00:00
bal
928e341f16 Bug fixed: incorrect return value
New version adapted from m68k4 version.
1985-04-18 15:12:29 +00:00
bal
3759de23eb Extra systems calls added 1985-04-18 15:12:06 +00:00
ceriel
9c9976c121 Er zat een bug in het patroon
lol adp stl met $1 < 0.
Ten onrechte werd in de gegenereerde code het AP register gebruikt.
Dit moest natuurlijk FP zijn.
1985-04-17 13:38:36 +00:00
keie
eb3fc1d43e Added provision to print (possibly in mach.h defined) modhead
on the output assmble file as the very first text.
1985-04-16 16:14:55 +00:00
bal
7b745d6fb2 Bug fixed for pattern 'sti $1 > 4' (ADDREG -> ADDSCR)
Bug was present since version 1.1
1985-04-16 15:24:23 +00:00
em
d10d14acac Initial revision 1985-04-15 00:05:45 +00:00
em
ca5599714b Initial revision 1985-04-14 23:26:24 +00:00
keie
f337b8df6d Removed RANLIB . 1985-04-14 14:27:04 +00:00
keie
7cd58cabab Added m68k4, pmds4
Removed one superfluous line.
1985-04-14 13:59:14 +00:00
em
8b4f21bd95 Added libraries needed after installation of cg. 1985-04-14 13:57:31 +00:00
em
ab820d3083 8080->i80. 1985-04-14 13:54:33 +00:00
em
fb23d440f0 Removed a superfluous line. 1985-04-14 13:46:54 +00:00
em
f70b857d1b Added pmds4. 1985-04-14 13:22:26 +00:00
em
bd07643039 To prevent a (incorrrect) error message from distr/mktree. 1985-04-12 20:32:06 +00:00
keie
686e5af1bb *** empty log message *** 1985-04-12 20:07:13 +00:00
keie
34ccddfc2d The library name was incorrect. 1985-04-12 17:21:52 +00:00
keie
b6f73fdc29 Initial revision 1985-04-12 17:08:56 +00:00
keie
c19324dfea *** empty log message *** 1985-04-12 17:06:38 +00:00
keie
772b64fabd *** empty log message *** 1985-04-12 16:56:43 +00:00
keie
ef92740400 Deletion of a few coercions caused a translation failure
for setjmp.e.
The coercions have been grabbed from an old version by FvH.
1985-04-12 16:43:40 +00:00
keie
ee9c5be180 Initial revision 1985-04-12 16:40:22 +00:00
bal
ca9a6feeb0 floating point stuff added 1985-04-12 15:47:30 +00:00
keie
022cb596be *** empty log message *** 1985-04-12 15:06:05 +00:00
keie
9eb53c3d47 *** empty log message *** 1985-04-12 14:59:45 +00:00
keie
dfcfa9883b Initial revision 1985-04-12 14:55:00 +00:00
em
fb6d291d38 *** empty log message *** 1985-04-12 14:33:09 +00:00
em
e4e29ae837 Added flp.s, contains subroutines for all EM fp instructions.
They trap.
1985-04-12 14:29:07 +00:00
em
94534b7c15 1- Floating point routines now call routines instead of calling trp. 1985-04-12 14:25:59 +00:00
em
491040b2c7 *** empty log message *** 1985-04-12 14:01:20 +00:00
keie
b4adc21f19 Putting some dots on some i's. 1985-04-12 11:32:41 +00:00
keie
bae4084355 *** empty log message *** 1985-04-12 11:25:21 +00:00
keie
d394fe5dda Just newer. 1985-04-12 11:20:15 +00:00
keie
dcfe4e8a97 *** empty log message *** 1985-04-09 13:48:55 +00:00
keie
be9e253a2f Added 1)libsys 2)end_em.
Changed handling of -i flag.
1985-04-02 11:21:33 +00:00
keie
620216fb26 Error code 0 was returned when the installation failed! 1985-04-02 10:55:02 +00:00
keie
70d71f4355 Copy of ../libbc/compmodule. 1985-04-02 10:50:53 +00:00
keie
6b87f1082e Removed -DCPM. 1985-04-02 10:46:43 +00:00
em
fd44c34a61 *** empty log message *** 1985-04-01 17:02:55 +00:00
keie
6c247029bd *** empty log message *** 1985-04-01 14:44:26 +00:00
keie
6bbdb92784 Adapted after installation of backend. 1985-04-01 14:02:58 +00:00
keie
22182c0d7f *** empty log message *** 1985-04-01 14:00:00 +00:00
keie
87f66789de Some minor cleaning up. 1985-04-01 13:20:42 +00:00
em
1879c8e724 *** empty log message *** 1985-03-29 21:44:50 +00:00
em
693830b09a *** empty log message *** 1985-03-29 21:10:43 +00:00
keie
e3fa99632e Corrected parameter name usage from i to d. 1985-03-26 17:03:30 +00:00
keie
b3d11b1fa5 Removed pascal library. 1985-03-26 16:27:23 +00:00
keie
2b6187a009 *** empty log message *** 1985-03-26 16:23:21 +00:00
keie
a8fc6009f7 The dl programs is replaced by a more general cv. 1985-03-26 16:20:11 +00:00
keie
92141b52ce Installed backend and libraries. 1985-03-26 16:18:24 +00:00
keie
b63f304db1 Or's are not allowed on a-registers, add's are. 1985-03-26 16:09:07 +00:00
keie
ec3e755168 Adapted to Unisoft signal handling. 1985-03-26 16:08:09 +00:00
keie
a41ff68078 *** empty log message *** 1985-03-26 15:04:46 +00:00
keie
244e172413 Added head_em. 1985-03-26 15:04:02 +00:00
keie
da936740a6 Added head_em to libsys. 1985-03-26 15:00:09 +00:00
keie
35fae90a9d Fetch head_em from pmds4.
Short size is 2 not 4!
1985-03-26 14:58:54 +00:00
keie
c5a739c68f Moved head_em to libsys. 1985-03-26 14:53:00 +00:00
keie
dc92fe358e *** empty log message *** 1985-03-26 14:48:32 +00:00
keie
59996174b6 Added some more system calls.
Moved errno to a separate file.
1985-03-21 14:13:55 +00:00
keie
84f9364d4c errno is moved to a sfile of its own. 1985-03-21 14:05:03 +00:00
keie
a635fb0203 *** empty log message *** 1985-03-21 14:04:45 +00:00
em
e3e1c5ac20 *** empty log message *** 1985-03-18 17:27:42 +00:00
em
e3e9add8b1 Initial revision 1985-03-18 17:24:31 +00:00
em
ffd0d165a7 *** empty log message *** 1985-03-18 15:52:00 +00:00
em
c1d5a0c721 Changed 8080 into i80. 1985-03-18 14:44:15 +00:00
em
3e743d78f3 *** empty log message *** 1985-03-18 14:39:26 +00:00
em
90c847ca59 *** empty log message *** 1985-03-18 14:32:46 +00:00
em
1b162c577e *** empty log message *** 1985-03-18 13:46:31 +00:00
em
a5f4b01d82 Initial revision 1985-03-18 13:15:00 +00:00
em
c5508c7c0b *** empty log message *** 1985-03-18 13:12:07 +00:00
garde
80e349860b Added RCS id. 1985-03-18 12:55:07 +00:00
em
157b243956 *** empty log message *** 1985-03-18 12:46:51 +00:00
em
eabf214312 *** empty log message *** 1985-03-18 11:11:44 +00:00
garde
d52117c8dd Some less important changes 1985-03-18 10:00:30 +00:00
keie
d457c50945 The universal assembler has a bug that precludes use of .align
in text segments, except as the very last command.
1985-03-15 11:03:41 +00:00
keie
b294ab5042 The universal assembler has a bug that precludes use of .align
in text segments, except as the very last command.
1985-03-15 10:50:35 +00:00
em
9d0812746b The assembler proved to contain yet another bug.
.align in text segments will not work for values that are
not a divisor of the gcd of the instruction sizes.
1985-03-14 17:33:28 +00:00
em
9f203c9a17 Expressions are now always calculated in long.
Some backends needed that.
1985-03-12 10:41:29 +00:00
em
0c92039ba4 Expression are always evaluated in longs.
Some 2-4 backends needed long expressions.
1985-03-12 10:39:24 +00:00
em
cf6d084155 Use of the Pascal library will not occur.
/.
1985-03-12 10:24:51 +00:00
keie
7e6a6f6de2 Now also testing for availability of /tmp and /usr/tmp. 1985-03-11 13:10:52 +00:00
bal
954d3a0326 Argument is 4 bytes (pointer), not 2 bytes. 1985-03-05 12:33:29 +00:00
keie
6f6356e0b4 Initial revision 1985-03-05 00:17:40 +00:00
keie
9e26d0e0c0 *** empty log message *** 1985-03-05 00:15:40 +00:00
keie
bf3ba84e92 Adapted to 4-4. 1985-03-04 17:26:31 +00:00
keie
7a790e48fb Bleasdale only. 1985-03-04 16:47:56 +00:00
keie
32bc0f2982 Initial revision 1985-03-04 16:44:32 +00:00
keie
fb4a3fd479 *** empty log message *** 1985-03-04 16:35:40 +00:00
keie
ccdb8693ee Now using 4-byte integers and clearing D1 for double size
instruction pointers.
1985-03-04 16:12:10 +00:00
keie
a8c5699241 Now returns correct values. 1985-03-04 16:11:56 +00:00
keie
e0c4e4b686 Added execv and execle. 1985-03-04 16:11:41 +00:00
keie
8a40c25069 Now using .reghp. 1985-03-04 16:11:26 +00:00
keie
0fd729951a Removed superfluous instruction. 1985-03-04 16:10:47 +00:00
keie
7a30dc4868 *** empty log message *** 1985-03-04 16:08:41 +00:00
keie
4b1965afbc *** empty log message *** 1985-03-04 15:55:28 +00:00
keie
b2b281f525 To force the first part of a circular ring of modules in from
tail_em.
/.
1985-03-04 15:37:38 +00:00
keie
d2a6847715 The previous version still assumed two-byte integers. 1985-03-04 15:33:28 +00:00
keie
2690f07cbd Incorrect alignment caused odd _end, which caused
failures of malloc().
1985-03-04 15:30:44 +00:00
keie
aa82964563 Now also prints stack height. 1985-03-04 15:29:36 +00:00
keie
c636aba734 Alignment now also works when the alignment ended on odd boundaries. 1985-03-04 15:28:02 +00:00
keie
ce92663b0a Initial revision 1985-03-04 15:27:09 +00:00
keie
a89ba7074f Always returned non-zero value. 1985-03-04 15:25:33 +00:00
keie
a71e706aa4 *** empty log message *** 1985-03-04 15:14:01 +00:00
garde
736a2d1022 Many things improved and extended 1985-03-04 13:42:38 +00:00
keie
17e13e9e71 Adapted to single cv for all machines. 1985-03-01 22:11:46 +00:00
keie
9d7b94ba34 Adapted to a single cv for all machines. 1985-03-01 22:10:44 +00:00
keie
218f7ed718 Corrected a horrible typing mistake. 1985-03-01 20:08:45 +00:00
keie
cb0b2e08cf 1 - At RREMOVE also check the stack set aside for coercions.
2 - When coercions unexpectedly need stack of part of the
stakpattern, discontinue this option.
1985-03-01 16:25:21 +00:00
keie
c2a990768d The top of the stack, which is set aside for certain
coercions is now saved with special routines.
This allows RREMOVE to check for registers.
1985-03-01 16:20:13 +00:00
keie
36537eccc0 Also clear D1 (for static link). 1985-03-01 16:00:23 +00:00
keie
6cdcb391fb Added RCS ID. 1985-03-01 10:34:00 +00:00
keie
9d9c9ae97b *** empty log message *** 1985-03-01 10:30:23 +00:00
bal
c478b62711 bug fixed in kill_much():
for ( .. ; i != (Lindex) i; ..  ) should be
for ( .. ; i != (Lindex) 0; ..  ).
1985-02-28 10:35:57 +00:00
keie
e7f7f33f60 cg tried to stack register parameters of moves, when
these registers were killed.
1985-02-26 16:31:38 +00:00
keie
c1f3dbba33 1 - Removed PMDS from selection list.
2 - Joined two line, that should have been one.
1985-02-26 11:56:57 +00:00
bal
d5098fe70f Bug fixed: co_lfirst received wrong value for multiply-optimization. 1985-02-25 14:03:09 +00:00
bal
469d075e77 Calls of which the actual and formal parameters do not match
are no longer substituted inline.
1985-02-20 15:01:02 +00:00
keie
2a4b3fd616 Removed nascom/z80a from the distribution. 1985-02-19 13:59:17 +00:00
keie
408dacc2aa The stacking pattern for ldc C and 4 with highw(c)==0 was incorrect.
The effect was that rand() from libcc/gen always returned
a 0.
1985-02-19 13:41:30 +00:00
bal
7397122695 p_use->u_ext field deleted from showptable() 1985-02-19 11:16:11 +00:00
bal
abcbc93b5d Dependencies for .m files added. 1985-02-19 11:13:13 +00:00
keie
de6ce0fe74 Added a default in the ANY case for system type. 1985-02-19 10:31:20 +00:00
keie
b449b94b48 Removed nascom from linked list. 1985-02-18 23:06:13 +00:00
keie
7d85a4c0b3 Added link to 6805. 1985-02-18 23:01:05 +00:00
bal
66ab97d2b0 bug fixed: lifetime of an item was too short; it should also cover
any live/dead message prior to its initial live-message.
1985-02-18 15:14:22 +00:00
keie
241a7de970 The PDP 11 needs -i, Vax'en ignore it. 1985-02-18 12:45:31 +00:00
keie
41d580c9cf Added some comment. 1985-02-18 01:06:58 +00:00
keie
ec46d547c4 Made use of apc and acc where assuming results
can be run on own system explicit.
1985-02-18 01:03:51 +00:00
keie
daa47964a5 Changed "name of system" into "type of system". 1985-02-18 00:12:12 +00:00
keie
ee63833f41 Basic also needs libc.a. 1985-02-17 22:47:40 +00:00
keie
445d52de66 Moved retar from ret.s to trp.s.
trp.s needed it and is behind ret.s in the library.
When ret.s is loaded, it calls (via unknown) trp.s so
inclusion in trp.s should work.
1985-02-17 22:31:10 +00:00
keie
b82c00e153 Added a line for
loc loc cuu $1==$1, because write.e contained the line
loc 2
loc 2
ciu
and the cg failed to translate.
1985-02-17 22:03:44 +00:00
keie
972692cb1c Further refinement. 1985-02-17 22:01:03 +00:00
em
bbfb511322 Added .align 2. Prevents end of bss to be odd.
Especially important for malloc, it distinguishes between
odd and even word pointers.
1985-02-17 01:12:36 +00:00
cvs2hg
3f3bddef8f fixup commit for tag 'dist2' 1985-02-17 00:57:20 +00:00
keie
9f45dd0650 Added .align 2.
Especially important for malloc.
1985-02-17 00:57:19 +00:00
keie
43a2b60360 *** empty log message *** 1985-02-16 22:09:05 +00:00
keie
14875e6ca5 *** empty log message *** 1985-02-16 16:48:18 +00:00
em
d32de5df93 Now chooses between Vax and Pdp conversion. 1985-02-16 15:58:34 +00:00
keie
eeb944f6e3 The assembler is used for both 2/4 and 4/4. 1985-02-16 15:49:03 +00:00
em
ca28f34c8e *** empty log message *** 1985-02-15 23:13:04 +00:00
em
625c309fa6 1985-02-15 23:12:16 +00:00
em
9f3928cd3a Adapted to -DNOFLOAT. 1985-02-15 23:11:30 +00:00
em
a65f05f29f Adapted to NOFLOAT. 1985-02-15 23:10:04 +00:00
em
6a6a84a274 *** empty log message *** 1985-02-15 23:00:46 +00:00
em
4f80e81ee7 *** empty log message *** 1985-02-15 22:53:13 +00:00
em
eb2b9d0bac Removed one error. 1985-02-15 14:37:35 +00:00
em
792d315beb Program was adapted with NOFLOAT flag. 1985-02-15 14:23:34 +00:00
em
04e454d3c6 Added RCS id.
Adapted to use the NOFLOAT cpp flag.
1985-02-15 14:20:04 +00:00
bal
a1c2dadb2a Compare group (cmp,cmi,cmu,cms,cmf) added as cheap operators. 1985-02-15 13:18:57 +00:00
em
b6381fad79 The cho worked incorrectly, thereby causing the whole test to fail. 1985-02-13 00:41:16 +00:00
em
c9eb48d373 Removed the use of float from the test.
Using int's in sqrt gives the same result.
1985-02-12 23:27:23 +00:00
em
67d635ccd4 1985-02-12 23:07:22 +00:00
em
f37307bc06 A slightly different message. 1985-02-12 23:07:05 +00:00
keie
2a4335787e Adfded RCS id. 1985-02-12 14:37:52 +00:00
keie
1b5278f3d4 As left by Hans v. Staveren. 1985-02-12 14:32:20 +00:00
keie
815b0e0f0f *** empty log message *** 1985-02-12 14:20:30 +00:00
keie
70c000b03e Now using the same em.c as in m68k2/int.
The interpreters are moved from pdp/pdp_int (or some such)
to lib/int22.
1985-02-12 13:11:27 +00:00
keie
f59262745e Initial revision 1985-02-12 12:54:44 +00:00
keie
cc4f8a793a Initial revision 1985-02-12 12:28:49 +00:00
keie
52fee02e94 Adapted to run on 4/4 machines. 1985-02-11 14:33:04 +00:00
keie
fee336890b Placed a few dot on e few i's. 1985-02-11 14:32:02 +00:00
keie
0b6744bb91 The default for any machine is without, double length
integer arithmetic and without floating point.
1985-02-11 11:17:35 +00:00
bal
e704ddc158 restructured. 1985-02-11 10:52:49 +00:00
bal
f7699474b8 The binaries of the phases of ego are now put in a single directory. 1985-02-11 10:07:47 +00:00
bal
6909adbf9c Macros newcflpx and oldcflpx added. 1985-02-11 09:52:11 +00:00
bal
156775643e Include files and declaration of em_flag added. 1985-02-11 09:51:02 +00:00
bal
d41c902b12 Memory allocation/deallocation for extends changed. 1985-02-11 09:48:32 +00:00
keie
43f003e959 Removed a few typos. 1985-02-08 16:54:34 +00:00
keie
ba1e51e914 Deleted a line with a statement unknown to this compiler. 1985-02-08 15:41:19 +00:00
keie
66875f1bde Looks more reasonanle now. 1985-02-08 13:21:23 +00:00
keie
8a7ee2ea50 Now calling trace with the current line number as parameter. 1985-02-08 13:18:26 +00:00
keie
e9850f2691 Improved. 1985-02-08 13:12:51 +00:00
keie
0122bc2dd7 *** empty log message *** 1985-02-07 22:59:50 +00:00
keie
c0085c2dd4 A list without double entries, for the moment supposing
that trp,etc always gets loaded, so will be there when .dvu needs it.
1985-02-07 22:51:12 +00:00
keie
00d75279e7 d2 contains the remainder of dvu i.s.o. d3. 1985-02-07 22:26:11 +00:00
keie
c0d87aaa16 *** empty log message *** 1985-02-07 22:06:32 +00:00
keie
3c7fcfe81a Initial revision 1985-02-07 17:43:43 +00:00
keie
4ff7e05f7e Initial revision 1985-02-07 17:18:06 +00:00
keie
3df42a584c *** empty log message *** 1985-02-07 15:58:40 +00:00
keie
9c93cbdfaa *** empty log message *** 1985-02-07 15:33:13 +00:00
em
1b36afae36 Added a line about the presence of out.std 1985-02-06 21:31:51 +00:00
em
0ff3a17f5e Initial revision 1985-02-06 21:25:27 +00:00
keie
d7abe0e8b6 Initial revision 1985-02-06 21:06:03 +00:00
garde
20986fd6ea monitor calls open, close and ioctl removed. 1985-02-06 16:56:41 +00:00
garde
293dfd2c64 Initial revision 1985-02-06 16:50:52 +00:00
em
e1b8023da1 *** empty log message *** 1985-02-05 14:52:52 +00:00
em
52d0f32e32 Copied from vax2, takes its info on which files
to use in which order from LIST.
1985-02-05 14:52:02 +00:00
em
c8e426ffb8 This one is made with lorder|tsort. 1985-02-05 14:51:17 +00:00
em
b70b6ba980 The first one, Duk's order. 1985-02-05 14:50:24 +00:00
em
c90c70bb84 Now fetching sedf from this directory instead of
from the cg source directory.
1985-02-05 11:44:40 +00:00
keie
a50f8ebe1c Placed the include files in {EM_HOME}/h/bc_..... 1985-02-04 22:18:16 +00:00
keie
da898f1325 *** empty log message *** 1985-02-04 14:31:17 +00:00
keie
1e38fa0573 *** empty log message *** 1985-02-04 14:26:13 +00:00
keie
5a6676cc53 Prevent the existence of pem2[24].p to frustate the ln and thus
the whole exercise.
1985-02-04 02:53:18 +00:00
keie
987ed39adb Added an entry "distr" to make tables1.c and tables1.h. 1985-02-03 23:50:51 +00:00
keie
3d4a5efe99 The creation of the library is now done by the process of creating
the distribution directory.
1985-02-03 23:23:50 +00:00
keie
46f5004866 Tail_em.s.a is now extracted from the RCS directory by the
distribution making process in em/distr2.
1985-02-03 23:21:24 +00:00
keie
df168727a6 The effect of the .distr entry is now done by the
mktree process from /usr/em/distr2.
1985-02-03 23:18:06 +00:00
em
2cc4735151 Added libmon to libraries to be translated. 1985-02-02 18:06:37 +00:00
em
dd7e9436a2 *** empty log message *** 1985-02-01 22:12:31 +00:00
garde
8e154eb826 Many, many improvements made, ususually small ones.
For example: many em-patterns have got alternative code-rules.
1985-02-01 12:51:56 +00:00
keie
ca219d89e9 Now using ../../proto/libg/Makefile. 1985-02-01 12:38:08 +00:00
keie
26999bb517 To avoid conflict while compiling with acc itself the word
size of the target machine is now defined as TEM_WSIZE.
1985-02-01 12:32:46 +00:00
keie
103659cd7b Added an entry to create a doc.pr suitable for printing
on a straightforward line printer.
1985-01-31 22:38:00 +00:00
keie
626ae9760f Added a reference to MES 11 in 11.1.4.4 at the non-local goto. 1985-01-31 15:15:20 +00:00
keie
dcd8451347 1- Zero is deleted as a possible argument to LOI and STI.
Allowing that was an oversight.
2- Message number 10 is reserved for global optimizer output.
3- Message number 11 must be used by GTO destinations.
1985-01-31 15:10:16 +00:00
keie
882906b3c3 Added a few sentences about the capability of ack to
preprocess Pascal programs and one restriction that imposes
on programs using it.
1985-01-31 14:50:15 +00:00
keie
f586956618 Zero is deleted as a possible argument to LOI and STI.
Allowing that was an oversight.
1985-01-31 14:03:56 +00:00
keie
6459b0bf5f Zero is deleted as a possible argument to LOI and STI.
Allowing that was an oversight.
1985-01-31 13:58:09 +00:00
keie
1f56b2aa4c 1 - Changed incorrect execution line for callc/modc
2 - Added several sources to 'pr' entry, for printing.
1985-01-31 10:53:59 +00:00
bal
d1c0d1db13 Bugs fixed for the following patterns:
lol loc 255 and 2  (byte order was wrong)
loc x beq , 0 < x < 128  (was 0 < x < 256)
loc x bne (idem).
These bugs were introduced in version 2.2.
1985-01-30 16:34:14 +00:00
bal
b99ce86e16 register save costs changed: they are now linearly dependent on
the number of registers to be saved (for time).
1985-01-30 15:43:02 +00:00
bal
bec394f7bd Entry for LOI changed from CLASS1 to CLASS12. 1985-01-30 14:49:03 +00:00
bal
db19d06f61 CLASS12 added for the LOI instruction. A "LOI n", n < wordsize,
loads wordsize bytes, not n bytes.
1985-01-30 14:47:49 +00:00
ceriel
e936aea1e1 Added -DCPM to the flags. 1985-01-30 12:37:10 +00:00
bal
31eab814f2 Debugging procedure print_allocs now writes to stderr. 1985-01-30 10:52:33 +00:00
bal
7f9dd27dc8 bug fixed: assemble_allocs() did generate whole_procedure allocations.
These allocations were initialized with a very low profit. Consequently
account_regsave rejected these allocations.
Solution: repl_allocs() updates the al_profits field of the
whole_procedure allocation.
1985-01-30 10:47:47 +00:00
bal
387191a2c7 bug fixed: oldmap(lmap,llength) was sometimes called when no new map
had to be allocated for the current (data-) unit.
1985-01-28 11:38:06 +00:00
em
cf3d3ad287 Also remove all *.e and *.d files when cleaning up. 1985-01-25 16:19:13 +00:00
keie
1bc30e42eb Strings in rom are initialized with usage count 9999.
decstr does not touch these at all.
1985-01-25 14:40:51 +00:00
keie
e271d9bbb8 Strings in rom are initialized with usage count 9999 i.s.o. 1.
String with that usage count are not touched any way at all.
1985-01-25 14:34:50 +00:00
bal
a49f2d23f7 Number of address registers decreased from 5 to 4. 1985-01-25 13:24:12 +00:00
keie
3c5d3c55af Added an entry called distr.
This make the formatted install.pr to be put on the distribution tape.
1985-01-25 11:28:55 +00:00
keie
6d344b6702 The program name is used to set the name
of the file were the contents of data statements are written.
The filename is extracted from the path and the suffix (if present)
is replaced by .d.
1985-01-25 11:04:18 +00:00
keie
8fa5a7b668 The parametrs passed to the call to opnchn when initializing are now
correct string descriptors.
Programs with data statements used to crash with TRAP TYPE 11.
1985-01-25 09:57:04 +00:00
keie
d12fef6c05 The non-flag arguments are now passed by position.
The order is :  (bem) input output program-name.
1985-01-25 09:55:28 +00:00
em
ed1ee8a3b4 Removed test18 because it is in essence a busy loop. 1985-01-24 22:34:31 +00:00
em
3bb153d6bb Added executable files to list of those to cleanup. 1985-01-24 21:27:32 +00:00
em
df08133a04 Added entry "clean" for cleanup. 1985-01-24 21:25:57 +00:00
keie
06087a6bc3 *** empty log message *** 1985-01-24 17:39:54 +00:00
keie
fd4d46036a Added ranlib commends. 1985-01-24 16:16:32 +00:00
keie
1e3ec09984 Some minor changes. 1985-01-24 15:34:23 +00:00
em
58c5d2d8ac Changed the line numbered 19 into a line numbered 190.
This seemed the correct thing to do.
1985-01-24 11:34:12 +00:00
em
410800127c *** empty log message *** 1985-01-24 11:27:36 +00:00
bal
1732114593 bug fixed: the "incr" parameter of sbrk() is a 2-byte integer,
not a 4-byte integer.
1985-01-23 16:31:51 +00:00
bal
66eabbcddf parameter of fscanf changed from "%d" to "%hd" to read a short. 1985-01-23 16:28:58 +00:00
bal
468401cb81 core allocation macros added. 1985-01-23 16:27:47 +00:00
bal
cac6ffd8c2 ovfl_harmful and arrbound_harmful turned into ints 1985-01-23 16:25:29 +00:00
bal
d32d4e6ba0 Interface of tmplocal() changed: second parameter is a long now 1985-01-23 16:23:15 +00:00
bal
5cad6f6aa7 interface with tmplocal() changed: second parameter is a long now. 1985-01-23 16:18:33 +00:00
bal
e46c49e291 bug fixed in get_instrs(): instr should be an int rather than a Celem_t. 1985-01-23 16:16:49 +00:00
bal
5a95c31414 bug fixed in last_mnem(): test on nil-pointer.
bug fixed in try_tail(): add line "if(l1==0||l2==0) return FALSE".
1985-01-23 16:13:57 +00:00
bal
f487f26e00 bug fixed in last_line() : assert(l!=0) should be assert(lines!=0). 1985-01-23 16:12:21 +00:00
bal
e95492dfb0 bug fixed in routine get_ca_lines(): test on nil-pointer. 1985-01-23 16:10:43 +00:00
bal
fefe15a844 init_regcnt renamed initregcnt to avoid name conflict.
bug fixed in routine fits_in(): test on nil-pointer.
routine choose_location(): interface with tmplocal() changed, second
parameter now is a long, so a cast is added.
1985-01-23 16:07:09 +00:00
bal
3d2c33e277 rules for itemtab.h and makeitems added. 1985-01-23 15:50:17 +00:00
bal
2ea3be322d clean_items renamed cleanitems to avoid name conflict.
clean_timeset renamed cleantimeset to avoid name conflict.
bugs fixed: calls to fscanf() with a pointer-to-short as argument
should provide a "%hd" instead of "%d".
1985-01-23 15:45:58 +00:00
garde
a849b751a9 src1 and src2 extended.
Errors in 'pat loc cmi teq' and 'pat loc cmi tne' recovered.
Second stack-pattern for 'pat zlt' and 'pat zge' added.
Patterns for 'lil loc adi sil', 'lil inc sil', 'lil dec sil'
and 'sil lil' added.
1985-01-22 19:55:11 +00:00
em
ea337060ec User defined trap handling routine is called with calls instruction.
A message is printed if there is no routine at all.
1985-01-22 15:20:19 +00:00
em
33c81637db Added `movl r3,ap' to restore the argument pointer before returning
vi jmp (r0).
1985-01-22 13:10:35 +00:00
em
8bdec01d71 Now using opder recommanded by 'lorder'. 1985-01-22 02:17:13 +00:00
keie
7556180ab3 Printf does not return a truth value for failure.
These -incorrect- tests were replaced by calls to ferror.
1985-01-21 23:58:07 +00:00
keie
09000449a4 Added declaration of _newstr. 1985-01-21 23:57:44 +00:00
keie
68644410fb Added correct declaration of salloc, thereby preventing incorrect conversions.
Removed now unnecessary casts from salloc to (char *).
Added a cast to (char *) for the argument of sfree in the second call.
1985-01-21 23:56:10 +00:00
keie
c2e988c3d5 1 - Changed argument from int to unsigned.
2 - The test for a failed malloc is changed from comparison to -1
    to comparison to 0.
1985-01-21 23:54:46 +00:00
keie
d4a597912f Tests for EOF returned by stdio routines need the full int width. 1985-01-21 23:53:41 +00:00
keie
682e5d9b8a Removed casts made superfluous by adding newstr to string.h 1985-01-21 23:53:01 +00:00
keie
f7027ba7e4 Test for EOF returned by stdio routines have to use the full int width. 1985-01-21 23:52:19 +00:00
keie
52a627589a Removed cast made superfluous by added newstr to string.h 1985-01-21 23:51:33 +00:00
keie
5fc9fdf795 Added test for outcome of request for more core.
If no more core is available a fatal error message is produced.
1985-01-21 23:48:06 +00:00
em
08c8edf314 Changed #define's of newlbss of cst_fmt. 1985-01-21 16:40:02 +00:00
em
603f82a578 Bug fix: redefined a Local local causing an INTERNAL ERROR from as. 1985-01-21 15:49:22 +00:00
keie
8f81c858f8 Due to an 8 character identifier length limitation the identifier
"strcompare" is changed into "strcomp".
1985-01-21 14:52:34 +00:00
keie
6a21488f0c Due to an 8 character identifiers limitation calls in EM
the identifier "randomize" was changed into "randomi".
1985-01-21 14:51:29 +00:00
keie
374ac8b21c Due to an 8 character identifiers limitation on EM calls to
"setchannel" were changed into "setchan" and the identifier
"seektable" is replaced by "seektab".
1985-01-21 14:50:12 +00:00
keie
770f321ea8 Changed calls to "setrandom" into calls to "setrand" and
calls to "randomize" inro calls to "randomi" to avoid
problems with routines compiled by C.
1985-01-21 14:48:16 +00:00
keie
decda89fba Added a few /*NOSTRICT*/ comments to indicate awareness of lint complaints. 1985-01-21 14:30:55 +00:00
keie
ff46181ae0 1 - Changed the defintion of a local 's' into 'Sym' to avoid naming conflict.
2 - Added .integer, .Sptr and .cptr at appropiate places to uses of yylval.
3 - Removed unnecessary casts.
4 - Added a few /*NOSTRICT*/ comments to indicate awareness of lint
    complaints.
1985-01-21 14:26:29 +00:00
keie
dbb0d46ac2 1 - Added comment to indicate awareness of lint complaints.
2 - Added/Removed some casts used with core allocation/deallocation.
1985-01-21 14:23:49 +00:00
keie
d53ef52028 Changed the argument of salloc from an int into an unsigned.
Just to shut up lint.
1985-01-21 14:22:07 +00:00
keie
a91ff9e04b Added a declaration of gosublabel. 1985-01-21 14:21:52 +00:00
keie
56a8cd53b6 Added a few comments to indicate awareness of lint complaints. 1985-01-21 14:20:11 +00:00
keie
0c2aee4835 1 - Removed definition of POINTERSIZE.
2 - Defined void as int, some compilers don't know void.
3 - Added declarations of the routines proclabel, salloc, strcpy, strcat, malloc.
1985-01-21 14:18:47 +00:00
garde
cd78a1a27a case 8 and case 6 deleted in switch of function 'prolog' 1985-01-21 14:17:11 +00:00
keie
309bbef3ea Now using a union for YYSTYPE and typed (non-)terminals.
Changed values $n(intvalue) to ival in definition of filelist.
Changed one asp,$n(midparms) into several asp,...SIZE in the definition
that uses MIDSYM.
1985-01-21 14:15:06 +00:00
keie
71cbd2c92f 1 added lint entry.
2 changed calls to cc into $(CC)
1985-01-21 14:14:22 +00:00
em
cb49888304 To have a file preprocessed, it must start with a # in column o1.
The RCSid is replaced to accomplish this.
1985-01-21 12:56:09 +00:00
em
9479f61318 Now using correct RCS identification 1985-01-21 12:47:04 +00:00
em
8d02182e12 Renaming due to 8 character C compiler limit. 1985-01-21 12:37:26 +00:00
em
aef211ad4e Used a correct definition of malloc. 1985-01-21 12:35:53 +00:00
em
a33d0e8e14 Replaced RCSid so that file starts with # in column 0 so it gets preprocessed. 1985-01-21 12:28:59 +00:00
em
4f40987ff0 Corrected type; forgot closing ". 1985-01-21 12:14:59 +00:00
em
ccfa0db0de Removed #define IDFIRST because fmt_id() replaces it. 1985-01-21 12:09:44 +00:00
em
6ac5841c7f Initial revision 1985-01-18 16:06:21 +00:00
em
f9c86fc6f6 Routines are now called with calls instead of jsb. We use ap as argument
pointer register. EM_BSIZE is required to be a constant.
1985-01-18 15:39:07 +00:00
em
a4ca3054f0 Changed label generators and added fmt_id(). 1985-01-18 15:36:51 +00:00
em
10ce06ff2b Routines are called with calls instead of jsb. EM_BSIZE is required to
be a constant.
1985-01-18 15:33:44 +00:00
duk
8d87404836 Initial revision 1985-01-18 14:30:03 +00:00
bal
2d8dcaa2df Initial revision 1985-01-18 09:59:09 +00:00
garde
d8d2068664 Initial revision 1985-01-17 14:31:34 +00:00
duk
e1ef16649c Initial revision 1985-01-17 14:20:52 +00:00
em
6512a304a0 Checking in Martin's changes. 1985-01-17 14:10:27 +00:00
keie
e75b8772ca Added some documentation for the interface between C and Pascal.
This was necessary because the format of Pascal and C procedure
pointers differ from now on.
1985-01-17 13:22:49 +00:00
keie
d19105ef78 Added the test program for the C<=>Pascal interface. 1985-01-17 12:43:51 +00:00
keie
f9b105e07a *** empty log message *** 1985-01-17 12:43:04 +00:00
bal
218ce4596e The EM runtime routines are reentrant now, so the remark about
reentrancy is removed from this file.
1985-01-17 10:39:33 +00:00
bal
8f7a447719 Bug fixed: a0 is changed by call to _brk, so it should be saved & restored. 1985-01-17 10:33:23 +00:00
keie
14a9b13fd3 Added RCS id. 1985-01-11 17:03:53 +00:00
keie
d72ad93216 Allows optional second argument.
This is the name of the destination file. The destination directory
is determined by compare.
1985-01-11 16:46:02 +00:00
keie
081413cfda 1 - Allows 2 arguments, 1 - name of source in current directory.
2 - name of destination file(!path), default arg 1.
2 - Make the necessary dirctory.
3 - runs ranlib if "ar t ... | grep SYMDEF succeeds.
1985-01-11 16:43:56 +00:00
keie
f0d34942e3 Added RCS id. 1985-01-11 16:28:30 +00:00
keie
959138af97 The previous fix produced an array in which the values were one off.
This has been fixed.
1985-01-11 13:42:51 +00:00
keie
c61ea7ee53 *** empty log message *** 1985-01-11 13:20:36 +00:00
keie
22e4268cc7 The recursive call of setp1 initialized elements 0...ASIZE.
This is out of bounds and now altered into 0..ASIZE-1.
1985-01-11 13:17:26 +00:00
keie
e2c5191f0c *** empty log message *** 1985-01-11 13:13:56 +00:00
sater
7f0def8861 RREMOVE section updated. 1985-01-11 09:44:34 +00:00
sater
dac2f97109 extra define added to aid in generation of DO_RREMOVE 1985-01-11 09:42:17 +00:00
sater
3a528a7324 code was added to generate DO_RREMOVE 1985-01-11 09:41:47 +00:00
sater
3534869cb5 code was added to cause generation of DO_RREMOVE in some cases 1985-01-11 09:41:13 +00:00
sater
e9b6045b5a diffs were applied to make default register property at stacking rule
-1 instead of 0.
1985-01-11 09:40:40 +00:00
sater
a1a8fd99a0 Optional register property in stacking rules must be -1 when absent.
Fixed this.
1985-01-10 16:30:09 +00:00
duk
d7fb9edfe2 Maybe some minor changes. 1985-01-10 13:35:39 +00:00
duk
58126396af Added call to trap signals. 1985-01-10 13:24:36 +00:00
duk
55017702e2 Header and section table now allocated statically. 1985-01-10 13:22:04 +00:00
duk
7d312abd59 Inline expansion of index_adjust() and compute_origins().
Section table now allocated statically.
1985-01-10 13:19:47 +00:00
duk
ba826bad5c Added routine to check signals. 1985-01-10 13:17:22 +00:00
sater
4ba6e7a39c *** empty log message *** 1985-01-08 15:34:54 +00:00
sater
f838dd1047 Initial revision 1985-01-08 15:28:26 +00:00
keie
6aaff51b39 *** empty log message *** 1985-01-08 13:52:58 +00:00
duk
f532b58045 Added provisions for copying everything after the string area into the
resulting object file. Because this is most likely symbolic debugging
information, these are parametrized by #ifdef SYMDBUG.
1985-01-08 11:54:57 +00:00
keie
576688fc10 *** empty log message *** 1985-01-08 11:48:43 +00:00
sater
72b83cca59 *** empty log message *** 1985-01-08 09:59:28 +00:00
keie
5edf93d2de *** empty log message *** 1985-01-07 15:54:38 +00:00
keie
dd0951f114 *** empty log message *** 1985-01-07 15:43:50 +00:00
keie
5779a88371 *** empty log message *** 1985-01-07 14:39:27 +00:00
keie
22c95138aa *** empty log message *** 1985-01-07 14:26:46 +00:00
keie
d0268a4ec1 *** empty log message *** 1985-01-07 14:15:47 +00:00
keie
112211eb3b *** empty log message *** 1985-01-07 13:57:25 +00:00
keie
d0444e3a04 15-5-83 EGK
The coercion from rm1 to register contained
                allocate(%[1],GENREG).
                The %[1] here is incorrect and has been removed.
16-5-83         EGK
                The word before the movb was cleared by a xor.
                Now we clear the upper byte after the movb.
                This allows the %[1] to be added to the allocate.
1985-01-07 13:51:36 +00:00
keie
9beb72e69b *** empty log message *** 1985-01-07 13:49:31 +00:00
keie
5fedca22ad *** empty log message *** 1985-01-07 13:37:12 +00:00
keie
b4ad7c46da *** empty log message *** 1985-01-07 13:08:48 +00:00
sater
c2229e5c60 Initial revision 1985-01-04 14:05:25 +00:00
sater
11b3f3aa8a added entries for cg,ncg and cgg 1985-01-04 14:04:10 +00:00
sater
79411cb4b3 added entry for ncg.doc 1985-01-04 13:57:11 +00:00
sater
dd8505531b Initial revision 1985-01-04 13:55:07 +00:00
keie
26f38cada3 *** empty log message *** 1985-01-01 22:33:43 +00:00
keie
c235c1a93d *** empty log message *** 1985-01-01 22:27:02 +00:00
keie
d16efbab98 *** empty log message *** 1985-01-01 22:19:09 +00:00
keie
57115f49cc Take precautions against an already existing march. 1985-01-01 21:32:02 +00:00
keie
5e8a571801 *** empty log message *** 1985-01-01 19:56:08 +00:00
keie
006c4b7a49 *** empty log message *** 1985-01-01 19:42:53 +00:00
keie
5662050ad3 Initial revision 1985-01-01 19:30:24 +00:00
keie
6a08d40d15 1 - Added void.
2 - Data and function pointers have the same size.
1985-01-01 19:24:34 +00:00
keie
fe6eed6c76 Added RCS identification. 1985-01-01 18:35:40 +00:00
keie
0ebd337637 *** empty log message *** 1985-01-01 18:34:12 +00:00
bal
ffb167e8b2 lay-out enhanced; flags (CFLAGS etc.) inherited from central Makefile;
entry for compiling this phase with ack -O created.
1984-12-21 14:41:47 +00:00
keie
6860747f3e Adapted to new tree structure. 1984-12-21 14:23:10 +00:00
sater
18dbfc024e Routine was wrong, leaving things on the stack in the one bit case,
the inclusion of slu in this routine was bogus.
It is never called anyway, so slu is taken out.
1984-12-20 15:17:05 +00:00
keie
e129db8343 1 - Added RCS id.
2 - Used two argument [feature] of install.
1984-12-20 14:26:14 +00:00
keie
b2b1167d7a See the logfile of mach/m68k2/libem/Makefile. 1984-12-20 14:21:35 +00:00
keie
6c9e4c84f0 The definition if the symbols, end, endbss etc, is moved
from a library to a file. This to avoid 2 libraries in this
directory.
1984-12-20 14:13:48 +00:00
keie
6b38714690 Added line for m68k interpreters manual. 1984-12-18 17:26:42 +00:00
keie
80d385c291 *** empty log message *** 1984-12-18 17:22:29 +00:00
keie
37d01caabd 1 - signal did not clear the stack properly.
2 - lseek did not return correct.
1984-12-18 17:12:12 +00:00
keie
7b39ce2cfa Traps now work as documented. 1984-12-18 17:11:35 +00:00
keie
53a88ccd69 1 - Human readable profile and count.
2 - Length of last table is now 64.
1984-12-18 17:09:36 +00:00
keie
2d4614ca5a Profile, count, flow in non-local goto corrected. 1984-12-18 17:08:54 +00:00
keie
246f45c867 1 - Improved line number updating when returning from library routines.
2 - Line 234, 0xD must be #0x1C, crashed at error handling for
    incorrect return size.
1984-12-18 17:07:23 +00:00
keie
b544d3b401 Replaced clr by the faster mov #0, (for d registers). 1984-12-18 17:06:36 +00:00
keie
5f41dcd958 1 - Indexed addressing mode gave unwanted sign extends.
They are replaced by additions.
2 - Added pointer checks.
3 - Completed parametrization of addresses of locals.

1984-12-18 17:04:24 +00:00
keie
9ea83d0838 Finishing profile tables. 1984-12-18 16:59:51 +00:00
keie
45e2eea414 1 - length of last table
2 - human readable profile and count output.
1984-12-18 16:58:30 +00:00
keie
8b60227186 Added pointer checks. 1984-12-18 16:58:11 +00:00
keie
f0a6c2fbcf Altered 1980 in 1984. 1984-12-18 16:57:56 +00:00
keie
8636bd025e Added machines to be sent with the second distribution to the LNTABLES. 1984-12-18 15:28:19 +00:00
keie
4d8c88e7b1 The first version, copied from 6800. 1984-12-18 15:13:56 +00:00
keie
b4faacec8c The first version, copied from 6809. 1984-12-18 15:13:55 +00:00
keie
eb15231cf4 Don't rely on cpp to be in the $PATH, call it from em/lib. 1984-12-18 13:12:30 +00:00
keie
cf947cedd3 Added Ack distribution Makefile names. 1984-12-18 13:12:03 +00:00
keie
e3bf7b5dc7 Removed the need for as in lib/m68k4.
The as in lib/m68k2 is now used directly.
1984-12-17 17:20:57 +00:00
keie
a5e9c4f8d1 *** empty log message *** 1984-12-17 15:52:04 +00:00
keie
8c874d4632 Run $RANLIB if the shell variable is set. 1984-12-17 15:50:02 +00:00
sater
d267037189 *** empty log message *** 1984-12-17 15:13:39 +00:00
sater
ea8e311e5a Changed descr to use recently developed 8080/cg. 1984-12-17 14:36:16 +00:00
keie
3ab2889451 Added 6500 documentation. 1984-12-17 11:38:36 +00:00
keie
c693044013 *** empty log message *** 1984-12-17 11:35:39 +00:00
keie
3b3d3f16b4 Adapted to new library. 1984-12-17 11:21:11 +00:00
keie
4f071008c8 *** empty log message *** 1984-12-17 11:11:37 +00:00
keie
d77b2081c0 Now using LIST. 1984-12-17 11:06:48 +00:00
keie
b097fe72a7 *** empty log message *** 1984-12-17 11:03:13 +00:00
keie
66d68121c8 Added F_DUM(Author of change-- Henry Bal). 1984-12-17 10:45:27 +00:00
keie
5060a9fcd6 *** empty log message *** 1984-12-17 10:44:08 +00:00
bal
523457f6ee Initial revision 1984-12-14 15:57:39 +00:00
bal
6babe9fccd Initial revision 1984-12-14 15:52:15 +00:00
bal
ad815f1061 Initial revision 1984-12-14 15:41:14 +00:00
keie
aa0f76a6cd Removed entries for pmds. 1984-12-14 13:45:42 +00:00
keie
c39e619032 Added Basic library and Revision number. 1984-12-10 15:14:00 +00:00
keie
4a2c2d89a0 Added revision number. 1984-12-10 14:57:51 +00:00
keie
468cdfd3eb 1 - Added Basic library.
2 - Added revision number.
1984-12-10 14:41:49 +00:00
keie
83f3de1555 Initial revision 1984-12-10 14:41:30 +00:00
keie
ef7ea116cd Added Basic library. 1984-12-10 14:29:51 +00:00
keie
f4ab1bb6e6 Initial revision 1984-12-10 14:28:41 +00:00
bal
98989fd9ca Initial revision 1984-12-10 13:36:12 +00:00
keie
9932e38ab2 Removed the definition of the NEEDS variable. 1984-12-10 12:49:56 +00:00
keie
0b9b183085 *** empty log message *** 1984-12-08 00:50:27 +00:00
keie
4cc2986757 This makefile was copied from ../../m68k2/dl.
The now irrelevant entries are removed.
1984-12-08 00:45:55 +00:00
keie
9f850cbb2d Comparing shouldn't stop when one compare fails. 1984-12-08 00:40:04 +00:00
keie
24204bca9f Added entries for pr and opr. 1984-12-08 00:28:16 +00:00
keie
1e651a534a Adapted to new install + compare, added anties for cmp, clean, opr and pr. 1984-12-08 00:17:39 +00:00
keie
1b210a8104 *** empty log message *** 1984-12-07 17:32:33 +00:00
keie
a0f184e3d1 Improved "make pr". 1984-12-07 17:14:43 +00:00
keie
9b6c26ad14 An efficiency change only. 1984-12-07 16:52:09 +00:00
keie
89a757d6f9 Added cmp entry. 1984-12-07 16:45:26 +00:00
keie
518e817345 This one works, the previous one didn't. 1984-12-07 16:42:59 +00:00
keie
f9fa5df654 install now allows a source and destination name. 1984-12-07 16:38:13 +00:00
keie
9e4b9fddab Now use prototype makefile from ../../proto. 1984-12-07 15:22:22 +00:00
ceriel
7f12f20be6 Removed a reference to a non existing Makefile ( in the lib directory). 1984-12-07 15:21:25 +00:00
bal
9019141137 Bug fixed in optimizing two adjacent basic blocks. 1984-12-07 14:19:53 +00:00
keie
af75a28622 Changed access path of em h directory. 1984-12-07 14:01:33 +00:00
keie
c744b44b48 Changed access path of en h directory. 1984-12-07 14:01:11 +00:00
keie
80d4c7ca2f Initial revision 1984-12-07 13:41:58 +00:00
keie
c2d3d6ce4a Initial revision 1984-12-07 10:42:27 +00:00
keie
47f5e79d96 The path lib/ack is changed into lib/descr.
The name ack, used as a file name was a bit overloaded.
1984-12-06 11:08:40 +00:00
ceriel
2c7c97051b Changed so that the installation process will continue if LLgen
is not present yet.
Also added Makefile to the "make pr" entry.
1984-12-06 10:39:28 +00:00
keie
0d5c765070 Repaired a few minor bugs. 1984-12-04 21:57:22 +00:00
keie
01d4011dd6 I hope this version is correct. 1984-12-04 21:48:14 +00:00
keie
7f3328678f Initial revision 1984-12-04 21:38:13 +00:00
sater
d9fe7e9cf0 Initial revision 1984-12-04 15:33:28 +00:00
bal
4e461a9860 Initial revision 1984-12-04 15:04:44 +00:00
bal
3cdaf9f4ba WORDLENGTH now defined in automatically generated file wordlen.h
Generate this file from makewlen.c
1984-12-04 15:04:01 +00:00
bal
0d0e2d2d22 WORDLENGTH now defined in automatically generated file worlen.h 1984-12-04 15:03:22 +00:00
bal
8d659c015f Bug fixed: fill_item() should initialize item->it_desirable to TRUE. 1984-12-04 14:41:20 +00:00
keie
695a914eb3 Added tail_m and tail_ln. 1984-12-04 13:31:03 +00:00
bal
9b72991e27 regsave_cost() return void instead of short. 1984-12-04 13:04:27 +00:00
bal
8db2c12881 regsave_cost() returns void instead of short. 1984-12-04 13:03:49 +00:00
keie
7e8d898bcb Initial revision 1984-12-03 23:20:13 +00:00
keie
550e4d3cee Adapted to use the files in the library directory dedicated to the pmds. 1984-12-03 22:55:26 +00:00
keie
271b83ecb3 Initial revision 1984-12-03 22:02:45 +00:00
bal
ee3ef338db Comment closer ("*/") added to description of getlines(). 1984-12-03 12:12:37 +00:00
ceriel
7e3e49082c Increased MAXPATLEN to 8000. 1984-11-30 11:14:18 +00:00
bal
0778ce4a9a Macros for B_DIST, B_USECNT and B_MARK removed, as these fields are
no longer used.
Declarations of nrinstrs and instrmap marked "extern" to satisfy ack compiler.
1984-11-30 10:52:05 +00:00
bal
7351e38ed5 Declaration of items[] made static to avoid name conflict with ra_items.c
Core allocation macros added.
1984-11-30 10:50:27 +00:00
bal
bac0efbedb Declaration of items[] made static to avoid name conflict with ra.c 1984-11-30 10:49:09 +00:00
bal
302608566a routines getcall(), get_text() and getcc() move from get.c to this file
routines putactuals(), putcall(), and putcc() move from put.c to this file
get.h, put.h, stdio.h, em_mnem.h and em_pseu.h included
1984-11-30 10:30:22 +00:00
bal
c814b9523d several data structures added (moved from types.h).
core allocation macros added.
1984-11-30 10:28:35 +00:00
bal
39891edd12 Declarations for iv and code_info added (moved from types.h).
core allocation macros added.
1984-11-30 10:27:05 +00:00
bal
90df1e5b9a core allocation macros added 1984-11-30 10:25:21 +00:00
bal
1e69d3458c declaration for sym,num and prc added (moved from types.h) 1984-11-30 10:24:21 +00:00
bal
6988358e29 ic.h included before ic_lookup.h 1984-11-30 10:23:34 +00:00
bal
49137da06b Lots of procedures removed (turned into macro in alloc.h or
moved to one specific phase).
1984-11-30 10:15:24 +00:00
bal
594a5bb49b Lots of data structures removed and made local to one specific phase. 1984-11-30 10:14:30 +00:00
bal
e5a282c621 Lots of procedure newxxx() and oldxxx() turned into macros.
Lots of such procedures removed and made local to one specific phase.
1984-11-30 10:12:37 +00:00
bal
4ab54c85a8 As getbblocks() was moved to cf.c, em_flag.h need no longer
be included.; also, the declaration for em_flag[] was removed.
1984-11-30 10:10:41 +00:00
em
7ac377c750 The routine salloc crashed on a 2/4 system.
Malloc was nor declared as "char *", but by default as int.
1984-11-30 00:16:29 +00:00
em
ad104f9164 I removed the unused integer deftype.
Its name collided with an array in symbols.c.
1984-11-29 17:27:00 +00:00
em
1b8f41d3b2 The definitions of lastline, currline and firstline are made
extern in graph.h. The space reserving declaration is made in
graph.c.
1984-11-29 17:26:44 +00:00
bal
b532117b2b -O flag removed 1984-11-29 16:25:08 +00:00
bal
bda5c8409c macros newlvbx and oldlvbx added. 1984-11-29 15:10:11 +00:00
em
f6da80afd8 The first line should contain the distribution library name. 1984-11-29 15:03:41 +00:00
bal
8a15a3f597 macros newlocal() and oldlocal() moved to alloc.h 1984-11-29 14:40:31 +00:00
em
ae1e81adb1 *** empty log message *** 1984-11-29 14:22:02 +00:00
bal
0c0c3b7892 -O flag removed from CFLAGS 1984-11-29 13:33:33 +00:00
bal
b0de601d5b -O removed from CFLAGS 1984-11-29 13:31:22 +00:00
bal
7767012a6e il_aux.h included (which now contains getcall(),putcall() etc.
routines that were peviously in get.c and put.c).
1984-11-29 11:08:15 +00:00
bal
bd06330739 stdio.h included (required by new interface to get.h). 1984-11-29 11:06:23 +00:00
bal
84ed8ee7ef routines getcall(), get_text() and getcc() move from get.c to this file
routines putactuals(), putcall(), and putcc() move from put.c to this file
get.h, put.h, stdio.h, em_mnem.h and em_pseu.h included
1984-11-29 11:03:19 +00:00
bal
f3e35f5432 routine getbblocks (plus its auxiliary routines) moved from get.c
to this file; core allocation macros newcfbx() and oldcfbx() added.
1984-11-29 10:51:16 +00:00
bal
edcb838b98 newnametable() move from alloc.c to this file,
get_ca_lines moved from get.c to this file,
em_pseu.h and em_mes.h included (needed by get_ca_lines).
1984-11-29 10:31:44 +00:00
bal
c17a52c09d stdio.h included (required by new get.h interface),
macros's newlocal() and oldlocal() added, replacing routines in
alloc.c with same name.
1984-11-29 10:25:21 +00:00
bal
0032ebfeda getbblocks(), getcall(), getcc() and get_text() removed,
get_ca_lines() removed,
curinp,lastbid,lastlabid exported
getbyte(),getshort(),getoff(),read_line and getlines() exported.
1984-11-29 10:18:53 +00:00
bal
582a0cc2aa getbblocks() removed (now local to CF phase),
getcall(),getcc() and get_text removed (now local to IL),
get_ca_lines() removed (now local to CA),
current input file "f" renamed "curinp" and exported,
getbyte (macro), getshort() and getoff() exported
read_line() and getlines() exported,
lastbid and lastlabid exported.
1984-11-29 10:15:23 +00:00
bal
dd5ceb7b97 putcall an putcc removed,
curoutp, outbyte,outshort and outoff exported.
1984-11-29 10:11:37 +00:00
bal
470826f0c9 putcall and putcc removed (make local to IL phase)
current output file renamed "curoutp" and exported
outbyte, outshort and outoff exported.
1984-11-29 10:09:15 +00:00
bal
1cb39eff7e cleaned up 1984-11-28 09:26:44 +00:00
em
90c1dc7c06 Installed basic compiler in ACK tree. 1984-11-27 23:59:28 +00:00
em
39c37e9571 1 - Added RCS identification.
2 - Changed the file name parseparams.c into parsepar.c, the original
    name was too long for RCS under BSD4.1
3 - Adapted to ACK standard Makefile format(cmp,install,...)
4 - Included more dependencies.
1984-11-27 23:53:31 +00:00
em
3ceada5482 Added basic.doc. 1984-11-27 23:51:07 +00:00
em
3cab14d65e Added RCS identification. 1984-11-27 23:48:38 +00:00
em
7efc02574d *** empty log message *** 1984-11-27 23:46:32 +00:00
em
9f872a7ea0 Removed conflict between rcs_id in basic.yacc and lex.c. 1984-11-27 23:41:46 +00:00
em
ea5498cd99 Now using ACK default tmp directory from em_path.h. 1984-11-27 23:21:41 +00:00
em
455cd930ec Added RCS identification. 1984-11-27 23:13:28 +00:00
em
335d55ff4a The version of basic copied from Martin Kerstens directory. 1984-11-27 22:23:55 +00:00
em
4301dfb7bf The version of basic copied from Martin Kerstens directory. 1984-11-27 22:11:59 +00:00
bal
502a7a86af Initial revision 1984-11-27 16:16:36 +00:00
bal
30ca0afe49 cleaned up 1984-11-27 15:52:23 +00:00
bal
ad383cbdc0 stack_change was renamed stack_chg 1984-11-27 15:43:14 +00:00
bal
165965eadc Initial revision 1984-11-27 15:40:13 +00:00
bal
a6d53a6bcd "ivars" was renamed "ivvars" to avoid name conflict with sr_expr.c 1984-11-27 15:30:34 +00:00
bal
df200afd46 cleaned up 1984-11-27 15:04:04 +00:00
bal
9c3a416acd cleaned up; dependecies added. 1984-11-27 14:53:00 +00:00
bal
9e38bfa060 cleaned up. 1984-11-27 14:25:02 +00:00
bal
2d6eff961f cleaned up. use CC. 1984-11-27 14:23:20 +00:00
bal
0981b8857b getoff() moved to front (was called before being defined)
declaration char *pseudo[] changed to char *pseudo[5] to suppress warining
1984-11-27 14:21:55 +00:00
bal
69bdddd9ba "cc" replaced by $(CC) 1984-11-27 12:59:18 +00:00
keie
4a36e98f5c Treatment of -R flag is altered.
1 - if recognized by mapflag and not by Ack internally no
    complaint is given.
2 - If recognized by both mapflag and internally:
       -R....-.... : effectuate only mapflag command
       otherwise   : effectuate both.
3 - If not recognized at all, give a warning message and
    pass the flag to the linker.
1984-11-26 17:14:17 +00:00
keie
3c2c03165b This manual page was not included in the first distribution.
This version is hacked from the VU-Pascal distribution.
1984-11-26 15:56:57 +00:00
bal
c4b4a08720 Initial revision 1984-11-26 15:15:07 +00:00
bal
6d481ce4d6 Initial revision 1984-11-26 15:04:22 +00:00
bal
6a9e49f683 Initial revision 1984-11-26 14:51:59 +00:00
bal
1833451151 Initial revision 1984-11-26 14:35:32 +00:00
bal
9f778655a6 Initial revision 1984-11-26 14:14:55 +00:00
bal
f01e1431b0 Initial revision 1984-11-26 14:07:17 +00:00
bal
415ae7e922 Initial revision 1984-11-26 13:58:05 +00:00
bal
7b798175ad Initial revision 1984-11-26 13:43:22 +00:00
sater
5481dd47a9 added documentation for the fmt_id and fmt_ilb macros 1984-11-26 11:09:11 +00:00
sater
0a00b80726 Added support for the fmt_id and fmt_ilb macros 1984-11-26 10:50:46 +00:00
sater
6a4dc794a2 In the RREMOVE section of this file, the field e_con of the
expression union was used in stead of e_reg.
Fixed. Checked all other occurrances, are correct.
1984-11-20 16:56:26 +00:00
sater
7c07f91e1c The constant 512 slipped in instead of BUFSIZ.
Changed.
1984-11-20 10:22:12 +00:00
keie
36c1f227ea Added a check for non-ascii characters in the description files. 1984-11-15 14:24:35 +00:00
ceriel
1fe1bc8c09 Forgotten to close a file. This is corrected. 1984-11-12 18:05:20 +00:00
keie
4e7f357a26 Added rcs identification. 1984-11-08 12:08:31 +00:00
keie
9f776924d6 Added a P for a specification of lal on line 51.
This missing letter caused lal -1 to be mapped on the opcode
for lal 0.
1984-11-08 11:11:31 +00:00
keie
cb84476be0 Added a check. Minis & shorties need an N or P argument. 1984-11-08 11:09:56 +00:00
bal
d07b17ca5c The routine con_float now generates a dummy floating point constant
and gives a warning, instead of generating a fatal error + abort.
1984-11-06 12:50:21 +00:00
bal
58c679c94c Patterns for floating point instruction and for LFR 8 and RET 8 added.
Each such instruction now results in a call to a library routine.
At present, all these routines generate an Illegal EM Instruction trap,
but anyone wishing to implement floating point for the 6502 can
do so without changing the back end table.
1984-11-06 12:47:26 +00:00
em
e2e78ccd0a The line with the user message for failure missed the call to echo. 1984-11-06 10:02:25 +00:00
bal
0d5a4693a7 make install also make a tail_mon now. 1984-11-05 15:58:11 +00:00
bal
95dd252a5b arguments for asld changed. several libraries added. 1984-11-05 15:29:48 +00:00
bal
87c5817216 program for be is {LIB}/cg instead of {LIB}/be 1984-11-05 15:13:20 +00:00
keie
b6cfa32faa *** empty log message *** 1984-11-05 15:11:19 +00:00
bal
b9ebdc1a07 em_head renamed head_em; em_tail renamed tail_em
installs tail_em rather than comparing it
1984-11-05 15:06:49 +00:00
em
73b651052e Added an example with segment prefixes. 1984-11-05 15:02:32 +00:00
em
6913efe107 Adapted to new tree shape for libraries and binaries. 1984-11-05 14:42:17 +00:00
em
3e7b7990f2 *** empty log message *** 1984-11-05 12:05:46 +00:00
em
9c66801439 *** empty log message *** 1984-11-05 11:55:15 +00:00
keie
2976b590af The flag -LIB was missing in the call to the shell-procedure
compmodule. Thus the generated libraries could not be effectively
used by our assembler/linker.
1984-11-05 11:37:23 +00:00
bal
a837112d99 Negation of negative operand with inc/dec added in certain cases.
Don't know effect for sure, author has left.
Added rcsid.
1984-11-02 11:09:46 +00:00
bal
13685d4bc0 Initial revision 1984-11-02 10:13:29 +00:00
sater
45887f2b72 Name of error file was wrong, it was the runtime error file instead
of the compile time error file.
1984-11-01 09:30:36 +00:00
ceriel
4d48191bcc The input routine used to skip space. This "feature" has been removed
because it is also used to read strings, in which space is significant.
1984-10-31 15:26:09 +00:00
keie
fedaa3267a Adapted to make use of ../../compare and ../../install. 1984-10-26 12:58:15 +00:00
keie
3d4feae541 Initial revision 1984-10-26 12:54:35 +00:00
keie
88b487cd7b Adapted to make use of ../../compare and ../../install. 1984-10-26 11:48:51 +00:00
keie
90a899316e Initial revision 1984-10-26 11:48:13 +00:00
keie
08632dc7bd *** empty log message *** 1984-10-26 11:47:56 +00:00
keie
ae27a86236 Adapted to make use of ../../compare and ../../install. 1984-10-26 11:04:10 +00:00
keie
fd0066f3a6 *** empty log message *** 1984-10-26 11:01:40 +00:00
keie
1092994a09 Initial revision 1984-10-26 11:00:08 +00:00
ceriel
da7230a8eb Running makedepend again gave a difference. 1984-10-26 10:31:22 +00:00
ceriel
1ca93d7aa1 removed the "depend" emtry, added a "distr" entry, which should be used
before a distribution is made.
Also added the -DNORCSID flag to the lint-options.
1984-10-26 10:25:55 +00:00
keie
9d8dd3f989 Adapted to use ../../install and ../../compare and hide knowledge
about final destination of libraries.
1984-10-26 10:25:32 +00:00
ceriel
c5345aaaba Added a "distr" entry, which will be propagated to the src directory. 1984-10-26 10:24:48 +00:00
keie
fd23647c1c Adapted to make use of ../../compare. 1984-10-26 10:21:18 +00:00
keie
4724e96474 Adapted to make use of ../../install and ../../compare. 1984-10-26 10:20:29 +00:00
keie
8df0cf17d6 Initial revision 1984-10-26 10:20:28 +00:00
keie
37730ff9ca *** empty log message *** 1984-10-26 10:19:56 +00:00
keie
a1e7cc26f4 *** empty log message *** 1984-10-26 10:12:57 +00:00
keie
137fa9ebce Adapted to use install in ../.. 1984-10-25 14:28:56 +00:00
keie
0cacc96ed8 Now using the compare script in ../.. 1984-10-25 14:28:19 +00:00
keie
4a20e17a9b Initial revision 1984-10-25 14:28:18 +00:00
keie
3bfc57ecd0 *** empty log message *** 1984-10-25 14:24:43 +00:00
keie
86d96452a3 Altered the installation procedure.
The libraries etc. are now installed in lib/m68k2 using install in ../..
1984-10-25 14:22:53 +00:00
keie
e88028dcb9 Altered to make use of ../../install and ../../compare. 1984-10-25 14:19:58 +00:00
keie
1e1fc36653 Initial revision 1984-10-25 14:19:57 +00:00
keie
cdebe97db8 *** empty log message *** 1984-10-25 14:15:27 +00:00
keie
08545984f4 Now making use of ../../install and ../../compare. 1984-10-25 14:10:00 +00:00
keie
b8e156100f Adapted to make use of compare in ../.. 1984-10-25 11:40:16 +00:00
keie
9109aaaada Adapted to make use of install and compare in ../.. 1984-10-25 11:39:39 +00:00
keie
b51fa518be *** empty log message *** 1984-10-25 11:39:38 +00:00
keie
c2b1975015 Adapted to make use of install and compare in ../.. 1984-10-25 11:27:08 +00:00
keie
ca89e47aa4 *** empty log message *** 1984-10-25 11:25:22 +00:00
keie
26ba8cc8fd Removed the definition of LIBDIR, it is superfluous. 1984-10-25 11:16:31 +00:00
keie
c94c590501 Adapted to make use of install and compare in ../.. 1984-10-25 11:16:30 +00:00
keie
38a943d27a Initial revision 1984-10-25 11:15:20 +00:00
keie
916b1b016e Moved the include directory from mach/ibm/include to lib/ibm/include. 1984-10-25 11:00:06 +00:00
keie
a72cc54578 Adapted to use compare in ../.. 1984-10-25 10:46:32 +00:00
keie
9b6418c324 Adapted to compare in ../.. 1984-10-25 10:45:22 +00:00
keie
e03e8c7607 Initial revision 1984-10-25 10:45:21 +00:00
keie
2cb8aae438 *** empty log message *** 1984-10-23 15:29:53 +00:00
keie
533d2bb940 Initial revision 1984-10-23 15:29:30 +00:00
keie
828b4d62c9 We have only one copy of the script for compare and install now
they are present in ../..
1984-10-23 15:14:17 +00:00
sater
7e31dee840 changed EM_WSIZE to TEM_WSIZE 1984-10-23 15:10:15 +00:00
sater
a4a5fc4bfa changed references to EM_?SIZE to TEM_?SIZE 1984-10-23 15:04:24 +00:00
sater
62f42d18f7 changed EM_WSIZE to TEM_WSIZE 1984-10-23 15:02:03 +00:00
sater
be9b72e273 added -h and -c flags, to change names of tables.h and tables.c respectively
now also takes an argument instead of stdin.
EM_BSIZE is now compulsory again.
Constants EM_?SIZE are passed on to cg with a T prepended (T for target)
1984-10-23 13:39:15 +00:00
sater
79ea4bdea3 Changed to use -h flag to cgg and better way of preserving old tables.h
if not changed. Nice huh, Andy?
1984-10-23 13:29:41 +00:00
sater
ab0db1c5fb added rcsid(again). Who took that away? 1984-10-16 13:45:16 +00:00
sater
5d5a09a5d0 added code to generate code for ACK assembler.
Works if ACK_ASS is defined.
1984-10-16 13:31:44 +00:00
ceriel
9eb72b6ee8 Had forgotten to initialise the line number on which a nonterminal
symbol occurred first.
1984-10-12 14:19:34 +00:00
ceriel
f1a2fdaa43 No changes 1984-10-11 21:35:58 +00:00
ceriel
bdc67c3332 The former version gave a fatal error message at the first undefined
nonterminal. The new version checks all nonterminals
1984-10-11 10:35:01 +00:00
ceriel
a33d4cdbba The routine findpath did not work. It used the same static buffer for
several calls. Now it uses alloc.
1984-10-09 11:43:19 +00:00
em
94e069fde1 Initial revision 1984-10-09 10:36:29 +00:00
ceriel
c89acc55c7 added "#ifdef NORCSID" 1984-10-09 10:16:33 +00:00
ceriel
d068cf64b3 Added some comments and removed some Lint complaints 1984-10-09 10:13:46 +00:00
ceriel
774ce1ecc3 Initial revision 1984-10-09 09:47:14 +00:00
ceriel
dd1bcb3f60 The routine LLmessage did not insert tokens properly.
This is corrected now.
1984-10-09 09:33:37 +00:00
ceriel
317ab99ecf Changed RCSid 1984-10-08 17:11:03 +00:00
ceriel
474d9d6e0f Added RCSid. 1984-10-08 16:21:03 +00:00
ceriel
a9a0339ec1 Adapted the libpath routine to use EM_DIR from ../../../h/em_path.h 1984-10-08 15:58:23 +00:00
ceriel
27dcc7efc6 Added entry for LLgen. 1984-10-08 15:20:54 +00:00
ceriel
58b1dd5b6d Initial revision 1984-10-08 15:19:18 +00:00
ceriel
82d5bad777 Added entry for LLgen documentation. 1984-10-08 15:00:23 +00:00
ceriel
a7c0f30307 Initial revision 1984-10-08 14:51:38 +00:00
ceriel
de22c41214 Initial revision 1984-10-08 14:24:19 +00:00
ceriel
a21f936651 Initial revision 1984-10-08 14:14:53 +00:00
keie
6cbb37051b Initial revision 1984-10-08 14:11:42 +00:00
keie
550d1fa79e New installation procedure:
1 - New place for binaries and libraries in the ACK tree.
2 - The ranlib action is moved to ../../install which tries it at
    every action.
1984-10-08 14:09:28 +00:00
bal
46dc90f366 bug fixed: generate "add.l #65536,a1" rather than "lea 65536(a1),a1".
The latter form is only generated for constants that fit in a word.
1984-10-08 12:45:38 +00:00
keie
8958cb6faf Altered the test path lib/n_ack into the normal path ACK_PATH. 1984-10-05 15:07:47 +00:00
keie
b5fa0675b6 Added a priority associated with each phase. Paths with the highest
total priority have preference.
1984-10-05 13:34:38 +00:00
keie
8e680a6467 1 - Added some debugging for linker flags.
2 - Setting of NEEDS and RTS is moved to main.c.
3 - Added recognition of -Rphase:[-]number for dynamic priority setting.
1984-10-05 13:31:40 +00:00
keie
c4434ccbce 1 - Most flags used by ack itself are now also passed to the phases
for recognition with mapflag.
2 - A few bugs are removed in connection with argument passing to the
    linker (unrecognized flags and libraries).
3 - The setting of RTS, HEAD and TAIL is done directly after the
    path determination for each file.
1984-10-05 13:28:56 +00:00
keie
1b251d6ab0 Removed the defines needed by util/ack/em_pc.c.
These defaults are now provided in lib/ack/fe.
1984-10-04 11:11:30 +00:00
keie
5376af0d04 1 - Added RCS identification.
2 - Removed the default for compiler and error file pathname.
    These are now always supplied by the callee.
1984-10-04 11:08:42 +00:00
keie
00bd62d942 Corrected a small bug in the pc mapflags. 1984-10-04 10:54:11 +00:00
keie
0abe5e195e 1- Added RCS identification.
2- The pathnames of the Pascal compiler and Compile time-error file
   are now always explicitly passed to em_pc.
1984-10-04 10:47:03 +00:00
keie
4c0687f68b Altered to reflect the changes in em_path.h.
Now dynamically concatenes EM_DIR and error path.
1984-10-04 10:42:13 +00:00
keie
42be23b631 Altered the description of EM_HOME in em_path.h to that of
EM_DIR.
1984-10-02 16:24:59 +00:00
sater
13d6e6815e added missing cast at call to regsave, in ms_gto case 1984-10-02 11:17:57 +00:00
sater
92aecb175c changed definition of myalloc to extern 1984-10-02 10:31:06 +00:00
sater
a3f62d0255 added external definition for myalloc() 1984-10-02 10:30:44 +00:00
keie
080555fffd Bug removed: the trailing zero at the end of a growstring was not
explicitly written in doassign(trans.c).
Only luck kept the program together.
1984-10-01 17:42:56 +00:00
keie
083dccb299 Nill pointers are not allowed in CSA descriptors any more. 1984-10-01 16:05:17 +00:00
keie
1bea1c6883 Null pointer are not allowed any more for in-bound indeces in the CSA
table.
1984-10-01 14:54:09 +00:00
keie
6da6316680 Initial revision 1984-09-25 16:33:15 +00:00
keie
523134a5dc Added National semiconductor assembler. 1984-09-25 16:32:45 +00:00
em
abb1fce8ff 1 - A few minor syntactic changes.
2 - Altered the description of strings as initializers. (sequence of U1's).
1984-09-25 11:06:29 +00:00
keie
6010f7b584 Made the buffer long enough for the machine state on most machines. 1984-09-24 15:18:20 +00:00
keie
a88bca3670 Initial revision 1984-09-24 15:18:07 +00:00
keie
95510f8b4c Initial revision 1984-09-24 14:10:23 +00:00
em
2c4b17e464 Compile-time option GLOBAL_OPT defined. If set, the resulting
peephole optimizer will be suitable for optimizing the output of
the global optimizer. In particular, it doesn't change the register
messages.
1984-09-14 10:25:07 +00:00
keie
c97e1a7bc2 1 - The prop keyword with is flags is now obsolete. Its function is
taken over by several other keywords: stdin, stdout, prep, optimizer,
    combiner and linker.
2 - The search order is changed. First {EM}/lib/{M}/descr, then
    {EM}/lib/ack/{M}, finally {M}.
1984-09-13 14:40:09 +00:00
keie
c93761cadc The t_do bits are not set by this module. The t_next entry is used
to see whether the scan for this phase is already done.
t_do is now set in add_inputs(files.c).
1984-09-13 14:35:02 +00:00
keie
aa4bae59e0 1 - The t_do flags is now set by add_inputs(files.c).
2 - Recognize the fact that it is possible to start a combiner without
    input files.
3 - Removed -d flag. Overflow for -v (>2) now ends up in debug.
    -v may be followed by a number indicating the increment.
1984-09-13 11:07:46 +00:00
keie
527726167a 1 - The outfile entry is only used when the output file must not be thrown
away.
2 - If a combiner has no named input file (only libs+flags) then issue
    a warning message and make up a name.
1984-09-13 11:04:00 +00:00
bal
68a6231d11 pem did not generate a register message for var-parameters of
array- or record type. The routine "treewalk" is modified.
It generates a register message for every var-parameter, even
if it has its noreg-flag set.
1984-09-12 13:21:43 +00:00
bal
ebed9d4804 unlk a6 added to restr(). 1984-09-11 15:44:14 +00:00
keie
5895758914 Added ego, basic and callname conventions. 1984-09-10 17:34:04 +00:00
keie
3c300d3e1c No comment. 1984-09-10 16:51:02 +00:00
keie
8443ef3f8d Combiners (ego, linkers) now use a list of path's(ack.h) to indicate
their input files.
Unmatched flags are now sent to the linker.
1984-09-10 16:48:57 +00:00
keie
1188f0e810 1 - A transformation is succesfull when
a - a stopsuffix is indicated and met,
    b - the last transformation is included in the transformation path.
2 - Maintains a 'cash' of best paths for all transformation to be executed.
1984-09-10 16:46:13 +00:00
keie
1dba1f5328 The input file names of the linker are to be found in a different place. 1984-09-10 16:45:12 +00:00
keie
20100c69c7 1 - added keywords callname and outfile. See manual.
2 - multiple combiners are allowed now.
3 - A different search mechanism is used for finding descriptor files.
1984-09-10 16:42:55 +00:00
keie
c504e2e22a 1 - callname recognition is moved to rmach.c.
2 - The overall scheme is altered.
	first, all input files are processed until a combining phase is met.
	then, all the combining phases are executed, the resulting files
	are again processed until a combiner (or final) phase is met.
3 - The EM_DIR shell variable can be used to set ack's idea of the EM
    home directory.
1984-09-10 16:37:11 +00:00
keie
31f96c6850 1 - The names of temporary files are now Ack'hex''unique'.'suffix'.
'hex' is the pid of the current invocation of ack in hex.
    'unique' is a tail unique to this invocation.
2 - The outfile field is used to indicate default naming, can be ovrrriden
    by the -o flag.
3 - Added handling for phases with multiple inputs (ego, linker).
1984-09-10 16:33:03 +00:00
keie
6eda6ac320 The role of the combiner is -partially- assumed by the linker.
Linker arguments are now part of the transformation structure.
Temp file nameing is changed.
1984-09-10 16:30:47 +00:00
keie
384bb7f6c4 Naming of the tempname is changed (see files.c). 1984-09-10 16:29:37 +00:00
keie
4c265a7cc6 Initial revision 1984-09-03 13:49:40 +00:00
sater
2bf16c5b2f Variable nregvars had a name clash with the array nregvar[] in the
file tables.c. That was different in the 8'th character (!"#$%&'()_).
These variables should actually be static.
1984-08-23 17:07:53 +00:00
keie
0d48be448f We do not use the missing " trick anymore.
The root directory of the EM tree is in the name EM_DIR, the
root directory for tempfiles is in TMP_DIR.
All other path's are relative to EM_DIR.
1984-08-23 13:33:11 +00:00
keie
f6b59970f6 The ACK tree on the vax has as default machine 'vax2'. 1984-08-23 13:27:14 +00:00
keie
1d463f136a The missing trailing " trick is now also used for TMP_DIR. 1984-08-23 13:26:44 +00:00
keie
773f0aa626 The ms_gto is added. This is a trick used to indicate procedures
jumped to with gto.
1984-08-23 13:25:44 +00:00
keie
621f9f4ea9 *** empty log message *** 1984-08-23 13:20:59 +00:00
keie
198da9e822 Initial revision 1984-08-23 13:18:14 +00:00
keie
5db647e661 Initial revision 1984-08-23 13:00:32 +00:00
sater
3744019c53 increased MAXNODES in small memory mode 1984-08-23 12:25:24 +00:00
sater
5689e6ab64 Increased the amount of information passed through error routines
to printf. The routine badassert, running on a 2/4 machine lost it's
last argument on the way.
Anyone know of a better way to solve this problem?
1984-08-17 15:35:28 +00:00
keie
4759d84bdd Added comment. 1984-08-17 14:57:31 +00:00
keie
c2f189c855 Added RCS identification. 1984-08-17 14:44:24 +00:00
sater
822b1c557c Revised to include rcsid of pattern file in binary opt 1984-08-16 16:08:39 +00:00
sater
744bc6845d enlarged string table in big memory case 1984-08-16 13:34:59 +00:00
sater
ce098c78cb added patterns to prevent stacking in *p++ cases 1984-08-15 16:05:54 +00:00
sater
d1b3479a55 added patterns to remove some more dup's 1984-08-15 16:04:19 +00:00
sater
e682a47599 added patterns for inc/dec/adp of local and external offsetted
This makes the getc() macro from C very efficient, among others
1984-08-15 14:31:54 +00:00
sater
eebcf1b22c added patterns to remove as many dup's as possible. 1984-08-15 14:23:42 +00:00
sater
b31c9f4a4a added definition of malloc().
Program crashed on 2/4 machines
1984-08-08 10:54:04 +00:00
sater
e41876f32a reworked patterns for autoincrement stores, now that peephole optimizer
rearranged it.
1984-08-07 10:22:49 +00:00
sater
eff0f36a5d added patterns for *p++ local and external p
added pattern to remove some badly placed dups
1984-08-03 16:37:15 +00:00
sater
6f8e6faa1f added setcc calls to some incrementing ops
added patterns for indirect local and external increments
added patterns for loe ine and such
1984-08-03 16:33:40 +00:00
sater
59fa458a20 removed some superfluous patterns.
Were special cases not needed with the general case.
1984-08-03 13:16:59 +00:00
sater
ff9d23e4ec A move from a nonreg to a reg did not have the effect that all
registers clashing with the destination were erased. Erase added.
1984-08-02 16:31:25 +00:00
keie
93672962a1 The name "unix" is now predefined for preprocessor usage. 1984-08-02 14:13:04 +00:00
sater
afc577b6c7 When building the parameter list for a pf-call, the line number
for the exchanges war remembered at the wrong time.
This caused:
	foo(3,'string')
to cause an external identifier for the string. Fixed.
1984-07-31 09:39:35 +00:00
keie
fe922d190d String initializer handling is changed.
Strings are now considered to be sequences of xU1's.
No alignment is done before or after the string other than the
alignment done for names and segment type switches.
1984-07-30 14:42:33 +00:00
bal
6e519cf02b bug fixed: added "fprintf(codefile,""rts\n");" to restr() 1984-07-30 12:47:54 +00:00
bal
f2e52892ac bugs fixed (syntax errors, patterns moved to front,
"ldl ldl adp sdl sti" requires DATAREG instead of ANY1 on
fakestack)
1984-07-30 11:16:41 +00:00
bal
233b4aeee4 patterns added to generate autoincrement and to generate
a "move X,d0" instead of a "move X,-(sp)" before storing into X
1984-07-27 16:53:19 +00:00
sater
d90f26a8c5 added rcsid 1984-07-27 10:28:48 +00:00
sater
0b07016f0b added PR* routines 1984-07-26 13:15:21 +00:00
sater
5894adfd67 Changed procedure prolog to use PR* routines. 1984-07-26 13:05:22 +00:00
keie
14a3683f85 *** empty log message *** 1984-07-23 11:49:00 +00:00
sater
eebc753306 removed all calls to blm~ from table
duplicated some patterns for in[lc] to deal with de[lc]
extra rule for adi 2 to deal with source1 cleverly
1984-07-23 11:29:59 +00:00
sater
978dd0191a removed blm.s, not used by table anymore 1984-07-20 16:20:54 +00:00
sater
5b20e4fed2 edited to make reentrant, no more globals in use 1984-07-20 16:20:28 +00:00
sater
c2f383773d added copyright notice 1984-07-20 13:54:36 +00:00
sater
ebc7a50d8f added rcsid
adapted to new archive updating style, with LIST and march and all that
1984-07-20 11:32:47 +00:00
sater
98c1d6868f Initial revision 1984-07-20 11:25:31 +00:00
sater
c99e75a01b added rcsid 1984-07-20 11:25:18 +00:00
sater
bb4210de79 added copyright notice 1984-07-20 11:20:12 +00:00
sater
b410ca7f8c removed copyright notice, wasn't really *written* by us. 1984-07-20 11:07:12 +00:00
sater
25a8908e26 added rcsid 1984-07-20 11:03:31 +00:00
sater
597d25decd Initial revision 1984-07-20 10:44:57 +00:00
sater
eb823929a1 A sti 8 of a regdef8 token went into panic mode. Fixed. 1984-07-20 10:32:48 +00:00
sater
ef248ee65e to check long >= 0 or long < 0 it is enough to test high order word. Added.
anding and oring of long constants is much better now
dvu 2 and rmu 2 by positive constants is now done inline.
1984-07-19 16:50:27 +00:00
sater
e20ab23a4b added rcsid 1984-07-19 15:03:30 +00:00
sater
5fb767966b Initial revision 1984-07-19 15:01:43 +00:00
sater
3b991bd1ce Archive made with archiver in environment ASAR if set, arch otherwise 1984-07-19 14:55:12 +00:00
sater
15e9fd8cd5 removed #ifdef UNTESTED around logical instructions without arguments,
seems they were used ( which implicitly means tested ) after all
1984-07-19 14:03:49 +00:00
sater
73d8f05fb5 Initial revision 1984-07-19 13:52:18 +00:00
sater
3ca5d2fcb6 added rcsid 1984-07-19 13:34:12 +00:00
sater
8483d153f2 changed name from comparchentry to compmodule 1984-07-19 13:22:36 +00:00
sater
b95f4c8bfd Initial revision 1984-07-19 13:20:15 +00:00
sater
801226a45c old code put back, now register handling is different again
actually old code never was removed, due to a misunderstanding
about comment conventions.
1984-07-19 13:12:03 +00:00
sater
f16fdf4e7f makefile adapted to new style archive handling, RCS and all that 1984-07-19 13:11:36 +00:00
sater
d082a2b0a2 a setl instruction was changed to a setd
setl was just plain wrong
1984-07-19 13:09:53 +00:00
sater
d5aa088876 Initial revision 1984-07-19 12:51:00 +00:00
bal
8defe7ce53 rcsid added 1984-07-19 11:50:29 +00:00
bal
69584eb0ca Initial revision 1984-07-19 11:50:28 +00:00
sater
1eade4ac9d Initial revision 1984-07-19 11:50:18 +00:00
bal
da4092cbdf New implementation of GTO (without register save masks)
several optimizations added
1984-07-19 11:15:28 +00:00
bal
c1fd560106 New implementation of GTO (without register save masks) 1984-07-19 11:07:15 +00:00
bal
17caf7129e rcsid added
several optimizations added
1984-07-19 11:02:06 +00:00
bal
a520ccdbbc rcsid added
clr.w -(sp) generated in prolog if register save mask is 0
1984-07-19 10:57:19 +00:00
bal
eeeff10a51 Initial revision 1984-07-19 10:03:10 +00:00
bal
c75693c35a Initial revision 1984-07-19 09:37:24 +00:00
sater
e1aef765a0 added patterns for ldc adi/ldc sbi with zero high order word
added patterns for *--p with p register
added patterns to generate cmpb to compare two bytes.
added patterns to use regvar to index global array
added patterns for lol inl
added patterns for external pointer increment/decrement
1984-07-18 16:47:24 +00:00
sater
2943d957bb The patterns to change a cii to cuu when dealing with a known positive
quantity was technically wrong. Changed to generate a cui.
1984-07-18 15:54:25 +00:00
sater
ec992b001c added definition of index, to keep compiler happy 1984-07-18 14:14:46 +00:00
sater
8304ce5eae removed recursive comments
removed NC with sti rules
added rule to reverse operands of adi 2
added rule to convert loc sbi to loc adi
added loc slu -> loc sli rule
added local++ rule
added rule for asping xsource2
added rule for csb when nothing on stack
1984-07-18 13:39:24 +00:00
sater
8af636a3c1 added rcsid
changed instruction label format to allow more than 256 procedures
1984-07-18 13:32:11 +00:00
sater
3169067979 changed instruction label format to allow more than 256 procedures 1984-07-18 13:28:01 +00:00
sater
a241500a91 added rcsid
converted to recognize and generate new 0%o format
1984-07-18 13:14:18 +00:00
sater
0473678491 added patterns for unsigned shifting
added patterns to delay additive operations until after multiplicative,
  this can be useful for some register machines
1984-07-18 11:05:28 +00:00
sater
fc59a0d703 Improved error handling on unterminated strings 1984-07-18 11:04:58 +00:00
sater
17a12c0bd7 added -f flags to all calls to rm 1984-07-16 15:29:48 +00:00
sater
e2f49f412d added special patterns for:
1) long compared to constant ( ldc cms 4 zxx )
2) long increments ( ld? ldc adi 4 sd? )
3) autoincrement loads and stores ( lol lol adp stl loi/sti )
1984-07-16 14:39:21 +00:00
keie
d2493e4bc3 *** empty log message *** 1984-07-16 09:36:12 +00:00
keie
b124a6d7da Added z8000 assembler manual. 1984-07-16 09:32:22 +00:00
sater
267955e114 added missing #endif
added two patterns, big improvement
added patterns for ciu and cui
some cosmetic change
1984-07-13 16:13:56 +00:00
keie
c5d95ce75d *** empty log message *** 1984-07-13 15:20:58 +00:00
keie
ebde08999f Added lines for DECUS cpp manual. 1984-07-13 15:19:19 +00:00
keie
73da8c2a2c The check for a too high offset in a hol is repaired. 1984-07-13 15:03:05 +00:00
keie
36af1e09be A bug in the exchange was repaired.
Exchanges across pseudo-instructions didn't work properly.
1984-07-13 15:01:23 +00:00
sater
da8966a6c8 Removed some patterns that have never been tested.
Now if someone uses them he will hear that it doesn't work.
That must be better then giving him code that probably won't work.
All these patterns had to do with things like adf without an argument
and things like that.
1984-07-13 14:55:37 +00:00
sater
caa918f7d9 Initial revision 1984-07-13 11:25:46 +00:00
sater
28960f5d32 Initial revision 1984-07-13 11:12:23 +00:00
sater
ea298b258e changed format of rcsid message 1984-07-12 15:18:13 +00:00
sater
a81a1917f5 Initial revision 1984-07-12 15:16:23 +00:00
sater
2dc4c564e2 added rcsid 1984-07-12 14:55:49 +00:00
sater
63324761c6 changed explanation of .base pseudo
added rcsid
1984-07-12 14:55:22 +00:00
sater
273ba7be86 added rcsid
added lines for formatting new manuals
1984-07-12 14:53:30 +00:00
sater
aaf81a512b *** empty log message *** 1984-07-12 14:51:48 +00:00
sater
96969afa26 Initial revision 1984-07-12 14:14:54 +00:00
sater
70c85c09b9 *** empty log message *** 1984-07-12 14:08:27 +00:00
sater
1eaf02a3e1 added rcsid 1984-07-12 14:07:14 +00:00
sater
10b9e1a748 added rcsid
added compilation of tstgto.p
1984-07-12 14:05:03 +00:00
sater
381355408e Initial revision 1984-07-12 13:50:44 +00:00
keie
8c892e94eb asprint is removed at cleanup time. 1984-07-12 13:24:02 +00:00
keie
150bf2e6d4 1 - Dump has a parameter.
2 - Dump are enabled.
1984-07-12 13:23:03 +00:00
keie
25ffbc9e0c 1 - A header is treated as an unsigned number.
2 - The low order word of the size in archives is fetched as unsigned.
3 - Sizes are unsigned.
1984-07-12 13:20:48 +00:00
keie
706fe6d592 Parameter added to dump preprocessor variable. 1984-07-12 12:58:18 +00:00
keie
d99c21963d 1 - Header fetch was changed to unsigned.
2 - Extra parentheses are needed by some compilers.
1984-07-12 12:57:36 +00:00
keie
28be8af452 Initial revision 1984-07-12 12:48:33 +00:00
sater
3e78acff56 removed REGPATCH define 1984-07-12 11:03:18 +00:00
sater
e3acc1a9ed added definition of newplb()
removed a tab from some string
1984-07-12 11:02:44 +00:00
sater
4001b657db Removed unbalanced quotes in comments, needed for new cpp 1984-07-12 10:50:47 +00:00
sater
2f56cb1cad reworked to use ack instead of npc.
made more user-friendly (ha ha)
1984-07-12 10:42:33 +00:00
sater
6b9a8d8685 Now lexical analyzer skips lines starting with #
to kill off remnants of some preprocessor.
1984-07-12 10:18:19 +00:00
sater
3287090f5b added description of newplb macro.
Enlarged an example.
1984-07-12 10:13:56 +00:00
sater
aa9d50ff5a The sequence:
lin 100
  cal $foo
  lin 101
used to have it's second lin lni'ed. This is obviously wrong.
A check is now made for procedure calls.
1984-07-12 09:29:49 +00:00
sater
4558cb8836 Replaced call to newilb after pro pseudo to call to newplb,
including retrofit for existing mach.h files
1984-07-12 09:26:24 +00:00
sater
8bd6bcfde0 Increased MAXINSTANCE in big memory model 1984-07-12 09:23:38 +00:00
keie
171f347998 Added the entries for instructions with 32-bit arguments. 1984-07-02 16:04:26 +00:00
keie
fcf9595988 1 - added routines to read unsigned 16-bit numbers
2 - cleanup of writing of ABS block, was in error for wordsize>4.
3 - strings are now padded up to a multiple of the wordsize.
4 - the padding algorithm for alignment was in error for wordsize>2.
1984-07-02 16:01:50 +00:00
keie
a54514d56f Not in the initial distribution. 1984-07-02 15:46:59 +00:00
keie
e9aa4befbb Added asprint to list of files to remove with 'clean'. 1984-07-02 15:46:06 +00:00
3934 changed files with 298719 additions and 246 deletions

19
.distr Normal file
View File

@@ -0,0 +1,19 @@
Action
Copyright
NEW
README
TakeAction
bin
doc
emtest
etc
first
h
include
modules
lang
lib
mach
man
mkun
util

166
Action Normal file
View File

@@ -0,0 +1,166 @@
name "System definition"
dir first
action did_first
failure "You have to run the shell script first in the directory first"
fatal
end
name "EM definition"
dir etc
end
name "LL(1) Parser generator"
dir util/LLgen
end
name "EM definition library"
dir util/data
end
name "C utilities"
dir util/cmisc
end
name "Modules"
dir modules/src
indir
end
name "C preprocessor"
dir util/cpp
end
name "ACK object utilities"
dir util/amisc
end
name "Encode/Decode"
dir util/misc
end
name "Shell files in bin"
dir util/shf
end
name "EM assembler"
dir util/ass
end
name "EM Peephole optimizer"
dir util/opt
end
name "EM Global optimizer"
dir util/ego
indir
end
name "ACK archiver"
dir util/arch
end
name "Program 'ack'"
dir util/ack
end
name "Bootstrap for backend tables"
dir util/cgg
end
name "Bootstrap for newest form of backend tables"
dir util/ncgg
end
name "LED link editor"
dir util/led
end
name "TOPGEN target optimizer generator"
dir util/topgen
end
name "C frontend"
dir lang/cem/cemcom
end
name "Basic frontend"
dir lang/basic/src
end
name "Occam frontend"
dir lang/occam/comp
end
name "Intel 8086 support"
dir mach/i86
indir
end
name "MSC6500 support"
dir mach/6500
indir
end
name "Motorola 6800 support"
dir mach/6800
indir
end
name "Motorola 6805 support"
dir mach/6805
indir
end
name "Motorola 6809 support"
dir mach/6809
indir
end
name "Intel 8080 support"
dir mach/i80
indir
end
name "2-2 Interpreter support"
dir mach/int22
indir
end
name "2-4 Interpreter support"
dir mach/int24
indir
end
name "4-4 Interpreter support"
dir mach/int44
indir
end
name "Motorola 68000 2-4 support"
dir mach/m68k2
indir
end
name "Motorola 68000 4-4 support"
dir mach/m68k4
indir
end
name "NS16032 support"
dir mach/ns
indir
end
name "PDP 11 support"
dir mach/pdp
indir
end
name "PMDS support"
dir mach/pmds
indir
end
name "PMDS 4/4 support"
dir mach/pmds4
indir
end
name "Signetics 2650 support"
dir mach/s2650
indir
end
name "Vax 4-4 support"
dir mach/vax4
indir
end
name "M68020 System V/68 support"
dir mach/m68020
indir
end
name "Sun 3 M68020 support"
dir mach/sun3
indir
end
name "Sun 2 M68000 support"
dir mach/sun2
indir
end
name "Mantra M68000 System V.0 support"
dir mach/mantra
indir
end
name "Z80 support"
dir mach/z80
indir
end
name "Zilog Z8000 support"
dir mach/z8000
indir
end
name "Pascal frontend"
dir lang/pc/pem
end

16
Copyright Normal file
View File

@@ -0,0 +1,16 @@
/*
* A M S T E R D A M C O M P I L E R K I T
*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
*
* Permission to use, sell, duplicate or disclose this software must be
* obtained in writing. Requests for such permissions may be sent to
*
* Dr. Andrew S. Tanenbaum
* Wiskundig Seminarium
* Vrije Universiteit
* Postbox 7161
* 1007 MC Amsterdam
* The Netherlands
*
*/

27
NEW Normal file
View File

@@ -0,0 +1,27 @@
What's new:
A lot of things have changed since the previous distribution.
It is not wise to mix files created by the previous version of the Kit
with files belonging to this version, although that might sometimes work.
The major changes are:
- a new C-compiler and runtime system
- a new C preprocessor
- new assembler framework, allowing the generation of relocatable
object code for most processors
- new versions of all assemblers, using the new assembler framework
- a new link-editor, linking is now a separate and fast phase for most
machines
- improved Pascal compiler, now also handles 4-byte wordsize
- Motorola M68020 backend and assembler
- Support for (some) SUN systems
- improved version of LL(1) parser generator, producing faster code
- a new language: Occam
- better System V support, the Kit should now just compile and run
Ceriel J.H. Jacobs
Dept. of Math. and Computer Science
Vrije Universiteit
Postbus 7161
1007 MC Amsterdam
The Netherlands
(UseNet: ceriel@cs.vu.nl)

2
README Normal file
View File

@@ -0,0 +1,2 @@
Before starting installation you should read
the file doc/install.pr

115
TakeAction Executable file
View File

@@ -0,0 +1,115 @@
case $# in
0) PAR=install ; CMD=Action ;;
1) PAR="$1" ; CMD=Action ;;
2) PAR="$1" ; CMD="$2" ;;
*) echo Syntax: "$0" [param [file]] ; exit 1 ;;
esac
if test -r "$CMD"
then :
else
case "$CMD" in
Action) echo No Action file present ;;
*) echo No Action file "($CMD)" present ;;
esac
fi
THISFILE=`pwd`/$0
SYS=
RETC=0
{ while read LINE
do
eval set $LINE
case x"$1" in
x!*) ;;
xname) SYS="$2"
ACTION='make $PAR'
DIR=.
FM=no
FAIL='Failed for $SYS, see $DIR/Out'
SUCC='$SYS -- done'
ATYPE=
FATAL=no
DOIT=yes
;;
xfatal) FATAL=yes ;;
xaction|xindir) case x$ATYPE in
x) ACTION=$2 ; ATYPE=$1
case $ATYPE$FM in
indirno) FAIL='Failed for $SYS' ;;
esac
;;
*) echo Already specified an $ATYPE for this name
RETC=65 ;;
esac ;;
xfailure) FM=yes
FAIL="$2" ;;
xsuccess) SUCC="$2" ;;
xdir) DIR="$2" ;;
xsystem) PAT="$2"
oIFS=$IFS
IFS="|"
eval set $2
case x`ack_sys` in
x$1|x$2|x$3|x$4|x$5|x$6|x$7) ;;
*) echo "Sorry, $SYS can only be made on $PAT systems"
DOIT=no
;;
esac
IFS=$oIFS
;;
xend) case $DOIT in
no) continue ;;
esac
case x$SYS in
x) echo Missing name line; RETC=65 ;;
*) if test -d $DIR
then (
cd $DIR
X=
case $ATYPE in
indir)
if sh $THISFILE $PAR $ACTION
then eval echo $SUCC
else RETC=2 ; eval echo $FAIL
fi ;;
*)
if eval "$ACTION >Out 2>&1 </dev/null"
then eval echo $SUCC
else RETC=1 ; X=: ; eval echo $FAIL
fi
;;
esac
(echo ------- `pwd`
cat Out
$X rm -f Out
) 2>/dev/null 1>&- 1>&3
exit $RETC
)
case $? in
0) ;;
*) case $RETC in
0) RETC=$? ;;
esac ;;
esac
else
echo Directory $DIR for $SYS is inaccessible
RETC=66
fi ;;
esac
case $FATAL$RETC in
yes0) ;;
yes*) echo Fatal error, installation stopped.
exit $RETC ;;
esac
SYS=
;;
*) echo Unknown keyword "$1"
RETC=67 ;;
esac
done
exit $RETC
} <$CMD
RETX=$?
case $RETX in
0) exit $RETC ;;
*) exit $RETX ;;
esac

1
bin/.distr Normal file
View File

@@ -0,0 +1 @@
em.pascal

1
bin/em.pascal Executable file
View File

@@ -0,0 +1 @@
exec /usr/em/doc/em/int/em /usr/em/doc/em/int/tables ${1-e.out} core

23
doc/.distr Normal file
View File

@@ -0,0 +1,23 @@
Makefile
ack.doc
basic.doc
cg.doc
crefman.doc
em
install.doc
install.pr
ncg.doc
pcref.doc
peep.doc
regadd.doc
toolkit.doc
v7bugs.doc
val.doc
LLgen
6500.doc
i80.doc
z80.doc
m68020.doc
top
ego
occam

1893
doc/6500.doc Normal file

File diff suppressed because it is too large Load Diff

3
doc/LLgen/.distr Normal file
View File

@@ -0,0 +1,3 @@
LLgen.n
LLgen.refs
Makefile

1042
doc/LLgen/LLgen.n Normal file

File diff suppressed because it is too large Load Diff

54
doc/LLgen/LLgen.refs Normal file
View File

@@ -0,0 +1,54 @@
%T An ALL(1) Compiler Generator
%A D. R. Milton
%A L. W. Kirchhoff
%A B. R. Rowland
%B Proc. of the SIGPLAN '79 Symposium on Compiler Construction
%D August 1979
%J SIGPLAN Notices
%N 8
%P 152-157
%V 14
%T Lex - A Lexical Analyser Generator
%A M. E. Lesk
%I Bell Laboratories
%D October 1975
%C Murrey Hill, New Jersey
%R Comp. Sci. Tech. Rep. No. 39
%T Yacc: Yet Another Compiler Compiler
%A S. C. Johnson
%I Bell Laboratories
%D 1975
%C Murray Hill, New Jersey
%R Comp. Sci. Tech. Rep. No. 32
%T The C Programming Language
%A B. W. Kernighan
%A D. M. Ritchie
%I Prentice-Hall, Inc.
%C Englewood Cliffs, New Jersey
%D 1978
%A M. Griffiths
%T LL(1) Grammars and Analysers
%E F. L. Bauer and J. Eickel
%B Compiler Construction, An Advanced Course
%I Springer-Verlag
%C New York, N.Y.
%D 1974
%T Make - A Program for Maintaining Computer Programs
%A S. I. Feldman
%J Software - Practice and Experience
%V 10
%N 8
%P 255-265
%D August 1979
%T Methods for the Automatic Construction of Error Correcting Parsers
%A J. R\*:ohrich
%J Acta Informatica
%V 13
%P 115-139
%D 1980

8
doc/LLgen/Makefile Normal file
View File

@@ -0,0 +1,8 @@
# $Header$
EQN=eqn
REFER=refer
TBL=tbl
../LLgen.doc: LLgen.n LLgen.refs
$(REFER) -sA+T -p LLgen.refs LLgen.n | $(EQN) | $(TBL) > $@

68
doc/Makefile Normal file
View File

@@ -0,0 +1,68 @@
# $Header$
SUF=pr
PRINT=cat
NROFF=nroff
TBL=tbl
EQN=eqn
PIC=pic
REFER=refer
MS=-ms
RESFILES= \
toolkit.$(SUF) install.$(SUF) em.$(SUF) ack.$(SUF) v7bugs.$(SUF) \
peep.$(SUF) cg.$(SUF) ncg.$(SUF) regadd.$(SUF) LLgen.$(SUF) \
basic.$(SUF) crefman.$(SUF) pcref.$(SUF) val.$(SUF) \
6500.$(SUF) i80.$(SUF) z80.$(SUF) top.$(SUF) ego.$(SUF) \
m68020.$(SUF) occam.$(SUF)
.SUFFIXES: .doc .$(SUF)
.doc.$(SUF):
$(NROFF) $(MS) $< > $@
crefman.$(SUF): crefman.doc
$(EQN) crefman.doc | $(NROFF) $(MS) >$@
v7bugs.$(SUF): v7bugs.doc
$(NROFF) v7bugs.doc >$@
install.$(SUF): install.doc
$(TBL) install.doc | $(NROFF) $(MS) >$@
pcref.$(SUF): pcref.doc
$(NROFF) pcref.doc >$@
val.$(SUF): val.doc
$(NROFF) val.doc >$@
6500.$(SUF): 6500.doc
$(TBL) 6500.doc | $(NROFF) $(MS) >$@
LLgen.doc: LLgen.X
LLgen.X:
cd LLgen; make "EQN="$(EQN) "TBL="$(TBL) "REFER="$(REFER)
top.doc: top.X
top.X:
cd top; make "EQN="$(EQN) "TBL="$(TBL) "REFER="$(REFER)
occam.doc: occam.X
occam.X:
cd occam; make "PIC="$(PIC) "TBL="$(TBL) "EQN="$(EQN)
ego.doc: ego.X
ego.X:
cd ego; make "REFER="$(REFER)
em.$(SUF): em.X
em.X:
cd em; make "TBL="$(TBL) "NROFF="$(NROFF) "SUF="$(SUF)
install cmp:
distr: install.doc
tbl install.doc | nroff -Tlp $(MS) >install.pr
pr:
@make "SUF="$(SUF) "NROFF="$(NROFF) "EQN="$(EQN) "TBL="$(TBL) \
"PIC="$(PIC) "MS="$(MS) \
$(RESFILES) >make.pr.out 2>&1
@$(PRINT) $(RESFILES)
opr:
make pr | opr
clean:
-rm -f *.old $(RESFILES) *.t *.out LLgen.doc top.doc \
occam.doc ego.doc

430
doc/ack.doc Normal file
View File

@@ -0,0 +1,430 @@
.\" $Header$
.nr PD 1v
.tr ~
.TL
Ack Description File
.br
Reference Manual
.AU
Ed Keizer
.AI
Vakgroep Informatica
Vrije Universiteit
Amsterdam
.NH
Introduction
.PP
The program \fIack\fP(I) internally maintains a table of
possible transformations and a table of string variables.
The transformation table contains one entry for each possible
transformation of a file.
Which transformations are used depends on the suffix of the
source file.
Each transformation table entry tells which input suffixes are
allowed and what suffix/name the output file has.
When the output file does not already satisfy the request of the
user, with the flag \fB\-c.suffix\fP, the table is scanned
starting with the next transformation in the table for another
transformation that has as input suffix the output suffix of
the previous transformation.
A few special transformations are recognized, among them is the
combiner, which is
a program combining several files into one.
When no stop suffix was specified (flag \fB\-c.suffix\fP) \fIack\fP
stops after executing the combiner with as arguments the \-
possibly transformed \- input files and libraries.
\fIAck\fP will only perform the transformations in the order in
which they are presented in the table.
.LP
The string variables are used while creating the argument list
and program call name for
a particular transformation.
.NH
Which descriptions are used
.PP
\fIAck\fP always uses two description files: one to define the
front-end transformations and one for the machine dependent
back-end transformations.
Each description has a name.
First the way of determining
the name of the descriptions needed is described.
.PP
When the shell environment variable ACKFE is set \fIack\fP uses
that to determine the front-end table name, otherwise it uses
\fBfe\fP.
.PP
The way the backend table name is determined is more
convoluted.
.br
First, when the last filename in the program call name is not
one of \fIack\fP, \fIcc\fP, \fIacc\fP, \fIpc\fP or \fIapc\fP,
this filename is used as the backend description name.
Second, when the \fB\-m\fP is present the \fB\-m\fP is chopped of this
flag and the rest is used as the backend description name.
Third, when both failed the shell environment variable ACKM is
used.
Last, when also ACKM was not present the default backend is
used, determined by the definition of ACKM in h/local.h.
The presence and value of the definition of ACKM is
determined at compile time of \fIack\fP.
.PP
Now, we have the names, but that is only the first step.
\fIAck\fP stores a few descriptions at compile time.
This descriptions are simply files read in at compile time.
At the moment of writing this document, the descriptions
included are: pdp, fe, i86, m68k2, vax2 and int.
The name of a description is first searched for internally,
then in lib/descr/\fIname\fP, then in
lib/\fIname\fP/descr, band finally in the current
directory of the user.
.NH
Using the description file
.PP
Before starting on a narrative of the description file,
the introduction of a few terms is necessary.
All these terms are used to describe the scanning of zero
terminated strings, thereby producing another string or
sequence of strings.
.IP Backslashing 5
.br
All characters preceded by \e are modified to prevent
recognition at further scanning.
This modification is undone before a string is passed to the
outside world as argument or message.
When reading the description files the
sequences \e\e, \e# and \e<newline> have a special meaning.
\e\e translates to a single \e, \e# translates to a single #
that is not
recognized as the start of comment, but can be used in
recognition and finally, \e<newline> translates to nothing at
all, thereby allowing continuation lines.
.nr PD 0
.IP "Variable replacement"
.br
The scan recognizes the sequences {{, {NAME} and {NAME?text}
Where NAME can be any combination if characters excluding ? and
} and text may be anything excluding }.
(~\e} is allowed of course~)
The first sequence produces an unescaped single {.
The second produces the contents of the NAME, definitions are
done by \fIack\fP and in description files.
When the NAME is not defined an error message is produced on
the diagnostic output.
The last sequence produces the contents of NAME if it is
defined and text otherwise.
.PP
.IP "Expression replacement"
.br
Syntax: (\fIsuffix sequence\fP:\fIsuffix sequence\fP=\fItext\fP)
.br
Example: (.c.p.e:.e=tail_em)
.br
If the two suffix sequences have a common member \-~\&.e in this
case~\- the text is produced.
When no common member is present the empty string is produced.
Thus the example given is a constant expression.
Normally, one of the suffix sequences is produced by variable
replacement.
\fIAck\fP sets three variables while performing the diverse
transformations: HEAD, TAIL and RTS.
All three variables depend on the properties \fIrts\fP and
\fIneed\fP from the transformations used.
Whenever a transformation is used for the first time,
the text following the \fIneed\fP is appended to both the HEAD and
TAIL variable.
The value of the variable RTS is determined by the first
transformation used with a \fIrts\fP property.
.IP
Two runtime flags have effect on the value of one or more of
these variables.
The flag \fB\-.suffix\fP has the same effect on these three variables
as if a file with that \fBsuffix\fP was included in the argument list
and had to be translated.
The flag \fB\-r.suffix\fP only has that effect on the TAIL
variable.
The program call names \fIacc\fP and \fIcc\fP have the effect
of an automatic \fB\-.c\fP flag.
\fIApc\fP and \fIpc\fP have the effect of an automatic \fB\-.p\fP flag.
.IP "Line splitting"
.br
The string is transformed into a sequence of strings by replacing
the blank space by string separators (nulls).
.IP "IO replacement"
.br
The > in the string is replaced by the output file name.
The < in the string is replaced by the input file name.
When multiple input files are present the string is duplicated
for each input file name.
.nr PD 1v
.LP
Each description is a sequence of variable definitions followed
by a sequence of transformation definitions.
Variable definitions use a line each, transformations
definitions consist of a sequence of lines.
Empty lines are discarded, as are lines with nothing but
comment.
Comment is started by a # character, and continues to the end
of the line.
Three special two-characters sequences exist: \e#, \e\e and
\e<newline>.
Their effect is described under 'backslashing' above.
Each \- nonempty \- line starts with a keyword, possibly
preceded by blank space.
The keyword can be followed by a further specification.
The two are separated by blank space.
.PP
Variable definitions use the keyword \fIvar\fP and look like this:
.DS X
var NAME=text
.DE
The name can be any identifier, the text may contain any
character.
Blank space before the equal sign is not part of the NAME.
Blank space after the equal is considered as part of the text.
The text is scanned for variable replacement before it is
associated with the variable name.
.br
.sp 2
The start of a transformation definition is indicated by the
keyword \fIname\fP.
The last line of such a definition contains the keyword
\fIend\fP.
The lines in between associate properties to a transformation
and may be presented in any order.
The identifier after the \fIname\fP keyword determines the name
of the transformation.
This name is used for debugging and by the \fB\-R\fP flag.
The keywords are used to specify which input suffices are
recognized by that transformation,
the program to run, the arguments to be handed to that program
and the name or suffix of the resulting output file.
Two keywords are used to indicate which run-time startoffs and
libraries are needed.
The possible keywords are:
.IP \fIfrom\fP
.br
followed by a sequence of suffices.
Each file with one of these suffices is allowed as input file.
Preprocessor transformations do not need the \fIfrom\fP
keyword. All other transformations do.
.nr PD 0
.IP \fIto\fP
.br
followed by the suffix of the output file name or in the case of a
linker
the output file name.
.IP \fIprogram\fP
.br
followed by name of the load file of the program, a pathname most likely
starts with either a / or {EM}.
This keyword must be
present, the remainder of the line
is subject to backslashing and variable replacement.
.IP \fImapflag\fP
.br
The mapflags are used to grab flags given to \fIack\fP and
pass them on to a specific transformation.
This feature uses a few simple pattern matching and replacement
facilities.
Multiple occurences of this keyword are allowed.
This text following the keyword is
subjected to backslashing.
The keyword is followed by a match expression and a variable
assignment separated by blank space.
As soon as both description files are read, \fIack\fP looks
at all transformations in these files to find a match for the
flags given to \fIack\fP.
The flags \fB\-m\fP, \fB\-o\fP,
\fB\-O\fP, \fB\-r\fP, \fB\-v\fP, \fB\-g\fP, \-\fB\-c\fP, \fB\-t\fP,
\fB\-k\fP, \fB\-R\fP and \-\fB\-.\fP are specific to \fIack\fP and
not handed down to any transformation.
The matching is performed in the order in which the entries
appear in the definition.
The scanning stops after first match is found.
When a match is found, the variable assignment is executed.
A * in the match expression matches any sequence of characters,
a * in the right hand part of the assignment is
replaced by the characters matched by
the * in the expression.
The right hand part is also subject to variable replacement.
The variable will probably be used in the program arguments.
The \fB\-l\fP flags are special,
the order in which they are presented to \fIack\fP must be
preserved.
The identifier LNAME is used in conjunction with the scanning of
\fB\-l\fP flags.
The value assigned to LNAME is used to replace the flag.
The example further on shows the use all this.
.IP \fIargs\fP
.br
The keyword is followed by the program call arguments.
It is subject to backslashing, variable replacement, expression
replacement, line splitting and IO replacement.
The variables assigned to by \fImapflags\fP will probably be
used here.
The flags not recognized by \fIack\fP or any of the transformations
are passed to the linker and inserted before all other arguments.
.IP \fIstdin\fP
.br
This keyword indicates that the transformation reads from standard input.
.IP \fIstdout\fP
.br
This keyword indicates that the transformation writes on standard output.
.IP \fIoptimizer\fP
.br
This keyword indicates that this transformation is an optimizer.
.IP \fIlinker\fP
.br
This keyword indicates that this transformation is the linker.
.IP \fIcombiner\fP
.br
This keyword indicates that this transformation is a combiner. A combiner
is a program combining several files into one, but is not a linker.
An example of a combiner is the global optimizer.
.IP \fIprep\fP
.br
This \-~optional~\- keyword is followed an option indicating its relation
to the preprocessor.
The possible options are:
.DS X
always the input files must be preprocessed
cond the input files must be preprocessed when starting with #
is this transformation is the preprocessor
.DE
.IP \fIrts\fP
.br
This \-~optional~\- keyword indicates that the rest of the line must be
used to set the variable RTS, if it was not already set.
Thus the variable RTS is set by the first transformation
executed which such a property or as a result from \fIack\fP's program
call name (acc, cc, apc or pc) or by the \fB\-.suffix\fP flag.
.IP \fIneed\fP
.br
This \-~optional~\- keyword indicates that the rest of the line must be
concatenated to the NEEDS variable.
This is done once for every transformation used or indicated
by one of the program call names mentioned above or indicated
by the \fB\-.suffix\fP flag.
.br
.nr PD 1v
.NH
Conventions used in description files
.PP
\fIAck\fP reads two description files.
A few of the variables defined in the machine specific file
are used by the descriptions of the front-ends.
Other variables, set by \fIack\fP, are of use to all
transformations.
.PP
\fIAck\fP sets the variable EM to the home directory of the
Amsterdam Compiler Kit.
The variable SOURCE is set to the name of the argument that is currently
being massaged, this is usefull for debugging.
The variable SUFFIX is set to the suffix of the argument that is
currently being massaged.
.br
The variable M indicates the
directory in lib/{M}/tail_..... and NAME is the string to
be defined by the preprocessor with \-D{NAME}.
The definitions of {w}, {s}, {l}, {d}, {f} and {p} indicate
EM_WSIZE, EM_SSIZE, EM_LSIZE, EM_DSIZE, EM_FSIZE and EM_PSIZE
respectively.
.br
The variable INCLUDES is used as the last argument to \fIcpp\fP.
It is used to add directories to
the list of directories containing #include files.
.PP
The variables HEAD, TAIL and RTS are set by \fIack\fP and used
to compose the arguments for the linker.
.NH
Example
.PP
Description for front-end
.DS X
.ta 4n 40n
name cpp # the C-preprocessor
# no from, it's governed by the P property
to .i # result files have suffix i
program {EM}/lib/cpp # pathname of loadfile
mapflag \-I* CPP_F={CPP_F?} \-I* # grab \-I.. \-U.. and
mapflag \-U* CPP_F={CPP_F?} \-U* # \-D.. to use as arguments
mapflag \-D* CPP_F={CPP_F?} \-D* # in the variable CPP_F
args {CPP_F?} {INCLUDES?} \-D{NAME} \-DEM_WSIZE={w} \-DEM_PSIZE={p} \e
\-DEM_SSIZE={s} \-DEM_LSIZE={l} \-DEM_FSIZE={f} \-DEM_DSIZE={d} <
# The arguments are: first the \-[IUD]...
# then the include dir's for this machine
# then the NAME and size valeus finally
# followed by the input file name
stdout # Output on stdout
prep is # Is preprocessor
end
name cem # the C-compiler proper
from .c # used for files with suffix .c
to .k # produces compact code files
program {EM}/lib/em_cem # pathname of loadfile
mapflag \-p CEM_F={CEM_F?} \-Xp # pass \-p as \-Xp to cem
mapflag \-L CEM_F={CEM_F?} \-l # pass \-L as \-l to cem
args \-Vw{w}i{w}p{p}f{f}s{s}l{l}d{d} {CEM_F?}
# the arguments are the object sizes in
# the \-V... flag and possibly \-l and \-Xp
stdin # input from stdin
stdout # output on stdout
prep always # use cpp
rts .c # use the C run-time system
need .c # use the C libraries
end
name decode # make human readable files from compact code
from .k.m # accept files with suffix .k or .m
to .e # produce .e files
program {EM}/lib/em_decode # pathname of loadfile
args < # the input file name is the only argument
stdout # the output comes on stdout
end
.DE
.DS X
.ta 4n 40n
Example of a backend, in this case the EM assembler/loader.
var w=2 # wordsize 2
var p=2 # pointersize 2
var s=2 # short size 2
var l=4 # long size 4
var f=4 # float size 4
var d=8 # dou<6F><75>XY<17>H<EFBFBD>\<5C>و<19>[H<1B>e startoff
var SIZE_FLAG=\-sm # default internal table size flag
var INCLUDES=\-I{EM}/include # use {EM}/include for #include files
name asld # Assembler/loader
from .k.m.a # accepts compact code and archives
to e.out # output file name
program {EM}/lib/em_ass # load file pathname
mapflag \-l* LNAME={EM}/{LIB}* # e.g. \-ly becomes
# {EM}/mach/int/lib/tail_y
mapflag \-+* ASS_F={ASS_F?} \-+* # recognize \-+ and \-\-
mapflag \-\-* ASS_F={ASS_F?} \-\-*
mapflag \-s* SIZE_FLAG=\-s* # overwrite old value of SIZE_FLAG
args {SIZE_FLAG} \e
({RTS}:.c={EM}/{RT}cc) ({RTS}:.p={EM}/{RT}pc) \-o > < \e
(.p:{TAIL}={EM}/{LIB}pc) \e
(.c:{TAIL}={EM}/{LIB}cc.1s {EM}/{LIB}cc.2g) \e
(.c.p:{TAIL}={EM}/{LIB}mon)
# \-s[sml] must be first argument
# the next line contains the choice for head_cc or head_pc
# and the specification of in- and output.
# the last three args lines choose libraries
linker
end
.DE
The command \fIack \-mint \-v \-v \-I../h \-L \-ly prog.c\fP
would result in the following
calls (with exec(II)):
.DS X
.ta 4n
1) /lib/cpp \-I../h \-I/usr/em/include \-Dint22 \-DEM_WSIZE=2 \-DEM_PSIZE=2 \e
\-DEM_SSIZE=2 \-DEM_LSIZE=4 \-DEM_FSIZE=4 \-DEM_DSIZE=8 prog.c
2) /usr/em/lib/em_cem \-Vw2i2p2f4s2l4d8 \-l
3) /usr/em/lib/em_ass \-sm /usr/em/mach/int/lib/head_cc \-o e.out prog.k
/usr/em/mach/int/lib/tail_y /usr/em/mach/int/lib/tail_cc.1s
/usr/em/mach/int/lib/tail_cc.2g /usr/em/mach/int/lib/tail_mon
.DE

849
doc/basic.doc Normal file
View File

@@ -0,0 +1,849 @@
.\" $Header$
.TL
.de Sy
.LP
.IP \fBsyntax\fR 10
..
.de PU
.IP \fBpurpose\fR 10
..
.de RM
.IP \fBremarks\fR 10
..
The ABC compiler
.AU
Martin L. Kersten
.AI
Department of Mathematics and Computer Science.
.br
Vrije Universiteit
.AB
This manual describes the
programming language BASIC and its compiler
included in the Amsterdam Compiler Kit.
.AE
.SH
INTRODUCTION.
.LP
The BASIC-EM compiler is an extensive implementation of the
programming language BASIC.
The language structure and semantics are modelled after the
BASIC interpreter/compiler of Microsoft (tr), a detailed comparison
is provided in appendix A.
.LP
The compiler generates code for a virtual machine, the EM machine
[[ACM, etc]]
Using EM as an intermediate machine results in a highly portable
compiler and BASIC code.
The drawback of EM is that it does not directly reflect one particular
hardware design, which means that many of
the low level operations available within
BASIC are ill-defined or even inapplicable.
To mention a few, the peek and poke instructions are likely
to be behave errorneous, while line printer and tapedeck
primitives are unknown.
.LP
This manual is divided into three chapters.
The first chapter discusses the general language syntax and semantics.
Chapter two describes the statements available in BASIC-EM.
Chapter 3 describes the predefined functions,
ordered alphabetically.
Appendix A discusses the differences with
Microsoft BASIC. Appendix B describes all reserved symbols.
Appendix C lists the error messages in use.
.SH
SYNTAX NOTATION
.LP
The conventions for syntax presentation are as follows:
.IP CAPS 10
Items are reserved words, must be input as shown
.IP <> 10
Items in lowercase letters enclosed in angular brackets
are to be supplied by the user.
.IP [] 10
Items are optional.
.IP \.\.\. 10
Items may be repeated any number of times
.IP {} 10
A choice between two or more alternatives. At least one of the entries
must be chosen.
.IP | 10
Vertical bars separate the choices within braces.
.LP
All punctuation must be included where shown.
.NH 1
GENERAL INFORMATION
.LP
The BASIC-EM compiler is designed for a UNIX based environment.
It accepts a text file with your BASIC program (suffix .b) and generates
an executable file, called a.out.
.NH 2
LINE FORMAT
.LP
A BASIC program consists of a series of lines, starting with a
positive line number in the range 0 to 65529.
A line may consists of more then one physical line on your terminal, but must
is limited to 1024 characters.
Multiple BASIC statements may be placed on a single line, provided
they are separated by a colon (:).
.NH 2
CONSTANTS
.LP
The BASIC compiler character set is comprised of alphabetic
characters, numeric characters, and special characters shown below.
.DS
= + - * / ^ ( ) % # $ \\ _
! [ ] , . ; : & ' ? > < \\ (blanc)
.DE
.LP
BASIC uses two different types of constants during processing:
numeric and string constants.
.br
A string constant is a sequence of characters taken from the ASCII
character set enclosed by double quotation marks.
.br
Numeric constants are positive or negative numbers, grouped into
five different classes.
.IP "a) integer constants" 25
Whole numbers in the range of -32768 and 32767. Integer constants do
not contain decimal points.
.IP "b) fixed point constants" 25
Positive or negative real numbers, i.e. numbers with a decimal point.
.IP "c) floating point constants" 25
Real numbers in scientific notation. A floating point constant
consists of an optional signed integer or fixed point number
followed by the letter E (or D) and an optional signed integer
(the exponent).
The allowable range of floating point constants is 10^-38 to 10^+38.
.IP "d) Hex constants" 25
Hexadecimal numbers, denoted by the prefix &H.
.IP "d) Octal constants" 25
Octal numbers, denoted by the prefix &O.
.NH 2
VARIABLES
.LP
Variables are names used to represent values in a BASIC program.
A variable is assigned a value by assigment specified in the program.
Before a variable is assigned its value is assumed to be zero.
.br
Variable names are composed of letters, digits or the decimal point,
starting with a letter. Up to 40 characters are significant.
A variable name be be followed by any of the following type
declaration characters:
.IP % 5
Defines an integer variable
.IP ! 5
Defines a single precision variable (see below)
.IP # 5
Defines a double precision variable
.IP $ 5
Defines a string variable.
.LP
NOTE: Two variables with the same name but different type is
considered illegal.
.LP
Beside single valued variables, values may be grouped
into tables or arrays.
Each element in an array is referenced by the array name and an index,
such a variable is called a subscripted variable.
An array has as many subscripts as there are dimensions in the array,
the maximum of which is 11.
.br
If a variable starts with FN it is assumed to be a call to a user defined
function.
.br
A variable name may not be a reserved word nor the name
of a predefined function.
A list of all reserved identifiers is included as Appendix ?.
.NH 2
EXPRESSIONS
.LP
BASIC-EM differs from Microsoft BASIC in supporting floats in one precision
only (due to EM).
All floating point constants have the same precision, i.e. 16 digits.
.LP
When necessary the compiler will convert a numeric value from
one type to another.
A value is always converted to the precision of the variable it is assigned
to.
When a floating point value is converted to an integer the fractional
portion is rounded.
In an expression all values are converted to the same degree of precision,
i.e. that of the most precise operand.
.br
Division by zero results in the message "Division by zero".
If overflow (or underflow) occurs, the "Overflow (underflow)" message is
displayed and execution is terminated (contrary to Microsoft).
.SH
Arithmetic
.LP
The arithmetic operators in order of precedence,a re:
.DS L
\^ Exponentiation
- Negation
*,/,\\,MOD Multiplication, Division, Remainder
+,- Addition, Substraction
.DE
The operator \\\\ denotes integer division, its operands are rounded to
integers before the operator is applied.
Modulus arithmetic is denoted by the operator MOD, which yields the
integer value that is the remainder of an integer division.
.br
The order in which operators are performed can be changec with parentheses.
.SH
Relational
.LP
The relational operators in order of precedence, are:
.DS
= Equality
<> Inequality
< Less than
> Greater than
<= Less than or equal to
>= Greater than or equal to
.DE
The relational operators are used to compare two values and returns
either "true" (-1) or "false" (0) (See IF statement).
The precedence of the relational operators is lower
then the arithmetic operators.
.SH
Logical
.LP
The logical operators performs tests on multiple relations, bit manipulations,
or Boolean operations.
The logical operators returns a bitwise result ("true" or "false").
In an expression, logical operators are performed after the relational and
arithmetic operators.
The logical operators work by converting their operands to signed
two-complement integers in the range -32768 to 32767.
.DS
NOT Bitwise negation
AND Bitwise and
OR Bitwise or
XOR Bitwise exclusive or
EQV Bitwise equivalence
IMP Bitwise implies
.DE
.SH
Functional
.LP
A function is used in an expression to call a system or user defined
function.
A list of predefined functions is presented in chapter 3.
.SH
String operations
.LP
Strings can be concatenated by using +. Strings can be compared with
the relational operators. String comparison is performed in lexicographic
order.
.NH 2
ERROR MESSAGES
.LP
The occurence of an error results in termination of the program
unless an ON....ERROR statement has been encountered.
.NH 1
B-EM STATEMENTS
.LP
This chapter describes the statements available within the BASIC-EM
compiler. Each description is formatted as follows:
.Sy
Shows the correct syntax for the statement. See introduction of
syntax notation above.
.PU
Describes the purpose and details of the instructions.
.RM
Describes special cases, deviation from Microsoft BASIC etc.
.LP
.NH 2
CALL
.Sy
CALL <variable name>[(<argument list>)]
.PU
The CALL statement provides the means to execute procedures
and functions written in another language included in the
Amsterdam Compiler Kit.
The argument list consist of (subscripted) variables.
The BASIC compiler pushes the address of the arguments on the stack in order
of encounter.
.RM
Not yet available
.NH 2
CLOSE
.Sy
CLOSE [[#]<file number>[,[#]<file number...>]]
.PU
To terminate I/O on a disk file.
<file number> is the number associated with the file
when it was OPENed (See OPEN). Ommission of parameters results in closing
all files.
.sp
The END statement and STOP statement always issue a CLOSE of
all files.
.NH 2
DATA
.Sy
DATA <list of constants>
.PU
DATA statements are used to construct a data bank of values that are
accessed by the program's READ statement.
DATA statements are non-executable,
the data items are assembled in a data file by the BASIC compiler.
This file can be replaced, provided the layout remains
the same (otherwise the RESTORE won't function properly).
.sp
The list of data items consists of numeric and string constants
as discussed in section 1.
Moreover, string constants starting with a letter and not
containing blancs, newlines, commas, colon need not be enclosed with
the string quotes.
.sp
DATA statements can be reread using the RESTORE statement.
.NH 2
DEF FN
.Sy
DEF FN<name> [(<parameterlist>)]=<expression>
.PU
To define and name a function that is written by the user.
<name> must be an identifier and should be preceded by FN,
which is considered integral part of the function name.
<expression> defines the expression to be evaluated upon function call.
.sp
The parameter list is comprised of a comma separated
list of variable names, used within the function definition,
that are to replaced by values upon function call.
The variable names defined in the parameterlist, called formal
parameters, do not affect the definition and use of variables
defined with the same name in the rest of the BASIC program.
.sp
A type declaration character may be suffixed to the function name to
designate the data type of the function result.
.NH 2
DEFINT/SNG/DBL/STR
.Sy
DEF<type> <range of letters>
.PU
Any undefined variable starting with the letter included in the range of
letters is declared of type <type> unless a type declaration character
is appended.
The range of letters is a comma separated list of characters and
character ranges (<letter>-<letter>).
.NH 2
DIM
.Sy
DIM <list of subscripted variable>
.PU
The DIM statement allocates storage for subscripted variables.
If an undefined subscripted variable is used
the maximum value of the array subscript(s) is assumed to be 10.
A subscript out of range is signalled by the program (when RCK works)
The minimum subscript value is 0, unless the OPTION BASE statement has been
encountered.
.sp
All variables in a subscripted variable are initially zero.
.sp
BUG. Multi-dimensional arrays MUST be defined.
.NH 2
END
.Sy
END
.PU
END terminates a BASIC program and returns to the UNIX shell.
An END statement at the end of the BASIC program is optional.
.NH 2
ERR and ERL
.PU
Whenever an error occurs the variable ERR contains the
error number and ERL the BASIC line where the error occurred.
The variables are usually used in error handling routines
provided by the user.
.NH 2
ERROR
.Sy
ERROR <integer expression>
.PU
To simulate the occurrence of a BASIC error.
To define your own error code use a value not already in
use by the BASIC runtime system.
The list of error messages currently in use
can be found in appendix B.
.NH 2
FIELD
.PU
To be implemented.
.NH 2
FOR...NEXT
.Sy
FOR <variable>= <low>TO<high>[STEP<size>]
.br
......
.br
NEXT [<variable>][,<variable>...]
.PU
The FOR statements allows a series of statements to be performed
repeatedly. <variable> is used as a counter. During the first
execution pass it is assigned the value <low>,
an arithmetic expression. After each pass the counter
is incremented with the step size <size>, an expression.
Ommission of the step size is intepreted as an increment of 1.
Execution of the program lines specified between the FOR and the NEXT
statement is terminated as soon as <low> is greater than <high>
.sp
The NEXT statement is labeled with the name(s) of the counter to be
incremented.
.sp
The body of the FOR statement is skipped when the initial value of the
loop times the sign of the step exceeds the value of the highest value
times the sign of the step.
.sp
The variables mentioned in the NEXT statement may be ommitted, in which case
the variable of increment the counter of the most recent FOR statement.
If a NEXT statement is encountered before its corresponding FOR statement,
the error message "NEXT without FOR" is generated.
.NH 2
GET
.Sy
GET [#]<file number>[, <record number>]
.PU
To be implemented.
.NH 2
GOSUB...RETURN
.Sy
GOSUB <line number
...
.br
RETURN
.PU
The GOSUB statement branches to the first statement of a subroutine.
The RETURN statement cause a branch back to the statement following the
most recent GOSUB statement.
A subroutine may contain more than one RETURN statement.
.sp
Subroutines may be called recursively.
Nesting of subroutine calls is limited, upon exceeding the maximum depth
the error message "XXXXX" is displayed.
.NH 2
GOTO
.Sy
GOTO <line number>
.PU
To branch unconditionally to a specified line in the program.
If <line number> does not exists, the compilation error message
"Line not defined" is displayed.
.RM
Microsoft BASIC continues at the first line
equal or greater then the line specified.
.NH 2
IF...THEN
.Sy
.br
IF <expression> THEN {<statements>|<line number>}
[ELSE {<statements>|<line number>}]
.br
.Sy
IF <expression> GOTO <line number>
[ELSE {<statements>|<line number>}]
.PU
The IF statement is used
to make a decision regarding the program flow based on the
result of the expressions.
If the expression is not zero, the THEN or GOTO clause is
executed. If the result of <expression> is zero, the THEN or
GOTO clause is ignored and the ELSE clause, if present is
executed.
.br
IF..THEN..ELSE statements may be nested.
Nesting is limited by the length of the line.
The ELSE clause matches with the closests unmatched THEN.
.sp
When using IF to test equality for a value that is the
result of a floating point expression, remember that the
internal representation of the value may not be exact.
Therefore, the test should be against a range to
handle the relative error.
.RM
Microsoft BASIC allows a comma before THEN.
.NH 2
INPUT
.Sy
INPUT [;][<"prompt string">;]<list of variables>
.PU
An INPUT statement can be used to obtain values from the user at the
terminal.
When an INPUT statement is encountered a question mark is printed
to indicate the program is awaiting data.
IF <"prompt string"> is included, the string is printed before the
the question mark. The question mark is suppressed when the prompt
string is followed by a comma, rather then a semicolon.
.sp
For each variable in the variable a list a value should be supplied.
Data items presented should be separated by a comma.
.sp
The type of the variable in the variable list must aggree with the
type of the data item entered. Responding with too few or too many
data items causes the message "?Redo". No assignment of input values
is made until an acceptable response is given.
.RM
The option to disgard the carriage return with the semicolon after the
input symbol is not yet implemented.
.NH 2
INPUT [#]
.Sy
INPUT #<file number>,<list of variables>
.PU
The purpose of the INPUT# statement is to read data items from a sequential
file and assign them to program variables.
<file number> is the number used to open the file for input.
The variables mentioned are (subscripted) variables.
The type of the data items read should aggree with the type of the variables.
A type mismatch results in the error message "XXXXX".
.sp
The data items on the sequential file are separated by commas and newlines.
In scanning the file, leading spaces, new lines, tabs, and
carriage returns are ignored. The first character encountered
is assumed to be the state of a new item.
String items need not be enclosed with double quotes, provided
it does not contain spaces, tabs, newlines and commas,
.RM
Microsoft BASIC won't assign values until the end of input statement.
This means that the user has to supply all the information.
.NH 2
LET
.Sy
[LET]<variable>=<expression>
.PU
To assign the value of an expression to a (subscribted) variable.
The type convertions as dictated in section 1.X apply.
.NH 2
LINE INPUT
.Sy
LINE INPUT [;][<"prompt string">;]<string variable>
.PU
An entire line of input is assigned to the string variable.
See INPUT for the meaning of the <"prompt string"> option.
.NH 2
LINE INPUT [#]
.Sy
LINE INPUT #<file number>,<string variable>
.PU
Read an entire line of text from a sequential file <file number>
and assign it to a string variable.
.NH 2
LSET and RSET
.PU
To be implemented
.NH 2
MID$
.Sy
MID$(<string expr1>,n[,m])=<string expr2>
.PU
To replace a portion of a string with another string value.
The characters of <string expr2> replaces characters in <string expr1>
starting at position n. If m is present, at most m characters are copied,
otherwise all characters are copied.
However, the string obtained never exceeds the length of string expr1.
.NH 2
ON ERROR GOTO
.Sy
ON ERROR GOTO <line number>
.PU
To enable error handling within the BASIC program.
An error may result from arithmetic errors, disk problems, interrupts, or
as a result of the ERROR statement.
After printing an error message the program is continued at the
statements associated with <line number>.
.sp
Error handling is disabled using ON ERROR GOTO 0.
Subsequent errors result in an error message and program termination.
.NH 2
ON...GOSUB and ON ...GOTO
.Sy
ON <expression> GOSUB <list of line numbers>
ON <expression> GOTO <list of line numbers>
.PU
To branch to one of several specified line numbers or subroutines, based
on the result of the <expression>. The list of line numbers are considered
the first, second, etc alternative. Branching to the first occurs when
the expression evaluates to one, to the second alternative on two, etc.
If the value of the expression in zero or greater than the number of alternatives, processing continues at the first statement following the ON..GOTO
(ON GOSUB) statement.
When the expression results in a negative number the
an "Illegal function call" error occurs.
.NH 2
OPEN
.NH 2
OPTION BASE
.Sy
OPTION BASE n
.PU
To declare the lower bound of subsequent array subscripts as either
0 or 1. The default lower bound is zero.
.NH 2
POKE
.Sy
POKE <expr1>,<expr2>
.PU
To poke around in memory. The use of this statement is not recommended,
because it requires full understanding of both
the implementation of the Amsterdam
Compiler Kit and the hardware characteristics.
.NH 2
PRINT [USING]
.NH 2
PUT
.PU
To be implemented
.NH 2
RANDOMIZE
.Sy
RANDOMIZE [<expression>]
.PU
To reset the random seed. When the expression is ommitted, the system
will ask for a value between -32768 and 32767.
The random number generator returns the same sequence of values provided
the same seed is used.
.NH 2
READ
.Sy
READ <list of variables>
.PU
To read values from the DATA statements and assign them to variables.
The type of the variables should match to the type of the items being read,
otherwise a "Syntax error" occurs.
.NH 2
REM
.Sy
REM <remark>
.PU
To include explantory information in a program.
The REM statements are not executed.
A single quote has the same effect as : REM, which
allows for the inclusion of comment at the end of the line.
.RM
Microsoft BASIC does not allow REM statements as part of
DATA lines.
.NH 2
RESTORE
.Sy
RESTORE [<line number>]
.PU
To allow DATA statements to be re-read from a specific line.
After a RESTORE statement is executed, the next READ accesses
the first item of the DATA statements.
If <line number> is specified, the next READ accesses the first
item in the specified line.
.sp
Note that data statements result in a sequential datafile generated
by the compiler, being read by the read statements.
This data file may be replaced using the operating system functions
with a modified version, provided the same layout of items
(same number of lines and items per line) is used.
.NH 2
STOP
.Sy
STOP
.PU
To terminate the execution of a program and return to the operating system
command interpreter. A STOP statement results in the message "Break in line
???"
.NH 2
SWAP
.Sy
SWAP <variable>,<variable>
.PU
To exchange the values of two variables.
.NH 2
TRON/TROFF
.Sy
TRON
.Sy
TROFF
.PU
As an aid in debugging the TRON statement results in a program
listing each line being interpreted. TROFF disables generation of
this code.
.NH 2
WHILE...WEND
.Sy
WHILE <expression>
.....
WEND
.PU
To execute a series of BASIC statements as long as a conditional expression
is true. WHILE...WEND loops may be nested.
.NH 2
WRITE
.Sy
WRITE [<list of expressions>]
.PU
To write data at the terminal in DATA statement layout conventions.
The expressions should be separated by commas.
.NH 2
WRITE #
.Sy
WRITE #<file number> ,<list of expressions>
.PU
To write a sequential data file, being opened with the "O" mode.
The values are being writting using the DATA statements layout conventions.
.NH
FUNCTIONS
.LP
.IP ABS(X) 12
Returns the absolute value of expression X
.IP ASC(X$) 12
Returns the numeric value of the first character of the string.
If X$ is not initialized an "Illegal function call" error
is returned.
.IP ATN(X) 12
Returns the arctangent of X in radians. Result is in the range
of -pi/2 to pi/2.
.IP CDBL(X) 12
Converts X to a double precision number.
.IP CHR$(X) 12
Converts the integer value X to its ASCII character.
X must be in the range of 0 to 127.
It is used for cursor addressing and generating bel signals.
.IP CINT(X) 12
Converts X to an integer by rounding the fractional portion.
If X is not in the range -32768 to 32767 an "Overflow"
error occurs.
.IP COS(X) 12
Returns the cosine of X in radians.
.IP CSNG(X) 12
Converts X to a double precision number.
.IP CVI(<2-bytes>) 12
Convert two byte string value to integer number.
.IP CVS(<4-bytes>) 12
Convert four byte string value to single precision number.
.IP CVD(<8-bytes>) 12
Convert eight byte string value to double precision number.
.IP EOF[(<file-number>)] 12
Returns -1 (true) if the end of a sequential file has been reached.
.IP EXP(X) 12
Returns e(base of natural logarithm) to the power of X.
X should be less then 10000.0.
.IP FIX(X) 12
Returns the truncated integer part of X. FIX(X) is
equivalent to SGN(X)*INT(ABS(X)).
The major difference between FIX and INT is that FIX does not
return the next lower number for negative X.
.IP HEX$(X) 12
Returns the string which represents the hexadecimal value of
the decimal argument. X is rounded to an integer using CINT
before HEX$ is evaluated.
.IP INT(X) 12
Returns the largest integer <= X.
.IP INPUT$(X[,[#]Y]) 12
Returns the string of X characters read from the terminal or
the designated file.
.IP LEX(X$) 12
Returns the number of characters in the string X$.
Non printable and blancs are counted too.
.IP LOC(<file\ number>) 12
For sequential files LOC returns
position of the read/write head, counted in number of bytes.
For random files the function returns the record number just
read or written from a GET or PUT statement.
If nothing was read or written 0 is returned.
.IP LOG(X) 12
Returns the natural logarithm of X. X must be greater than zero.
.IP MID$(X,I,[J]) 12
To be implemented.
.IP MKI$(X) 12
Converts an integer expression to a two-byte string.
.IP MKS$(X) 12
Converts a single precision expression to a four-byte string.
.IP MKD$(X) 12
Converts a double precision expression to a eight-byte string.
.IP OCT$(X) 12
Returns the string which represents the octal value of the decimal
argument. X is rounded to an integer using CINT before OCTS is evaluated.
.IP PEEK(I) 12
Returns the byte read from the indicated memory. (Of limited use
in the context of ACK)
.IP POS(I) 12
Returns the current cursor position. To be implemented.
.IP RIGHT$(X$,I)
Returns the right most I characters of string X$.
If I=0 then the empty string is returned.
.IP RND(X) 12
Returns a random number between 0 and 1. X is a dummy argument.
.IP SGN(X) 12
If X>0 , SGN(X) returns 1.
.br
if X=0, SGN(X) returns 0.
.br
if X<0, SGN(X) returns -1.
.IP SIN(X) 12
Returns the sine of X in radians.
.IP SPACE$(X) 12
Returns a string of spaces length X. The expression
X is rounded to an integer using CINT.
.IP STR$(X)
Returns the string representation value of X.
.IP STRING$(I,J) 12
Returns thes string of length Iwhose characters all
have ASCII code J. (or first character when J is a string)
.IP TAB(I) 12
Spaces to position I on the terminal. If the current
print position is already beyond space I,TAB
goes to that position on the next line.
Space 1 is leftmost position, and the rightmost position
is width minus 1. To be used within PRINT statements only.
.IP TAN(X) 12
Returns the tangent of X in radians. If TAN overflows
the "Overflow" message is displayed.
.IP VAL(X$) 12
Returns the numerical value of string X$.
The VAL function strips leading blanks and tabs from the
argument string.
.SH
APPENDIX A DIFFERENCES WITH MICROSOFT BASIC
.LP
The following list of Microsoft commands and statements are
not recognized by the compiler.
.DS
SPC
USR
VARPTR
AUTO
CHAIN
CLEAR
CLOAD
COMMON
CONT
CSAVE
DELETE
EDIT
ERASE
FRE
KILL
LIST
LLIST
LOAD
LPRINT
MERGE
NAME
NEW
NULL
RENUM
RESUME
RUN
SAVE
WAIT
WIDTH LPRINT
.DE
Some statements are in the current implementation not available,
but will be soon. These include:
.DS
CALL
DEFUSR
FIELD
GET
INKEY
INPUT$
INSTR$
LEFT$
LSET
RSET
PUT
.DE

1863
doc/cg.doc Normal file

File diff suppressed because it is too large Load Diff

627
doc/crefman.doc Normal file
View File

@@ -0,0 +1,627 @@
.EQ
delim $$
.EN
.RP
.TL
ACK/CEM Compiler
.br
Reference Manual
.AU
Erik H. Baalbergen
.AI
Department of Mathematics and Computer Science
Vrije Universiteit
Amsterdam
The Netherlands
.AB no
.AE
.NH
C Language
.PP
This section discusses the extensions to and deviations from the C language,
as described in [1].
The issues are numbered according to the reference manual.
.SH
2.2 Identifiers
.PP
Upper and lower case letters are different.
The number of significant letters
is 32 by default, but may be set to another value using the \fB\-M\fP option.
The identifier length should be set according to the rest of the compilation
programs.
.SH
2.3 Keywords
.SH
\f5asm\fP
.PP
The keyword \f5asm\fP
is recognized.
However, the statement
.DS
.ft 5
asm(string);
.ft R
.DE
is skipped, while a warning is given.
.SH
\f5enum\fP
.PP
The \f5enum\fP keyword is recognized and interpreted.
.SH
\f5entry\fP, \f5fortran\fP
.PP
The words \f5entry\fP and \f5fortran\fP
are reserved under the restricted option.
The words are not interpreted by the compiler.
.SH
2.4.1 Integer Constants
.PP
An octal or hex constant which is less than or equal to the largest unsigned
(target) machine integer is taken to be \f5unsigned\fP.
An octal or hex constant which exceeds the largest unsigned (target) machine
integer is taken to be \f5long\fP.
.SH
2.4.3 Character Constants
.PP
A character constant is a sequence of 1 up to \f5sizeof(int)\fP characters
enclosed in single quotes.
The value of a character constant '$c sub 1 c sub 2 ... c sub n$'
is $d sub n + M \(mu d sub {n - 1} + ... + M sup {n - 1} \(mu d sub 2 + M sup n \(mu d sub 1$,
where M is 1 + maximum unsigned number representable in an \f5unsigned char\fP,
and $d sub i$ is the signed value (ASCII)
of character $c sub i$.
.SH
2.4.4 Floating Constants
.PP
The compiler does not support compile-time floating point arithmetic.
.SH
2.6 Hardware characteristics
.PP
The compiler is capable of producing EM code for machines with the following
properties
.IP \(bu
a \f5char\fP is 8 bits
.IP \(bu
the size of \f5int\fP is equal to the word size
.IP \(bu
the size of \f5short\fP may not exceed the size of \f5int\fP
.IP \(bu
the size of \f5int\fP may not exceed the size of \f5long\fP
.IP \(bu
the size of pointers is equal to the size of either \f5short\fP, \f5int\fP
or \f5long\fP
.LP
.SH
4 What's in a name?
.SH
\f5char\fP
.PP
Objects of type \f5char\fP are taken to be signed.
The combination \f5unsigned char\fP is legal.
.SH
\f5unsigned\fP
.PP
The type combinations \f5unsigned char\fP, \f5unsigned short\fP and
\f5unsigned long\fP are supported.
.SH
\f5enum\fP
.PP
The data type \f5enum\fP is implemented as described
in \fIRecent Changes to C\fP (see appendix A).
.I Cem
treats enumeration variables as if they were \f5int\fP.
.SH
\f5void\fP
.PP
Type \f5void\fP is implemented.
The type specifies an empty set of values, which takes no storage space.
.SH
\fRFundamental types\fP
.PP
The names of the fundamental types can be redefined by the user, using
\f5typedef\fP.
.SH
7 Expressions
.PP
The order of evaluation of expressions depends on the complexity of the
subexpressions.
In case of commutative operations, the most complex subexpression is
evaluated first.
Parameter lists are evaluated from right to left.
.SH
7.2 Unary operators
.PP
The type of a \f5sizeof\fP expression is \f5unsigned int\fP.
.SH
7.13 Conditional operator
.PP
Both the second and the third expression in a conditional expression may
include assignment operators.
They may be structs or unions.
.SH
7.14 Assignment operators
.PP
Structures may be assigned, passed as arguments to functions, and returned
by functions.
The types of operands taking part must be the same.
.SH
8.2 Type specifiers
.PP
The combinations \f5unsigned char\fP, \f5unsigned short\fP
and \f5unsigned long\fP are implemented.
.SH
8.5 Structure and union declarations
.PP
Fields of any integral type, either signed or unsigned,
are supported, as long as the type fits in a word on the target machine.
.PP
Fields are left adjusted by default; the first field is put into the left
part of a word, the next one on the right side of the first one, etc.
The \f5-Vr\fP option in the call of the compiler
causes fields to be right adjusted within a machine word.
.PP
The tags of structs and unions occupy a different name space from that of
variables and that of member names.
.SH
9.7 Switch statement
.PP
The type of \fIexpression\fP in
.DS
.ft 5
\f5switch (\fP\fIexpression\fP\f5)\fP \fIstatement\fP
.ft
.DE
must be integral.
A warning is given under the restricted option if the type is \f5long\fP.
.SH
10 External definitions
.PP
See [4] for a discussion on this complicated issue.
.SH
10.1 External function definitions
.PP
Structures may be passed as arguments to functions, and returned
by functions.
.SH
11.1 Lexical scope
.PP
Typedef names may be redeclared like any other variable name; the ice mentioned
in \(sc11.1 is walked correctly.
.SH
12 Compiler control lines
.PP
Lines which do not occur within comment, and with \f5#\fP as first
character, are interpreted as compiler control line.
There may be an arbitrary number of spaces, tabs and comments (collectively
referred as \fIwhite space\fP) following the \f5#\fP.
Comments may contain newline characters.
Control lines with only white space between the \f5#\fP and the line separator
are skipped.
.PP
The #\f5include\fP, #\f5ifdef\fP, #\f5ifndef\fP, #\f5undef\fP, #\f5else\fP and
#\f5endif\fP control lines and line directives consist of a fixed number of
arguments.
The list of arguments may be followed an arbitrary sequence of characters,
in which comment is interpreted as such.
(I.e., the text between \f5/*\fP and \f5*/\fP is skipped, regardless of
newlines; note that commented-out lines beginning with \f5#\fP are not
considered to be control lines.)
.SH
12.1 Token replacement
.PP
The replacement text of macros is taken to be a string of characters, in which
an identifier may stand for a formal parameter, and in which comment is
interpreted as such.
Comments and newline characters, preceeded by a backslash, in the replacement
text are replaced by a space character.
.PP
The actual parameters of a macro are considered tokens and are
balanced with regard to \f5()\fP, \f5{}\fP and \f5[]\fP.
This prevents the use of macros like
.DS
.ft 5
CTL([)
.ft
.DE
.PP
Formal parameters of a macro must have unique names within the formal-parameter
list of that macro.
.PP
A message is given at the definition of a macro if the macro has
already been #\f5defined\fP, while the number of formal parameters differ or
the replacement texts are not equal (apart from leading and trailing
white space).
.PP
Recursive use of macros is detected by the compiler.
.PP
Standard #\f5defined\fP macros are
.DS
\f5__FILE__\fP name of current input file as string constant
\f5__DATE__\fP curent date as string constant; e.g. \f5"Tue Wed 2 14:45:23 1986"\fP
\f5__LINE__\fP current line number as an integer
.DE
.PP
No message is given if \fIidentifier\fP is not known in
.DS
.ft 5
#undef \fIidentifier\fP
.ft
.DE
.SH
12.2 File inclusion
.PP
A newline character is appended to each file which is included.
.SH
12.3 Conditional compilation
.PP
The #\f5if\fP, #\f5ifdef\fP and #\f5ifndef\fP control lines may be followed
by an arbitrary number of
.DS
.ft 5
#elif \fIconstant-expression\fP
.ft
.DE
control lines, before the corresponding #\f5else\fP or #\f5endif\fP
is encountered.
The construct
.DS
.ft 5
#elif \fIconstant-expression\fP
some text
#endif /* corresponding to #elif */
.ft
.DE
is equivalent to
.DS
.ft 5
#else
#if \fIconstant-expression\fP
some text
#endif /* corresponding to #if */
#endif /* corresponding to #else */
.ft
.DE
.PP
The \fIconstant-expression\fP in #\f5if\fP and #\f5elif\fP control lines
may contain the construction
.DS
.ft 5
defined(\fIidentifier\fP)
.ft
.DE
which is replaced by \f51\fP, if \fIidentifier\fP has been #\f5defined\fP,
and by \f50\fP, if not.
.PP
Comments in skipped lines are interpreted as such.
.SH
12.4 Line control
.PP
Line directives may occur in the following forms:
.DS
.ft 5
#line \fIconstant\fP
#line \fIconstant\fP "\fIfilename\fP"
#\fIconstant\fP
#\fIconstant\fP "\fIfilename\fP"
.ft
.DE
Note that \fIfilename\fP is enclosed in double quotes.
.SH
14.2 Functions
.PP
If a pointer to a function is called, the function the pointer points to
is called instead.
.SH
15 Constant expressions
.PP
The compiler distinguishes the following types of integral constant expressions
.IP \(bu
field-width specifier
.IP \(bu
case-entry specifier
.IP \(bu
array-size specifier
.IP \(bu
global variable initialization value
.IP \(bu
enum-value specifier
.IP \(bu
truth value in \f5#if\fP control line
.LP
.PP
Constant integral expressions are compile-time evaluated while an effort
is made to report overflow.
Constant floating expressions are not compile-time evaluated.
.NH
Compiler flags
.IP \fB\-C\fR
Run the preprocessor stand-alone while maintaining the comments.
Line directives are produced whenever needed.
.IP \fB\-D\fP\fIname\fP=\fIstring-of-characters\fP
.br
Define \fIname\fR as macro with \fIstring-of-characters\fR as
replacement text.
.IP \fB\-D\fP\fIname\fP
.br
Equal to \fB\-D\fP\fIname\fP\fB=1\fP.
.IP \fB\-E\fP
Run the preprocessor stand alone, i.e.,
list the sequence of input tokens and delete any comments.
Line directives are produced whenever needed.
.IP \fB\-I\fIpath\fR
.br
Prepend \fIpath\fR to the list of include directories.
To put the directories "include", "sys/h" and "util/h" into the
include directory list in that order, the user has to specify
.DS
.ft 5
-Iinclude -Isys/h -Iutil/h
.ft R
.DE
An empty \fIpath\fP causes the standard include
directory (usually \f5/usr/include\fP) to be forgotten.
.IP \fB\-M\fP\fIn\fP
.br
Set maximum significant identifier length to \fIn\fP.
.IP \fB\-n\fP
Suppress EM register messages.
The user-declared variables are not stored into registers on the target
machine.
.IP \fB\-p\fP
Generate the EM \fBfil\fP and \fBlin\fP instructions in order to enable
an interpreter to keep track of the current location in the source code.
.IP \fB\-P\fP
Equivalent with \fB\-E\fP, but without line directives.
.IP \fB\-R\fP
Interpret the input as restricted C (according to the language as
described in [1]).
.IP \fB\-T\fP\fIpath\fP
.br
Create temporary files, if necessary, in directory \fIpath\fP.
.IP \fB\-U\fP\fIname\fP
.br
Get rid of the compiler-predefined macro \fIname\fP, i.e.,
consider
.DS
.ft 5
#undef \fIname\fP
.ft R
.DE
to appear in the beginning of the file.
.IP \fB\-V\fIcm\fR.\fIn\fR,\ \fB\-V\fIcm\fR.\fIncm\fR.\fIn\fR\ ...
.br
Set the size and alignment requirements.
The letter \fIc\fR indicates the simple type, which is one of
\fBs\fR(short), \fBi\fR(int), \fBl\fR(long), \fBf\fR(float), \fBd\fR(double)
or \fBp\fR(pointer).
If \fIc\fR is \fBS\fP or \fBU\fP, then \fIn\fP is taken to be the initial
alignment of structs or unions, respectively.
The effective alignment of a struct or union is the least common multiple
of the initial struct/union alignment and the alignments of its members.
The \fIm\fR parameter can be used to specify the length of the type (in bytes)
and the \fIn\fR parameter for the alignment of that type.
Absence of \fIm\fR or \fIn\fR causes the default value to be retained.
To specify that the bitfields should be right adjusted instead of the
default left adjustment, specify \fBr\fR as \fIc\fR parameter.
.IP \fB\-w\fR
Suppress warning messages
.IP \fB\-\-\fIcharacter\fR
.br
Set debug-flag \fIcharacter\fP.
This enables some special features offered by a debug and develop version of
the compiler.
Some particular flags may be recognized, others may have surprising effects.
.RS
.IP \fBd\fP
Generate a dependency graph, reflecting the calling structure of functions.
Lines of the form
.DS
.ft 5
DFA: \fIcalling-function\fP: \fIcalled-function\fP
.ft
.DE
are generated whenever a function call is encountered.
.IP \fBf\fP
Dump whole identifier table, including macros and reserved words.
.IP \fBh\fP
Supply hash-table statistics.
.IP \fBi\fP
Print names of included files.
.IP \fBm\fP
Supply statistics concerning the memory allocation.
.IP \fBt\fP
Dump table of identifiers.
.IP \fBu\fP
Generate extra statistics concerning the predefined types and identifiers.
Works in combination with \fBf\fP or \fBt\fP.
.IP \fBx\fP
Print expression trees in human-readable format.
.RE
.LP
.SH
References
.IP [1]
Brian W. Kernighan, Dennis M. Ritchie,
.I
The C Programming Language
.R
.IP [2]
L. Rosler,
.I
Draft Proposed Standard - Programming Language C,
.R
ANSI X3J11 Language Subcommittee
.IP [3]
Erik H. Baalbergen, Dick Grune, Maarten Waage,
.I
The CEM Compiler,
.R
Informatica Manual IM-4, Dept. of Mathematics and Computer Science, Vrije
Universiteit, Amsterdam, The Netherlands
.IP [4]
Erik H. Baalbergen,
.I
Modeling global declarations in C,
.R
internal paper
.LP
.bp
.SH
Appendix A - Enumeration Type
.PP
The syntax is
.sp
.RS
.I enum-specifier :
.RS
\&\f5enum\fP { \fIenum-list\fP }
.br
\&\f5enum\fP \fIidentifier\fP { \fIenum-list\fP }
.br
\&\f5enum\fP \fIidentifier\fP
.RE
.sp
\&\fIenum-list\fP :
.RS
\&\fIenumerator\fP
.br
\&\fIenum-list\fP , \fIenumerator\fP
.RE
.sp
\&\fIenumerator\fP :
.RS
\&\fIidentifier\fP
.br
\&\fIidentifier\fP = \fIconstant-expression\fP
.RE
.sp
.RE
The identifier has the same role as the structure tag in a struct specification.
It names a particular enumeration type.
.PP
The identifiers in the enum-list are declared as constants, and may appear
whenever constants are required.
If no enumerators with
.B =
appear, then the values of the constants begin at 0 and increase by 1 as the
declaration is read from left to right.
An enumerator with
.B =
gives the associated identifier the value indicated; subsequent identifiers
continue the progression from the assigned value.
.PP
Enumeration tags and constants must all be distinct, and, unlike structure
tags and members, are drawn from the same set as ordinary identifiers.
.PP
Objects of a given enumeration type are regarded as having a type distinct
from objects of all other types.
.bp
.SH
Appendix B: C grammar in LL(1) form
.PP
The \fBbold-faced\fP and \fIitalicized\fP tokens represent terminal symbols.
.vs 16
.nf
\fBexternal definitions\fP
program: external-definition*
external-definition: ext-decl-specifiers [declarator [function | non-function] | '\fB;\fP'] | asm-statement
ext-decl-specifiers: decl-specifiers?
non-function: initializer? ['\fB,\fP' init-declarator]* '\fB;\fP'
function: declaration* compound-statement
.sp 1
\fBdeclarations\fP
declaration: decl-specifiers init-declarator-list? '\fB;\fP'
decl-specifiers: other-specifier+ [single-type-specifier other-specifier*]? | single-type-specifier other-specifier*
other-specifier: \fBauto\fP | \fBstatic\fP | \fBextern\fP | \fBtypedef\fP | \fBregister\fP | \fBshort\fP | \fBlong\fP | \fBunsigned\fP
type-specifier: decl-specifiers
single-type-specifier: \fItype-identifier\fP | struct-or-union-specifier | enum-specifier
init-declarator-list: init-declarator ['\fB,\fP' init-declarator]*
init-declarator: declarator initializer?
declarator: primary-declarator ['\fB(\fP' formal-list ? '\fB)\fP' | arrayer]* | '\fB*\fP' declarator
primary-declarator: identifier | '\fB(\fP' declarator '\fB)\fP'
arrayer: '\fB[\fP' constant-expression? '\fB]\fP'
formal-list: formal ['\fB,\fP' formal]*
formal: identifier
enum-specifier: \fBenum\fP [enumerator-pack | identifier enumerator-pack?]
enumerator-pack: '\fB{\fP' enumerator ['\fB,\fP' enumerator]* '\fB,\fP'? '\fB}\fP'
enumerator: identifier ['\fB=\fP' constant-expression]?
struct-or-union-specifier: [ \fBstruct\fP | \fBunion\fP] [ struct-declaration-pack | identifier struct-declaration-pack?]
struct-declaration-pack: '\fB{\fP' struct-declaration+ '\fB}\fP'
struct-declaration: type-specifier struct-declarator-list '\fB;\fP'?
struct-declarator-list: struct-declarator ['\fB,\fP' struct-declarator]*
struct-declarator: declarator bit-expression? | bit-expression
bit-expression: '\fB:\fP' constant-expression
initializer: '\fB=\fP'? initial-value
cast: '\fB(\fP' type-specifier abstract-declarator '\fB)\fP'
abstract-declarator: primary-abstract-declarator ['\fB(\fP' '\fB)\fP' | arrayer]* | '\fB*\fP' abstract-declarator
primary-abstract-declarator: ['\fB(\fP' abstract-declarator '\fB)\fP']?
.sp 1
\fBstatements\fP
statement:
expression-statement
| label '\fB:\fP' statement
| compound-statement
| if-statement
| while-statement
| do-statement
| for-statement
| switch-statement
| case-statement
| default-statement
| break-statement
| continue-statement
| return-statement
| jump
| '\fB;\fP'
| asm-statement
;
expression-statement: expression '\fB;\fP'
label: identifier
if-statement: \fBif\fP '\fB(\fP' expression '\fB)\fP' statement [\fBelse\fP statement]?
while-statement: \fBwhile\fP '\fB(\fP' expression '\fB)\fP' statement
do-statement: \fBdo\fP statement \fBwhile\fP '\fB(\fP' expression '\fB)\fP' '\fB;\fP'
for-statement: \fBfor\fP '\fB(\fP' expression? '\fB;\fP' expression? '\fB;\fP' expression? '\fB)\fP' statement
switch-statement: \fBswitch\fP '\fB(\fP' expression '\fB)\fP' statement
case-statement: \fBcase\fP constant-expression '\fB:\fP' statement
default-statement: \fBdefault\fP '\fB:\fP' statement
break-statement: \fBbreak\fP '\fB;\fP'
continue-statement: \fBcontinue\fP '\fB;\fP'
return-statement: \fBreturn\fP expression? '\fB;\fP'
jump: \fBgoto\fP identifier '\fB;\fP'
compound-statement: '\fB{\fP' declaration* statement* '\fB}\fP'
asm-statement: \fBasm\fP '\fB(\fP' \fIstring\fP '\fB)\fP' '\fB;\fP'
.sp 1
\fBexpressions\fP
initial-value: assignment-expression | initial-value-pack
initial-value-pack: '\fB{\fP' initial-value-list '\fB}\fP'
initial-value-list: initial-value ['\fB,\fP' initial-value]* '\fB,\fP'?
primary: \fIidentifier\fP | constant | \fIstring\fP | '\fB(\fP' expression '\fB)\fP'
secundary: primary [index-pack | parameter-pack | selection]*
index-pack: '\fB[\fP' expression '\fB]\fP'
parameter-pack: '\fB(\fP' parameter-list? '\fB)\fP'
selection: ['\fB.\fP' | '\fB\->\fP'] identifier
parameter-list: assignment-expression ['\fB,\fP' assignment-expression]*
postfixed: secundary postop?
unary: cast unary | postfixed | unop unary | size-of
size-of: \fBsizeof\fP [cast | unary]
binary-expression: unary [binop binary-expression]*
conditional-expression: binary-expression ['\fB?\fP' expression '\fB:\fP' assignment-expression]?
assignment-expression: conditional-expression [asgnop assignment-expression]?
expression: assignment-expression ['\fB,\fP' assignment-expression]*
unop: '\fB*\fP' | '\fB&\fP' | '\fB\-\fP' | '\fB!\fP' | '\fB~ \fP' | '\fB++\fP' | '\fB\-\-\fP'
postop: '\fB++\fP' | '\fB\-\-\fP'
multop: '\fB*\fP' | '\fB/\fP' | '\fB%\fP'
addop: '\fB+\fP' | '\fB\-\fP'
shiftop: '\fB<<\fP' | '\fB>>\fP'
relop: '\fB<\fP' | '\fB>\fP' | '\fB<=\fP' | '\fB>=\fP'
eqop: '\fB==\fP' | '\fB!=\fP'
arithop: multop | addop | shiftop | '\fB&\fP' | '\fB^ \fP' | '\fB|\fP'
binop: arithop | relop | eqop | '\fB&&\fP' | '\fB||\fP'
asgnop: '\fB=\fP' | '\fB+\fP' '\fB=\fP' | '\fB\-\fP' '\fB=\fP' | '\fB*\fP' '\fB=\fP' | '\fB/\fP' '\fB=\fP' | '\fB%\fP' '\fB=\fP'
| '\fB<<\fP' '\fB=\fP' | '\fB>>\fP' '\fB=\fP' | '\fB&\fP' '\fB=\fP' | '\fB^ \fP' '\fB=\fP' | '\fB|\fP' '\fB=\fP'
| '\fB+=\fP' | '\fB\-=\fP' | '\fB*=\fP' | '\fB/=\fP' | '\fB%=\fP'
| '\fB<<=\fP' | '\fB>>=\fP' | '\fB&=\fP' | '\fB^=\fP' | '\fB|=\fP'
constant: \fIinteger\fP | \fIfloating\fP
constant-expression: assignment-expression
identifier: \fIidentifier\fP | \fItype-identifier\fP
.fi

18
doc/ego/.distr Normal file
View File

@@ -0,0 +1,18 @@
Makefile
bo
ca
cf
cj
cs
ic
il
intro
lv
ov
ra
refs.gen
refs.opt
refs.stat
sp
sr
ud

52
doc/ego/Makefile Normal file
View File

@@ -0,0 +1,52 @@
REFS=-p refs.opt -p refs.stat -p refs.gen
INTRO=intro/intro?
OV=ov/ov?
IC=ic/ic?
CF=cf/cf?
IL=il/il?
SR=sr/sr?
CS=cs/cs?
SP=sp/sp?
UD=ud/ud?
LV=lv/lv?
CJ=cj/cj?
BO=bo/bo?
RA=ra/ra?
CA=ca/ca?
EGO=$(INTRO) $(OV) $(IC) $(CF) $(IL) $(SR) $(CS) $(SP) $(CJ) $(BO) \
$(UD) $(LV) $(RA) $(CA)
REFER=refer
../ego.doc: $(EGO)
$(REFER) -sA+T -l4,2 $(REFS) intro/head $(EGO) intro/tail > ../ego.doc
ego.f: $(EGO)
$(REFER) -sA+T -l4,2 $(REFS) intro/head $(EGO) intro/tail | nroff -ms > ego.f
intro.f: $(INTRO)
$(REFER) -sA+T -l4,2 $(REFS) ov/head $(INTRO) intro/tail | nroff -ms > intro.f
ov.f: $(OV)
$(REFER) -sA+T -l4,2 $(REFS) ov/head $(OV) intro/tail | nroff -ms > ov.f
ic.f: $(IC)
$(REFER) -sA+T -l4,2 $(REFS) ic/head $(IC) intro/tail | nroff -ms > ic.f
cf.f: $(CF)
$(REFER) -sA+T -l4,2 $(REFS) cf/head $(CF) intro/tail | nroff -ms > cf.f
il.f: $(IL)
$(REFER) -sA+T -l4,2 $(REFS) il/head $(IL) intro/tail | nroff -ms > il.f
sr.f: $(SR)
$(REFER) -sA+T -l4,2 $(REFS) sr/head $(SR) intro/tail | nroff -ms > sr.f
cs.f: $(CS)
$(REFER) -sA+T -l4,2 $(REFS) cs/head $(CS) intro/tail | nroff -ms > cs.f
sp.f: $(SP)
$(REFER) -sA+T -l4,2 $(REFS) sp/head $(SP) intro/tail | nroff -ms > sp.f
cj.f: $(CJ)
$(REFER) -sA+T -l4,2 $(REFS) cj/head $(CJ) intro/tail | nroff -ms > cj.f
bo.f: $(BO)
$(REFER) -sA+T -l4,2 $(REFS) bo/head $(BO) intro/tail | nroff -ms > bo.f
ud.f: $(UD)
$(REFER) -sA+T -l4,2 $(REFS) ud/head $(UD) intro/tail | nroff -ms > ud.f
lv.f: $(LV)
$(REFER) -sA+T -l4,2 $(REFS) lv/head $(LV) intro/tail | nroff -ms > lv.f
ra.f: $(RA)
$(REFER) -sA+T -l4,2 $(REFS) ra/head $(RA) intro/tail | nroff -ms > ra.f
ca.f: $(CA)
$(REFER) -sA+T -l4,2 $(REFS) ca/head $(CA) intro/tail | nroff -ms > ca.f

1
doc/ego/bo/.distr Normal file
View File

@@ -0,0 +1 @@
bo1

151
doc/ego/bo/bo1 Normal file
View File

@@ -0,0 +1,151 @@
.bp
.NH 1
Branch Optimization
.NH 2
Introduction
.PP
The Branch Optimization phase (BO) performs two related
(branch) optimizations.
.NH 3
Fusion of basic blocks
.PP
If two basic blocks B1 and B2 have the following properties:
.DS
SUCC(B1) = {B2}
PRED(B2) = {B1}
.DE
then B1 and B2 can be combined into one basic block.
If B1 ends in an unconditional jump to the beginning of B2, this
jump can be eliminated,
hence saving a little execution time and object code size.
This technique can be used to eliminate some deficiencies
introduced by the front ends (for example, the "C" front end
translates switch statements inefficiently due to its one pass nature).
.NH 3
While-loop optimization
.PP
The straightforward way to translate a while loop is to
put the test for loop termination at the beginning of the loop.
.DS
while cond loop LAB1: Test cond
body of the loop ---> Branch On False To LAB2
end loop code for body of loop
Branch To LAB1
LAB2:
Fig. 10.1 Example of Branch Optimization
.DE
If the condition fails at the Nth iteration, the following code
gets executed (dynamically):
.DS
N * conditional branch (which fails N-1 times)
N-1 * unconditional branch
N-1 * body of the loop
.DE
An alternative translation is:
.DS
Branch To LAB2
LAB1:
code for body of loop
LAB2:
Test cond
Branch On True To LAB1
.DE
This translation results in the following profile:
.DS
N * conditional branch (which succeeds N-1 times)
1 * unconditional branch
N-1 * body of the loop
.DE
So the second translation will be significantly faster if N >> 2.
If N=2, execution time will be slightly increased.
On the average, the program will be speeded up.
Note that the code sizes of the two translations will be the same.
.NH 2
Implementation
.PP
The basic block fusion technique is implemented
by traversing the control flow graph of a procedure,
looking for basic blocks B with only one successor (S).
If one is found, it is checked if S has only one predecessor
(which has to be B).
If so, the two basic blocks can in principle be combined.
However, as one basic block will have to be moved,
the textual order of the basic blocks will be altered.
This reordering causes severe problems in the presence
of conditional jumps.
For example, if S ends in a conditional branch,
the basic block that comes textually next to S must stay
in that position.
So the transformation in Fig. 10.2 is illegal.
.DS
LAB1: S1 LAB1: S1
BRA LAB2 S2
... --> BEQ LAB3
LAB2: S2 ...
BEQ LAB3 S3
S3
Fig. 10.2 An illegal transformation of Branch Optimization
.DE
If B is moved towards S the same problem occurs if the block before B
ends in a conditional jump.
The problem could be solved by adding one extra branch,
but this would reduce the gains of the optimization to zero.
Hence the optimization will only be done if the block that
follows S (in the textual order) is not a successor of S.
This condition assures that S does not end in a conditional branch.
The condition always holds for the code generated by the "C"
front end for a switch statement.
.PP
After the transformation has been performed,
some attributes of the basic blocks involved (such as successor and
predecessor sets and immediate dominator) must be recomputed.
.PP
The while-loop technique is applied to one loop at a time.
The list of basic blocks of the loop is traversed to find
a block B that satisfies the following conditions:
.IP 1.
the textually next block to B is not part of the loop
.IP 2.
the last instruction of B is an unconditional branch;
hence B has only one successor, say S
.IP 3.
the textually next block of B is a successor of S
.IP 4.
the last instruction of S is a conditional branch
.LP
If such a block B is found, the control flow graph is changed
as depicted in Fig. 10.3.
.DS
| |
| v
v |
|-----<------| ----->-----|
____|____ | |
| | | |-------| |
| S1 | | | v |
| Bcc | | | .... |
|--| | | | |
| --------- | | ----|---- |
| | | | | |
| .... ^ | | S2 | |
| | | | | |
| --------- | | | | |
v | | | ^ --------- |
| | S2 | | | | |
| | BRA | | | |-----<-----
| | | | | v
| --------- | | ____|____
| | | | | |
| ------>------ | | S1 |
| | | Bnn |
|-------| | | |
| | ----|----
v | |
|----<--|
|
v
Fig. 10.3 Transformation of the CFG by Branch Optimization
.DE

1
doc/ego/ca/.distr Normal file
View File

@@ -0,0 +1 @@
ca1

75
doc/ego/ca/ca1 Normal file
View File

@@ -0,0 +1,75 @@
.bp
.NH 1
Compact assembly generation
.NH 2
Introduction
.PP
The "Compact Assembly generation phase" (CA) transforms the
intermediate code of the optimizer into EM code in
Compact Assembly Language (CAL) format.
In the intermediate code, all program entities
(such as procedures, labels, global variables)
are denoted by a unique identifying number (see 3.5).
In the CAL output of the optimizer these numbers have to
be replaced by normal identifiers (strings).
The original identifiers of the input program are used whenever possible.
Recall that the IC phase generates two files that can be
used to map unique identifying numbers to procedure names and
global variable names.
For instruction labels CA always generates new names.
The reasons for doing so are:
.IP -
instruction labels are only visible inside one procedure, so they can
not be referenced in other modules
.IP -
the names are not very suggestive anyway, as they must be integer numbers
.IP -
the optimizer considerably changes the control structure of the program,
so there is really no one to one mapping of instruction labels in
the input and the output program.
.LP
As the optimizer combines all input modules into one module,
visibility problems may occur.
Two modules M1 and M2 can both define an identifier X (provided that
X is not externally visible in any of these modules).
If M1 and M2 are combined into one module M, two distinct
entities with the same name would exist in M, which
is not allowed.
.[~[
tanenbaum machine architecture
.], section 11.1.4.3]
In these cases, CA invents a new unique name for one of the entities.
.NH 2
Implementation
.PP
CA first reads the files containing the procedure and global variable names
and stores the names in two tables.
It scans these tables to make sure that all names are different.
Subsequently it reads the EM text, one procedure at a time,
and outputs it in CAL format.
The major part of the code that does the latter transformation
is adapted from the EM Peephole Optimizer.
.PP
The main problem of the implementation of CA is to
assure that the visibility rules are obeyed.
If an identifier must be externally visible (i.e.
it was externally visible in the input program)
and the identifier is defined (in the output program) before
being referenced,
an EXA or EXP pseudo must be generated for it.
(Note that the optimizer may change the order of definitions and
references, so some pseudos may be needed that were not
present in the input program).
On the other hand, an identifier may be only internally visible.
If such an identifier is referenced before being defined,
an INA or INP pseudo must be emitted prior to its first reference.
.UH
Acknowledgements
.PP
The author would like to thank Andy Tanenbaum for his guidance,
Duk Bekema for implementing the Common Subexpression Elimination phase
and writing the initial documentation of that phase,
Dick Grune for reading the manuscript of this report
and Ceriel Jacobs, Ed Keizer, Martin Kersten, Hans van Staveren
and the members of the S.T.W. user's group for their
interest and assistance.

6
doc/ego/cf/.distr Normal file
View File

@@ -0,0 +1,6 @@
cf1
cf2
cf3
cf4
cf5
cf6

94
doc/ego/cf/cf1 Normal file
View File

@@ -0,0 +1,94 @@
.bp
.NH
The Control Flow Phase
.PP
In the previous chapter we described the intermediate
code of the global optimizer.
We also specified which part of this code
was constructed by the IC phase of the optimizer.
The Control Flow Phase (\fICF\fR) does
the remainder of the job,
i.e. it determines:
.IP -
the control flow graphs
.IP -
the loop tables
.IP -
the calling, change and use attributes of
the procedure table entries
.LP
CF operates on one procedure at a time.
For every procedure it first reads the EM instructions
from the EM-text file and groups them into basic blocks.
For every basic block, its successors and
predecessors are determined,
resulting in the control flow graph.
Next, the immediate dominator of every basic block
is computed.
Using these dominators, any loop in the
procedure is detected.
Finally, interprocedural analysis is done,
after which we will know the global effects of
every procedure call on its environment.
.sp
CF uses the same internal data structures
for the procedure table and object table as IC.
.NH 2
Partitioning into basic blocks
.PP
With regard to flow of control, we distinguish
three kinds of EM instructions:
jump instructions, instruction label definitions and
normal instructions.
Jump instructions are all conditional or unconditional
branch instructions,
the case instructions (CSA/CSB)
and the RET (return) instruction.
A procedure call (CAL) is not considered to be a jump.
A defining occurrence of an instruction label
is regarded as an EM instruction.
.PP
An instruction starts
a new basic block, in any of the following cases:
.IP 1.
It is the first instruction of a procedure
.IP 2.
It is the first of a list of instruction label
defining occurrences
.IP 3.
It follows a jump
.LP
If there are several consecutive instruction labels
(which is highly unusual),
all of them are put in the same basic block.
Note that several cases may overlap,
e.g. a label definition at the beginning of a procedure
or a label following a jump.
.PP
A simple Finite State Machine is used to model
the above rules.
It also recognizes the end of a procedure,
marked by an END pseudo.
The basic blocks are stored internally as a doubly linked
linear list.
The blocks are linked in textual order.
Every node of this list has the attributes described
in the previous chapter (see syntax rule for
basic_block).
Furthermore, every node contains a pointer to its
EM instructions,
which are represented internally
as a linear, doubly linked list,
just as in the IC phase.
However, instead of one list per procedure (as in IC)
there is now one list per basic block.
.PP
On the fly, a table is build that maps
every label identifier to the label definition
instruction.
This table is used for computing the control flow.
The table is stored as a dynamically allocated array.
The length of the array is the number of labels
of the current procedure;
this value can be found in the procedure table,
where it was stored by IC.

50
doc/ego/cf/cf2 Normal file
View File

@@ -0,0 +1,50 @@
.NH 2
Control Flow
.PP
A \fIsuccessor\fR of a basic block B is a block C
that can be executed immediately after B.
C is said to be a \fIpredecessor\fR of B.
A block ending with a RET instruction
has no successors.
Such a block is called a \fIreturn block\fR.
Any block that has no predecessors cannot be
executed at all (i.e. it is unreachable),
unless it is the first block of a procedure,
called the \fIprocedure entry block\fR.
.PP
Internally, the successor and predecessor
attributes of a basic block are stored as \fIsets\fR.
Alternatively, one may regard all these
sets of all basic blocks as a conceptual \fIgraph\fR,
in which there is an edge from B to C if C
is in the successor set of B.
We call this conceptual graph
the \fIControl Flow Graph\fR.
.PP
The only successor of a basic block ending on an
unconditional branch instruction is the block that
contains the label definition of the target of the jump.
The target instruction can be found via the LAB_ID
that is the operand of the jump instruction,
by using the label-map table mentioned
above.
If the last instruction of a block is a
conditional jump,
the successors are the target block and the textually
next block.
The last instruction can also be a case jump
instruction (CSA or CSB).
We then analyze the case descriptor,
to find all possible target instructions
and their associated blocks.
We require the case descriptor to be allocated in
a ROM, so it cannot be changed dynamically.
A case jump via an alterable descriptor could in principle
go to any label in the program.
In the presence of such an uncontrolled jump,
hardly any optimization can be done.
We do not expect any front end to generate such a descriptor,
however, because of the controlled nature
of case statements in high level languages.
If the basic block does not end in a jump instruction,
its only successor is the textually next block.

53
doc/ego/cf/cf3 Normal file
View File

@@ -0,0 +1,53 @@
.NH 2
Immediate dominators
.PP
A basic block B dominates a block C if every path
in the control flow graph from the procedure entry block
to C goes through B.
The immediate dominator of C is the closest dominator
of C on any path from the entry block.
See also
.[~[
aho compiler design
.], section 13.1.]
.PP
There are a number of algorithms to compute
the immediate dominator relation.
.IP 1.
Purdom and Moore give an algorithm that is
easy to program and easy to describe (although the
description they give is unreadable;
it is given in a very messy Algol60 program full of gotos).
.[
predominators
.]
.IP 2.
Aho and Ullman present a bitvector algorithm, which is also
easy to program and to understand.
(See
.[~[
aho compiler design
.], section 13.1.]).
.IP 3
Lengauer and Tarjan introduce a fast algorithm that is
hard to understand, yet remarkably easy to implement.
.[
lengauer dominators
.]
.LP
The Purdom-Moore algorithm is very slow if the
number of basic blocks in the flow graph is large.
The Aho-Ullman algorithm in fact computes the
dominator relation,
from which the immediate dominator relation can be computed
in time quadratic to the number of basic blocks, worst case.
The storage requirement is also quadratic to the number
of blocks.
The running time of the third algorithm is proportional
to:
.DS
(number of edges in the graph) * log(number of blocks).
.DE
We have chosen this algorithm because it is fast
(as shown by experiments done by Lengauer and Tarjan),
it is easy to program and requires little data space.

93
doc/ego/cf/cf4 Normal file
View File

@@ -0,0 +1,93 @@
.NH 2
Loop detection
.PP
Loops are detected by using the loop construction
algorithm of.
.[~[
aho compiler design
.], section 13.1.]
This algorithm uses \fIback edges\fR.
A back edge is an edge from B to C in the CFG,
whose head (C) dominates its tail (B).
The loop associated with this back edge
consists of C plus all nodes in the CFG
that can reach B without going through C.
.PP
As an example of how the algorithm works,
consider the piece of program of Fig. 4.1.
First just look at the program and think for
yourself what part of the code constitutes the loop.
.DS
loop
if cond then 1
-- lots of simple
-- assignment
-- statements 2 3
exit; -- exit loop
else
S; -- one statement
end if;
end loop;
Fig. 4.1 A misleading loop
.DE
Although a human being may be easily deceived
by the brackets "loop" and "end loop",
the loop detection algorithm will correctly
reply that only the test for "cond" and
the single statement in the false-part
of the if statement are part of the loop!
The statements in the true-part only get
executed once, so there really is no reason at all
to say they're part of the loop too.
The CFG contains one back edge, "3->1".
As node 3 cannot be reached from node 2,
the latter node is not part of the loop.
.PP
A source of problems with the algorithm is the fact
that different back edges may result in
the same loop.
Such an ill-structured loop is
called a \fImessy\fR loop.
After a loop has been constructed, it is checked
if it is really a new loop.
.PP
Loops can partly overlap, without one being nested
inside the other.
This is the case in the program of Fig. 4.2.
.DS
1: 1
S1;
2:
S2; 2
if cond then
goto 4;
S3; 3 4
goto 1;
4:
S4;
goto 1;
Fig. 4.2 Partly overlapping loops
.DE
There are two back edges "3->1" and "4->1",
resulting in the loops {1,2,3} and {1,2,4}.
With every basic block we associate a set of
all loops it is part of.
It is not sufficient just to record its
most enclosing loop.
.PP
After all loops of a procedure are detected, we determine
the nesting level of every loop.
Finally, we find all strong and firm blocks of the loop.
If the loop has only one back edge (i.e. it is not messy),
the set of firm blocks consists of the
head of this back edge and its dominators
in the loop (including the loop entry block).
A firm block is also strong if it is not a
successor of a block that may exit the loop;
a block may exit a loop if it has an (immediate) successor
that is not part of the loop.
For messy loops we do not determine the strong
and firm blocks. These loops are expected
to occur very rarely.

79
doc/ego/cf/cf5 Normal file
View File

@@ -0,0 +1,79 @@
.NH 2
Interprocedural analysis
.PP
It is often desirable to know the effects
a procedure call may have.
The optimization below is only possible if
we know for sure that the call to P cannot
change A.
.DS
A := 10; A:= 10;
P; -- procedure call --> P;
B := A + 2; B := 12;
.DE
Although it is not possible to predict exactly
all the effects a procedure call has, we may
determine a kind of upper bound for it.
So we compute all variables that may be
changed by P, although they need not be
changed at every invocation of P.
We can get hold of this set by just looking
at all assignment (store) instructions
in the body of P.
EM also has a set of \fIindirect\fR assignment
instructions,
i.e. assignment through a pointer variable.
In general, it is not possible to determine
which variable is affected by such an assignment.
In these cases, we just record the fact that P
does an indirect assignment.
Note that this does not mean that all variables
are potentially affected, as the front ends
may generate messages telling that certain
variables can never be accessed indirectly.
We also set a flag if P does a use (load) indirect.
Note that we only have to look at \fIglobal\fR
variables.
If P changes or uses any of its locals,
this has no effect on its environment.
Local variables of a lexically enclosing
procedure can only be accessed indirectly.
.PP
A procedure P may of course call another procedure.
To determine the effects of a call to P,
we also must know the effects of a call to the second procedure.
This second one may call a third one, and so on.
Effectively, we need to compute the \fItransitive closure\fR
of the effects.
To do this, we determine for every procedure
which other procedures it calls.
This set is the "calling" attribute of a procedure.
One may regard all these sets as a conceptual graph,
in which there is an edge from P to Q
if Q is in the calling set of P. This graph will
be referred to as the \fIcall graph\fR.
(Note the resemblance with the control flow graph).
.PP
We can detect which procedures are called by P
by looking at all CAL instructions in its body.
Unfortunately, a procedure may also be
called indirectly, via a CAI instruction.
Yet, only procedures that are used as operand of an LPI
instruction can be called indirect,
because this is the only way to take the address of a procedure.
We determine for every procedure whether it does
a CAI instruction.
We also build a set of all procedures used as
operand of an LPI.
.sp
After all procedures have been processed (i.e. all CFGs
are constructed, all loops are detected,
all procedures are analyzed to see which variables
they may change, which procedures they call,
whether they do a CAI or are used in an LPI) the
transitive closure of all interprocedural
information is computed.
During the same process,
the calling set of every procedure that uses a CAI
is extended with the above mentioned set of all
procedures that can be called indirect.

21
doc/ego/cf/cf6 Normal file
View File

@@ -0,0 +1,21 @@
.NH 2
Source files
.PP
The sources of CF are in the following files and packages:
.IP cf.h: 14
declarations of global variables and data structures
.IP cf.c:
the routine main; interprocedural analysis;
transitive closure
.IP succ:
control flow (successor and predecessor)
.IP idom:
immediate dominators
.IP loop:
loop detection
.IP get:
read object and procedure table;
read EM text and partition it into basic blocks
.IP put:
write tables, CFGs and EM text
.LP

1
doc/ego/cj/.distr Normal file
View File

@@ -0,0 +1 @@
cj1

136
doc/ego/cj/cj1 Normal file
View File

@@ -0,0 +1,136 @@
.bp
.NH 1
Cross jumping
.NH 2
Introduction
.PP
The "Cross Jumping" optimization technique (CJ)
.[
wulf design optimizing compiler
.]
is basically a space optimization technique. It looks for pairs of
basic blocks (B1,B2), for which:
.DS
SUCC(B1) = SUCC(B2) = {S}
.DE
(So B1 and B2 both have one and the same successor).
If the last few non-branch instructions are the same for B1 and B2,
one such sequence can be eliminated.
.DS
Pascal:
if cond then
S1
S3
else
S2
S3
(pseudo) EM:
TEST COND TEST COND
BNE *1 BNE *1
S1 S1
S3 ---> BRA *2
BRA *2 1:
1: S2
S2 2:
S3 S3
2:
Fig. 9.1 An example of Cross Jumping
.DE
As the basic blocks have the same successor,
at least one of them ends in an unconditional branch instruction (BRA).
Hence no extra branch instruction is ever needed, just the target
of an existing branch needs to be changed; neither the program size
nor the execution time will ever increase.
In general, the execution time will remain the same, unless
further optimizations can be applied because of this optimization.
.PP
This optimization is particularly effective,
because it cannot always be done by the programmer at the source level,
as demonstrated by the Fig. 8.2.
.DS
Pascal:
if cond then
x := f(4)
else
x := g(5)
EM:
... ...
LOC 4 LOC 5
CAL F CAL G
ASP 2 ASP 2
LFR 2 LFR 2
STL X STL X
Fig. 9.2 Effectiveness of Cross Jumping
.DE
At the source level there is no common tail,
but at the EM level there is a common tail.
.NH 2
Implementation
.PP
The implementation of cross jumping is rather straightforward.
The technique is applied to one procedure at a time.
The control flow graph of the procedure
is scanned for pairs of basic blocks
with the same (single) successor and with common tails.
Note that there may be more than two such blocks (e.g. as the result
of a case statement).
This is dealt with by repeating the entire process until no
further optimizations can de done for the current procedure.
.sp
If a suitable pair of basic blocks has been found, the control flow
graph must be altered. One of the basic
blocks must be split into two.
The control flow graphs before and after the optimization are shown
in Fig. 9.3 and Fig. 9.4.
.DS
-------- --------
| | | |
| S1 | | S2 |
| S3 | | S3 |
| | | |
-------- --------
| |
|------------------|--------------------|
|
v
Fig. 9.3 CFG before optimization
.DE
.DS
-------- --------
| | | |
| S1 | | S2 |
| | | |
-------- --------
| |
|--------------------<------------------|
v
--------
| |
| S3 |
| |
--------
|
v
Fig. 9.4 CFG after optimization
.DE
Some attributes of the three resulting blocks (such as immediate dominator)
are updated.
.PP
In some cases, cross jumping might split the computation of an expression
into two, by inserting a branch somewhere in the middle.
Most code generators will generate very poor assembly code when
presented with such EM code.
Therefor, cross jumping is not performed in these cases.

5
doc/ego/cs/.distr Normal file
View File

@@ -0,0 +1,5 @@
cs1
cs2
cs3
cs4
cs5

42
doc/ego/cs/cs1 Normal file
View File

@@ -0,0 +1,42 @@
.bp
.NH 1
Common subexpression elimination
.NH 2
Introduction
.PP
The Common Subexpression Elimination optimization technique (CS)
tries to eliminate multiple computations of EM expressions
that yield the same result.
It places the result of one such computation
in a temporary variable,
and replaces the other computations by a reference
to this temporary variable.
The primary goal of this technique is to decrease
the execution time of the program,
but in general it will save space too.
.PP
As an example of the application of Common Subexpression Elimination,
consider the piece of program in Fig. 7.1(a).
.DS
x := a * b; TMP := a * b; x := a * b;
CODE; x := TMP; CODE
y := c + a * b; CODE y := x;
y := c + TMP;
(a) (b) (c)
Fig. 7.1 Examples of Common Subexpression Elimination
.DE
If neither a nor b is changed in CODE,
the instructions can be replaced by those of Fig. 7.1(b),
which saves one multiplication,
but costs an extra store instruction.
If the value of x is not changed in CODE either,
the instructions can be replaced by those of Fig. 7.1(c).
In this case
the extra store is not needed.
.PP
In the following sections we will describe
which transformations are done
by CS and how this phase
was implemented.

83
doc/ego/cs/cs2 Normal file
View File

@@ -0,0 +1,83 @@
.NH 2
Specification of the Common Subexpression Elimination phase
.PP
In this section we will describe
the window
through which CS examines the code,
the expressions recognized by CS,
and finally the changes made to the code.
.NH 3
The working window
.PP
The CS algorithm is applied to the
largest sequence of textually adjacent basic blocks
B1,..,Bn, for which
.DS
PRED(Bj) = {Bj-1}, j = 2,..,n.
.DE
Intuitively, this window consists of straight line code,
with only one entry point (at the beginning); it may
contain jumps, which should all have their targets outside the window.
This is illustrated in Fig. 7.2.
.DS
x := a * b; (1)
if x < 10 then (2)
y := a * b; (3)
Fig. 7.2 The working window of CS
.DE
Line (2) can only be executed after line (1).
Likewise, line (3) can only be executed after
line (2).
Both a and b have the same values at line (1) and at line (3).
.PP
Larger windows were avoided.
In Fig. 7.3, the value of a at line (4) may have been obtained
at more than one point.
.DS
x := a * b; (1)
if x < 10 then (2)
a := 100; (3)
y := a * b; (4)
Fig. 7.3 Several working windows
.DE
.NH 3
Recognized expressions.
.PP
The computations eliminated by CS need not be normal expressions
(like "a * b"),
but can even consist of a single operand that is expensive to access,
such as an array element or a record field.
If an array element is used,
its address is computed implicitly.
CS is able to eliminate either the element itself or its
address, whichever one is most profitable.
A variable of a textually enclosing procedure may also be
expensive to access, depending on the lexical level difference.
.NH 3
Transformations
.PP
CS creates a new temporary local variable (TMP)
for every eliminated expression,
unless it is able to use an existing local variable.
It emits code to initialize this variable with the
result of the expression.
Most recurrences of the expression
can simply be replaced by a reference to TMP.
If the address of an array element is recognized as
a common subexpression,
references to the element itself are replaced by
indirect references through TMP (see Fig. 7.4).
.DS
x := A[i]; TMP := &A[i];
. . . --> x := *TMP;
A[i] := y; . . .
*TMP := y;
Fig. 7.4 Elimination of an array address computation
.DE
Here, '&' is the 'address of' operator,
and unary '*' is the indirection operator.
(Note that EM actually has different instructions to do
a use-indirect or an assign-indirect.)

243
doc/ego/cs/cs3 Normal file
View File

@@ -0,0 +1,243 @@
.NH 2
Implementation
.PP
.NH 3
The value number method
.PP
To determine whether two expressions have the same result,
there must be some way to determine whether their operands have
the same values.
We use a system of \fIvalue numbers\fP
.[
kennedy data flow analysis
.]
in which each distinct value of whatever type,
created or used within the working window,
receives a unique identifying number, its value number.
Two items have the same value number if and only if,
based only upon information from the instructions in the window,
their values are provably identical.
For example, after processing the statement
.DS
a := 4;
.DE
the variable a and the constant 4 have the same value number.
.PP
The value number of the result of an expression depends only
on the kind of operator and the value number(s) of the operand(s).
The expressions need not be textually equal, as shown in Fig. 7.5.
.DS
a := c; (1)
use(a * b); (2)
d := b; (3)
use(c * d); (4)
Fig. 7.5 Different expressions with the same value number
.DE
At line (1) a receives the same value number as c.
At line (2) d receives the same value number as b.
At line (4) the expression "c * d" receives the same value number
as the expression "a * b" at line (2),
because the value numbers of their left and right operands are the same,
and the operator (*) is the same.
.PP
As another example of the value number method, consider Fig. 7.6.
.DS
use(a * b); (1)
a := 123; (2)
use(a * b); (3)
Fig. 7.6 Identical expressions with the different value numbers
.DE
Although textually the expressions "a * b" in line 1 and line 3 are equal,
a will have different value numbers at line 3 and line 1.
The two expressions will not mistakenly be recognized as equivalent.
.NH 3
Entities
.PP
The Value Number Method distinguishes between operators and operands.
The value numbers of operands are stored in a table,
called the \fIsymbol table\fR.
The value number of a subexpression depends on the
(root) operator of the expression and on the value numbers
of its operands.
A table of "available expressions" is used to do this mapping.
.PP
CS recognizes the following kinds of EM operands, called \fIentities\fR:
.IP
- constant
- local variable
- external variable
- indirectly accessed entity
- offsetted entity
- address of local variable
- address of external variable
- address of offsetted entity
- address of local base
- address of argument base
- array element
- procedure identifier
- floating zero
- local base
- heap pointer
- ignore mask
.LP
Whenever a new entity is encountered in the working window,
it is entered in the symbol table and given a brand new value number.
Most entities have attributes (e.g. the offset in
the current stackframe for local variables),
which are also stored in the symbol table.
.PP
An entity is called static if its value cannot be changed
(e.g. a constant or an address).
.NH 3
Parsing expressions
.PP
Common subexpressions are recognized by simulating the behaviour
of the EM machine.
The EM code is parsed from left to right;
as EM is postfix code, this is a bottom up parse.
At any point the current state of the EM runtime stack is
reflected by a simulated "fake stack",
containing descriptions of the parsed operands and expressions.
A descriptor consists of:
.DS
(1) the value number of the operand or expression
(2) the size of the operand or expression
(3) a pointer to the first line of EM-code
that constitutes the operand or expression
.DE
Note that operands may consist of several EM instructions.
Whenever an operator is encountered, the
descriptors of its operands are on top of the fake stack.
The operator and the value numbers of the operands
are used as indices in the table of available expressions,
to determine the value number of the expression.
.PP
During the parsing process,
we keep track of the first line of each expression;
we need this information when we decide to eliminate the expression.
.NH 3
Updating entities
.PP
An entity is assigned a value number when it is
used for the first time
in the working window.
If the entity is used as left hand side of an assignment,
it gets the value number of the right hand side.
Sometimes the effects of an instruction on an entity cannot
be determined exactly;
the current value and value number of the entity may become
inconsistent.
Hence the current value number must be forgotten.
This is achieved by giving the entity a new value number
that was not used before.
The entity is said to be \fIkilled\fR.
.PP
As information is lost when an entity is killed,
CS tries to save as many entities as possible.
In case of an indirect assignment through a pointer,
some analysis is done to see which variables cannot be altered.
For a procedure call, the interprocedural information contained
in the procedure table is used to restrict the set of entities that may
be changed by the call.
Local variables for which the front end generated
a register message can never be changed by an indirect assignment
or a procedure call.
.NH 3
Changing the EM text
.PP
When a new expression comes available,
it is checked whether its result is saved in a local
that may go in a register.
The last line of the expression must be followed
by a STL or SDL instruction
(depending on the size of the result)
and a register message must be present for
this local.
If there is such a local,
it is recorded in the available expressions table.
Each time a new occurrence of this expression
is found,
the value number of the local is compared against
the value number of the result.
If they are different the local cannot be used and is forgotten.
.PP
The available expressions are linked in a list.
New expressions are linked at the head of the list.
In this way expressions that are contained within other
expressions appear later in the list,
because EM-expressions are postfix.
The elimination process walks through the list,
starting at the head, to find the largest expressions first.
If an expression is eliminated,
any expression later on in the list, contained in the former expression,
is removed from the list,
as expressions can only be eliminated once.
.PP
A STL or SDL is emitted after the first occurrence of the expression,
unless there was an existing local variable that could hold the result.
.NH 3
Desirability analysis
.PP
Although the global optimizer works on EM code,
the goal is to improve the quality of the object code.
Therefore some machine-dependent information is needed
to decide whether it is desirable to
eliminate a given expression.
Because it is impossible for the CS phase to know
exactly what code will be generated,
some heuristics are used.
CS essentially looks for some special cases
that should not be eliminated.
These special cases can be turned on or off for a given machine,
as indicated in a machine descriptor file.
.PP
Some operators can sometimes be translated
into an addressing mode for the machine at hand.
Such an operator is only eliminated
if its operand is itself expensive,
i.e. it is not just a simple load.
The machine descriptor file contains a set of such operators.
.PP
Eliminating the loading of the Local Base or
the Argument Base by the LXL resp. LXA instruction
is only beneficial if the difference in lexical levels
exceeds a certain threshold.
The machine descriptor file contains this threshold.
.PP
Replacing a SAR or a LAR by an AAR followed by a LOI
may possibly increase the size of the object code.
We assume that this is only possible when the
size of the array element is greater than some limit.
.PP
There are back ends that can very efficiently translate
the index computing instruction sequence LOC SLI ADS.
If this is the case,
the SLI instruction between a LOC
and an ADS is not eliminated.
.PP
To handle unforseen cases, the descriptor file may also contain
a set of operators that should never be eliminated.
.NH 3
The algorithm
.PP
After these preparatory explanations,
the algorithm itself is easy to understand.
For each instruction within the current window,
the following steps are performed in the given order :
.IP 1.
Check if this instruction defines an entity.
If so, the set of entities is updated accordingly.
.IP 2.
Kill all entities that might be affected by this instruction.
.IP 3.
Simulate the instruction on the fake-stack.
If this instruction is an operator,
update the list of available expressions accordingly.
.PP
The result of this process is
a list of available expressions plus the information
needed to eliminate them.
Expressions that are desirable to eliminate are eliminated.
Next, the window is shifted and the process is repeated.

305
doc/ego/cs/cs4 Normal file
View File

@@ -0,0 +1,305 @@
.NH 2
Implementation.
.PP
In this section we will discuss the implementation of the CS phase.
We will first describe the basic actions that are undertaken
by the algorithm, than the algorithm itself.
.NH 3
Partioning the EM instructions
.PP
There are over 100 EM instructions.
For our purpose we partition this huge set into groups of
instructions which can be more or less conveniently handled together.
.PP
There are groups for all sorts of load instructions:
simple loads, expensive loads, loads of an array element.
A load is considered \fIexpensive\fP when more than one EM instructions
are involved in loading it.
The load of a lexical entity is also considered expensive.
For instance: LOF is expensive, LAL is not.
LAR forms a group on its own,
because it is not only an expensive load,
but also implicitly includes the ternary operator AAR,
which computes the address of the array element.
.PP
There are groups for all sorts of operators:
unary, binary, and ternary.
The groups of operators are further partitioned according to the size
of their operand(s) and result.
\" .PP
\" The distinction between operators and expensive loads is not always clear.
\" The ADP instruction for example,
\" might seem a unary operator because it pops one item
\" (a pointer) from the stack.
\" However, two ADP-instructions which pop an item with the same value number
\" need not have the same result,
\" because the attributes (an offset, to be added to the pointer)
\" can be different.
\" Is it then a binary operator?
\" That would give rise to the strange, and undesirable,
\" situation that some binary operators pop two operands
\" and others pop one.
\" The conclusion is inevitable:
\" we have been fooled by the name (ADd Pointer).
\" The ADP-instruction is an expensive load.
\" In this context LAF, meaning Load Address of oFfsetted,
\" would have been a better name,
\" corresponding to LOF, like LAL,
\" Load Address of Local, corresponds to LOL.
.PP
There are groups for all sorts of stores:
direct, indirect, array element.
The SAR forms a group on its own for the same reason
as appeared with LAR.
.PP
The effect of the remaining instructions is less clear.
They do not help very much in parsing expressions or
in constructing our pseudo symboltable.
They are partitioned according to the following criteria:
.RS
.IP "-"
They change the value of an entity without using the stack
(e.g. ZRL, DEE).
.IP "-"
They are subroutine calls (CAI, CAL).
.IP "-"
They change the stack in some irreproduceable way (e.g. ASP, LFR, DUP).
.IP "-"
They have no effect whatever on the stack or on the entities.
This does not mean they can be deleted,
but they can be ignored for the moment
(e.g. MES, LIN, NOP).
.IP "-"
Their effect is too complicate too compute,
so we just assume worst case behaviour.
Hopefully, they do not occur very often.
(e.g. MON, STR, BLM).
.IP "-"
They signal the end of the basic block (e.g. BLT, RET, TRP).
.RE
.NH 3
Parsing expressions
.PP
To recognize expressions,
we simulate the behaviour of the EM machine,
by means of a fake-stack.
When we scan the instructions in sequential order,
we first encounter the instructions that load
the operands on the stack,
and then the instruction that indicates the operator,
because EM expressions are postfix.
When we find an instruction to load an operand,
we load on the fake-stack a struct with the following information:
.DS
(1) the value number of the operand
(2) the size of the operand
(3) a pointer to the first line of EM-code
that constitutes the operand
.DE
In most cases, (3) will point to the line
that loaded the operand (e.g. LOL, LOC),
i.e. there is only one line that refers to this operand,
but sometimes some information must be popped
to load the operand (e.g. LOI, LAR).
This information must have been pushed before,
so we also pop a pointer to the first line that pushed
the information.
This line is now the first line that defines the operand.
.PP
When we find the operator instruction,
we pop its operand(s) from the fake-stack.
The first line that defines the first operand is
now the first line of the expression.
We now have all information to determine
whether the just parsed expression has occurred before.
We also know the first and last line of the expression;
we need this when we decide to eliminate it.
Associated with each available expression is a set of
which the elements contains the first and last line of
a recurrence of this expression.
.PP
Not only will the operand(s) be popped from the fake-stack,
but the following will be pushed:
.DS
(1) the value number of the result
(2) the size of the result
(3) a pointer to the first line of the expression
.DE
In this way an item on the fake-stack always contains
the necessary information.
As you see, EM expressions are parsed bottum up.
.NH 3
Updating entities
.PP
As said before,
we build our private "symboltable",
while scanning the EM-instructions.
The behaviour of the EM-machine is not only reflected
in the fake-stack,
but also in the entities.
When an entity is created,
we do not yet know its value,
so we assign a brand new value number to it.
Each time a store-instruction is encountered,
we change the value number of the target entity of this store
to the value number of the token that was popped
from the fake-stack.
Because entities may overlap,
we must also "forget" the value numbers of entities
that might be affected by this store.
Each such entity will be \fIkilled\fP,
i.e. assigned a brand new valuenumber.
.PP
Because we lose information when we forget
the value number of an entity,
we try to save as much entities as possible.
When we store into an external,
we don't have to kill locals and vice versa.
Furthermore, we can see whether two locals or
two externals overlap,
because we know the offset from the local base,
resp. the offset within the data block,
and the size.
The situation becomes more complicated when we have
to consider indirection.
The worst case is that we store through an unknown pointer.
In that case we kill all entities except those locals
for which a so-called \fIregister message\fP has been generated;
this register message indicates that this local can never be
accessed indirectly.
If we know this pointer we can be more careful.
If it points to a local then the entity that is accessed through
this pointer can never overlap with an external.
If it points to an external this entity can never overlap with a local.
Furthermore, in the latter case,
we can find the data block this entity belongs to.
Since pointer arithmetic is only defined within a data block,
this entity can never overlap with entities that are known to
belong to another data block.
.PP
Not only after a store-instruction but also after a
subroutine-call it may be necessary to kill entities;
the subroutine may affect global variables or store
through a pointer.
If a subroutine is called that is not available as EM-text,
we assume worst case behaviour,
i.e. we kill all entities without register message.
.NH 3
Additions and replacements.
.PP
When a new expression comes available,
we check whether the result is saved in a local
that may go in a register.
The last line of the expression must be followed
by a STL or SDL instruction,
depending on the size of the result
(resp. WS and 2*WS),
and a register message must be present for
this local.
If we have found such a local,
we store a pointer to it with the available expression.
Each time a new occurrence of this expression
is found,
we compare the value number of the local against
the value number of the result.
When they are different we remove the pointer to it,
because we cannot use it.
.PP
The available expressions are singly linked in a list.
When a new expression comes available,
we link it at the head of the list.
In this way expressions that are contained within other
expressions appear later in the list,
because EM-expressions are postfix.
When we are going to eliminate expressions,
we walk through the list,
starting at the head, to find the largest expressions first.
When we decide to eliminate an expression,
we look at the expressions in the tail of the list,
starting from where we are now,
to delete expressions that are contained within
the chosen one because
we cannot eliminate an expression more than once.
.PP
When we are going to eliminate expressions,
and we do not have a local that holds the result,
we emit a STL or SDL after the line where the expression
was first found.
The other occurrences are simply removed,
unless they contain instructions that not only have
effect on the stack; e.g. messages, stores, calls.
Before each instruction that needs the result on the stack,
we emit a LOL or LDL.
When the expression was an AAR,
but the instruction was a LAR or a SAR,
we append a LOI resp. a STI of the number of bytes
in an array-element after each LOL/LDL.
.NH 3
Desirability analysis
.PP
Although the global optimizer works on EM code,
the goal is to improve the quality of the object code.
Therefore we need some machine dependent information
to decide whether it is desirable to
eliminate a given expression.
Because it is impossible for the CS phase to know
exactly what code will be generated,
we use some heuristics.
In most cases it will save time when we eliminate an
operator, so we just do it.
We only look for some special cases.
.PP
Some operators can in some cases be translated
into an addressing mode for the machine at hand.
We only eliminate such an operator,
when its operand is itself "expensive",
i.e. not just a simple load.
The user of the CS phase has to supply
a set of such operators.
.PP
Eliminating the loading of the Local Base or
the Argument Base by the LXL resp. LXA instruction
is only beneficial when the number of lexical levels
we have to go back exceeds a certain threshold.
This threshold will be different when registers
are saved by the back end.
The user must supply this threshold.
.PP
Replacing a SAR or a LAR by an AAR followed by a LOI
may possibly increase the size of the object code.
We assume that this is only possible when the
size of the array element is greater than some
(user-supplied) limit.
.PP
There are back ends that can very efficiently translate
the index computing instruction sequence LOC SLI ADS.
If this is the case,
we do not eliminate the SLI instruction between a LOC
and an ADS.
.PP
To handle unforeseen cases, the user may also supply
a set of operators that should never be eliminated.
.NH 3
The algorithm
.PP
After these preparatory explanations,
we can be short about the algorithm itself.
For each instruction within our window,
the following steps are performed in the order given:
.IP 1.
We check if this instructin defines an entity.
If this is the case the set of entities is updated accordingly.
.IP 2.
We kill all entities that might be affected by this instruction.
.IP 3.
The instruction is simulated on the fake-stack.
Copy propagation is done.
If this instruction is an operator,
we update the list of available expressions accordingly.
.PP
When we have processed all instructions this way,
we have built a list of available expressions plus the information we
need to eliminate them.
Those expressions of which desirability analysis tells us so,
we eliminate.
The we shift our window and continue.

46
doc/ego/cs/cs5 Normal file
View File

@@ -0,0 +1,46 @@
.NH 2
Source files of CS
.PP
The sources of CS are in the following files and packages:
.IP cs.h 14
declarations of global variables and data structures
.IP cs.c
the routine main;
a driving routine to process
the basic blocks in the right order
.IP vnm
implements a procedure that performs
the value numbering on one basic block
.IP eliminate
implements a procedure that does the
transformations, if desirable
.IP avail
implements a procedure that manipulates the list of available expressions
.IP entity
implements a procedure that manipulates the set of entities
.IP getentity
implements a procedure that extracts the
pseudo symboltable information from EM-instructions;
uses a small table
.IP kill
implements several routines that find the entities
that might be changed by EM-instructions
and kill them
.IP partition
implements several routines that partition the huge set
of EM-instructions into more or less manageable,
more or less logical chunks
.IP profit
implements a procedure that decides whether it
is advantageous to eliminate an expression;
also removes expressions with side-effects
.IP stack
implements the fake-stack and operations on it
.IP alloc
implements several allocation routines
.IP aux
implements several auxiliary routines
.IP debug
implements several routines to provide debugging
and verbose output
.LP

5
doc/ego/ic/.distr Normal file
View File

@@ -0,0 +1,5 @@
ic1
ic2
ic3
ic4
ic5

57
doc/ego/ic/ic1 Normal file
View File

@@ -0,0 +1,57 @@
.bp
.NH
The Intermediate Code and the IC phase
.PP
In this chapter the intermediate code of the EM global optimizer
will be defined.
The 'Intermediate Code construction' phase (IC),
which builds the initial intermediate code from
EM Compact Assembly Language,
will be described.
.NH 2
Introduction
.PP
The EM global optimizer is a multi pass program,
hence there is a need for an intermediate code.
Usually, programs in the Amsterdam Compiler Kit use the
Compact Assembly Language format
.[~[
keizer architecture
.], section 11.2]
for this purpose.
Although this code has some convenient features,
such as being compact,
it is quite unsuitable in our case,
because of a number of reasons.
At first, the code lacks global information
about whole procedures or whole basic blocks.
Second, it uses identifiers ('names') to bind
defining and applied occurrences of
procedures, data labels and instruction labels.
Although this is usual in high level programming
languages, it is awkward in an intermediate code
that must be read many times.
Each pass of the optimizer would have
to incorporate an identifier look-up mechanism
to associate a defining occurrence with each
applied occurrence of an identifier.
Finally, EM programs are used to declare blocks of bytes,
rather than variables. A 'hol 6' instruction may be used to
declare three 2-byte variables.
Clearly, the optimizer wants to deal with variables, and
not with rows of bytes.
.PP
To overcome these problems, we have developed a new
intermediate code.
This code does not merely consist of the EM instructions,
but also contains global information in the
form of tables and graphs.
Before describing the intermediate code we will
first leap aside to outline
the problems one generally encounters
when trying to store complex data structures such as
graphs outside the program, i.e. in a file.
We trust this will enhance the
comprehensibility of the
intermediate code definition and the design and implementation
of the IC phase.

146
doc/ego/ic/ic2 Normal file
View File

@@ -0,0 +1,146 @@
.NH 2
Representation of complex data structures in a sequential file
.PP
Most programmers are quite used to deal with
complex data structures, such as
arrays, graphs and trees.
There are some particular problems that occur
when storing such a data structure
in a sequential file.
We call data that is kept in
main memory
.UL internal
,as opposed to
.UL external
data
that is kept in a file outside the program.
.sp
We assume a simple data structure of a
scalar type (integer, floating point number)
has some known external representation.
An
.UL array
having elements of a scalar type can be represented
externally easily, by successively
representing its elements.
The external representation may be preceded by a
number, giving the length of the array.
Now, consider a linear, singly linked list,
the elements of which look like:
.DS
record
data: scalar_type;
next: pointer_type;
end;
.DE
It is significant to note that the "next"
fields of the elements only have a meaning within
main memory.
The field contains the address of some location in
main memory.
If a list element is written to a file in
some program,
and read by another program,
the element will be allocated at a different
address in main memory.
Hence this address value is completely
useless outside the program.
.sp
One may represent the list by ignoring these "next" fields
and storing the data items in the order they are linked.
The "next" fields are represented \fIimplicitly\fR.
When the file is read again,
the same list can be reconstructed.
In order to know where the external representation of the
list ends,
it may be useful to put the length of
the list in front of it.
.sp
Note that arrays and linear lists have the
same external representation.
.PP
A doubly linked, linear list,
with elements of the type:
.DS
record
data: scalar_type;
next,
previous: pointer_type;
end
.DE
can be represented in precisely the same way.
Both the "next" and the "previous" fields are represented
implicitly.
.PP
Next, consider a binary tree,
the nodes of which have type:
.DS
record
data: scalar_type;
left,
right: pointer_type;
end
.DE
Such a tree can be represented sequentially,
by storing its nodes in some fixed order, e.g. prefix order.
A special null data item may be used to
denote a missing left or right son.
For example, let the scalar type be integer,
and let the null item be 0.
Then the tree of fig. 3.1(a)
can be represented as in fig. 3.1(b).
.DS
4
9 12
12 3 4 6
8 1 5 1
Fig. 3.1(a) A binary tree
4 9 12 0 0 3 8 0 0 1 0 0 12 4 0 5 0 0 6 1 0 0 0
Fig. 3.1(b) Its sequential representation
.DE
We are still able to represent the pointer fields ("left"
and "right") implicitly.
.PP
Finally, consider a general
.UL graph
, where each node has a "data" field and
pointer fields,
with no restriction on where they may point to.
Now we're at the end of our tale.
There is no way to represent the pointers implicitly,
like we did with lists and trees.
In order to represent them explicitly,
we use the following scheme.
Every node gets an extra field,
containing some unique number that identifies the node.
We call this number its
.UL id.
A pointer is represented externally as the id of the node
it points to.
When reading the file we use a table that maps
an id to the address of its node.
In general this table will not be completely filled in
until we have read the entire external representation of
the graph and allocated internal memory locations for
every node.
Hence we cannot reconstruct the graph in one scan.
That is, there may be some pointers from node A to B,
where B is placed after A in the sequential file than A.
When we read the node of A we cannot map the id of B
to the address of node B,
as we have not yet allocated node B.
We can overcome this problem if the size
of every node is known in advance.
In this case we can allocate memory for a node
on first reference.
Else, the mapping from id to pointer
cannot be done while reading nodes.
The mapping can be done either in an extra scan
or at every reference to the node.

414
doc/ego/ic/ic3 Normal file
View File

@@ -0,0 +1,414 @@
.NH 2
Definition of the intermediate code
.PP
The intermediate code of the optimizer consists
of several components:
.IP -
the object table
.IP -
the procedure table
.IP -
the em code
.IP -
the control flow graphs
.IP -
the loop table
.LP -
.PP
These components are described in
the next sections.
The syntactic structure of every component
is described by a set of context free syntax rules,
with the following conventions:
.DS
x a non-terminal symbol
A a terminal symbol (in capitals)
x: a b c; a grammar rule
a | b a or b
(a)+ 1 or more occurrences of a
{a} 0 or more occurrences of a
.DE
.NH 3
The object table
.PP
EM programs declare blocks of bytes rather than (global) variables.
A typical program may declare 'HOL 7780'
to allocate space for 8 I/O buffers,
2 large arrays and 10 scalar variables.
The optimizer wants to deal with
.UL objects
like variables, buffers and arrays
and certainly not with huge numbers of bytes.
Therefore the intermediate code contains information
about which global objects are used.
This information can be obtained from an EM program
by just looking at the operands of instruction
such as LOE, LAE, LDE, STE, SDE, INE, DEE and ZRE.
.PP
The object table consists of a list of
.UL datablock
entries.
Each such entry represents a declaration like HOL, BSS,
CON or ROM.
There are five kinds of datablock entries.
The fifth kind,
UNKNOWN, denotes a declaration in a
separately compiled file that is not made
available to the optimizer.
Each datablock entry contains the type of the block,
its size, and a description of the objects that
belong to it.
If it is a rom,
it also contains a list of values given
as arguments to the rom instruction,
provided that this list contains only integer numbers.
An object has an offset (within its datablock)
and a size.
The size need not always be determinable.
Both datablock and object contain a unique
identifying number
(see previous section for their use).
.DS
.UL syntax
object_table:
{datablock} ;
datablock:
D_ID -- unique identifying number
PSEUDO -- one of ROM,CON,BSS,HOL,UNKNOWN
SIZE -- # bytes declared
FLAGS
{value} -- contents of rom
{object} ; -- objects of the datablock
object:
O_ID -- unique identifying number
OFFSET -- offset within the datablock
SIZE ; -- size of the object in bytes
value:
argument ;
.DE
A data block has only one flag: "external", indicating
whether the data label is externally visible.
The syntax for "argument" will be given later on
(see em_text).
.NH 3
The procedure table
.PP
The procedure table contains global information
about all procedures that are made available
to the optimizer
and that are needed by the EM program.
(Library units may not be needed, see section 3.5).
The table has one entry for
every procedure.
.DS
.UL syntax
procedure_table:
{procedure}
procedure:
P_ID -- unique identifying number
#LABELS -- number of instruction labels
#LOCALS -- number of bytes for locals
#FORMALS -- number of bytes for formals
FLAGS -- flag bits
calling -- procedures called by this one
change -- info about global variables changed
use ; -- info about global variables used
calling:
{P_ID} ; -- procedures called
change:
ext -- external variables changed
FLAGS ;
use:
FLAGS ;
ext:
{O_ID} ; -- a set of objects
.DE
.PP
The number of bytes of formal parameters accessed by
a procedure is determined by the front ends and
passed via a message (parameter message) to the optimizer.
If the front end is not able to determine this number
(e.g. the parameter may be an array of dynamic size or
the procedure may have a variable number of arguments) the attribute
contains the value 'UNKNOWN_SIZE'.
.sp 0
A procedure has the following flags:
.IP -
external: true if the proc. is externally visible
.IP -
bodyseen: true if its code is available as EM text
.IP -
calunknown: true if it calls a procedure that has its bodyseen
flag not set
.IP -
environ: true if it uses or changes a (non-global) variable in
a lexically enclosing procedure
.IP -
lpi: true if is used as operand of an lpi instruction, so
it may be called indirect
.LP
The change and use attributes both have one flag: "indirect",
indicating whether the procedure does a 'use indirect'
or a 'store indirect' (indirect means through a pointer).
.NH 3
The EM text
.PP
The EM text contains the EM instructions.
Every EM instruction has an operation code (opcode)
and 0 or 1 operands.
EM pseudo instructions can have more than
1 operand.
The opcode is just a small (8 bit) integer.
.sp
There are several kinds of operands, which we will
refer to as
.UL types.
Many EM instructions can have more than one type of operand.
The types and their encodings in Compact Assembly Language
are discussed extensively in.
.[~[
keizer architecture
.], section 11.2]
Of special interest is the way numeric values
are represented.
Of prime importance is the machine independency of
the representation.
Ultimately, one could store every integer
just as a string of the characters '0' to '9'.
As doing arithmetic on strings is awkward,
Compact Assembly Language allows several alternatives.
The main idea is to look at the value of the integer.
Integers that fit in 16, 32 or 64 bits are
represented as a row of resp. 2, 4 and 8 bytes,
preceded by an indication of how many bytes are used.
Longer integers are represented as strings;
this is only allowed within pseudo instructions, however.
This concept works very well for target machines
with reasonable word sizes.
At present, most ACK software cannot be used for word sizes
higher than 32 bits,
although the handles for using larger word sizes are
present in the design of the EM code.
In the intermediate code we essentially use the
same ideas.
We allow three representations of integers.
.IP -
integers that fit in a short are represented as a short
.IP -
integers that fit in a long but not in a short are represented
as longs
.IP -
all remaining integers are represented as strings
(only allowed in pseudos).
.LP
The terms short and long are defined in
.[~[
ritchie reference manual programming language
.], section 4]
and depend only on the source machine
(i.e. the machine on which ACK runs),
not on the target machines.
For historical reasons a long will often be called an
.UL offset.
.PP
Operands can also be instruction labels,
objects or procedures.
Instruction labels are denoted by a
.UL label
.UL identifier,
which can be distinguished from a normal identifier.
.sp
The operand of a pseudo instruction can be a list of
.UL arguments.
Arguments can have the same type as operands, except
for the type short, which is not used for arguments.
Furthermore, an argument can be a string or
a string representation of a signed integer, unsigned integer
or floating point number.
If the number of arguments is not fully determined by
the pseudo instruction (e.g. a ROM pseudo can have any number
of arguments), then the list is terminated by a special
argument of type CEND.
.DS
.UL syntax
em_text:
{line} ;
line:
INSTR -- opcode
OPTYPE -- operand type
operand ;
operand:
empty | -- OPTYPE = NO
SHORT | -- OPTYPE = SHORT
OFFSET | -- OPTYPE = OFFSET
LAB_ID | -- OPTYPE = INSTRLAB
O_ID | -- OPTYPE = OBJECT
P_ID | -- OPTYPE = PROCEDURE
{argument} ; -- OPTYPE = LIST
argument:
ARGTYPE
arg ;
arg:
empty | -- ARGTYPE = CEND
OFFSET |
LAB_ID |
O_ID |
P_ID |
string | -- ARGTYPE = STRING
const ; -- ARGTYPE = ICON,UCON or FCON
string:
LENGTH -- number of characters
{CHARACTER} ;
const:
SIZE -- number of bytes
string ; -- string representation of (un)signed
-- or floating point constant
.DE
.NH 3
The control flow graphs
.PP
Each procedure can be divided
into a number of basic blocks.
A basic block is a piece of code with
no jumps in, except at the beginning,
and no jumps out, except at the end.
.PP
Every basic block has a set of
.UL successors,
which are basic blocks that can follow it immediately in
the dynamic execution sequence.
The
.UL predecessors
are the basic blocks of which this one
is a successor.
The successor and predecessor attributes
of all basic blocks of a single procedure
are said to form the
.UL control
.UL flow
.UL graph
of that procedure.
.PP
Another important attribute is the
.UL immediate
.UL dominator.
A basic block B dominates a block C if
every path in the graph from the procedure entry block
to C goes through B.
The immediate dominator of C is the closest dominator
of C on any path from the entry block.
(Note that the dominator relation is transitive,
so the immediate dominator is well defined.)
.PP
A basic block also has an attribute containing
the identifiers of every
.UL loop
that the block belongs to (see next section for loops).
.DS
.UL syntax
control_flow_graph:
{basic_block} ;
basic_block:
B_ID -- unique identifying number
#INSTR -- number of EM instructions
succ
pred
idom -- immediate dominator
loops -- set of loops
FLAGS ; -- flag bits
succ:
{B_ID} ;
pred:
{B_ID} ;
idom:
B_ID ;
loops:
{LP_ID} ;
.DE
The flag bits can have the values 'firm' and 'strong',
which are explained below.
.NH 3
The loop tables
.PP
Every procedure has an associated
.UL loop
.UL table
containing information about all the loops
in the procedure.
Loops can be detected by a close inspection of
the control flow graph.
The main idea is to look for two basic blocks,
B and C, for which the following holds:
.IP -
B is a successor of C
.IP -
B is a dominator of C
.LP
B is called the loop
.UL entry
and C is called the loop
.UL end.
Intuitively, C contains a jump backwards to
the beginning of the loop (B).
.PP
A loop L1 is said to be
.UL nested
within loop L2 if all basic blocks of L1
are also part of L2.
It is important to note that loops could
originally be written as a well structured for -or
while loop or as a messy goto loop.
Hence loops may partly overlap without one
being nested inside the other.
The
.UL nesting
.UL level
of a loop is the number of loops in
which it is nested (so it is 0 for
an outermost loop).
The details of loop detection will be discussed later.
.PP
It is often desirable to know whether a
basic block gets executed during every iteration
of a loop.
This leads to the following definitions:
.IP -
A basic block B of a loop L is said to be a \fIfirm\fR block
of L if B is executed on all successive iterations of L,
with the only possible exception of the last iteration.
.IP -
A basic block B of a loop L is said to be a \fIstrong\fR block
of L if B is executed on all successive iterations of L.
.LP
Note that a strong block is also a firm block.
If a block is part of a conditional statement, it is neither
strong nor firm, as it may be skipped during some iterations
(see Fig. 3.2).
.DS
loop
if cond1 then
... -- this code will not
-- result in a firm or strong block
end if;
... -- strong (always executed)
exit when cond2;
... -- firm (not executed on
-- last iteration).
end loop;
Fig. 3.2 Example of firm and strong block
.DE
.DS
.UL syntax
looptable:
{loop} ;
loop:
LP_ID -- unique identifying number
LEVEL -- loop nesting level
entry -- loop entry block
end ;
entry:
B_ID ;
end:
B_ID ;
.DE

80
doc/ego/ic/ic4 Normal file
View File

@@ -0,0 +1,80 @@
.NH 2
External representation of the intermediate code
.PP
The syntax of the intermediate code was given
in the previous section.
In this section we will make some remarks about
the representation of the code in sequential files.
.sp
We use sequential files in order to avoid
the bookkeeping of complex file indices.
As a consequence of this decision
we can't store all components
of the intermediate code
in one file.
If a phase wishes to change some attribute
of a procedure,
or wants to add or delete entire procedures
(inline substitution may do the latter),
the procedure table will only be fully updated
after the entire EM text has been scanned.
Yet, the next phase undoubtedly wants
to read the procedure table before it
starts working on the EM text.
Hence there is an ordering problem, which
can be solved easily by putting the
procedure table in a separate file.
Similarly, the data block table is kept
in a file of its own.
.PP
The control flow graphs (CFGs) could be mixed
with the EM text.
Rather, we have chosen to put them
in a separate file too.
The control flow graph file should be regarded as a
file that imposes some structure on the EM-text file,
just as an overhead sheet containing a picture
of a Flow Chart may be put on an overhead sheet
containing statements.
The loop tables are also put in the CFG file.
A loop imposes an extra structure on the
CFGs and hence on the EM text.
So there are four files:
.IP -
the EM-text file
.IP -
the procedure table file
.IP -
the object table file
.IP -
the CFG and loop tables file
.LP
Every table is preceded by its length, in order to
tell where it ends.
The CFG file also contains the number of instructions of
every basic block,
indicating which part of the EM text belongs
to that block.
.DS
.UL syntax
intermediate_code:
object_table_file
proctable_file
em_text_file
cfg_file ;
object_table_file:
LENGTH -- number of objects
object_table ;
proctable_file:
LENGTH -- number of procedures
procedure_table ;
em_text_file:
em_text ;
cfg_file:
{per_proc} ; -- one for every procedure
per_proc:
BLENGTH -- number of basic blocks
LLENGTH -- number of loops
control_flow_graph
looptable ;
.DE

163
doc/ego/ic/ic5 Normal file
View File

@@ -0,0 +1,163 @@
.NH 2
The Intermediate Code construction phase
.PP
The first phase of the global optimizer,
called
.UL IC,
constructs a major part of the intermediate code.
To be specific, it produces:
.IP -
the EM text
.IP -
the object table
.IP -
part of the procedure table
.LP
The calling, change and use attributes of a procedure
and all its flags except the external and bodyseen flags
are computed by the next phase (Control Flow phase).
.PP
As explained before,
the intermediate code does not contain
any names of variables or procedures.
The normal identifiers are replaced by identifying
numbers.
Yet, the output of the global optimizer must
contain normal identifiers, as this
output is in Compact Assembly Language format.
We certainly want all externally visible names
to be the same in the input as in the output,
because the optimized EM module may be a library unit,
used by other modules.
IC dumps the names of all procedures and data labels
on two files:
.IP -
the procedure dump file, containing tuples (P_ID, procedure name)
.IP -
the data dump file, containing tuples (D_ID, data label name)
.LP
The names of instruction labels are not dumped,
as they are not visible outside the procedure
in which they are defined.
.PP
The input to IC consists of one or more files.
Each file is either an EM module in Compact Assembly Language
format, or a Unix archive file (library) containing such modules.
IC only extracts those modules from a library that are
needed somehow, just as a linker does.
It is advisable to present as much code
of the EM program as possible to the optimizer,
although it is not required to present the whole program.
If a procedure is called somewhere in the EM text,
but its body (text) is not included in the input,
its bodyseen flag in the procedure table will still
be off.
Whenever such a procedure is called,
we assume the worst case for everything;
it will change and use all variables it has access to,
it will call every procedure etc.
.sp
Similarly, if a data label is used
but not defined, the PSEUDO attribute in its data block
will be set to UNKNOWN.
.NH 3
Implementation
.PP
Part of the code for the EM Peephole Optimizer
.[
staveren peephole toplass
.]
has been used for IC.
Especially the routines that read and unravel
Compact Assembly Language and the identifier
lookup mechanism have been used.
New code was added to recognize objects,
build the object and procedure tables and to
output the intermediate code.
.PP
IC uses singly linked linear lists for both the
procedure and object table.
Hence there are no limits on the size of such
a table (except for the trivial fact that it must fit
in main memory).
Both tables are outputted after all EM code has
been processed.
IC reads the EM text of one entire procedure
at a time,
processes it and appends the modified code to
the EM text file.
EM code is represented internally as a doubly linked linear
list of EM instructions.
.PP
Objects are recognized by looking at the operands
of instructions that reference global data.
If we come across the instructions:
.DS
LDE X+6 -- Load Double External
LAE X+20 -- Load Address External
.DE
we conclude that the data block
preceded by the data label X contains an object
at offset 6 of size twice the word size,
and an object at offset 20 of unknown size.
.sp
A data block entry of the object table is allocated
at the first reference to a data label.
If this reference is a defining occurrence
or a INA pseudo instruction,
the label is not externally visible
.[~[
keizer architecture
.], section 11.1.4.3]
In this case, the external flag of the data block
is turned off.
If the first reference is an applied occurrence
or a EXA pseudo instruction, the flag is set.
We record this information, because the
optimizer may change the order of defining and
applied occurrences.
The INA and EXA pseudos are removed from the EM text.
They may be regenerated by the last phase
of the optimizer.
.sp
Similar rules hold for the procedure table
and the INP and EXP pseudos.
.NH 3
Source files of IC
.PP
The source files of IC consist
of the files ic.c, ic.h and several packages.
.UL ic.h
contains type definitions, macros and
variable declarations that may be used by
ic.c and by every package.
.UL ic.c
contains the definitions of these variables,
the procedure
.UL main
and some high level I/O routines used by main.
.sp
Every package xxx consists of two files.
ic_xxx.h contains type definitions,
macros, variable declarations and
procedure declarations that may be used by
every .c file that includes this .h file.
The file ic_xxx.c provides the
definitions of these variables and
the implementation of the declared procedures.
IC uses the following packages:
.IP lookup: 18
procedures that loop up procedure, data label
and instruction label names; procedures to dump
the procedure and data label names.
.IP lib:
one procedure that gets the next useful input module;
while scanning archives, it skips unnecessary modules.
.IP aux:
several auxiliary routines.
.IP io:
low-level I/O routines that unravel the Compact
Assembly Language.
.IP put:
routines that output the intermediate code
.LP

6
doc/ego/il/.distr Normal file
View File

@@ -0,0 +1,6 @@
il1
il2
il3
il4
il5
il6

112
doc/ego/il/il1 Normal file
View File

@@ -0,0 +1,112 @@
.bp
.NH 1
Inline substitution
.NH 2
Introduction
.PP
The Inline Substitution technique (IL)
tries to decrease the overhead associated
with procedure calls (invocations).
During a procedure call, several actions
must be undertaken to set up the right
environment for the called procedure.
.[
johnson calling sequence
.]
On return from the procedure, most of these
effects must be undone.
This entire process introduces significant
costs in execution time as well as
in object code size.
.PP
The inline substitution technique replaces
some of the calls by the modified body of
the called procedure, hence eliminating
the overhead.
Furthermore, as the calling and called procedure
are now integrated, they can be optimized
together, using other techniques of the optimizer.
This often leads to extra opportunities for
optimization
.[
ball predicting effects
.]
.[
carter code generation cacm
.]
.[
scheifler inline cacm
.]
.PP
An inline substitution of a call to a procedure P increases
the size of the program, unless P is very small or P is
called only once.
In the latter case, P can be eliminated.
In practice, procedures that are called only once occur
quite frequently, due to the
introduction of structured programming.
(Carter
.[
carter umi ann arbor
.]
states that almost 50% of the Pascal procedures
he analyzed were called just once).
.PP
Scheifler
.[
scheifler inline cacm
.]
has a more general view of inline substitution.
In his model, the program under consideration is
allowed to grow by a certain amount,
i.e. code size is sacrificed to speed up the program.
The above two cases are just special cases of
his model, obtained by setting the size-change to
(approximately) zero.
He formulates the substitution problem as follows:
.IP
"Given a program, a subset of all invocations,
a maximum program size, and a maximum procedure size,
find a sequence of substitutions that minimizes
the expected execution time."
.LP
Scheifler shows that this problem is NP-complete
.[~[
aho hopcroft ullman analysis algorithms
.], chapter 10]
by reduction to the Knapsack Problem.
Heuristics will have to be used to find a near-optimal
solution.
.PP
In the following chapters we will extend
Scheifler's view and adapt it to the EM Global Optimizer.
We will first describe the transformations that have
to be applied to the EM text when a call is substituted
in line.
Next we will examine in which cases inline substitution
is not possible or desirable.
Heuristics will be developed for
chosing a good sequence of substitutions.
These heuristics make no demand on the user
(such as making profiles
.[
scheifler inline cacm
.]
or giving pragmats
.[~[
ichbiah ada military standard
.], section 6.3.2]),
although the model could easily be extended
to use such information.
Finally, we will discuss the implementation
of the IL phase of the optimizer.
.PP
We will often use the term inline expansion
as a synonym of inline substitution.
.sp 0
The inverse technique of procedure abstraction
(automatic subroutine generation)
.[
shaffer subroutine generation
.]
will not be discussed in this report.

93
doc/ego/il/il2 Normal file
View File

@@ -0,0 +1,93 @@
.NH 2
Parameters and local variables.
.PP
In the EM calling sequence, the calling procedure
pushes its parameters on the stack
before doing the CAL.
The called routine first saves some
status information on the stack and then
allocates space for its own locals
(also on the stack).
Usually, one special purpose register,
the Local Base (LB) register,
is used to access both the locals and the
parameters.
If memory is highly segmented,
the stack frames of the caller and the callee
may be allocated in different fragments;
an extra Argument Base (AB) register is used
in this case to access the actual parameters.
See 4.2 of
.[
keizer architecture
.]
for further details.
.PP
If a procedure call is expanded in line,
there are two problems:
.IP 1. 3
No stack frame will be allocated for the called procedure;
we must find another place to put its locals.
.IP 2.
The LB register cannot be used to access the actual
parameters;
as the CAL instruction is deleted, the LB will
still point to the local base of the \fIcalling\fR procedure.
.LP
The local variables of the called procedure will
be put in the stack frame of the calling procedure,
just after its own locals.
The size of the stack frame of the
calling procedure will be increased
during its entire lifetime.
Therefore our model will allow a
limit to be set on the number of bytes
for locals that the called procedure may have
(see next section).
.PP
There are several alternatives to access the parameters.
An actual parameter may be any auxiliary expression,
which we will refer to as
the \fIactual parameter expression\fR.
The value of this expression is stored
in a location on the stack (see above),
the \fIparameter location\fR.
.sp 0
The alternatives for accessing parameters are:
.IP -
save the value of the stackpointer at the point of the CAL
in a temporary variable X;
this variable can be used to simulate the AB register, i.e.
parameter locations are accessed via an offset to
the value of X.
.IP -
create a new temporary local variable T for
the parameter (in the stack frame of the caller);
every access to the parameter location must be changed
into an access to T.
.IP -
do not evaluate the actual parameter expression before the call;
instead, substitute this expression for every use of the
parameter location.
.LP
The first method may be expensive if X is not
put in a register.
We will not use this method.
The time required to evaluate and access the
parameters when the second method is used
will not differ much from the normal
calling sequence (i.e. not in line call).
It is not expensive, but there are no
extra savings either.
The third method is essentially the 'by name'
parameter mechanism of Algol60.
If the actual parameter is just a numeric constant,
it is advantageous to use it.
Yet, there are several circumstances
under which it cannot or should not be used.
We will deal with this in the next section.
.sp 0
In general we will use the third method,
if it is possible and desirable.
Such parameters will be called \fIin line parameters\fR.
In all other cases we will use the second method.

164
doc/ego/il/il3 Normal file
View File

@@ -0,0 +1,164 @@
.NH 2
Feasibility and desirability analysis
.PP
Feasibility and desirability analysis
of in line substitution differ
somewhat from most other techniques.
Usually, much effort is needed to find
a feasible opportunity for optimization
(e.g. a redundant subexpression).
Desirability analysis then checks
if it is really advantageous to do
the optimization.
For IL, opportunities are easy to find.
To see if an in line expansion is
desirable will not be hard either.
Yet, the main problem is to find the most
desirable ones.
We will deal with this problem later and
we will first attend feasibility and
desirability analysis.
.PP
There are several reasons why a procedure invocation
cannot or should not be expanded in line.
.sp
A call to a procedure P cannot be expanded in line
in any of the following cases:
.IP 1. 3
The body of P is not available as EM text.
Clearly, there is no way to do the substitution.
.IP 2.
P, or any procedure called by P (transitively),
follows the chain of statically enclosing
procedures (via a LXL or LXA instruction)
or follows the chain of dynamically enclosing
procedures (via a DCH).
If the call were expanded in line,
one level would be removed from the chains,
leading to total chaos.
This chaos could be solved by patching up
every LXL, LXA or DCH in all procedures
that could be part of the chains,
but this is hard to implement.
.IP 3.
P, or any procedure called by P (transitively),
calls a procedure whose body is not
available as EM text.
The unknown procedure may use an LXL, LXA or DCH.
However, in several languages a separately
compiled procedure has no access to the
static or dynamic chain.
In this case
this point does not apply.
.IP 4.
P, or any procedure called by P (transitively),
uses the LPB instruction, which converts a
local base to an argument base;
as the locals and parameters are stored
in a non-standard way (differing from the
normal EM calling sequence) this instruction
would yield incorrect results.
.IP 5.
The total number of bytes of the parameters
of P is not known.
P may be a procedure with a variable number
of parameters or may have an array of dynamic size
as value parameter.
.LP
It is undesirable to expand a call to a procedure P in line
in any of the following cases:
.IP 1. 3
P is large, i.e. the number of EM instructions
of P exceeds some threshold.
The expanded code would be large too.
Furthermore, several programs in ACK,
including the global optimizer itself,
may run out of memory if they they have to run
in a small address space and are provided
very large procedures.
The threshold may be set to infinite,
in which case this point does not apply.
.IP 2.
P has many local variables.
All these variables would have to be allocated
in the stack frame of the calling procedure.
.PP
If a call may be expanded in line, we have to
decide how to access its parameters.
In the previous section we stated that we would
use in line parameters whenever possible and desirable.
There are several reasons why a parameter
cannot or should not be expanded in line.
.sp
No parameter of a procedure P can be expanded in line,
in any of the following cases:
.IP 1. 3
P, or any procedure called by P (transitively),
does a store-indirect or a use-indirect (i.e. through
a pointer).
However, if the front-end has generated messages
telling that certain parameters can not be accessed
indirectly, those parameters may be expanded in line.
.IP 2.
P, or any procedure called by P (transitively),
calls a procedure whose body is not available as EM text.
The unknown procedure may do a store-indirect
or a use-indirect.
However, the same remark about front-end messages
as for 1. holds here.
.IP 3.
The address of a parameter location is taken (via a LAL).
In the normal calling sequence, all parameters
are stored sequentially. If the address of one
parameter location is taken, the address of any
other parameter location can be computed from it.
Hence we must put every parameter in a temporary location;
furthermore, all these locations must be in
the same order as for the normal calling sequence.
.IP 4.
P has overlapping parameters; for example, it uses
the parameter at offset 10 both as a 2 byte and as a 4 byte
parameter.
Such code may be produced by the front ends if
the formal parameter is of some record type
with variants.
.PP
Sometimes a specific parameter must not be expanded in line.
.sp 0
An actual parameter expression cannot be expanded in line
in any of the following cases:
.IP 1. 3
P stores into the parameter location.
Even if the actual parameter expression is a simple
variable, it is incorrect to change the 'store into
formal' into a 'store into actual', because of
the parameter mechanism used.
In Pascal, the following expansion is incorrect:
.DS
procedure p (x:integer);
begin
x := 20;
end;
...
a := 10; a := 10;
p(a); ---> a := 20;
write(a); write(a);
.DE
.IP 2.
P changes any of the operands of the
actual parameter expression.
If the expression is expanded and evaluated
after the operand has been changed,
the wrong value will be used.
.IP 3.
The actual parameter expression has side effects.
It must be evaluated only once,
at the place of the call.
.LP
It is undesirable to expand an actual parameter in line
in the following case:
.IP 1. 3
The parameter is used more than once
(dynamically) and the actual parameter expression
is not just a simple variable or constant.
.LP

132
doc/ego/il/il4 Normal file
View File

@@ -0,0 +1,132 @@
.NH 2
Heuristic rules
.PP
Using the information described
in the previous section,
we can find all calls that can
be expanded in line, and for which
this expansion is desirable.
In general, we cannot expand all these calls,
so we have to choose the 'best' ones.
With every CAL instruction
that may be expanded, we associate
a \fIpay off\fR,
which expresses how desirable it is
to expand this specific CAL.
.sp
Let Tc denote the portion of EM text involved
in a specific call, i.e. the pushing of the actual
parameter expressions, the CAL itself,
the popping of the parameters and the
pushing of the result (if any, via an LFR).
Let Te denote the EM text that would be obtained
by expanding the call in line.
Let Pc be the original program and Pe the program
with Te substituted for Tc.
The pay off of the CAL depends on two factors:
.IP -
T = execution_time(Pe) - execution_time(Pc)
.IP -
S = code_size(Pe) - code_size(Pc)
.LP
The change in execution time (T) depends on:
.IP -
T1 = execution_time(Te) - execution_time(Tc)
.IP -
N = number of times Te or Tc get executed.
.LP
We assume that T1 will be the same every
time the code gets executed.
This is a reasonable assumption.
(Note that we are talking about one CAL,
not about different calls to the same procedure).
Hence
.DS
T = N * T1
.DE
T1 can be estimated by a careful analysis
of the transformations that are performed.
Below, we list everything that will be
different when a call is expanded in line:
.IP -
The CAL instruction is not executed.
This saves a subroutine jump.
.IP -
The instructions in the procedure prolog
are not executed.
These instructions, generated from the PRO pseudo,
save some machine registers
(including the old LB), set the new LB and allocate space
for the locals of the called routine.
The savings may be less if there are no
locals to allocate.
.IP -
In line parameters are not evaluated before the call
and are not pushed on the stack.
.IP -
All remaining parameters are stored in local variables,
instead of being pushed on the stack.
.IP -
If the number of parameters is nonzero,
the ASP instruction after the CAL is not executed.
.IP -
Every reference to an in line parameter is
substituted by the parameter expression.
.IP -
RET (return) instructions are replaced by
BRA (branch) instructions.
If the called procedure 'falls through'
(i.e. it has only one RET, at the end of its code),
even the BRA is not needed.
.IP -
The LFR (fetch function result) is not executed
.PP
Besides these changes, which are caused directly by IL,
other changes may occur as IL influences other optimization
techniques, such as Register Allocation and Constant Propagation.
Our heuristic rules do not take into account the quite
inpredictable effects on Register Allocation.
It does, however, favour calls that have numeric \fIconstants\fR
as parameter; especially the constant "0" as an inline
parameter gets high scores,
as further optimizations may often be possible.
.PP
It cannot be determined statically how often a CAL instruction gets
executed.
We will use \fIloop nesting\fR information here.
The nesting level of the loop in which
the CAL appears (if any) will be used as an
indication for the number of times it gets executed.
.PP
Based on all these facts,
the pay off of a call will be computed.
The following model was developed empirically.
Assume procedure P calls procedure Q.
The call takes place in basic block B.
.DS
ZP = # zero parameters
CP = # constant parameters - ZP
LN = Loop Nesting level (0 if outside any loop)
F = \fIif\fR # formal parameters of Q > 0 \fIthen\fR 1 \fIelse\fR 0
FT = \fIif\fR Q falls through \fIthen\fR 1 \fIelse\fR 0
S = size(Q) - 1 - # inline_parameters - F
L = \fIif\fR # local variables of P > 0 \fIthen\fR 0 \fIelse\fR -1
A = CP + 2 * ZP
N = \fIif\fR LN=0 and P is never called from a loop \fIthen\fR 0 \fIelse\fR (LN+1)**2
FM = \fIif\fR B is a firm block \fIthen\fR 2 \fIelse\fR 1
pay_off = (100/S + FT + F + L + A) * N * FM
.DE
S stands for the size increase of the program,
which is slightly less than the size of Q.
The size of a procedure is taken to be its number
of (non-pseudo) EM instructions.
The terms "loop nesting level" and "firm" were defined
in the chapter on the Intermediate Code (section "loop tables").
If a call is not inside a loop and the calling procedure
is itself never called from a loop (transitively),
then the call will probably be executed at most once.
Such a call is never expanded in line (its pay off is zero).
If the calling procedure doesn't have local variables, a penalty (L)
is introduced, as it will most likely get local variables if the
call gets expanded.

440
doc/ego/il/il5 Normal file
View File

@@ -0,0 +1,440 @@
.NH 2
Implementation
.PP
A major factor in the implementation
of Inline Substitution is the requirement
not to use an excessive amount of memory.
IL essentially analyzes the entire program;
it makes decisions based on which procedure calls
appear in the whole program.
Yet, because of the memory restriction, it is
not feasible to read the entire program
in main memory.
To solve this problem, the IL phase has been
split up into three subphases that are executed sequentially:
.IP 1.
analyze every procedure; see how it accesses its parameters;
simultaneously collect all calls
appearing in the whole program an put them
in a \fIcall-list\fR.
.IP 2.
use the call-list and decide which calls will be substituted
in line.
.IP 3.
take the decisions of subphase 2 and modify the
program accordingly.
.LP
Subphases 1 and 3 scan the input program; only
subphase 3 modifies it.
It is essential that the decisions can be made
in subphase 2
without using the input program,
provided that subphase 1 puts enough information
in the call-list.
Subphase 2 keeps the entire call-list in main memory
and repeatedly scans it, to
find the next best candidate for expansion.
.PP
We will specify the
data structures used by IL before
describing the subphases.
.NH 3
Data structures
.NH 4
The procedure table
.PP
In subphase 1 information is gathered about every procedure
and added to the procedure table.
This information is used by the heuristic rules.
A proctable entry for procedure p has
the following extra information:
.IP -
is it allowed to substitute an invocation of p in line?
.IP -
is it allowed to put any parameter of such a call in line?
.IP -
the size of p (number of EM instructions)
.IP -
does p 'fall through'?
.IP -
a description of the formal parameters that p accesses; this information
is obtained by looking at the code of p. For every parameter f,
we record:
.RS
.IP -
the offset of f
.IP -
the type of f (word, double word, pointer)
.IP -
may the corresponding actual parameter be put in line?
.IP -
is f ever accessed indirectly?
.IP -
if f used: never, once or more than once?
.RE
.IP -
the number of times p is called (see below)
.IP -
the file address of its call-count information (see below).
.LP
.NH 4
Call-count information
.PP
As a result of Inline Substitution, some procedures may
become useless, because all their invocations have been
substituted in line.
One of the tasks of IL is to keep track which
procedures are no longer called.
Note that IL is especially keen on procedures that are
called only once
(possibly as a result of expanding all other calls to it).
So we want to know how many times a procedure
is called \fIduring\fR Inline Substitution.
It is not good enough to compute this
information afterwards.
The task is rather complex, because
the number of times a procedure is called
varies during the entire process:
.IP 1.
If a call to p is substituted in line,
the number of calls to p gets decremented by 1.
.IP 2.
If a call to p is substituted in line,
and p contains n calls to q, then the number of calls to q
gets incremented by n.
.IP 3.
If a procedure p is removed (because it is no
longer called) and p contains n calls to q,
then the number of calls to q gets decremented by n.
.LP
(Note that p may be the same as q, if p is recursive).
.sp 0
So we actually want to have the following information:
.DS
NRCALL(p,q) = number of call to q appearing in p,
for all procedures p and q that may be put in line.
.DE
This information, called \fIcall-count information\fR is
computed by the first subphase.
It is stored in a file.
It is represented as a number of lists, rather than as
a (very sparse) matrix.
Every procedure has a list of (proc,count) pairs,
telling which procedures it calls, and how many times.
The file address of its call-count list is stored
in its proctable entry.
Whenever this information is needed, it is fetched from
the file, using direct access.
The proctable entry also contains the number of times
a procedure is called, at any moment.
.NH 4
The call-list
.PP
The call-list is the major data structure use by IL.
Every item of the list describes one procedure call.
It contains the following attributes:
.IP -
the calling procedure (caller)
.IP -
the called procedure (callee)
.IP -
identification of the CAL instruction (sequence number)
.IP -
the loop nesting level; our heuristic rules appreciate
calls inside a loop (or even inside a loop nested inside
another loop, etc.) more than other calls
.IP -
the actual parameter expressions involved in the call;
for every actual, we record:
.RS
.IP -
the EM code of the expression
.IP -
the number of bytes of its result (size)
.IP -
an indication if the actual may be put in line
.RE
.LP
The structure of the call-list is rather complex.
Whenever a call is expanded in line, new calls
will suddenly appear in the program,
that were not contained in the original body
of the calling subroutine.
These calls are inherited from the called procedure.
We will refer to these invocations as \fInested calls\fR
(see Fig. 5.1).
.DS
procedure p is
begin .
a(); .
b(); .
end;
procedure r is procedure r is
begin begin
x(); x();
p(); -- in line a(); -- nested call
y(); b(); -- nested call
end; y();
end;
Fig. 5.1 Example of nested procedure calls
.DE
Nested calls may subsequently be put in line too
(probably resulting in a yet deeper nesting level, etc.).
So the call-list does not always reflect the source program,
but changes dynamically, as decisions are made.
If a call to p is expanded, all calls appearing in p
will be added to the call-list.
.sp 0
A convenient and elegant way to represent
the call-list is to use a LISP-like list.
.[
poel lisp trac
.]
Calls that appear at the same level
are linked in the CDR direction. If a call C
to a procedure p is expanded,
all calls appearing in p are put in a sub-list
of C, i.e. in its CAR.
In the example above, before the decision
to expand the call to p is made, the
call-list of procedure r looks like:
.DS
(call-to-x, call-to-p, call-to-y)
.DE
After the decision, it looks like:
.DS
(call-to-x, (call-to-p*, call-to-a, call-to-b), call-to-y)
.DE
The call to p is marked, because it has been
substituted.
Whenever IL wants to traverse the call-list of some procedure,
it uses the well-known LISP technique of
recursion in the CAR direction and
iteration in the CDR direction
(see page 1.19-2 of
.[
poel lisp trac
.]
).
All list traversals look like:
.DS
traverse(list)
{
for (c = first(list); c != 0; c = CDR(c)) {
if (c is marked) {
traverse(CAR(c));
} else {
do something with c
}
}
}
.DE
The entire call-list consists of a number of LISP-like lists,
one for every procedure.
The proctable entry of a procedure contains a pointer
to the beginning of the list.
.NH 3
The first subphase: procedure analysis
.PP
The tasks of the first subphase are to determine
several attributes of every procedure
and to construct the basic call-list,
i.e. without nested calls.
The size of a procedure is determined
by simply counting its EM instructions.
Pseudo instructions are skipped.
A procedure does not 'fall through' if its CFG
contains a basic block
that is not the last block of the CFG and
that ends on a RET instruction.
The formal parameters of a procedure are determined
by inspection of
its code.
.PP
The call-list in constructed by looking at all CAL instructions
appearing in the program.
The call-list should only contain calls to procedures
that may be put in line.
This fact is only known if the procedure was
analyzed earlier.
If a call to a procedure p appears in the program
before the body of p,
the call will always be put in the call-list.
If p is later found to be unsuitable,
the call will be removed from the list by the
second subphase.
.PP
An important issue is the recognition
of the actual parameter expressions of the call.
The front ends produces messages telling how many
bytes of formal parameters every procedure accesses.
(If there is no such message for a procedure, it
cannot be put in line).
The actual parameters together must account for
the same number of bytes.A recursive descent parser is used
to parse side-effect free EM expressions.
It uses a table and some
auxiliary routines to determine
how many bytes every EM instruction pops from the stack
and how many bytes it pushes onto the stack.
These numbers depend on the EM instruction, its argument,
and the wordsize and pointersize of the target machine.
Initially, the parser has to recognize the
number of bytes specified in the formals-message,
say N.
Assume the first instruction before the CAL pops S bytes
and pushes R bytes.
If R > N, too many bytes are recognized
and the parser fails.
Else, it calls itself recursively to recognize the
S bytes used as operand of the instruction.
If it succeeds in doing so, it continues with the next instruction,
i.e. the first instruction before the code recognized by
the recursive call, to recognize N-R more bytes.
The result is a number of EM instructions that collectively push N bytes.
If an instruction is come across that has side-effects
(e.g. a store or a procedure call) or of which R and S cannot
be computed statically (e.g. a LOS), it fails.
.sp 0
Note that the parser traverses the code backwards.
As EM code is essentially postfix code, the parser works top down.
.PP
If the parser fails to recognize the parameters, the call will not
be substituted in line.
If the parameters can be determined, they still have to
match the formal parameters of the called procedure.
This check is performed by the second subphase; it cannot be
done here, because it is possible that the called
procedure has not been analyzed yet.
.PP
The entire call-list is written to a file,
to be processed by the second subphase.
.NH 3
The second subphase: making decisions
.PP
The task of the second subphase is quite easy
to understand.
It reads the call-list file,
builds an incore call-list and deletes every
call that may not be expanded in line (either because the called
procedure may not be put in line, or because the actual parameters
of the call do not match the formal parameters of the called procedure).
It assigns a \fIpay-off\fR to every call,
indicating how desirable it is to expand it.
.PP
The subphase repeatedly scans the call-list and takes
the call with the highest ratio.
The chosen one gets marked,
and the call-list is extended with the nested calls,
as described above.
These nested calls are also assigned a ratio,
and will be considered too during the next scans.
.sp 0
After every decision the number of times
every procedure is called is updated, using
the call-count information.
Meanwhile, the subphase keeps track of the amount of space left
available.
If all space is used, or if there are no more calls left to
be expanded, it exits this loop.
Finally, calls to procedures that are called only
once are also chosen.
.PP
The actual parameters of a call are only needed by
this subphase to assign a ratio to a call.
To save some space, these actuals are not kept in main memory.
They are removed after the call has been read and a ratio
has been assigned to it.
So this subphase works with \fIabstracts\fR of calls.
After all work has been done,
the actual parameters of the chosen calls are retrieved
from a file,
as they are needed by the transformation subphase.
.NH 3
The third subphase: doing transformations
.PP
The third subphase makes the actual modifications to
the EM text.
It is directed by the decisions made in the previous subphase,
as expressed via the call-list.
The call-list read by this subphase contains
only calls that were selected for expansion.
The list is ordered in the same way as the EM text,
i.e. if a call C1 appears before a call C2 in the call-list,
C1 also appears before C2 in the EM text.
So the EM text is traversed linearly,
the calls that have to be substituted are determined
and the modifications are made.
If a procedure is come across that is no longer needed,
it is simply not written to the output EM file.
The substitution of a call takes place in distinct steps:
.IP "change the calling sequence" 7
.sp 0
The actual parameter expressions are changed.
Parameters that are put in line are removed.
All remaining ones must store their result in a
temporary local variable, rather than
push it on the stack.
The CAL instruction and any ASP (to pop actual parameters)
or LFR (to fetch the result of a function)
are deleted.
.IP "fetch the text of the called procedure"
.sp 0
Direct disk access is used to to read the text of the
called procedure.
The file offset is obtained from the proctable entry.
.IP "allocate bytes for locals and temporaries"
.sp 0
The local variables of the called procedure will be put in the
stack frame of the calling procedure.
The same applies to any temporary variables
that hold the result of parameters
that were not put in line.
The proctable entry of the caller is updated.
.IP "put a label after the CAL"
.sp 0
If the called procedure contains a RET (return) instruction
somewhere in the middle of its text (i.e. it does
not fall through), the RET must be changed into
a BRA (branch), to jump over the
remainder of the text.
This label is not needed if the called
procedure falls through.
.IP "copy the text of the called procedure and modify it"
.sp 0
References to local variables of the called routine
and to parameters that are not put in line
are changed to refer to the
new local of the caller.
References to in line parameters are replaced
by the actual parameter expression.
Returns (RETs) are either deleted or
replaced by a BRA.
Messages containing information about local
variables or parameters are changed.
Global data declarations and the PRO and END pseudos
are removed.
Instruction labels and references to them are
changed to make sure they do not have the
same identifying number as
labels in the calling procedure.
.IP "insert the modified text"
.sp 0
The pseudos of the called procedure are put after the pseudos
of the calling procedure.
The real text of the callee is put at
the place where the CAL was.
.IP "take care of nested substitutions"
.sp 0
The expanded procedure may contain calls that
have to be expanded too (nested calls).
If the descriptor of this call contains actual
parameter expressions,
the code of the expressions has to be changed
the same way as the code of the callee was changed.
Next, the entire process of finding CALs and doing
the substitutions is repeated recursively.
.LP

27
doc/ego/il/il6 Normal file
View File

@@ -0,0 +1,27 @@
.NH 2
Source files of IL
.PP
The sources of IL are in the following files
and packages (the prefixes 1_, 2_ and 3_ refer to the three subphases):
.IP il.h: 14
declarations of global variables and
data structures
.IP il.c:
the routine main; the driving routines of the three subphases
.IP 1_anal:
contains a subroutine that analyzes a procedure
.IP 1_cal:
contains a subroutine that analyzes a call
.IP 1_aux:
implements auxiliary procedures used by subphase 1
.IP 2_aux:
implements auxiliary procedures used by subphase 2
.IP 3_subst:
the driving routine for doing the substitution
.IP 3_change:
lower level routines that do certain modifications
.IP 3_aux:
implements auxiliary procedures used by subphase 3
.IP aux
implements auxiliary procedures used by several subphases.
.LP

3
doc/ego/intro/.distr Normal file
View File

@@ -0,0 +1,3 @@
head
intro1
tail

7
doc/ego/intro/head Normal file
View File

@@ -0,0 +1,7 @@
.ND
.ll 80m
.nr LL 80m
.nr tl 78m
.tr ~
.ds >. .
.ds [. " \[

79
doc/ego/intro/intro1 Normal file
View File

@@ -0,0 +1,79 @@
.TL
The design and implementation of
the EM Global Optimizer
.AU
H.E. Bal
.AI
Vrije Universiteit
Wiskundig Seminarium, Amsterdam
.AB
The EM Global Optimizer is part of the Amsterdam Compiler Kit,
a toolkit for making retargetable compilers.
It optimizes the intermediate code common to all compilers of
the toolkit (EM),
so it can be used for all programming languages and
all processors supported by the kit.
.PP
The optimizer is based on well-understood concepts like
control flow analysis and data flow analysis.
It performs the following optimizations:
Inline Substitution, Strength Reduction, Common Subexpression Elimination,
Stack Pollution, Cross Jumping, Branch Optimization, Copy Propagation,
Constant Propagation, Dead Code Elimination and Register Allocation.
.PP
This report describes the design of the optimizer and several
of its implementation issues.
.AE
.bp
.NH 1
Introduction
.PP
.FS
This work was supported by the
Stichting Technische Wetenschappen (STW)
under grant VWI00.0001.
.FE
The EM Global Optimizer is part of a software toolkit
for making production-quality retargetable compilers.
This toolkit,
called the Amsterdam Compiler Kit
.[
tanenbaum toolkit rapport
.]
.[
tanenbaum toolkit cacm
.]
runs under the Unix*
.FS
*Unix is a Trademark of Bell Laboratories
.FE
operating system.
.sp 0
The main design philosophy of the toolkit is to use
a language- and machine-independent
intermediate code, called EM.
.[
keizer architecture
.]
The basic compilation process can be split up into
two parts.
A language-specific front end translates the source program into EM.
A machine-specific back end transforms EM to assembly code
of the target machine.
.PP
The global optimizer is an optional phase of the
compilation process, and can be used to obtain
machine code of a higher quality.
The optimizer transforms EM-code to better EM-code,
so it comes between the front end and the back end.
It can be used with any combination of languages
and machines, as far as they are supported by
the compiler kit.
.PP
This report describes the design of the
global optimizer and several of its
implementation issues.
Measurements can be found in.
.[
bal tanenbaum global
.]

3
doc/ego/intro/tail Normal file
View File

@@ -0,0 +1,3 @@
.[
$LIST$
.]

1
doc/ego/lv/.distr Normal file
View File

@@ -0,0 +1 @@
lv1

95
doc/ego/lv/lv1 Normal file
View File

@@ -0,0 +1,95 @@
.bp
.NH 1
Live-Variable analysis
.NH 2
Introduction
.PP
The "Live-Variable analysis" optimization technique (LV)
performs some code improvements and computes information that may be
used by subsequent optimizations.
The main task of this phase is the
computation of \fIlive-variable information\fR.
.[~[
aho compiler design
.] section 14.4]
A variable A is said to be \fIdead\fR at some point p of the
program text, if on no path in the control flow graph
from p to a RET (return), A can be used before being changed;
else A is said to be \fIlive\fR.
.PP
A statement of the form
.DS
VARIABLE := EXPRESSION
.DE
is said to be dead if the left hand side variable is dead just after
the statement and the right hand side expression has no
side effects (i.e. it doesn't change any variable).
Such a statement can be eliminated entirely.
Dead code will seldom be present in the original program,
but it may be the result of earlier optimizations,
such as copy propagation.
.PP
Live-variable information is passed to other phases via
messages in the EM code.
Live/dead messages are generated at points in the EM text where
variables become dead or live.
This information is especially useful for the Register
Allocation phase.
.NH 2
Implementation
.PP
The implementation uses algorithm 14.6 of.
.[
aho compiler design
.]
First two sets DEF and USE are computed for every basic block b:
.IP DEF(b) 9
the set of all variables that are assigned a value in b before
being used
.IP USE(b) 9
the set of all variables that may be used in b before being changed.
.LP
(So variables that may, but need not, be used resp. changed via a procedure
call or through a pointer are included in USE but not in DEF).
The next step is to compute the sets IN and OUT :
.IP IN[b] 9
the set of all variables that are live at the beginning of b
.IP OUT[b] 9
the set of all variables that are live at the end of b
.LP
IN and OUT can be computed for all blocks simultaneously by solving the
data flow equations:
.DS
(1) IN[b] = OUT[b] - DEF[b] + USE[b]
[2] OUT[b] = IN[s1] + ... + IN[sn] ;
where SUCC[b] = {s1, ... , sn}
.DE
The equations are solved by a similar algorithm as for
the Use Definition equations (see previous chapter).
.PP
Finally, each basic block is visited in turn to remove its dead code
and to emit the live/dead messages.
Every basic block b is traversed from its last
instruction backwards to the beginning of b.
Initially, all variables that are dead at the end
of b are marked dead. All others are marked live.
If we come across an assignment to a variable X that
was marked live, a live-message is put after the
assignment and X is marked dead;
if X was marked dead, the assignment may be removed, provided that
the right hand side expression contains no side effects.
If we come across a use of a variable X that
was marked dead, a dead-message is put after the
use and X is marked live.
So at any point, the mark of X tells whether X is
live or dead immediately before that point.
A message is also generated at the start of a basic block
for every variable that was live at the end of the (textually)
previous block, but dead at the entry of this block, or v.v.
.PP
Only local variables are considered.
This significantly reduces the memory needed by this phase,
eases the implementation and is hardly less efficient than
considering all variables.
(Note that it is very hard to prove that an assignment to
a global variable is dead).

1
doc/ego/ov/.distr Normal file
View File

@@ -0,0 +1 @@
ov1

371
doc/ego/ov/ov1 Normal file
View File

@@ -0,0 +1,371 @@
.bp
.NH 1
Overview of the global optimizer
.NH 2
The ACK compilation process
.PP
The EM Global Optimizer is one of three optimizers that are
part of the Amsterdam Compiler Kit (ACK).
The phases of ACK are:
.IP 1.
A Front End translates a source program to EM
.IP 2.
The Peephole Optimizer
.[
tanenbaum staveren peephole toplass
.]
reads EM code and produces 'better' EM code.
It performs a number of optimizations (mostly peephole
optimizations)
such as constant folding, strength reduction and unreachable code
elimination.
.IP 3.
The Global Optimizer further improves the EM code.
.IP 4.
The Code Generator transforms EM to assembly code
of the target computer.
.IP 5.
The Target Optimizer improves the assembly code.
.IP 6.
An Assembler/Loader generates an executable file.
.LP
For a more extensive overview of the ACK compilation process,
we refer to.
.[
tanenbaum toolkit rapport
.]
.[
tanenbaum toolkit cacm
.]
.PP
The input of the Global Optimizer may consist of files and
libraries.
Every file or module in the library must contain EM code in
Compact Assembly Language format.
.[~[
tanenbaum machine architecture
.], section 11.2]
The output consists of one such EM file.
The input files and libraries together need not
constitute an entire program,
although as much of the program as possible should be supplied.
The more information about the program the optimizer
gets, the better its output code will be.
.PP
The Global Optimizer is language- and machine-independent,
i.e. it can be used for all languages and machines supported by ACK.
Yet, it puts some unavoidable restrictions on the EM code
produced by the Front End (see below).
It must have some knowledge of the target machine.
This knowledge is expressed in a machine description table
which is passed as argument to the optimizer.
This table does not contain very detailed information about the
target (such as its instruction set and addressing modes).
.NH 2
The EM code
.PP
The definition of EM, the intermediate code of all ACK compilers,
is given in a separate document.
.[
tanenbaum machine architecture
.]
We will only discuss some features of EM that are most relevant
to the Global Optimizer.
.PP
EM is the assembly code of a virtual \fIstack machine\fR.
All operations are performed on the top of the stack.
For example, the statement "A := B + 3" may be expressed in EM as:
.DS
LOL -4 -- push local variable B
LOC 3 -- push constant 3
ADI 2 -- add two 2-byte items on top of
-- the stack and push the result
STL -2 -- pop A
.DE
So EM is essentially a \fIpostfix\fR code.
.PP
EM has a rich instruction set, containing several arithmetic
and logical operators.
It also contains special-case instructions (such as INCrement).
.PP
EM has \fIglobal\fR (\fIexternal\fR) variables, accessible
by all procedures and \fIlocal\fR variables, accessible by a few
(nested) procedures.
The local variables of a lexically enclosing procedure may
be accessed via a \fIstatic link\fR.
EM has instructions to follow the static chain.
There are EM instruction to allow a procedure
to access its local variables directly (such as LOL and STL above).
Local variables are referenced via an offset in the stack frame
of the procedure, rather than by their names (e.g. -2 and -4 above).
The EM code does not contain the (source language) type
of the variables.
.PP
All structured statements in the source program are expressed in
low level jump instructions.
Besides conditional and unconditional branch instructions, there are
two case instructions (CSA and CSB),
to allow efficient translation of case statements.
.NH 2
Requirements on the EM input
.PP
As the optimizer should be useful for all languages,
it clearly should not put severe restrictions on the EM code
of the input.
There is, however, one immovable requirement:
it must be possible to determine the \fIflow of control\fR of the
input program.
As virtually all global optimizations are based on control flow information,
the optimizer would be totally powerless without it.
For this reason we restrict the usage of the case jump instructions (CSA/CSB)
of EM.
Such an instruction is always called with the address of a case descriptor
on top the the stack.
.[~[
tanenbaum machine architecture
.] section 7.4]
This descriptor contains the labels of all possible
destinations of the jump.
We demand that all case descriptors are allocated in a global
data fragment of type ROM, i.e. the case descriptors
may not be modifyable.
Furthermore, any case instruction should be immediately preceded by
a LAE (Load Address External) instruction, that loads the
address of the descriptor,
so the descriptor can be uniquely identified.
.PP
The optimizer will work improperly if the user deceives the control flow.
We will give two methods to do this.
.PP
In "C" the notorious library routines "setjmp" and "longjmp"
.[
unix programmer's manual
.]
may be used to jump out of a procedure,
but can also be used for a number of other stuffy purposes,
for example, to create an extra entry point in a loop.
.DS
while (condition) {
....
setjmp(buf);
...
}
...
longjmp(buf);
.DE
The invocation to longjmp actually is a jump to the place of
the last call to setjmp with the same argument (buf).
As the calls to setjmp and longjmp are indistinguishable from
normal procedure calls, the optimizer will not see the danger.
No need to say that several loop optimizations will behave
unexpectedly when presented with such pathological input.
.PP
Another way to deceive the flow of control is
by using exception handling routines.
Ada*
.FS
* Ada is a registered trademark of the U.S. Government
(Ada Joint Program Office).
.FE
has clearly recognized the dangers of exception handling,
but other languages (such as PL/I) have not.
.[
ada rationale
.]
.PP
The optimizer will be more effective if the EM input contains
some extra information about the source program.
Especially the \fIregister message\fR is very important.
These messages indicate which local variables may never be
accessed indirectly.
Most optimizations benefit significantly by this information.
.PP
The Inline Substitution technique needs to know how many bytes
of formal parameters every procedure accesses.
Only calls to procedures for which the EM code contains this information
will be substituted in line.
.NH 2
Structure of the optimizer
.PP
The Global Optimizer is organized as a number of \fIphases\fR,
each one performing some task.
The main structure is as follows:
.IP IC 6
the Intermediate Code construction phase transforms EM into the
intermediate code (ic) of the optimizer
.IP CF
the Control Flow phase extends the ic with control flow
information and interprocedural information
.IP OPTs
zero or more optimization phases, each one performing one or
more related optimizations
.IP CA
the Compact Assembly phase generates Compact Assembly Language EM code
out of ic.
.LP
.PP
An important issue in the design of a global optimizer is the
interaction between optimization techniques.
It is often advantageous to combine several techniques in
one algorithm that takes into account all interactions between them.
Ideally, one single algorithm should be developed that does
all optimizations simultaneously and deals with all possible interactions.
In practice, such an algorithm is still far out of reach.
Instead some rather ad hoc (albeit important) combinations are chosen,
such as Common Subexpression Elimination and Register Allocation.
.[
prabhala sethi common subexpressions
.]
.[
sethi ullman optimal code
.]
.PP
In the Em Global Optimizer there is one separate algorithm for
every technique.
Note that this does not mean that all techniques are independent
of each other.
.PP
In principle, the optimization phases can be run in any order;
a phase may even be run more than once.
However, the following rules should be obeyed:
.IP -
the Live Variable analysis phase (LV) must be run prior to
Register Allocation (RA), as RA uses information outputted by LV.
.IP -
RA should be the last phase; this is a consequence of the way
the interface between RA and the Code Generator is defined.
.LP
The ordering of the phases has significant impact on
the quality of the produced code.
In
.[
wulf overview production quality carnegie-mellon
.]
two kinds of phase ordering problems are distinguished.
If two techniques A and B both take away opportunities of each other,
there is a "negative" ordering problem.
If, on the other hand, both A and B introduce new optimization
opportunities for each other, the problem is called "positive".
In the Global Optimizer the following interactions must be
taken into account:
.IP -
Inline Substitution (IL) may create new opportunities for most
other techniques, so it should be run as early as possible
.IP -
Use Definition analysis (UD) may introduce opportunities for LV.
.IP -
Strength Reduction may create opportunities for UD
.LP
The optimizer has a default phase ordering, which can
be changed by the user.
.NH 2
Structure of this document
.PP
The remaining chapters of this document each describe one
phase of the optimizer.
For every phase, we describe its task, its design,
its implementation, and its source files.
The latter two sections are intended to aid the
maintenance of the optimizer and
can be skipped by the initial reader.
.NH 2
References
.PP
There are very
few modern textbooks on optimization.
Chapters 12, 13, and 14 of
.[
aho compiler design
.]
are a good introduction to the subject.
Wulf et. al.
.[
wulf optimizing compiler
.]
describe one specific optimizing (Bliss) compiler.
Anklam et. al.
.[
anklam vax-11
.]
discuss code generation and optimization in
compilers for one specific machine (a Vax-11).
Kirchgaesner et. al.
.[
optimizing ada compiler
.]
present a brief description of many
optimizations; the report also contains a lengthy (over 60 pages)
bibliography.
.PP
The number of articles on optimization is quite impressive.
The Lowrey and Medlock paper on the Fortran H compiler
.[
object code optimization
.]
is a classical one.
Other papers on global optimization are.
.[
faiman optimizing pascal
.]
.[
perkins sites
.]
.[
harrison general purpose optimizing
.]
.[
morel partial redundancies
.]
.[
Mintz global optimizer
.]
Freudenberger
.[
freudenberger setl optimizer
.]
describes an optimizer for a Very High Level Language (SETL).
The Production-Quality Compiler-Compiler (PQCC) project uses
very sophisticated compiler techniques, as described in.
.[
wulf overview ieee
.]
.[
wulf overview carnegie-mellon
.]
.[
wulf machine-relative
.]
.PP
Several Ph.D. theses are dedicated to optimization.
Davidson
.[
davidson simplifying
.]
outlines a machine-independent peephole optimizer that
improves assembly code.
Katkus
.[
katkus
.]
describes how efficient programs can be obtained at little cost by
optimizing only a small part of a program.
Photopoulos
.[
photopoulos mixed code
.]
discusses the idea of generating interpreted intermediate code as well
as assembly code, to obtain programs that are both small and fast.
Shaffer
.[
shaffer automatic
.]
describes the theory of automatic subroutine generation.
.]
Leverett
.[
leverett register allocation compilers
.]
deals with register allocation in the PQCC compilers.
.PP
References to articles about specific optimization techniques
will be given in later chapters.

4
doc/ego/ra/.distr Normal file
View File

@@ -0,0 +1,4 @@
ra1
ra2
ra3
ra4

33
doc/ego/ra/ra1 Normal file
View File

@@ -0,0 +1,33 @@
.bp
.NH 1
Register Allocation
.NH 2
Introduction
.PP
The efficient usage of the general purpose registers
of the target machine plays a key role in any optimizing compiler.
This subject, often referred to as \fIRegister Allocation\fR,
has great impact on both the code generator and the
optimizing part of such a compiler.
The code generator needs registers for at least the evaluation of
arithmetic expressions;
the optimizer uses the registers to decrease the access costs
of frequently used entities (such as variables).
The design of an optimizing compiler must pay great
attention to the cooperation of optimization, register allocation
and code generation.
.PP
Register allocation has received much attention in literature (see
.[
leverett register allocation compilers
.]
.[
chaitin register coloring
.]
.[
freiburghouse usage counts
.]
and
.[~[
sites register
.]]).

139
doc/ego/ra/ra2 Normal file
View File

@@ -0,0 +1,139 @@
.NH 2
Usage of registers in ACK compilers
.PP
We will first describe the major design decisions
of the Amsterdam Compiler Kit,
as far as they concern register allocation.
Subsequently we will outline
the role of the Global Optimizer in the register
allocation process and the interface
between the code generator and the optimizer.
.NH 3
Usage of registers without the intervention of the Global Optimizer
.PP
Registers are used for two purposes:
.IP 1.
for the evaluation of arithmetic expressions
.IP 2.
to hold local variables, for the duration of the procedure they
are local to.
.LP
It is essential to note that no translation part of the compilers,
except for the code generator, knows anything at all
about the register set of the target computer.
Hence all decisions about registers are ultimately made by
the code generator.
Earlier phases of a compiler can only \fIadvise\fR the code generator.
.PP
The code generator splits the register set into two:
a fixed part for the evaluation of expressions (called \fIscratch\fR
registers) and a fixed part to store local variables.
This partitioning, which depends only on the target computer, significantly
reduces the complexity of register allocation, at the penalty
of some loss of code quality.
.PP
The code generator has some (machine-dependent) knowledge of the access costs
of memory locations and registers and of the costs of saving and
restoring registers. (Registers are always saved by the \fIcalled\fR
procedure).
This knowledge is expressed in a set of procedures for each target machine.
The code generator also knows how many registers there are and of
which type they are.
A register can be of type \fIpointer\fR, \fIfloating point\fR
or \fIgeneral\fR.
.PP
The front ends of the compilers determine which local variables may
be put in a register;
such a variable may never be accessed indirectly (i.e. through a pointer).
The front end also determines the types and sizes of these variables.
The type can be any of the register types or the type \fIloop variable\fR,
which denotes a general-typed variable that is used as loop variable
in a for-statement.
All this information is collected in a \fIregister message\fR in
the EM code.
Such a message is a pseudo EM instruction.
This message also contains a \fIscore\fR field,
indicating how desirable it is to put this variable in a register.
A front end may assign a high score to a variable if it
was declared as a register variable (which is only possible in
some languages, such as "C").
Any compiler phase before the code generator may change this score field,
if it has reason to do so.
The code generator bases its decisions on the information contained
in the register message, most notably on the score.
.PP
If the global optimizer is not used,
the score fields are set by the Peephole Optimizer.
This optimizer simply counts the number of occurrences
of every local (register) variable and adds this count
to the score provided by the front end.
In this way a simple, yet quite effective
register allocation scheme is achieved.
.NH 3
The role of the Global Optimizer
.PP
The Global Optimizer essentially tries to improve the scheme
outlined above.
It uses the following principles for this purpose:
.IP -
Entities are not always assigned a register for the duration
of an entire procedure; smaller regions of the program text
may be considered too.
.IP -
several variables may be put in the same register simultaneously,
provided at most one of them is live at any point.
.IP -
besides local variables, other entities (such as constants and addresses of
variables and procedures) may be put in a register.
.IP -
more accurate cost estimates are used.
.LP
To perform its task, the optimizer must have some
knowledge of the target machine.
.NH 3
The interface between the register allocator and the code generator
.PP
The RA phase of the optimizer must somehow be able to express its
decisions.
Such decisions may look like: 'put constant 1283 in a register from
line 12 to line 40'.
To be precise, RA must be able to tell the code generator to:
.IP -
initialize a register with some value
.IP -
update an entity from a register
.IP -
replace all occurrences of an entity in a certain region
of text by a reference to the register.
.LP
At least three problems occur here: the code generator is only used to
put local variables in registers,
it only assigns a register to a variable for the duration of an entire
procedure and it is not used to have some earlier compiler phase
make all the decisions.
.PP
All problems are solved by one mechanism, that involves no changes
to the code generator.
With every (non-scratch) register R that will be used in
a procedure P, we associate a new variable T, local to P.
The size of T is the same as the size of R.
A register message is generated for T with an exceptionally high score.
The scores of all original register messages are set to zero.
Consequently, the code generator will always assign precisely those new
variables to a register.
If the optimizer wants to put some entity, say the constant 1283, in
a register, it emits the code "T := 1283" and replaces all occurrences
of '1283' by T.
Similarly, it can put the address of a procedure in T and replace all
calls to that procedure by indirect calls.
Furthermore, it can put several different entities in T (and thus in R)
during the lifetime of P.
.PP
In principle, the code generated by the optimizer in this way would
always be valid EM code, even if the optimizer would be presented
a totally wrong description of the target computer register set.
In practice, it would be a waste of data as well as text space to
allocate memory for these new variables, as they will always be assigned
a register (in the correct order of events).
Hence, no memory locations are allocated for them.
For this reason they are called pseudo local variables.

383
doc/ego/ra/ra3 Normal file
View File

@@ -0,0 +1,383 @@
.NH 2
The register allocation phase
.PP
.NH 3
Overview
.PP
The RA phase deals with one procedure at a time.
For every procedure, it first determines which entities
may be put in a register. Such an entity
is called an \fIitem\fR.
For every item it decides during which parts of the procedure it
might be assigned a register.
Such a region is called a \fItimespan\fR.
For any item, several (possibly overlapping) timespans may
be considered.
A pair (item,timespan) is called an \fIallocation\fR.
If the items of two allocations are both live at some
point of time in the intersections of their timespans,
these allocations are said to be \fIrivals\fR of each other,
as they cannot be assigned the same register.
The rivals-set of every allocation is computed.
Next, the gains of assigning a register to an allocation are estimated,
for every allocation.
With all this information, decisions are made which allocations
to store in which registers (\fIpacking\fR).
Finally, the EM text is transformed to reflect these decisions.
.NH 3
The item recognition subphase
.PP
RA tries to put the following entities in a register:
.IP -
a local variable for which a register message was found
.IP -
the address of a local variable for which no
register message was found
.IP -
the address of a global variable
.IP -
the address of a procedure
.IP -
a numeric constant.
.LP
Only the \fIaddress\fR of a global variable
may be put in a register, not the variable itself.
This approach avoids the very complex problems that would be
caused by procedure calls and indirect pointer references (see
.[~[
aho design compiler
.] sections 14.7 and 14.8]
and
.[~[
spillman side-effects
.]]).
Still, on most machines accessing a global variable using indirect
addressing through a register is much cheaper than
accessing it via its address.
Similarly, if the address of a procedure is put in a register, the
procedure can be called via an indirect call.
.PP
With every item we associate a register type.
This type is
.DS
for local variables: the type contained in the register message
for addresses of variables and procedures: the pointer type
for constants: the general type
.DE
An entity other than a local variable is not taken to be an item
if it is used only once within the current procedure.
.PP
An item is said to be \fIlive\fR at some point of the program text
if its value may be used before it is changed.
As addresses and constants are never changed, all items but local
variables are always live.
The region of text during which a local variable is live is
determined via the live/dead messages generated by the
Live Variable analysis phase of the Global Optimizer.
.NH 3
The allocation determination subphase
.PP
If a procedure has more items than registers,
it may be advantageous to put an item in a register
only during those parts of the procedure where it is most
heavily used.
Such a part will be called a timespan.
With every item we may associate a set of timespans.
If two timespans of an item overlap,
at most one of them may be granted a register,
as there is no use in putting the same item in two
registers simultaneously.
If two timespans of an item are distinct,
both may be chosen;
the item will possibly be put in two
different registers during different parts of the procedure.
The timespan may also consist
of the whole procedure.
.PP
A list of (item,timespan) pairs (allocations)
is build, which will be the input to the decision making
subphase of RA (packing subphase).
This allocation list is the main data structure of RA.
The description of the remainder of RA will be in terms
of allocations rather than items.
The phrase "to assign a register to an allocation" means "to assign
a register to the item of the allocation for the duration of
the timespan of the allocation".
Subsequent subphases will add more information
to this list.
.PP
Several factors must be taken into account when a
timespan for an item is constructed:
.IP 1.
At any \fIentry point\fR of the timespan where the
item is live,
the register must be initialized with the item
.IP 2.
At any exit point of the timespan where the item is live,
the item must be updated.
.LP
In order to decrease these costs, we will only consider timespans with
one entry point
and no live exit points.
.NH 3
The rivals computation subphase
.PP
As stated before, several different items may be put in the
same register, provided they are not live simultaneously.
For every allocation we determine the intersection
of its timespan and the lifetime of its item (i.e. the part of the
procedure during which the item is live).
The allocation is said to be busy during this intersection.
If two allocations are ever busy simultaneously they are
said to be rivals of each other.
The rivals information is added to the allocation list.
.NH 3
The profits computation subphase
.PP
To make good decisions, the packing subphase needs to
know which allocations can be assigned the same register
(rivals information) and how much is gained by
granting an allocation a register.
.PP
Besides the gains of using a register instead of an
item,
two kinds of overhead costs must be
taken into account:
.IP -
the register must be initialized with the item
.IP -
the register must be saved at procedure entry
and restored at procedure exit.
.LP
The latter costs should not be due to a single
allocation, as several allocations can be assigned the same register.
These costs are dealt with after packing has been done.
They do not influence the decisions of the packing algorithm,
they may only undo them.
.PP
The actual profits consist of improvements
of execution time and code size.
As the former is far more difficult to estimate , we will
discuss code size improvements first.
.PP
The gains of putting a certain item in a register
depends on how the item is used.
Suppose the item is
a pointer variable.
On machines that do not have a
double-indirect addressing mode,
two instructions are needed to dereference the variable
if it is not in a register, but only one if it is put in a register.
If the variable is not dereferenced, but simply copied, one instruction
may be sufficient in both cases.
So the gains of putting a pointer variable in a register are higher
if the variable is dereferenced often.
.PP
To make accurate estimates, detailed knowledge of
the target machine and of the code generator
would be needed.
Therefore, a simplification has been made that substantially limits
the amount of target machine information that is needed.
The estimation of the number of bytes saved does
not take into account how an item is used.
Rather, an average number is used.
So these gains are computed as follows:
.DS
#bytes_saved = #occurrences * gains_per_occurrence
.DE
The number of occurrences is derived from
the EM code.
Note that this is not exact either,
as there is no one-to-one correspondence between occurrences in
the EM code and in the assembler code.
.PP
The gains of one occurrence depend on:
.IP 1.
the type of the item
.IP 2.
the size of the item
.IP 3.
the type of the register
.LP
and for local variables and addresses of local variables:
.IP 4.
the type of the local variable
.IP 5.
the offset of the variable in the stackframe
.LP
For every allocation we try two types of registers: the register type
of the item and the general register type.
Only the type with the highest profits will subsequently be used.
This type is added to the allocation information.
.PP
To compute the gains, RA uses a machine-dependent table
that is read from a machine descriptor file.
By means of this table the number of bytes saved can be computed
as a function of the five properties.
.PP
The costs of initializing a register with an item
is determined in a similar way.
The cost of one initialization is also
obtained from the descriptor file.
Note that there can be at most one initialization for any
allocation.
.PP
To summarize, the number of bytes a certain allocation would
save is computed as follows:
.DS
net_bytes_saved = bytes_saved - init_cost
bytes_saved = #occurrences * gains_per_occ
init_cost = #initializations * costs_per_init
.DE
.PP
It is inherently more difficult to estimate the execution
time saved by putting an item in a register,
because it is impossible to predict how
many times an item will be used dynamically.
If an occurrence is part of a loop,
it may be executed many times.
If it is part of a conditional statement,
it may never be executed at all.
In the latter case, the speed of the program may even get
worse if an initialization is needed.
As a clear example, consider the piece of "C" code in Fig. 13.1.
.DS
switch(expr) {
case 1: p(); break;
case 2: p(); p(); break;
case 3: p(); break;
default: break;
}
Fig. 13.1 A "C" switch statement
.DE
Lots of bytes may be saved by putting the address of procedure p
in a register, as p is called four times (statically).
Dynamically, p will be called zero, one or two times,
depending on the value of the expression.
.PP
The optimizer uses the following strategy for optimizing
execution time:
.IP 1.
try to put items in registers during \fIloops\fR first
.IP 2.
always keep the initializing code outside the loop
.IP 3.
if an item is not used in a loop, do not put it in a register if
the initialization costs may be higher than the gains
.LP
The latter condition can be checked by determining the
minimal number of usages (dynamically) of the item during the procedure,
via a shortest path algorithm.
In the example above, this minimal number is zero, so the address of
p is not put in a register.
.PP
The costs of one occurrence is estimated as described above for the
code size.
The number of dynamic occurrences is guessed by looking at the
loop nesting level of every occurrence.
If the item is never used in a loop,
the minimal number of occurrences is used.
From these facts, the execution time improvement is assessed
for every allocation.
.NH 3
The packing subphase
.PP
The packing subphase takes as input the allocation
list and outputs a
description of which allocations should be put
in which registers.
So it is essentially the decision making part of RA.
.PP
The packing system tries to assign a register to allocations one
at a time, in some yet to be defined order.
For every allocation A, it first checks if there is a register
(of the right type)
that is already assigned to one or more allocations,
none of which are rivals of A.
In this case A is assigned the same register.
Else, A is assigned a new register, if one exists.
A table containing the number of free registers for every type
is maintained.
It is initialized with the number of non-scratch registers of
the target computer and updated whenever a
new register is handed out.
The packing algorithm stops when no more allocations can
or need be assigned a register.
.PP
After an allocation A has been packed,
all allocations with non-disjunct timespans (including
A itself) are removed from the allocation list.
.PP
In case the number of items exceeds the number of registers, it
is important to choose the most profitable allocations.
Due to the possibility of having several allocations
occupying the same register,
this problem is quite complex.
Our packing algorithm uses simple heuristic rules
and avoids any combinatorial search.
It has distinct rules for different costs measures.
.PP
If object code size is the most important factor,
the algorithm is greedy and chooses allocations in
decreasing order of their profits attribute.
It does not take into account the fact that
other allocations may be passed over because of
this decision.
.PP
If execution time is at prime stake, the algorithm
first considers allocations whose timespans consist of loops.
After all these have been packed, it considers the remaining
allocations.
Within the two subclasses, it considers allocations
with the highest profits first.
When assigning a register to an allocation with a loop
as timespan, the algorithm checks if the item has
already been put in a register during another loop.
If so, it tries to use the same register for the
new allocation.
After all packing has been done,
it checks if the item has always been assigned the same
register (although not necessarily during all loops).
If so, it tries to put the item in that register during
the entire procedure. This is possible
if the allocation (item,whole_procedure) is not a rival
of any allocation with a different item that has been
assigned to the same register.
Note that this approach is essentially 'bottom up',
as registers are first assigned over small regions
of text which are later collapsed into larger regions.
The advantage of this approach is the fact that
the decisions for one loop can be made independently
of all other loops.
.PP
After the entire packing process has been completed,
we compute for each register how much is gained in using
this register, by simply adding the net profits
of all allocations assigned to it.
This total yield should outweigh the costs of
saving/restoring the register at procedure entry/exit.
As most modern processors (e.g. 68000, Vax) have special
instructions to save/restore several registers,
the differential costs of saving one extra register are by
no means constant.
The costs are read from the machine descriptor file and
compared to the total yields of the registers.
As a consequence of this analysis, some allocations
may have their registers taken away.
.NH 3
The transformation subphase
.PP
The final subphase of RA transforms the EM text according to the
decisions made by the packing system.
It traverses the text of the currently optimized procedure and
changes all occurrences of items at points where
they are assigned a register.
It also clears the score field of the register messages for
normal local variables and emits register messages with a very
high score for the pseudo locals.
At points where registers have to be initialized with items,
it generates EM code to do so.
Finally it tries to decrease the size of the stackframe
of the procedure by looking at which local variables need not
be given memory locations.

28
doc/ego/ra/ra4 Normal file
View File

@@ -0,0 +1,28 @@
.NH 2
Source files of RA
.PP
The sources of RA are in the following files and packages:
.IP ra.h: 14
declarations of global variables and data structures
.IP ra.c:
the routine main; initialization of target machine-dependent tables
.IP items:
a routine to build the list of items of one procedure;
routines to manipulate items
.IP lifetime:
contains a subroutine that determines when items are live/dead
.IP alloclist:
contains subroutines that build the initial allocations list
and that compute the rivals sets.
.IP profits:
contains a subroutine that computes the profits of the allocations
and a routine that determines the costs of saving/restoring registers
.IP pack:
contains the packing subphase
.IP xform:
contains the transformation subphase
.IP interval:
contains routines to manipulate intervals of time
.IP aux:
contains auxiliary routines
.LP

120
doc/ego/refs.gen Normal file
View File

@@ -0,0 +1,120 @@
%T A Practical Toolkit for Making Portable Compilers
%A A.S. Tanenbaum
%A H. van Staveren
%A E.G. Keizer
%A J.W. Stevenson
%I Vrije Universiteit, Amsterdam
%R Rapport nr IR-74
%D October 1981
%T A Practical Toolkit for Making Portable Compilers
%A A.S. Tanenbaum
%A H. van Staveren
%A E.G. Keizer
%A J.W. Stevenson
%J CACM
%V 26
%N 9
%P 654-660
%D September 1983
%T A Unix Toolkit for Making Portable Compilers
%A A.S. Tanenbaum
%A H. van Staveren
%A E.G. Keizer
%A J.W. Stevenson
%J Proceedings USENIX conf.
%C Toronto, Canada
%V 26
%D July 1983
%P 255-261
%T Using Peephole Optimization on Intermediate Code
%A A.S. Tanenbaum
%A H. van Staveren
%A J.W. Stevenson
%J TOPLAS
%V 4
%N 1
%P 21-36
%D January 1982
%T Language- and Machine-independent Global Optimization on Intermediate Code
%A H.E. Bal
%A A.S. Tanenbaum
%J Computer Languages
%V 11
%N 2
%P 105-121
%D April 1986
%T Description of a machine architecture for use with
block structured languages
%A A.S. Tanenbaum
%A H. van Staveren
%A E.G. Keizer
%A J.W. Stevenson
%I Vrije Universiteit, Amsterdam
%R Rapport nr IR-81
%D August 1983
%T Amsterdam Compiler Kit documentation
%A A.S. Tanenbaum et. al.
%I Vrije Universiteit, Amsterdam
%R Rapport nr IR-90
%D June 1984
%T The C Programming Language - Reference Manual
%A D.M. Ritchie
%I Bell Laboratories
%C Murray Hill, New Jersey
%D 1978
%T Unix programmer's manual, Seventh Edition
%A B.W. Kernighan
%A M.D. McIlroy
%I Bell Laboratories
%C Murray Hill, New Jersey
%V 1
%D January 1979
%T A Tour Through the Portable C Compiler
%A S.C. Johnson
%I Bell Laboratories
%B Unix programmer's manual, Seventh Edition
%C Murray Hill, New Jersey
%D January 1979
%T Ada Programming Language - MILITARY STANDARD
%A J.D. Ichbiah
%I U.S. Department of Defense
%R ANSI/MIL-STD-1815A
%D 22 January 1983
%T Rationale for the Design of the Ada Programming Language
%A J.D. Ichbiah
%J SIGPLAN Notices
%V 14
%N 6
%D June 1979
%T The Programming Languages LISP and TRAC
%A W.L. van der Poel
%I Technische Hogeschool Delft
%C Delft
%D 1972
%T Compiler construction
%A W.M. Waite
%A G. Goos
%I Springer-Verlag
%C New York
%D 1984
%T The C Programming Language
%A B.W. Kernighan
%A D.M. Ritchie
%I Prentice-Hall, Inc
%C Englewood Cliffs,NJ
%D 1978

546
doc/ego/refs.opt Normal file
View File

@@ -0,0 +1,546 @@
%T Principles of compiler design
%A A.V. Aho
%A J.D. Ullman
%I Addison-Wesley
%C Reading, Massachusetts
%D 1978
%T The Design and Analysis of Computer Algorithms
%A A.V. Aho
%A J.E. Hopcroft
%A J.D. Ullman
%I Addison-Wesley
%C Reading, Massachusetts
%D 1974
%T Code generation in a machine-independent compiler
%A R.G.G. Cattell
%A J.M. Newcomer
%A B.W. Leverett
%J SIGPLAN Notices
%V 14
%N 8
%P 65-75
%D August 1979
%T An algorithm for Reduction of Operator Strength
%A J. Cocke
%A K. Kennedy
%J CACM
%V 20
%N 11
%P 850-856
%D November 1977
%T Reduction of Operator Strength
%A F.E. Allen
%A J. Cocke
%A K. Kennedy
%B Program Flow Analysis
%E S.S. Muchnick and D. Jones
%I Prentice-Hall
%C Englewood Cliffs, N.J.
%D 1981
%T Simplifying Code Generation Through Peephole Optimization
%A J.W. Davidson
%R Ph.D. thesis
%I Dept. of Computer Science
%C Univ. of Arizona
%D December 1981
%T A study of selective optimization techniques
%A G.R. Katkus
%R Ph.D. Thesis
%C University of Southern California
%D 1973
%T Automatic subroutine generation in an optimizing compiler
%A J.B. Shaffer
%R Ph.D. Thesis
%C University of Maryland
%D 1978
%T Optimal mixed code generation for microcomputers
%A D.S. Photopoulos
%R Ph.D. Thesis
%C Northeastern University
%D 1981
%T The Design of an Optimizing Compiler
%A W.A. Wulf
%A R.K. Johnsson
%A C.B. Weinstock
%A S.O. Hobbs
%A C.M. Geschke
%I American Elsevier Publishing Company
%C New York
%D 1975
%T Retargetable Compiler Code Generation
%A M. Ganapathi
%A C.N. Fischer
%A J.L. Hennessy
%J ACM Computing Surveys
%V 14
%N 4
%P 573-592
%D December 1982
%T An Optimizing Pascal Compiler
%A R.N. Faiman
%A A.A. Kortesoja
%J IEEE Trans. on Softw. Eng.
%V 6
%N 6
%P 512-518
%D November 1980
%T Experience with the SETL Optimizer
%A S.M. Freudenberger
%A J.T. Schwartz
%J TOPLAS
%V 5
%N 1
%P 26-45
%D Januari 1983
%T An Optimizing Ada Compiler
%A W. Kirchgaesner
%A J. Uhl
%A G. Winterstein
%A G. Goos
%A M. Dausmann
%A S. Drossopoulou
%I Institut fur Informatik II, Universitat Karlsruhe
%D February 1983
%T A Fast Algorithm for Finding Dominators
in a Flowgraph
%A T. Lengauer
%A R.E. Tarjan
%J TOPLAS
%V 1
%N 1
%P 121-141
%D July 1979
%T Optimization of hierarchical directed graphs
%A M.T. Lepage
%A D.T. Barnard
%A A. Rudmik
%J Computer Languages
%V 6
%N 1
%P 19-34
%D Januari 1981
%T Object Code Optimization
%A E.S. Lowry
%A C.W. Medlock
%J CACM
%V 12
%N 1
%P 13-22
%D Januari 1969
%T Automatic Program Improvement:
Variable Usage Transformations
%A B. Maher
%A D.H. Sleeman
%J TOPLAS
%V 5
%N 2
%P 236-264
%D April 1983
%T The design of a global optimizer
%A R.J. Mintz
%A G.A. Fisher
%A M. Sharir
%J SIGPLAN Notices
%V 14
%N 9
%P 226-234
%D September 1979
%T Global Optimization by Suppression of Partial Redundancies
%A E. Morel
%A C. Renvoise
%J CACM
%V 22
%N 2
%P 96-103
%D February 1979
%T Efficient Computation of Expressions with Common Subexpressions
%A B. Prabhala
%A R. Sethi
%J JACM
%V 27
%N 1
%P 146-163
%D Januari 1980
%T An Analysis of Inline Substitution for a Structured
Programming Language
%A R.W. Scheifler
%J CACM
%V 20
%N 9
%P 647-654
%D September 1977
%T Immediate Predominators in a Directed Graph
%A P.W. Purdom
%A E.F. Moore
%J CACM
%V 15
%N 8
%P 777-778
%D August 1972
%T The Generation of Optimal Code for Arithmetic Expressions
%A R. Sethi
%A J.D. Ullman
%J JACM
%V 17
%N 4
%P 715-728
%D October 1970
%T Exposing side-effects in a PL/I optimizing compiler
%A T.C. Spillman
%B Information Processing 1971
%I North-Holland Publishing Company
%C Amsterdam
%P 376-381
%D 1971
%T Inner Loops in Flowgraphs and Code Optimization
%A S. Vasudevan
%J Acta Informatica
%N 17
%P 143-155
%D 1982
%T A New Strategy for Code Generation - the General-Purpose
Optimizing Compiler
%A W.H. Harrison
%J IEEE Trans. on Softw. Eng.
%V 5
%N 4
%P 367-373
%D July 1979
%T PQCC: A Machine-Relative Compiler Technology
%A W.M. Wulf
%R CMU-CS-80-144
%I Carnegie-Mellon University
%C Pittsburgh
%D 25 september 1980
%T Machine-independent Pascal code optimization
%A D.R. Perkins
%A R.L. Sites
%J SIGPLAN Notices
%V 14
%N 8
%P 201-207
%D August 1979
%T A Case Study of a New Code Generation Technique for Compilers
%A J.L. Carter
%J CACM
%V 20
%N 12
%P 914-920
%D December 1977
%T Table-driven Code Generation
%A S.L. Graham
%J IEEE Computer
%V 13
%N 8
%P 25-33
%D August 1980
%T Register Allocation in Optimizing Compilers
%A B.W. Leverett
%R Ph.D. Thesis, CMU-CS-81-103
%I Carnegie-Mellon University
%C Pittsburgh
%D February 1981
%T Register Allocation via Coloring
%A G.J. Chaitin
%A M.A. Auslander
%A A.K. Chandra
%A J. Cocke
%A M.E. Hopkins
%A P.W. Markstein
%J Computer Languages
%V 6
%N 1
%P 47-57
%D January 1981
%T How to Call Procedures, or Second Thoughts on
Ackermann's Function
%A B.A. Wichmann
%J Software - Practice and Experience
%V 7
%P 317-329
%D 1977
%T Register Allocation Via Usage Counts
%A R.A. Freiburghouse
%J CACM
%V 17
%N 11
%P 638-642
%D November 1974
%T Machine-independent register allocation
%A R.L. Sites
%J SIGPLAN Notices
%V 14
%N 8
%P 221-225
%D August 1979
%T An Overview of the Production-Quality Compiler-Compiler Project
%A B.W. Leverett
%A R.G.G Cattell
%A S.O. Hobbs
%A J.M. Newcomer
%A A.H. Reiner
%A B.R. Schatz
%A W.A. Wulf
%J IEEE Computer
%V 13
%N 8
%P 38-49
%D August 1980
%T An Overview of the Production-Quality Compiler-Compiler Project
%A B.W. Leverett
%A R.G.G Cattell
%A S.O. Hobbs
%A J.M. Newcomer
%A A.H. Reiner
%A B.R. Schatz
%A W.A. Wulf
%R CMU-CS-79-105
%I Carnegie-Mellon University
%C Pittsburgh
%D 1979
%T Topics in Code Generation and Register Allocation
%A B.W. Leverett
%R CMU-CS-82-130
%I Carnegie-Mellon University
%C Pittsburgh
%D 28 July 1982
%T Predicting the Effects of Optimization on a Procedure Body
%A J.E. Ball
%J SIGPLAN Notices
%V 14
%N 8
%P 214-220
%D August 1979
%T The C Language Calling Sequence
%A S.C. Johnson
%A D.M. Ritchie
%I Bell Laboratories
%C Murray Hill, New Jersey
%D September 1981
%T A Generalization of Two Code Ordering Optimizations
%A C.W. Fraser
%R TR 82-11
%I Department of Computer Science
%C The University of Arizona, Tucson
%D October 1982
%T A Survey of Data Flow Analysis Techniques
%A K. Kennedy
%B Program Flow Analysis
%E S.S. Muchnick and D. Jones
%I Prentice-Hall
%C Englewood Cliffs
%D 1981
%T Delayed Binding in PQCC Generated Compilers
%A W.A. Wulf
%A K.V. Nori
%R CMU-CS-82-138
%I Carnegie-Mellon University
%C Pittsburgh
%D 1982
%T Interprocedural Data Flow Analysis in the presence
of Pointers, Procedure Variables, and Label Variables
%A W.E. Weihl
%J Conf. Rec. of the 7th ACM Symp. on Principles of
Programming Languages
%C Las Vegas, Nevada
%P 83-94
%D 1980
%T Low-Cost, High-Yield Code Optimization
%A D.R. Hanson
%R TR 82-17
%I Department of Computer Science
%C The University of Arizona, Tucson
%D November 1982
%T Program Flow Analysis
%E S.S. Muchnick and D. Jones
%I Prentice-Hall
%C Englewood Cliffs
%D 1981
%T A machine independent algorithm for code generation and its
use in retargetable compilers
%A R. Glanville
%R Ph.D. thesis
%C University of California, Berkeley
%D December 1977
%T A formal framework for the derivation of machine-specific optimizers
%A R. Giegerich
%J TOPLAS
%V 5
%N 3
%P 478-498
%D July 1983
%T Engineering a compiler: Vax-11 code generation and optimization
%A P. Anklam
%A D. Cutler
%A R. Heinen
%A M. MacLaren
%I Digital Equipment Corporation
%D 1982
%T Analyzing exotic instructions for a retargetable code generator
%A T.M. Morgan
%A L.A. Rowe
%J SIGPLAN Notices
%V 17
%N 6
%P 197-204
%D June 1982
%T TCOLAda and the Middle End of the PQCC Ada Compiler
%A B.M. Brosgol
%J SIGPLAN Notices
%V 15
%N 11
%P 101-112
%D November 1980
%T Implementation Implications of Ada Generics
%A G. Bray
%J Ada Letters
%V III
%N 2
%P 62-71
%D September 1983
%T Attributed Linear Intermediate Representations for Retargetable
Code Generators
%A M. Ganapathi
%A C.N. Fischer
%J Software-Practice and Experience
%V 14
%N 4
%P 347-364
%D April 1984
%T UNCOL: The myth and the fact
%A T.B. Steel
%J Annu. Rev. Autom. Program.
%V 2
%D 1960
%P 325-344
%T Experience with a Graham-Glanville Style Code Generator
%A P. Aigrain
%A S.L. Graham
%A R.R. Henry
%A M.K. McKusick
%A E.P. Llopart
%J SIGPLAN Notices
%V 19
%N 6
%D June 1984
%P 13-24
%T Using Dynamic Programming to generate Optimized Code in a
Graham-Glanville Style Code Generator
%A T.W. Christopher
%A P.J. Hatcher
%A R.C. Kukuk
%J SIGPLAN Notices
%V 19
%N 6
%D June 1984
%P 25-36
%T Peep - An Architectural Description Driven Peephole Optimizer
%A R.R. Kessler
%J SIGPLAN Notices
%V 19
%N 6
%D June 1984
%P 106-110
%T Automatic Generation of Peephole Optimizations
%A J.W. Davidson
%A C.W. Fraser
%J SIGPLAN Notices
%V 19
%N 6
%D June 1984
%P 111-116
%T Analysing and Compressing Assembly Code
%A C.W. Fraser
%A E.W. Myers
%A A.L. Wendt
%J SIGPLAN Notices
%V 19
%N 6
%D June 1984
%P 117-121
%T Register Allocation by Priority-based Coloring
%A F. Chow
%A J. Hennessy
%J SIGPLAN Notices
%V 19
%N 6
%D June 1984
%P 222-232
%V 19
%N 6
%D June 1984
%P 117-121
%T Code Selection through Object Code Optimization
%A J.W. Davidson
%A C.W. Fraser
%I Dept. of Computer Science
%C Univ. of Arizona
%D November 1981
%T A Portable Machine-Independent Global Optimizer - Design
and Measurements
%A F.C. Chow
%I Computer Systems Laboratory
%C Stanford University
%D December 1983

29
doc/ego/refs.stat Normal file
View File

@@ -0,0 +1,29 @@
%T An analysis of Pascal Programs
%A L.R. Carter
%I UMI Research Press
%C Ann Arbor, Michigan
%D 1982
%T An Emperical Study of FORTRAN Programs
%A D.E. Knuth
%J Software - Practice and Experience
%V 1
%P 105-133
%D 1971
%T F77 Performance
%A D.A. Mosher
%A R.P. Corbett
%J ;login:
%V 7
%N 3
%D June 1982
%T Ada Language Statistics for the iMAX 432 Operating System
%A S.F. Zeigler
%A R.P. Weicker
%J Ada LETTERS
%V 2
%N 6
%P 63-67
%D May 1983

1
doc/ego/sp/.distr Normal file
View File

@@ -0,0 +1 @@
sp1

171
doc/ego/sp/sp1 Normal file
View File

@@ -0,0 +1,171 @@
.bp
.NH 1
Stack pollution
.NH 2
Introduction
.PP
The "Stack Pollution" optimization technique (SP) decreases the costs
(time as well as space) of procedure calls.
In the EM calling sequence, the actual parameters are popped from
the stack by the \fIcalling\fR procedure.
The ASP (Adjust Stack Pointer) instruction is used for this purpose.
A call in EM is shown in Fig. 8.1
.DS
Pascal: EM:
f(a,2) LOC 2
LOE A
CAL F
ASP 4 -- pop 4 bytes
Fig. 8.1 An example procedure call in Pascal and EM
.DE
As procedure calls occur often in most programs,
the ASP is one of the most frequently used EM instructions.
.PP
The main intention of removing the actual parameters after a procedure call
is to avoid the stack size to increase rapidly.
Yet, in some cases, it is possible to \fIdelay\fR or even \fIavoid\fR the
removal of the parameters without letting the stack grow
significantly.
In this way, considerable savings in code size and execution time may
be achieved, at the cost of a slightly increased stack size.
.PP
A stack adjustment may be delayed if there is some other stack adjustment
later on in the same basic block.
The two ASPs can be combined into one.
.DS
Pascal: EM: optimized EM:
f(a,2) LOC 2 LOC 2
g(3,b,c) LOE A LOE A
CAL F CAL F
ASP 4 LOE C
LOE C LOE B
LOE B LOC 3
LOC 3 CAL G
CAL G ASP 10
ASP 6
Fig. 8.2 An example of local Stack Pollution
.DE
The stacksize will be increased only temporarily.
If the basic block contains another ASP, the ASP 10 may subsequently be
combined with that next ASP, and so on.
.PP
For some back ends, a stack adjustment also takes place
at the point of a procedure return.
There is no need to specify the number of bytes to be popped at a
return.
This provides an opportunity to remove ASPs more globally.
If all ASPs outside any loop are removed, the increase of the
stack size will still only be small, as no such ASP is executed more
than once without an intervening return from the procedure it is part of.
.PP
This second approach is not generally applicable to all target machines,
as some back ends require the stack to be cleaned up at the point of
a procedure return.
.NH 2
Implementation
.PP
There is one main problem the implementation has to solve.
In EM, the stack is not only used for passing parameters,
but also for evaluating expressions.
Hence, ASP instructions can only be combined or removed
if certain conditions are satisfied.
.PP
Two consecutive ASPs of one basic block can only be combined
(as described above) if:
.IP 1.
On no point of text in between the two ASPs, any item is popped from
the stack that was pushed onto it before the first ASP.
.IP 2.
The number of bytes popped from the stack by the second ASP must equal
the number of bytes pushed since the first ASP.
.LP
Condition 1. is not satisfied in Fig. 8.3.
.DS
Pascal: EM:
5 + f(10) + g(30) LOC 5
LOC 10
CAL F
ASP 2 -- cannot be removed
LFR 2 -- push function result
ADI 2
LOC 30
CAL G
ASP 2
LFR 2
ADI 2
Fig. 8.3 An illegal transformation
.DE
If the first ASP were removed (delayed), the first ADI would add
10 and f(10), instead of 5 and f(10).
.sp
Condition 2. is not satisfied in Fig. 8.4.
.DS
Pascal: EM:
f(10) + 5 * g(30) LOC 10
CAL F
ASP 2
LFR 2
LOC 5
LOC 30
CAL G
ASP 2
LFR 2
MLI 2 -- 5 * g(30)
ADI 2
Fig. 8.4 A second illegal transformation
.DE
If the two ASPs were combined into one 'ASP 4', the constant 5 would
have been popped, rather than the parameter 10 (so '10 + f(10)*g(30)'
would have been computed).
.PP
The second approach to deleting ASPs (i.e. let the procedure return
do the stack clean-up)
is only applied to the last ASP of every basic block.
Any preceding ASPs are dealt with by the first approach.
The last ASP of a basic block B will only be removed if:
.IP -
on no path in the control flow graph from B to any block containing a
RET (return) there is a basic block that, at some point of its text, pops
items from the stack that it has not itself pushed earlier.
.LP
Clearly, if this condition is satisfied, no harm can be done; no
other basic block will ever access items that were pushed
on the stack before the ASP.
.PP
The number of bytes pushed onto or popped from the stack can be
easily encoded in a so called "pop-push table".
The numbers in general depend on the target machine word- and pointer
size and on the argument given to the instruction.
For example, an ADS instruction is described by:
.DS
-a-p+p
.DE
which means: an 'ADS n' first pops an n-byte value (n being the argument),
next pops a pointer-size value and finally pushes a pointer-size value.
For some infrequently used EM instructions the pop-push numbers
cannot be computed statically.
.PP
The stack pollution algorithm first performs a depth first search over
the control flow graph and marks all blocks that do not satisfy
the global condition.
Next it visits all basic blocks in turn.
For every pair of adjacent ASPs, it checks conditions 1. and 2. and
combines the ASPs if they are satisfied.
The new ASP may be used as first ASP in the next pair.
If a condition fails, it simply continues with the next ASP.
Finally, the last ASP is removed if:
.IP -
nothing has been popped from the stack after the last ASP that was
pushed before it
.IP -
the block was not marked by the depth first search
.IP -
the block is not in a loop
.LP

4
doc/ego/sr/.distr Normal file
View File

@@ -0,0 +1,4 @@
sr1
sr2
sr3
sr4

44
doc/ego/sr/sr1 Normal file
View File

@@ -0,0 +1,44 @@
.bp
.NH 1
Strength reduction
.NH 2
Introduction
.PP
The Strength Reduction optimization technique (SR)
tries to replace expensive operators
by cheaper ones,
in order to decrease the execution time
of the program.
A classical example is replacing a 'multiplication by 2'
by an addition or a shift instruction.
These kinds of local transformations are already
done by the EM Peephole Optimizer.
Strength reduction can also be applied
more generally to operators used in a loop.
.DS
i := 1; i := 1;
while i < 100 loop --> TMP := i * 118;
put(i * 118); while i < 100 loop
i := i + 1; put(TMP);
end loop; i := i + 1;
TMP := TMP + 118;
end loop;
Fig. 6.1 An example of Strenght Reduction
.DE
In Fig. 6.1, a multiplication inside a loop is
replaced by an addition inside the loop and a multiplication
outside the loop.
Clearly, this is a global optimization; it cannot
be done by a peephole optimizer.
.PP
In some cases a related technique, \fItest replacement\fR,
can be used to eliminate the
loop variable i.
This technique will not be discussed in this report.
.sp 0
In the example above, the resulting code
can be further optimized by using
constant propagation.
Obviously, this is not the task of the
Strength Reduction phase.

217
doc/ego/sr/sr2 Normal file
View File

@@ -0,0 +1,217 @@
.NH 2
The model of strength reduction
.PP
In this section we will describe
the transformations performed by
Strength Reduction (SR).
Before doing so, we will introduce the
central notion of an induction variable.
.NH 3
Induction variables
.PP
SR looks for variables whose
values form an arithmetic progression
at the beginning of a loop.
These variables are called induction variables.
The most frequently occurring example of such
a variable is a loop-variable in a high-order
programming language.
Several quite sophisticated models of strength
reduction can be found in the literature.
.[
cocke reduction strength cacm
.]
.[
allen cocke kennedy reduction strength
.]
.[
lowry medlock cacm
.]
.[
aho compiler design
.]
In these models the notion of an induction variable
is far more general than the intuitive notion
of a loop-variable.
The definition of an induction variable we present here
is more restricted,
yielding a simpler model and simpler transformations.
We think the principle source for strength reduction lies in
expressions using a loop-variable,
i.e. a variable that is incremented or decremented
by the same amount after every loop iteration,
and that cannot be changed in any other way.
.PP
Of course, the EM code does not contain high level constructs
such as for-statements.
We will define an induction variable in terms
of the Intermediate Code of the optimizer.
Note that the notions of a loop in the
EM text and of a firm basic block
were defined in section 3.3.5.
.sp
.UL definition
.sp 0
An induction variable i of a loop L is a local variable
that is never accessed indirectly,
whose size is the word size of the target machine, and
that is assigned exactly once within L,
the assignment:
.IP -
being of the form i := i + c or i := c +i,
c is a constant
called the \fIstep value\fR of i.
.IP -
occurring in a firm block of L.
.LP
(Note that the first restriction on the assignment
is not described in terms of the Intermediate Code;
we will give such a description later; the current
definition is easier to understand however).
.NH 3
Recognized expressions
.PP
SR recognizes certain expressions using
an induction variable and replaces
them by cheaper ones.
Two kinds of expensive operations are recognized:
multiplication and array address computations.
The expressions that are simplified must
use an induction variable
as an operand of
a multiplication or as index in an array expression.
.PP
Often a linear function of an induction variable is used,
rather than the variable itself.
In these cases optimization is still possible.
We call such expressions \fIiv-expressions\fR.
.sp
.UL definition:
.sp 0
An iv-expression of an induction variable i of a loop L is
an expression that:
.IP -
uses only the operators + and - (unary as well as binary)
.IP -
uses i as operand exactly once
.IP -
uses (besides i) only constants or variables that are
never changed in L as operands.
.LP
.PP
The expressions recognized by SR are of the following forms:
.IP (1)
iv_expression * constant
.IP (2)
constant * iv_expression
.IP (3)
A[iv-expression] := (assign to array element)
.IP (4)
A[iv-expression] (use array element)
.IP (5)
& A[iv-expression] (take address of array element)
.LP
(Note that EM has different instructions to use an array element,
store into one, or take the address of one, resp. LAR, SAR, and AAR).
.sp 0
The size of the elements of A must
be known statically.
In cases (3) and (4) this size
must equal the word size of the
target machine.
.NH 3
Transformations
.PP
With every recognized expression we associate
a new temporary local variable TMP,
allocated in the stack frame of the
procedure containing the expression.
At any program point within the loop, TMP will
contain the following value:
.IP multiplication: 18
the current value of iv-expression * constant
.IP arrays:
the current value of &A[iv-expression].
.LP
In the second case, TMP essentially is a pointer variable,
pointing to the element of A that is currently in use.
.sp 0
If the same expression occurs several times in the loop,
the same temporary local is used each time.
.PP
Three transformations are applied to the EM text:
.IP (1)
TMP is initialized with the right value.
This initialization takes place just
before the loop.
.IP (2)
The recognized expression is simplified.
.IP (3)
TMP is incremented; this takes place just
after the induction variable is incremented.
.LP
For multiplication, the initial value of TMP
is the value of the recognized expression at
the program point immediately before the loop.
For arrays, TMP is initialized with the address
of the first array element that is accessed.
So the initialization code is:
.DS
TMP := iv-expression * constant; or
TMP := &A[iv-expression]
.DE
At the point immediately before the loop,
the induction variable will already have been
initialized,
so the value used in the code above will be the
value it has during the first iteration.
.PP
For multiplication, the recognized expression can simply be
replaced by TMP.
For array optimizations, the replacement
depends on the form:
.DS
\fIform\fR \fIreplacement\fR
(3) A[iv-expr] := *TMP := (assign indirect)
(4) A[iv-expr] *TMP (use indirect)
(5) &A[iv-expr] TMP
.DE
The '*' denotes the indirect operator. (Note that
EM has different instructions to do
an assign-indirect and a use-indirect).
As the size of the array elements is restricted
to be the word size in case (3) and (4),
only one EM instruction needs to
be generated in all cases.
.PP
The amount by which TMP is incremented is:
.IP multiplication: 18
step value * constant
.IP arrays:
step value * element size
.LP
Note that the step value (see definition of induction variable above),
the constant, and the element size (see previous section) can all
be determined statically.
If the sign of the induction variable in the
iv-expression is negative, the amount
must be negated.
.PP
The transformations are demonstrated by an example.
.DS
i := 100; i := 100;
while i > 1 loop TMP := (6-i) * 5;
X := (6-i) * 5 + 2; while i > 1 loop
Y := (6-i) * 5 - 8; --> X := TMP + 2;
i := i - 3; Y := TMP - 8;
end loop; i := i - 3;
TMP := TMP + 15;
end loop;
Fig. 6.2 Example of complex Strength Reduction transformations
.DE
The expression '(6-i)*5' is recognized twice. The constant
is 5.
The step value is -3.
The sign of i in the recognized expression is '-'.
So the increment value of TMP is -(-3*5) = +15.

232
doc/ego/sr/sr3 Normal file
View File

@@ -0,0 +1,232 @@
.NH 2
Implementation
.PP
Like most phases, SR deals with one procedure
at a time.
Within a procedure, SR works on one loop at a time.
Loops are processed in textual order.
If loops are nested inside each other,
SR starts with the outermost loop and proceeds in the
inwards direction.
This order is chosen,
because it enables the optimization
of multi-dimensional array address computations,
if the elements are accessed in the usual way
(i.e. row after row, rather than column after column).
For every loop, SR first detects all induction variables
and then tries to recognize
expressions that can be optimized.
.NH 3
Finding induction variables
.PP
The process of finding induction variables
can conveniently be split up
into two parts.
First, the EM text of the loop is scanned to find
all \fIcandidate\fR induction variables,
which are word-sized local variables
that are assigned precisely once
in the loop, within a firm block.
Second, for every candidate, the single assignment
is inspected, to see if it has the form
required by the definition of an induction variable.
.PP
Candidates are found by scanning the EM code of the loop.
During this scan, two sets are maintained.
The set "cand" contains all variables that were
assigned exactly once so far, within a firm block.
The set "dismiss" contains all variables that
should not be made a candidate.
Initially, both sets are empty.
If a variable is assigned to, it is put
in the cand set, if three conditions are met:
.IP 1.
the variable was not in cand or dismiss already
.IP 2.
the assignment takes place in a firm block
.IP 3.
the assignment is not a ZRL instruction (assignment by zero)
or a SDL instruction (store double local).
.LP
If any condition fails, the variable is dismissed from cand
(if it was there already) and put in dismiss
(if it was not there already).
.sp 0
All variables for which no register message was generated (i.e. those
variables that may be accessed indirectly) are assumed
to be changed in the loop.
.sp 0
All variables that remain in cand are candidate induction variables.
.PP
From the set of candidates, the induction variables can
be determined, by inspecting the single assignment.
The assignment must match one of the EM patterns below.
('x' is the candidate. 'ws' is the word size of the target machine.
'n' is any number.)
.DS
\fIpattern\fR \fIstep size\fR
INL x | +1
DEL x | -1
LOL x ; (INC | DEC) ; STL x | +1 | -1
LOL x ; LOC n ; (ADI ws | SBI ws) ; STL x | +n | -n
LOC n ; LOL x ; ADI ws ; STL x. +n
.DE
From the patterns the step size of the induction variable
can also be determined.
These step sizes are displayed on the right hand side.
.sp
For every induction variable we maintain the following information:
.IP -
the offset of the variable in the stackframe of its procedure
.IP -
a pointer to the EM text of the assignment statement
.IP -
the step value
.LP
.NH 3
Optimizing expressions
.PP
If any induction variables of the loop were found,
the EM text of the loop is scanned again,
to detect expressions that can be optimized.
SR scans for multiplication and array instructions.
Whenever it finds such an instruction, it analyses the
code in front of it.
If an expression is to be optimized, it must
be generated by the following syntax rules.
.DS
optimizable_expr:
iv_expr const mult |
const iv_expr mult |
address iv_expr address array_instr;
mult:
MLI ws |
MLU ws ;
array_instr:
LAR ws |
SAR ws |
AAR ws ;
const:
LOC n ;
.DE
An 'address' is an EM instruction that loads an
address on the stack.
An instruction like LOL may be an 'address', if
the size of an address (pointer size, =ps) is
the same as the word size.
If the pointer size is twice the word size,
instructions like LDL are an 'address'.
(The addresses in the third grammar rule
denote resp. the array address and the
array descriptor address).
.DS
address:
LAE |
LAL |
LOL if ps=ws |
LOE ,, |
LIL ,, |
LDL if ps=2*ws |
LDE ,, ;
.DE
The notion of an iv-expression was introduced earlier.
.DS
iv_expr:
iv_expr unair_op |
iv_expr iv_expr binary_op |
loopconst |
iv ;
unair_op:
NGI ws |
INC |
DEC ;
binary_op:
ADI ws |
ADU ws |
SBI ws |
SBU ws ;
loopconst:
const |
LOL x if x is not changed in loop ;
iv:
LOL x if x is an induction variable ;
.DE
An iv_expression must satisfy one additional constraint:
it must use exactly one operand that is an induction
variable.
A simple, hand written, top-down parser is used
to recognize an iv-expression.
It scans the EM code from right to left
(recall that EM is essentially postfix).
It uses semantic attributes (inherited as well as
derived) to check the additional constraint.
.PP
All information assembled during the recognition
process is put in a 'code_info' structure.
This structure contains the following information:
.IP -
the optimizable code itself
.IP -
the loop and basic block the code is part of
.IP -
the induction variable
.IP -
the iv-expression
.IP -
the sign of the induction variable in the
iv-expression
.IP -
the offset and size of the temporary local variable
.IP -
the expensive operator (MLI, LAR etc.)
.IP -
the instruction that loads the constant
(for multiplication) or the array descriptor
(for arrays).
.LP
The entire transformation process is driven
by this information.
As the EM text is represented internally
as a list, this process consists
mainly of straightforward list manipulations.
.sp 0
The initialization code must be put
immediately before the loop entry.
For this purpose a \fIheader block\fR is
created that has the loop entry block as
its only successor and that dominates the
entry block.
The CFG and all relations (SUCC,PRED, IDOM, LOOPS etc.)
are updated.
.sp 0
An EM instruction that will
replace the optimizable code
is created and put at the place of the old code.
The list representing the old optimizable code
is used to create a list for the initializing code,
as they are similar.
Only two modifications are required:
.IP -
if the expensive operator is a LAR or SAR,
it must be replaced by an AAR, as the initial value
of TMP is the \fIaddress\fR of the first
array element that is accessed.
.IP -
code must be appended to store the result of the
expression in TMP.
.LP
Finally, code to increment TMP is created and put after
the code of the single assignment to the
induction variable.
The generated code uses either an integer addition
(ADI) or an integer-to-pointer addition (ADS)
to do the increment.
.PP
SR maintains a set of all expressions that have already
been recognized in the present loop.
Such expressions are said to be \fIavailable\fR.
If an expression is recognized that is
already available,
no new temporary local variable is allocated for it,
and the code to initialize and increment the local
is not generated.

28
doc/ego/sr/sr4 Normal file
View File

@@ -0,0 +1,28 @@
.NH 2
Source files of SR
.PP
The sources of SR are in the following files
and packages:
.IP sr.h: 14
declarations of global variables and
data structures
.IP sr.c:
the routine main; a driving routine to process
(possibly nested) loops in the right order
.IP iv
implements a procedure that finds the induction variables
of a loop
.IP reduce
implements a procedure that finds optimizable expressions
and that does the transformations
.IP cand
implements a procedure that finds the candidate induction
variables; used to implement iv
.IP xform
implements several useful routines that transform
lists of EM text or a CFG; used to implement reduce
.IP expr
implements a procedure that parses iv-expressions
.IP aux
implements several auxiliary procedures.
.LP

5
doc/ego/ud/.distr Normal file
View File

@@ -0,0 +1,5 @@
ud1
ud2
ud3
ud4
ud5

58
doc/ego/ud/ud1 Normal file
View File

@@ -0,0 +1,58 @@
.bp
.NH 1
Use-Definition analysis
.NH 2
Introduction
.PP
The "Use-Definition analysis" phase (UD) consists of two related optimization
techniques that both depend on "Use-Definition" information.
The techniques are Copy Propagation and Constant Propagation.
They are best explained via an example (see Figs. 11.1 and 11.2).
.DS
(1) A := B A := B
... --> ...
(2) use(A) use(B)
Fig. 11.1 An example of Copy Propagation
.DE
.DS
(1) A := 12 A := 12
... --> ...
(2) use(A) use(12)
Fig. 11.2 An example of Constant Propagation
.DE
Both optimizations have to check that the value of A at line (2)
can only be obtained at line (1).
Copy Propagation also has to assure that the value of B is
the same at line (1) as at line (2).
.PP
One purpose of both transformations is to introduce
opportunities for the Dead Code Elimination optimization.
If the variable A is used nowhere else, the assignment A := B
becomes useless and can be eliminated.
.sp 0
If B is less expensive to access than A (e.g. this is sometimes the case
if A is a local variable and B is a global variable),
Copy Propagation directly improves the code itself.
If A is cheaper to access the transformation will not be performed.
Likewise, a constant as operand may be cheeper than a variable.
Having a constant as operand may also facilitate other optimizations.
.PP
The design of UD is based on the theory described in section
14.1 and 14.3 of.
.[
aho compiler design
.]
As a main departure from that theory,
we do not demand the statement A := B to become redundant after
Copy Propagation.
If B is cheaper to access than A, the optimization is always performed;
if B is more expensive than A, we never do the transformation.
If A and B are equally expensive UD uses the heuristic rule to
replace infrequently used variables by frequently used ones.
This rule increases the chances of the assignment to become useless.
.PP
In the next section we will give a brief outline of the data
flow theory used
for the implementation of UD.

64
doc/ego/ud/ud2 Normal file
View File

@@ -0,0 +1,64 @@
.NH 2
Data flow information
.PP
.NH 3
Use-Definition information
.PP
A \fIdefinition\fR of a variable A is an assignment to A.
A definition is said to \fIreach\fR a point p if there is a
path in the control flow graph from the definition to p, such that
A is not redefined on that path.
.PP
For every basic block B, we define the following sets:
.IP GEN[b] 9
the set of definitions in b that reach the end of b.
.IP KILL[b]
the set of definitions outside b that define a variable that
is changed in b.
.IP IN[b]
the set of all definitions reaching the beginning of b.
.IP OUT[b]
the set of all definitions reaching the end of b.
.LP
GEN and KILL can be determined by inspecting the code of the procedure.
IN and OUT are computed by solving the following data flow equations:
.DS
(1) OUT[b] = IN[b] - KILL[b] + GEN[b]
(2) IN[b] = OUT[p1] + ... + OUT[pn],
where PRED(b) = {p1, ... , pn}
.DE
.NH 3
Copy information
.PP
A \fIcopy\fR is a definition of the form "A := B".
A copy is said to be \fIgenerated\fR in a basic block n if
it occurs in n and there is no subsequent assignment to B in n.
A copy is said to be \fIkilled\fR in n if:
.IP (i)
it occurs in n and there is a subsequent assignment to B within n, or
.IP (ii)
it occurs outside n, the definition A := B reaches the beginning of n
and B is changed in n (note that a copy also is a definition).
.LP
A copy \fIreaches\fR a point p, if there are no assignments to B
on any path in the control flow graph from the copy to p.
.PP
We define the following sets:
.IP C_GEN[b] 11
the set of all copies in b generated in b.
.IP C_KILL[b]
the set of all copies killed in b.
.IP C_IN[b]
the set of all copies reaching the beginning of b.
.IP C_OUT[b]
the set of all copies reaching the end of b.
.LP
C_IN and C_OUT are computed by solving the following equations:
(root is the entry node of the current procedure; '*' denotes
set intersection)
.DS
(1) C_OUT[b] = C_IN[b] - C_KILL[b] + C_GEN[b]
(2) C_IN[b] = C_OUT[p1] * ... * C_OUT[pn],
where PRED(b) = {p1, ... , pn} and b /= root
C_IN[root] = {all copies}
.DE

26
doc/ego/ud/ud3 Normal file
View File

@@ -0,0 +1,26 @@
.NH 2
Pointers and subroutine calls
.PP
The theory outlined above assumes that variables can
only be changed by a direct assignment.
This condition does not hold for EM.
In case of an assignment through a pointer variable,
it is in general impossible to see which variable is affected
by the assignment.
Similar problems occur in the presence of procedure calls.
Therefore we distinguish two kinds of definitions:
.IP -
an \fIexplicit\fR definition is a direct assignment to one
specific variable
.IP -
an \fIimplicit\fR definition is the potential alteration of
a variable as a result of a procedure call or an indirect assignment.
.LP
An indirect assignment causes implicit definitions to
all variables that may be accessed indirectly, i.e.
all local variables for which no register message was generated
and all global variables.
If a procedure contains an indirect assignment it may change the
same set of variables, else it may change some global variables directly.
The KILL, GEN, IN and OUT sets contain explicit as well
as implicit definitions.

78
doc/ego/ud/ud4 Normal file
View File

@@ -0,0 +1,78 @@
.NH 2
Implementation
.PP
UD first builds a number of tables:
.IP locals: 9
contains information about the local variables of the
current procedure (offset,size,whether a register message was found
for it and, if so, the score field of that message)
.IP defs:
a table of all explicit definitions appearing in the
current procedure.
.IP copies:
a table of all copies appearing in the
current procedure.
.LP
Every variable (local as well as global), definition and copy
is identified by a unique number, which is the index
in the table.
All tables are constructed by traversing the EM code.
A fourth table, "vardefs" is used, indexed by a 'variable number',
which contains for every variable the set of explicit definitions of it.
Also, for each basic block b, the set CHGVARS containing all variables
changed by it is computed.
.PP
The GEN sets are obtained in one scan over the EM text,
by analyzing every EM instruction.
The KILL set of a basic block b is computed by looking at the
set of variables
changed by b (i.e. CHGVARS[b]).
For every such variable v, all explicit definitions to v
(i.e. vardefs[v]) that are not in GEN[b] are added to KILL[b].
Also, the implicit defininition of v is added to KILL[b].
Next, the data flow equations for use-definition information
are solved,
using a straight forward, iterative algorithm.
All sets are represented as bitvectors, so the operations
on sets (union, difference) can be implemented efficiently.
.PP
The C_GEN and C_KILL sets are computed simultaneously in one scan
over the EM text.
For every copy A := B appearing in basic block b we do
the following:
.IP 1.
for every basic block n /= b that changes B, see if the definition A := B
reaches the beginning of n (i.e. check if the index number of A := B in
the "defs" table is an element of IN[n]);
if so, add the copy to C_KILL[n]
.IP 2.
if B is redefined later on in b, add the copy to C_KILL[b], else
add it to C_GEN[b]
.LP
C_IN and C_OUT are computed from C_GEN and C_KILL via the second set of
data flow equations.
.PP
Finally, in one last scan all opportunities for optimization are
detected.
For every use u of a variable A, we check if
there is a unique explicit definition d reaching u.
.sp
If the definition is a copy A := B and B has the same value at d as
at u, then the use of A at u may be changed into B.
The latter condition can be verified as follows:
.IP -
if u and d are in the same basic block, see if there is
any assignment to B in between d and u
.IP -
if u and d are in different basic blocks, the condition is
satisfied if there is no assignment to B in the block of u prior to u
and d is in C_IN[b].
.LP
Before the transformation is actually done, UD first makes sure the
alteration is really desirable, as described before.
The information needed for this purpose (access costs of local and
global variables) is read from a machine descriptor file.
.sp
If the only definition reaching u has the form "A := constant", the use
of A at u is replaced by the constant.

19
doc/ego/ud/ud5 Normal file
View File

@@ -0,0 +1,19 @@
.NH 2
Source files of UD
.PP
The sources of UD are in the following files and packages:
.IP ud.h: 14
declarations of global variables and data structures
.IP ud.c:
the routine main; initialization of target machine dependent tables
.IP defs:
routines to compute the GEN and KILL sets and routines to analyse
EM instructions
.IP const:
routines involved in constant propagation
.IP copy:
routines involved in copy propagation
.IP aux:
contains auxiliary routines
.LP

32
doc/em/.distr Normal file
View File

@@ -0,0 +1,32 @@
Makefile
READ_ME
addend.n
app.codes.nr
app.exam.nr
app.int.nr
assem.nr
cont.nr
descr.nr
dspace.nr
em.i
env.nr
even.c
exam.e
exam.p
int
intro.nr
ip.awk
ispace.nr
mach.nr
macr.nr
mapping.nr
mem.nr
print
show
title.nr
traps.nr
types.nr
mkdispatch.c
dispat1.sed
dispat2.sed
dispat3.sed

36
doc/em/Makefile Normal file
View File

@@ -0,0 +1,36 @@
HOME=../..
TBL=tbl
NROFF=nroff
SUF=pr
head: ../em.$(SUF)
FILES = macr.nr title.nr intro.nr mem.nr ispace.nr dspace.nr mapping.nr \
types.nr descr.nr env.nr traps.nr mach.nr assem.nr \
app.int.nr app.codes.nr app.exam.nr cont.nr
IOP=$(HOME)/util/ass/ip_spec.t# # to construct itables from
../em.$(SUF): $(FILES) itables dispatdummy em.i Makefile
$(TBL) $(FILES) | $(NROFF) > ../em.$(SUF)
app.codes.pr: app.codes.nr itables dispatdummy
itables: $(IOP) ip.awk
awk -f ip.awk $(IOP) | sed 's/-/\\-/g' | $(TBL) >itables
dispatdummy: $(IOP) mkdispatch
mkdispatch < $(IOP) > dispatdummy
sed -f dispat1.sed < dispatdummy | $(TBL) > dispat1
sed -f dispat2.sed < dispatdummy | $(TBL) > dispat2
sed -f dispat3.sed < dispatdummy | $(TBL) > dispat3
mkdispatch: mkdispatch.c
cc -I$(HOME)/util/ass -I$(HOME)/h -o mkdispatch mkdispatch.c $(HOME)/lib/em_data.a
.SUFFIXES : .pr .nr
.nr.pr: ; $(TBL) macr.nr $*.nr | $(NROFF) >$@
clean:
rm -f *.pr itables *.out dispatdummy dispat? *.o mkdispatch

9
doc/em/READ_ME Normal file
View File

@@ -0,0 +1,9 @@
This it the text of IR-81,
DESCRIPTION OF A MACHINE ARCHITECTURE FOR USE WITH BLOCK STRUCTURED LANGUAGES
The file em.i (text of the defining interpreter) was hand-edited from int/em.p
To print, set NROFF and TBL in the Makefile and call make.
It uses the kun macro package which is also distributed.
The directory int contains the interpreter.

1121
doc/em/addend.n Normal file

File diff suppressed because it is too large Load Diff

153
doc/em/app.codes.nr Normal file
View File

@@ -0,0 +1,153 @@
.BP
.AP "EM CODE TABLES"
The following table is used by the assembler for EM machine
language.
It specifies the opcodes used for each instruction and
how arguments are mapped to machine language arguments.
The table is presented in three columns,
each line in each column contains three or four fields.
Each line describes a range of interpreter opcodes by
specifying for which instruction the range is used, the type of the
opcodes (mini, shortie, etc..) and range for the instruction
argument.
.A
The first field on each line gives the EM instruction mnemonic,
the second field gives some flags.
If the opcodes are minis or shorties the third field specifies
how many minis/shorties are used.
The last field gives the number of the (first) interpreter
opcode.
.N 1
Flags :
.IS 3
.N 1
Opcode type, only one of the following may be specified.
.PS - 5 " "
.PT \-
opcode without argument
.PT m
mini
.PT s
shortie
.PT 2
opcode with 2-byte signed argument
.PT 4
opcode with 4-byte signed argument
.PT 8
opcode with 8-byte signed argument
.PE
Secondary (escaped) opcodes.
.PS - 5 " "
.PT e
The opcode thus marked is in the secondary opcode group instead
of the primary
.PE
restrictions on arguments
.PS - 5 " "
.PT N
Negative arguments only
.PT P
Positive and zero arguments only
.PE
mapping of arguments
.PS - 5 " "
.PT w
argument must be divisible by the wordsize and is divided by the
wordsize before use as opcode argument.
.PT o
argument ( possibly after division ) must be >= 1 and is
decremented before use as opcode argument
.PE
.IE
If the opcode type is 2,4 or 8 the resulting argument is used as
opcode argument (least significant byte first).
.N
If the opcode type is mini, the argument is added
to the first opcode \- if in range \- .
If the argument is negative, the absolute value minus one is
used in the algorithm above.
.N
For shorties with positive arguments the first opcode is used
for arguments in the range 0..255, the second for the range
256..511, etc..
For shorties with negative arguments the first opcode is used
for arguments in the range \-1..\-256, the second for the range
\-257..\-512, etc..
The byte following the opcode contains the least significant
byte of the argument.
First some examples of these specifications.
.PS - 5
.PT "aar mwPo 1 34"
Indicates that opcode 34 is used as a mini for Positive
instruction arguments only.
The w and o indicate division and decrementing of the
instruction argument.
Because the resulting argument must be zero ( only opcode 34 may be used
), this mini can only be used for instruction argument 2.
Conclusion: opcode 34 is for "AAR 2".
.PT "adp sP 1 41"
Opcode 41 is used as shortie for ADP with arguments in the range
0..255.
.PT "bra sN 2 60"
Opcode 60 is used as shortie for BRA with arguments \-1..\-256,
61 is used for arguments \-257..\-512.
.PT "zer e\- 145"
Escaped opcode 145 is used for ZER.
.PE
The interpreter opcode table:
.N 1
.IS 3
.so itables
.IE
.P
The table above results in the following dispatch tables.
Dispatch tables are used by interpreters to jump to the
routines implementing the EM instructions, indexed by the next opcode.
Each line of the dispatch tables gives the routine names
of eight consecutive opcodes, preceded by the first opcode number
on that line.
Routine names consist of an EM mnemonic followed by a suffix.
The suffices show the encoding used for each opcode.
.N
The following suffices exist:
.N 1
.VS 1 0
.IS 4
.PS - 11
.PT .z
no arguments
.PT .l
16-bit argument
.PT .lw
16-bit argument divided by the wordsize
.PT .p
positive 16-bit argument
.PT .pw
positive 16-bit argument divided by the wordsize
.PT .n
negative 16-bit argument
.PT .nw
negative 16-bit argument divided by the wordsize
.PT .s<num>
shortie with <num> as high order argument byte
.PT .w<num>
shortie with argument divided by the wordsize
.PT .<num>
mini with <num> as argument
.PT .<num>W
mini with <num>*wordsize as argument
.PE 1
<num> is a possibly negative integer.
.VS 1 1
.IE
The dispatch table for the 256 primary opcodes:
.N 1
.so dispat1
.N 2
The list of secondary opcodes (escape1):
.N 1
.so dispat2
.N 2
Finally, the list of opcodes with four byte arguments (escape2).
.N 1
.so dispat3

277
doc/em/app.exam.nr Normal file
View File

@@ -0,0 +1,277 @@
.BP
.AP "AN EXAMPLE PROGRAM"
.A 1 0
.NA
.ta 4n 8n 12n 16n 20n
.nf
1 program example(output);
2 {This program just demonstrates typical EM code.}
3 type rec = record r1: integer; r2:real; r3: boolean end;
4 var mi: integer; mx:real; r:rec;
5
6 function sum(a,b:integer):integer;
7 begin
8 sum := a + b
9 end;
10
11 procedure test(var r: rec);
12 label 1;
13 var i,j: integer;
14 x,y: real;
15 b: boolean;
16 c: char;
17 a: array[1..100] of integer;
18
19 begin
20 j := 1;
21 i := 3 * j + 6;
22 x := 4.8;
23 y := x/0.5;
24 b := true;
25 c := 'z';
26 for i:= 1 to 100 do a[i] := i * i;
27 r.r1 := j+27;
28 r.r3 := b;
29 r.r2 := x+y;
30 i := sum(r.r1, a[j]);
31 while i > 0 do begin j := j + r.r1; i := i - 1 end;
32 with r do begin r3 := b; r2 := x+y; r1 := 0 end;
33 goto 1;
34 1: writeln(j, i:6, x:9:3, b)
35 end; {test}
36 begin {main program}
37 mx := 15.96;
38 mi := 99;
39 test(r)
40 end.
.fi
.AD
.BP
The EM code as produced by the Pascal-VU compiler is given below. Comments
have been added manually. Note that this code has already been optimized.
.A 1 0
.NA
.nf
.ta 1n 24n
mes 2,2,2 ; wordsize 2, pointersize 2
\&.1
rom 't.p\e000' ; the name of the source file
hol 552,\-32768,0 ; externals and buf occupy 552 bytes
exp $sum ; sum can be called from other modules
pro $sum,2 ; procedure sum ; 2 bytes local storage
lin 8 ; code from source line 8
ldl 0 ; load two locals ( a and b )
adi 2 ; add them
ret 2 ; return the result
end 2 ; end of procedure ( still two bytes local storage )
\&.2
rom 1,99,2 ; descriptor of array a[]
exp $test ; the compiler exports all level 0 procedures
pro $test,226 ; procedure test, 226 bytes local storage
\&.3
rom 4.8F8 ; assemble Floating point 4.8 (8 bytes) in
\&.4 ; global storage
rom 0.5F8 ; same for 0.5
mes 3,\-226,2,2 ; compiler temporary not referenced by address
mes 3,\-24,2,0 ; the same is true for i, j, b and c in test
mes 3,\-22,2,0
mes 3,\-4,2,0
mes 3,\-2,2,0
mes 3,\-20,8,0 ; and for x and y
mes 3,\-12,8,0
lin 20 ; maintain source line number
loc 1
stl \-4 ; j := 1
lni ; lin 21 prior to optimization
lol \-4
loc 3
mli 2
loc 6
adi 2
stl \-2 ; i := 3 * j + 6
lni ; lin 22 prior to optimization
lae .3
loi 8
lal \-12
sti 8 ; x := 4.8
lni ; lin 23 prior to optimization
lal \-12
loi 8
lae .4
loi 8
dvf 8
lal \-20
sti 8 ; y := x / 0.5
lni ; lin 24 prior to optimization
loc 1
stl \-22 ; b := true
lni ; lin 25 prior to optimization
loc 122
stl \-24 ; c := 'z'
lni ; lin 26 prior to optimization
loc 1
stl \-2 ; for i:= 1
2
lol \-2
dup 2
mli 2 ; i*i
lal \-224
lol \-2
lae .2
sar 2 ; a[i] :=
lol \-2
loc 100
beq *3 ; to 100 do
inl \-2 ; increment i and loop
bra *2
3
lin 27
lol \-4
loc 27
adi 2 ; j + 27
sil 0 ; r.r1 :=
lni ; lin 28 prior to optimization
lol \-22 ; b
lol 0
stf 10 ; r.r3 :=
lni ; lin 29 prior to optimization
lal \-20
loi 16
adf 8 ; x + y
lol 0
adp 2
sti 8 ; r.r2 :=
lni ; lin 23 prior to optimization
lal \-224
lol \-4
lae .2
lar 2 ; a[j]
lil 0 ; r.r1
cal $sum ; call now
asp 4 ; remove parameters from stack
lfr 2 ; get function result
stl \-2 ; i :=
4
lin 31
lol \-2
zle *5 ; while i > 0 do
lol \-4
lil 0
adi 2
stl \-4 ; j := j + r.r1
del \-2 ; i := i - 1
bra *4 ; loop
5
lin 32
lol 0
stl \-226 ; make copy of address of r
lol \-22
lol \-226
stf 10 ; r3 := b
lal \-20
loi 16
adf 8
lol \-226
adp 2
sti 8 ; r2 := x + y
loc 0
sil \-226 ; r1 := 0
lin 34 ; note the abscence of the unnecesary jump
lae 22 ; address of output structure
lol \-4
cal $_wri ; write integer with default width
asp 4 ; pop parameters
lae 22
lol \-2
loc 6
cal $_wsi ; write integer width 6
asp 6
lae 22
lal \-12
loi 8
loc 9
loc 3
cal $_wrf ; write fixed format real, width 9, precision 3
asp 14
lae 22
lol \-22
cal $_wrb ; write boolean, default width
asp 4
lae 22
cal $_wln ; writeln
asp 2
ret 0 ; return, no result
end 226
exp $_main
pro $_main,0 ; main program
\&.6
con 2,\-1,22 ; description of external files
\&.5
rom 15.96F8
fil .1 ; maintain source file name
lae .6 ; description of external files
lae 0 ; base of hol area to relocate buffer addresses
cal $_ini ; initialize files, etc...
asp 4
lin 37
lae .5
loi 8
lae 2
sti 8 ; mx := 15.96
lni ; lin 38 prior to optimization
loc 99
ste 0 ; mi := 99
lni ; lin 39 prior to optimization
lae 10 ; address of r
cal $test
asp 2
loc 0 ; normal exit
cal $_hlt ; cleanup and finish
asp 2
end 0
mes 5 ; reals were used
.fi
.AD
.A 1 0
The compact code corresponding to the above program is listed below.
Read it horizontally, line by line, not column by column.
Each number represents a byte of compact code, printed in decimal.
The first two bytes form the magic word.
.N 1
.IS 3
.Dr 33
173 0 159 122 122 122 255 242 1 161 250 124 116 46 112 0
255 156 245 40 2 245 0 128 120 155 249 123 115 117 109 160
249 123 115 117 109 122 67 128 63 120 3 122 88 122 152 122
242 2 161 121 219 122 255 155 249 124 116 101 115 116 160 249
124 116 101 115 116 245 226 0 242 3 161 253 128 123 52 46
56 255 242 4 161 253 128 123 48 46 53 255 159 123 245 30
255 122 122 255 159 123 96 122 120 255 159 123 98 122 120 255
159 123 116 122 120 255 159 123 118 122 120 255 159 123 100 128
120 255 159 123 108 128 120 255 67 140 69 121 113 116 68 73
116 69 123 81 122 69 126 3 122 113 118 68 57 242 3 72
128 58 108 112 128 68 58 108 72 128 57 242 4 72 128 44
128 58 100 112 128 68 69 121 113 98 68 69 245 122 0 113
96 68 69 121 113 118 182 73 118 42 122 81 122 58 245 32
255 73 118 57 242 2 94 122 73 118 69 220 10 123 54 118
18 122 183 67 147 73 116 69 147 3 122 104 120 68 73 98
73 120 111 130 68 58 100 72 136 2 128 73 120 4 122 112
128 68 58 245 32 255 73 116 57 242 2 59 122 65 120 20
249 123 115 117 109 8 124 64 122 113 118 184 67 151 73 118
128 125 73 116 65 120 3 122 113 116 41 118 18 124 185 67
152 73 120 113 245 30 255 73 98 73 245 30 255 111 130 58
100 72 136 2 128 73 245 30 255 4 122 112 128 69 120 104
245 30 255 67 154 57 142 73 116 20 249 124 95 119 114 105
8 124 57 142 73 118 69 126 20 249 124 95 119 115 105 8
126 57 142 58 108 72 128 69 129 69 123 20 249 124 95 119
114 102 8 134 57 142 73 98 20 249 124 95 119 114 98 8
124 57 142 20 249 124 95 119 108 110 8 122 88 120 152 245
226 0 155 249 125 95 109 97 105 110 160 249 125 95 109 97
105 110 120 242 6 151 122 119 142 255 242 5 161 253 128 125
49 53 46 57 54 255 50 242 1 57 242 6 57 120 20 249
124 95 105 110 105 8 124 67 157 57 242 5 72 128 57 122
112 128 68 69 219 110 120 68 57 130 20 249 124 116 101 115
116 8 122 69 120 20 249 124 95 104 108 116 8 122 152 120
159 124 160 255 159 125 255
.De
.IE

8
doc/em/app.int.nr Normal file
View File

@@ -0,0 +1,8 @@
.BP
.AP "EM INTERPRETER"
.nf
.ft CW
.ta 8 16 24 32 40 48 56 64 72 80
.so em.i
.ft P
.fi

801
doc/em/assem.nr Normal file
View File

@@ -0,0 +1,801 @@
.BP
.SN 11
.S1 "EM ASSEMBLY LANGUAGE"
We use two representations for assembly language programs,
one is in ASCII and the other is the compact assembly language.
The latter needs less space than the first for the same program
and therefore allows faster processing.
Our only program accepting ASCII assembly
language converts it to the compact form.
All other programs expect compact assembly input.
The first part of the chapter describes the ASCII assembly
language and its semantics.
The second part describes the syntax of the compact assembly
language.
The last part lists the EM instructions with the type of
arguments allowed and an indication of the function.
Appendix A gives a detailed description of the effect of all
instructions in the form of a Pascal program.
.S2 "ASCII assembly language"
An assembly language program consists of a series of lines, each
line may be blank, contain one (pseudo)instruction or contain one
label.
Input to the assembler is in lower case.
Upper case is used in this
document merely to distinguish keywords from the surrounding prose.
Comment is allowed at the end of each line and starts with a semicolon ";".
This kind of comment does not exist in the compact form.
.A
Labels must be placed all by themselves on a line and start in
column 1.
There are two kinds of labels, instruction and data labels.
Instruction labels are unsigned positive integers.
The scope of an instruction label is its procedure.
.A
The pseudoinstructions CON, ROM and BSS may be preceded by a
line containing a
1\-8 character data label, the first character of which is a
letter, period or underscore.
The period may only be followed by
digits, the others may be followed by letters, digits and underscores.
The use of the character "." followed by a constant,
which must be in the range 1 to 32767 (e.g. ".40") is recommended
for compiler
generated programs.
These labels are considered as a special case and handled
more efficiently in compact assembly language (see below).
Note that a data label on its own or two consecutive labels are not
allowed.
.P
Each statement may contain an instruction mnemonic or pseudoinstruction.
These must begin in column 2 or later (not column 1) and must be followed
by a space, tab, semicolon or LF.
Everything on the line following a semicolon is
taken as a comment.
.P
Each input file contains one module.
A module may contain many procedures,
which may be nested.
A procedure consists of
a PRO statement, a (possibly empty)
collection of instructions and pseudoinstructions and finally an END
statement.
Pseudoinstructions are also allowed between procedures.
They do not belong to a specific procedure.
.P
All constants in EM are interpreted in the decimal base.
The ASCII assembly language accepts constant expressions
wherever constants are allowed.
The operators recognized are: +, \-, *, % and / with the usual
precedence order.
Use of the parentheses ( and ) to alter the precedence order is allowed.
.S3 "Instruction arguments"
Unlike many other assembly languages, the EM assembly
language requires all arguments of normal and pseudoinstructions
to be either a constant or an identifier, but not a combination
of these two.
There is one exception to this rule: when a data label is used
for initialization or as an instruction argument,
expressions of the form 'label+constant' and 'label-constant'
are allowed.
This makes it possible to address, for example, the
third word of a ten word BSS block
directly.
Thus LOE LABEL+4 is permitted and so is CON LABEL+3.
The resulting address is must be in the same fragment as the label.
It is not allowed to add or subtract from instruction labels or procedure
identifiers,
which certainly is not a severe restriction and greatly aids
optimization.
.P
Instruction arguments can be constants,
data labels, data labels offsetted by a constant, instruction
labels and procedure identifiers.
The range of integers allowed depends on the instruction.
Most instructions allow only integers
(signed or unsigned)
that fit in a word.
Arguments used as offsets to pointers should fit in a
pointer-sized integer.
Finally, arguments to LDC should fit in a double-word integer.
.P
Several instructions have two possible forms:
with an explicit argument and with an implicit argument on top of the stack.
The size of the implicit argument is the wordsize.
The implicit argument is always popped before all other operands.
For example: 'CMI 4' specifies that two four-byte signed
integers on top of the stack are to be compared.
\&'CMI' without an argument expects a wordsized integer
on top of the stack that specifies the size of the integers to
be compared.
Thus the following two sequences are equivalent:
.N 1
.TS
center, tab(:) ;
l r 30 l r.
LDL:\-10:LDL:\-10
LDL:\-14:LDL:\-14
::LOC:4
CMI:4:CMI:
ZEQ:*1:ZEQ:*1
.TE 1
Section 11.1.6 shows the arguments allowed for each instruction.
.S3 "Pseudoinstruction arguments"
Pseudoinstruction arguments can be divided in two classes:
Initializers and others.
The following initializers are allowed: signed integer constants,
unsigned integer constants, floating-point constants, strings,
data labels, data labels offsetted by a constant, instruction
labels and procedure identifiers.
.P
Constant initializers in BSS, HOL, CON and ROM pseudoinstructions
can be followed by a letter I, U or F.
This indicator
specifies the type of the initializer: Integer, Unsigned or Float.
If no indicator is present I is assumed.
The size of the initializer is the wordsize unless
the indicator is followed by an integer specifying the
initializer's size.
This integer is governed by the same restrictions as for
transfer of objects to/from memory.
As in instruction arguments, initializers include expressions of the form:
\&"LABEL+offset" and "LABEL\-offset".
The offset must be an unsigned decimal constant.
The 'IUF' indicators cannot be used in the offsets.
.P
Data labels are referred to by their name.
.P
Strings are surrounded by double quotes (").
Semicolon's in string do not indicate the start of comment.
In the ASCII representation the escape character \e (backslash)
alters the meaning of subsequent character(s).
This feature allows inclusion of zeroes, graphic characters and
the double quote in the string.
The following escape sequences exist:
.DS
.TS
center, tab(:);
l l l.
newline:NL\|(LF):\en
horizontal tab:HT:\et
backspace:BS:\eb
carriage return:CR:\er
form feed:FF:\ef
backslash:\e:\e\e
double quote:":\e"
bit pattern:\fBddd\fP:\e\fBddd\fP
.TE
.DE
The escape \fB\eddd\fP consists of the backslash followed by 1,
2, or 3 octal digits specifing the value of
the desired character.
If the character following a backslash is not one of those
specified,
the backslash is ignored.
Example: CON "hello\e012\e0".
Each string element initializes a single byte.
The ASCII character set is used to map characters onto values.
.P
Instruction labels are referred to as *1, *2, etc. in both branch
instructions and as initializers.
.P
The notation $procname means the identifier for the procedure
with the specified name.
This identifier has the size of a pointer.
.S3 Notation
First, the notation used for the arguments, classes of
instructions and pseudoinstructions.
.IS 2
.TS
tab(:);
l l l.
<cst>:\&=:integer constant (current range \-2**31..2**31\-1)
<dlb>:\&=:data label
<arg>:\&=:<cst> or <dlb> or <dlb>+<cst> or <dlb>\-<cst>
<con>:\&=:integer constant, unsigned constant, floating-point constant
<str>:\&=:string constant (surrounded by double quotes),
<ilb>:\&=:instruction label
::'*' followed by an integer in the range 0..32767.
<pro>:\&=:procedure number ('$' followed by a procedure name)
<val>:\&=:<arg>, <con>, <pro> or <ilb>.
<par>:\&=:<val> or <str>
<...>*:\&=:zero or more of <...>
<...>+:\&=:one or more of <...>
[...]:\&=:optional ...
.TE
.IE
.S3 "Pseudoinstructions"
.S4 Storage declaration
Initialized global data is allocated by the pseudoinstruction CON,
which needs at least one argument.
Each argument is used to allocate and initialize a number of
consequtive bytes in data memory.
The number of bytes to be allocated and the alignment depend on the type
of the argument.
For each argument, an integral number of words,
determined by the argument type, is allocated and initialized.
.P
The pseudoinstruction ROM is the same as CON,
except that it guarantees that the initialized words
will not change during the execution of the program.
This information allows optimizers to do
certain calculations such as array indexing and
subrange checking at compile time instead
of at run time.
.P
The pseudoinstruction BSS allocates
uninitialized global data or large blocks of data initialized
by the same value.
The first argument to this pseudo is the number
of bytes required, which must be a multiple of the wordsize.
The other arguments specify the value used for initialization and
whether the initialization is only for convenience or a strict necessity.
The pseudoinstruction HOL is similar to BSS in that it requests an
(un)initialized global data block.
Addressing of a HOL block, however, is quasi absolute.
The first byte is addressed by 0,
the second byte by 1 etc. in assembly language.
The assembler/loader adds the base address of
the HOL block to these numbers to obtain the
absolute address in the machine language.
.P
The scope of a HOL block starts at the HOL pseudo and
ends at the next HOL pseudo or at the end of a module
whatever comes first.
Each instruction falls in the scope of at most one
HOL block, the current HOL block.
It is not allowed to have more than one HOL block per procedure.
.P
The alignment restrictions are enforced by the
pseudoinstructions.
All initializers are aligned on a multiple of their size or the wordsize
whichever is smaller.
Strings form an exception, they are to be seen as a sequence of initializers
each for one byte, i.e. strings are not padded with zero bytes.
Switching to another type of fragment or placing a label forces
word-alignment.
There are three types of fragments in global data space: CON, ROM and
BSS/HOL.
.N 2
.IS 2
.PS - 4
.PT "BSS <cst1>,<val>,<cst2>"
Reserve <cst1> bytes.
<val> is the value used to initialize the area.
<cst1> must be a multiple of the size of <val>.
<cst2> is 0 if the initialization is not strictly necessary,
1 if it is.
.PT "HOL <cst1>,<val>,<cst2>"
Idem, but all following absolute global data references will
refer to this block.
Only one HOL is allowed per procedure,
it has to be placed before the first instruction.
.PT "CON <val>+"
Assemble global data words initialized with the <val> constants.
.PT "ROM <val>+"
Idem, but the initialized data will never be changed by the program.
.PE
.IE
.S4 Partitioning
Two pseudoinstructions partition the input into procedures:
.IS 2
.PS - 4
.PT "PRO <pro>[,<cst>]"
Start of procedure.
<pro> is the procedure name.
<cst> is the number of bytes for locals.
The number of bytes for locals must be specified in the PRO or
END pseudoinstruction.
When specified in both, they must be identical.
.PT "END [<cst>]"
End of Procedure.
<cst> is the number of bytes for locals.
The number of bytes for locals must be specified in either the PRO or
END pseudoinstruction or both.
.PE
.IE
.S4 Visibility
Names of data and procedures in an EM module can either be
internal or external.
External names are known outside the module and are used to link
several pieces of a program.
Internal names are not known outside the modules they are used in.
Other modules will not 'see' an internal name.
.A
To reduce the number of passes needed,
it must be known at the first occurrence whether
a name is internal or external.
If the first occurrence of a name is in a definition,
the name is considered to be internal.
If the first occurrence of a name is a reference,
the name is considered to be external.
If the first occurrence is in one of the following pseudoinstructions,
the effect of the pseudo has precedence.
.IS 2
.PS - 4
.PT "EXA <dlb>"
External name.
<dlb> is known, possibly defined, outside this module.
Note that <dlb> may be defined in the same module.
.PT "EXP <pro>"
External procedure identifier.
Note that <pro> may be defined in the same module.
.PT "INA <dlb>"
Internal name.
<dlb> is internal to this module and must be defined in this module.
.PT "INP <pro>"
Internal procedure.
<pro> is internal to this module and must be defined in this module.
.PE
.IE
.S4 Miscellaneous
Two other pseudoinstructions provide miscellaneous features:
.IS 2
.PS - 4
.PT "EXC <cst1>,<cst2>"
Two blocks of instructions preceding this one are
interchanged before being processed.
<cst1> gives the number of lines of the first block.
<cst2> gives the number of lines of the second one.
Blank and pure comment lines do not count.
.PT "MES <cst>[,<par>]*"
A special type of comment.
Used by compilers to communicate with the
optimizer, assembler, etc. as follows:
.VS 1 0
.PS - 4
.PT "MES 0"
An error has occurred, stop further processing.
.PT "MES 1"
Suppress optimization.
.PT "MES 2,<cst1>,<cst2>"
Use wordsize <cst1> and pointer size <cst2>.
.PT "MES 3,<cst1>,<cst2>,<cst3>,<cst4>"
Indicates that a local variable is never referenced indirectly.
Used to indicate that a register may be used for a specific
variable.
<cst1> is offset in bytes from AB if positive
and offset from LB if negative.
<cst2> gives the size of the variable.
<cst3> indicates the class of the variable.
The following values are currently recognized:
.PS
.PT 0
The variable can be used for anything.
.PT 1
The variable is used as a loopindex.
.PT 2
The variable is used as a pointer.
.PT 3
The variable is used as a floating point number.
.PE 0
<cst4> gives the priority of the variable,
higher numbers indicate better candidates.
.PT "MES 4,<cst>,<str>"
Number of source lines in file <str> (for profiler).
.PT "MES 5"
Floating point used.
.PT "MES 6,<val>*"
Comment. Used to provide comments in compact assembly language.
.PT "MES 7,....."
Reserved.
.PT "MES 8,<pro>[,<dlb>]..."
Library module. Indicates that the module may only be loaded
if it is useful, that is, if it can satisfy any unresolved
references during the loading process.
May not be preceded by any other pseudo, except MES's.
.PT "MES 9,<cst>"
Guarantees that no more than <cst> bytes of parameters are
accessed, either directly or indirectly.
.PT "MES 10,<cst>[,<par>]*
This message number is reserved for the global optimizer.
It inserts these messages in its output as hints to backends.
<cst> indicates the type of hint.
.PT "MES 11"
Procedures containing this message are possible destinations of
non-local goto's with the GTO instruction.
Some backends keep locals in registers,
the locals in this procedure should not be kept in registers and
all registers containing locals of other procedures should be
saved upon entry to this procedure.
.PE 1
.VS 1 1
Each backend is free to skip irrelevant MES pseudos.
.PE
.IE
.S2 "The Compact Assembly Language"
The assembler accepts input in a highly encoded form.
This
form is intended to reduce the amount of file transport between the
front ends, optimizers
and back ends, and also reduces the amount of storage required for storing
libraries.
Libraries are stored as archived compact assembly language, not machine
language.
.P
When beginning to read the input, the assembler is in neutral state, and
expects either a label or an instruction (including the pseudoinstructions).
The meaning of the next byte(s) when in neutral state is as follows, where
b1, b2
etc. represent the succeeding bytes.
.N 1
.DS
.TS
tab(:) ;
rw17 4 l.
0:Reserved for future use
1\-129:Machine instructions, see Appendix A, alphabetical list
130\-149:Reserved for future use
150\-161:BSS,CON,END,EXA,EXC,EXP,HOL,INA,INP,MES,PRO,ROM
162\-179:Reserved for future pseudoinstructions
180\-239:Instruction labels 0 \- 59 (180 is local label 0 etc.)
240\-244:See the Common Table below
245\-255:Not used
.TE 1
.DE 0
After a label, the assembler is back in neutral state; it can immediately
accept another label or an instruction in the next byte.
No linefeeds are used to separate lines.
.P
If an opcode expects no arguments,
the assembler is back in neutral state after
reading the one byte containing the instruction number.
If it has one or
more arguments (only pseudos have more than 1), the arguments follow directly,
encoded as follows:
.N 1
.IS 2
.TS
tab(:);
r l.
0\-239:Offsets from \-120 to 119
240\-255:See the Common Table below
.TE 1
Absence of an optional argument is indicated by a special
byte.
.IE 2
.CS
Common Table for Neutral State and Arguments
.CE
.TS
tab(:);
c c s c
l8 l l8 l.
class:bytes:description
<ilb>:240:b1:Instruction label b1 (Not used for branches)
<ilb>:241:b1 b2:16 bit instruction label (256*b2 + b1)
<dlb>:242:b1:Global label .0\-.255, with b1 being the label
<dlb>:243:b1 b2:Global label .0\-.32767
:::with 256*b2+b1 being the label
<dlb>:244:<string>:Global symbol not of the form .nnn
<cst>:245:b1 b2:16 bit constant
<cst>:246:b1 b2 b3 b4:32 bit constant
<cst>:247:b1 .. b8:64 bit constant
<arg>:248:<dlb><cst>:Global label + (possibly negative) constant
<pro>:249:<string>:Procedure name (not including $)
<str>:250:<string>:String used in CON or ROM (no quotes-no escapes)
<con>:251:<cst><string>:Integer constant, size <cst> bytes
<con>:252:<cst><string>:Unsigned constant, size <cst> bytes
<con>:253:<cst><string>:Floating constant, size <cst> bytes
:254::unused
<end>:255::Delimiter for argument lists or
:::indicates absence of optional argument
.TE 1
.P
The bytes specifying the value of a 16, 32 or 64 bit constant
are presented in two's complement notation, with the least
significant byte first. For example: the value of a 32 bit
constant is ((s4*256+b3)*256+b2)*256+b1, where s4 is b4\-256 if
b4 is greater than 128 else s4 takes the value of b4.
A <string> consists of a <cst> inmediatly followed by
a sequence of bytes with length <cst>.
.P
.ne 8
The pseudoinstructions fall into several categories, depending on their
arguments:
.N 1
.DS
Group 1 \- EXC, BSS, HOL have a known number of arguments
Group 2 \- EXA, EXP, INA, INP have a string as argument
Group 3 \- CON, MES, ROM have a variable number of various things
Group 4 \- END, PRO have a trailing optional argument.
.DE 1
Groups 1 and 2
use the encoding described above.
Group 3 also uses the encoding listed above, with an <end> byte after the
last argument to indicate the end of the list.
Group 4 uses
an <end> byte if the trailing argument is not present.
.N 2
.IS 2
.TS
tab(|);
l s l
l s s
l 2 lw(46) l.
Example ASCII|Example compact
(LOC = 69, BRA = 18 here):
2||182
1||181
LOC|10|69 130
LOC|\-10|69 110
LOC|300|69 245 44 1
BRA|*19|18 139
300||241 44 1
.3||242 3
CON|4,9,*2,$foo|151 124 129 240 2 249 123 102 111 111 255
CON|.35|151 242 35 255
.TE 0
.IE 0
.S2 "Assembly language instruction list"
.P
For each instruction in the list the range of argument values
in the assembly language is given.
The column headed \fIassem\fP contains the mnemonics defined
in 11.1.3.
The following column specifies restrictions of the argument
value.
Addresses have to obey the restrictions mentioned in chapter 2.
The classes of arguments
are indicated by letters:
.ds b \fBb\fP
.ds c \fBc\fP
.ds d \fBd\fP
.ds g \fBg\fP
.ds f \fBf\fP
.ds l \fBl\fP
.ds n \fBn\fP
.ds w \fBw\fP
.ds p \fBp\fP
.ds r \fBr\fP
.ds s \fBs\fP
.ds z \fBz\fP
.ds o \fBo\fP
.ds - \fB\-\fP
.N 1
.TS
tab(:);
c s l l
l l 15 l l.
\fIassem\fP:constraints:rationale
\&\*c:cst:fits word:constant
\&\*d:cst:fits double word:constant
\&\*l:cst::local offset
\&\*g:arg:>= 0:global offset
\&\*f:cst::fragment offset
\&\*n:cst:>= 0:counter
\&\*s:cst:>0 , word multiple:object size
\&\*z:cst:>= 0 , zero or word multiple:object size
\&\*o:cst:> 0 , word multiple or fraction:object size
\&\*w:cst:> 0 , word multiple:object size *
\&\*p:pro::pro identifier
\&\*b:ilb:>= 0:label number
\&\*r:cst:0,1,2:register number
\&\*-:::no argument
.TE 1
.P
The * at the rationale for \*w indicates that the argument
can either be given as argument or on top of the stack.
If the argument is omitted, the argument is fetched from the
stack;
it is assumed to be a wordsized unsigned integer.
Instructions that check for undefined integer or floating-point
values and underflow or overflow
are indicated below by (*).
.N 1
.DS
.ta 12n
GROUP 1 \- LOAD
LOC \*c : Load constant (i.e. push one word onto the stack)
LDC \*d : Load double constant ( push two words )
LOL \*l : Load word at \*l-th local (\*l<0) or parameter (\*l>=0)
LOE \*g : Load external word \*g
LIL \*l : Load word pointed to by \*l-th local or parameter
LOF \*f : Load offsetted (top of stack + \*f yield address)
LAL \*l : Load address of local or parameter
LAE \*g : Load address of external
LXL \*n : Load lexical (address of LB \*n static levels back)
LXA \*n : Load lexical (address of AB \*n static levels back)
LOI \*o : Load indirect \*o bytes (address is popped from the stack)
LOS \*w : Load indirect, \*w-byte integer on top of stack gives object size
LDL \*l : Load double local or parameter (two consecutive words are stacked)
LDE \*g : Load double external (two consecutive externals are stacked)
LDF \*f : Load double offsetted (top of stack + \*f yield address)
LPI \*p : Load procedure identifier
.DE
.DS
GROUP 2 \- STORE
STL \*l : Store local or parameter
STE \*g : Store external
SIL \*l : Store into word pointed to by \*l-th local or parameter
STF \*f : Store offsetted
STI \*o : Store indirect \*o bytes (pop address, then data)
STS \*w : Store indirect, \*w-byte integer on top of stack gives object size
SDL \*l : Store double local or parameter
SDE \*g : Store double external
SDF \*f : Store double offsetted
.DE
.DS
GROUP 3 \- INTEGER ARITHMETIC
ADI \*w : Addition (*)
SBI \*w : Subtraction (*)
MLI \*w : Multiplication (*)
DVI \*w : Division (*)
RMI \*w : Remainder (*)
NGI \*w : Negate (two's complement) (*)
SLI \*w : Shift left (*)
SRI \*w : Shift right (*)
.DE
.DS
GROUP 4 \- UNSIGNED ARITHMETIC
ADU \*w : Addition
SBU \*w : Subtraction
MLU \*w : Multiplication
DVU \*w : Division
RMU \*w : Remainder
SLU \*w : Shift left
SRU \*w : Shift right
.DE
.DS
GROUP 5 \- FLOATING POINT ARITHMETIC
ADF \*w : Floating add (*)
SBF \*w : Floating subtract (*)
MLF \*w : Floating multiply (*)
DVF \*w : Floating divide (*)
NGF \*w : Floating negate (*)
FIF \*w : Floating multiply and split integer and fraction part (*)
FEF \*w : Split floating number in exponent and fraction part (*)
.DE
.DS
GROUP 6 \- POINTER ARITHMETIC
ADP \*f : Add \*f to pointer on top of stack
ADS \*w : Add \*w-byte value and pointer
SBS \*w : Subtract pointers in same fragment and push diff as size \*w integer
.DE
.DS
GROUP 7 \- INCREMENT/DECREMENT/ZERO
INC \*- : Increment word on top of stack by 1 (*)
INL \*l : Increment local or parameter (*)
INE \*g : Increment external (*)
DEC \*- : Decrement word on top of stack by 1 (*)
DEL \*l : Decrement local or parameter (*)
DEE \*g : Decrement external (*)
ZRL \*l : Zero local or parameter
ZRE \*g : Zero external
ZRF \*w : Load a floating zero of size \*w
ZER \*w : Load \*w zero bytes
.DE
.DS \" ???
GROUP 8 \- CONVERT (stack: source, source size, dest. size (top))
CII \*- : Convert integer to integer (*)
CUI \*- : Convert unsigned to integer (*)
CFI \*- : Convert floating to integer (*)
CIF \*- : Convert integer to floating (*)
CUF \*- : Convert unsigned to floating (*)
CFF \*- : Convert floating to floating (*)
CIU \*- : Convert integer to unsigned
CUU \*- : Convert unsigned to unsigned
CFU \*- : Convert floating to unsigned
.DE
.DS
GROUP 9 \- LOGICAL
AND \*w : Boolean and on two groups of \*w bytes
IOR \*w : Boolean inclusive or on two groups of \*w bytes
XOR \*w : Boolean exclusive or on two groups of \*w bytes
COM \*w : Complement (one's complement of top \*w bytes)
ROL \*w : Rotate left a group of \*w bytes
ROR \*w : Rotate right a group of \*w bytes
.DE
.DS
GROUP 10 \- SETS
INN \*w : Bit test on \*w byte set (bit number on top of stack)
SET \*w : Create singleton \*w byte set with bit n on (n is top of stack)
.DE
.DS
GROUP 11 \- ARRAY
LAR \*w : Load array element, descriptor contains integers of size \*w
SAR \*w : Store array element
AAR \*w : Load address of array element
.DE
.DS
GROUP 12 \- COMPARE
CMI \*w : Compare \*w byte integers, Push negative, zero, positive for <, = or >
CMF \*w : Compare \*w byte reals
CMU \*w : Compare \*w byte unsigneds
CMS \*w : Compare \*w byte values, can only be used for bit for bit equality test
CMP \*- : Compare pointers
TLT \*- : True if less, i.e. iff top of stack < 0
TLE \*- : True if less or equal, i.e. iff top of stack <= 0
TEQ \*- : True if equal, i.e. iff top of stack = 0
TNE \*- : True if not equal, i.e. iff top of stack non zero
TGE \*- : True if greater or equal, i.e. iff top of stack >= 0
TGT \*- : True if greater, i.e. iff top of stack > 0
.DE
.DS \" ???
GROUP 13 \- BRANCH
BRA \*b : Branch unconditionally to label \*b
BLT \*b : Branch less (pop 2 words, branch if top > second)
BLE \*b : Branch less or equal
BEQ \*b : Branch equal
BNE \*b : Branch not equal
BGE \*b : Branch greater or equal
BGT \*b : Branch greater
ZLT \*b : Branch less than zero (pop 1 word, branch negative)
ZLE \*b : Branch less or equal to zero
ZEQ \*b : Branch equal zero
ZNE \*b : Branch not zero
ZGE \*b : Branch greater or equal zero
ZGT \*b : Branch greater than zero
.DE
.DS
GROUP 14 \- PROCEDURE CALL
CAI \*- : Call procedure (procedure identifier on stack)
CAL \*p : Call procedure (with identifier \*p)
LFR \*s : Load function result
RET \*z : Return (function result consists of top \*z bytes)
.DE
.DS
GROUP 15 \- MISCELLANEOUS
ASP \*f : Adjust the stack pointer by \*f
ASS \*w : Adjust the stack pointer by \*w-byte integer
BLM \*z : Block move \*z bytes; first pop destination addr, then source addr
BLS \*w : Block move, size is in \*w-byte integer on top of stack
CSA \*w : Case jump; address of jump table at top of stack
CSB \*w : Table lookup jump; address of jump table at top of stack
DCH \*- : Follow dynamic chain, convert LB to LB of caller
DUP \*s : Duplicate top \*s bytes
DUS \*w : Duplicate top \*w bytes
EXG \*w : Exchange top \*w bytes
FIL \*g : File name (external 4 := \*g)
GTO \*g : Non-local goto, descriptor at \*g
LIM \*- : Load 16 bit ignore mask
LIN \*n : Line number (external 0 := \*n)
LNI \*- : Line number increment
LOR \*r : Load register (0=LB, 1=SP, 2=HP)
LPB \*- : Convert local base to argument base
MON \*- : Monitor call
NOP \*- : No operation
RCK \*w : Range check; trap on error
RTT \*- : Return from trap
SIG \*- : Trap errors to proc identifier on top of stack, \-2 resets default
SIM \*- : Store 16 bit ignore mask
STR \*r : Store register (0=LB, 1=SP, 2=HP)
TRP \*- : Cause trap to occur (Error number on stack)
.DE 0

6
doc/em/cont.nr Normal file
View File

@@ -0,0 +1,6 @@
.MS T A 0
.ME
.BP
.MS B A 0
.ME
.CT

162
doc/em/descr.nr Normal file
View File

@@ -0,0 +1,162 @@
.SN 7
.BP
.S1 "DESCRIPTORS"
Several instructions use descriptors, notably the range check instruction,
the array instructions, the goto instruction and the case jump instructions.
Descriptors reside in data space.
They may be constructed at run time, but
more often they are fixed and allocated in ROM data.
.P
All instructions using descriptors, except GTO, have as argument
the size of the integers in the descriptor.
All implementations have to allow integers of the size of a
word in descriptors.
All integers popped from the stack and used for indexing or comparing
must have the same size as the integers in the descriptor.
.S2 "Range check descriptors"
Range check descriptors consist of two integers:
.IS 2
.PS 1 4 "" .
.PT
lower bound~~~~~~~signed
.PT
upper bound~~~~~~~signed
.PE
.IE
The range check instruction checks an integer on the stack against
these bounds and causes a trap if the value is outside the interval.
The value itself is neither changed nor removed from the stack.
.S2 "Array descriptors"
Each array descriptor describes a single dimension.
For multi-dimensional arrays, several array instructions are
needed to access a single element.
Array descriptors contain the following three integers:
.IS 2
.PS 1 4 "" .
.PT
lower bound~~~~~~~~~~~~~~~~~~~~~signed
.PT
upper bound \- lower bound~~~~~~~unsigned
.PT
number of bytes per element~~~~~unsigned
.PE
.IE
The array instructions LAR, SAR and AAR have the pointer to the start
of the descriptor as operand on the stack.
.sp
The element A[I] is fetched as follows:
.IS 2
.PS 1 4 "" .
.PT
Stack the address of A (e.g., using LAE or LAL)
.PT
Stack the value of I (n-byte integer)
.PT
Stack the pointer to the descriptor (e.g., using LAE)
.PT
LAR n (n is the size of the integers in the descriptor and I)
.PE
.IE
All array instructions first pop the address of the descriptor
and the index.
If the index is not within the bounds specified, a trap occurs.
If ok, (I~\-~lower bound) is multiplied
by the number of bytes per element (the third word). The result is added
to the address of A and replaces A on the stack.
.A
At this point LAR, SAR and AAR diverge.
AAR is finished. LAR pops the address and fetches the data
item,
the size being specified by the descriptor.
The usual restrictions for memory access must be obeyed.
SAR pops the address and stores the
data item now exposed.
.S2 "Non-local goto descriptors"
The GTO instruction provides a way of returning directly to any
active procedure invocation.
The argument of the instruction is the address of a descriptor
containing three pointers:
.IS 2
.PS 1 4 "" .
.PT
value of PC after the jump
.PT
value of SP after the jump
.PT
value of LB after the jump
.PE
.IE
GTO replaces the loads PC, SP and LB from the descriptor,
thereby jumping to a procedure
and removing zeor or more frames from the stack.
The LB, SP and PC in the descriptor must belong to a
dynamically enclosing procedure,
because some EM implementations will need to backtrack through
the dynamic chain and use the implementation dependent data
in frames to restore registers etc.
.S2 "Case descriptors"
The case jump instructions CSA and CSB both
provide multiway branches selected by a case index.
Both fetch two operands from the stack:
first a pointer to the low address of the case descriptor
and then the case index.
CSA uses the case index as index in the descriptor table, but CSB searches
the table for an occurrence of the case index.
Therefore, the descriptors for CSA and CSB,
as shown in figure 4, are different.
All pointers in the table must be addresses of instructions in the
procedure executing the case instruction.
.P
CSA selects the new PC by indexing.
If the index, a signed integer, is greater than or equal to
the lower bound and less than or equal to the upper bound,
then fetch the new PC from the list of instruction pointers by indexing with
index-lower.
The table does not contain the value of the upper bound,
but the value of upper-lower as an unsigned integer.
The default instruction pointer is used when the index is out of bounds.
If the resulting PC is 0, then trap.
.P
CSB selects the new PC by searching.
The table is searched for an entry with index value equal to the case index.
That entry or, if none is found, the default entry contains the
new PC.
When the resulting PC is 0, a trap is performed.
.P
The choice of which case instruction to use for
each source language case statement
is up to the front end.
If the range of the index value is dense, i.e
.DS
(highest value \- lowest value) / number of cases
.DE 1
is less than some threshold, then CSA is the obvious choice.
If the range is sparse, CSB is better.
.N 2
.Dr 30
|--------------------| |--------------------| high address
| pointer for upb | | pointer n-1 |
|--------------------| |- - - - - - - |
| . | | index n-1 |
| . | |--------------------|
| . | | . |
| . | | . |
| . | | . |
| . | |--------------------|
| . | | pointer 1 |
|--------------------| |- - - - - - - |
| pointer for lwb+1 | | index 1 |
|--------------------| |--------------------|
| pointer for lwb | | pointer 0 |
|--------------------| |- - - - - - - |
| upper - lower | | index 0 |
|--------------------| |--------------------|
| lower bound | | number of entries |
|--------------------| |--------------------|
| default pointer | | default pointer | low address
|--------------------| |--------------------|
CSA descriptor CSB descriptor
.Df
Figure 4. Descriptor layout for CSA and CSB
.De

6
doc/em/dispat1.sed Normal file
View File

@@ -0,0 +1,6 @@
1c\
.TS\
r l l l l l l l l.
s/-/\\-/g
/DISPATCH2/,$c\
.TE

6
doc/em/dispat2.sed Normal file
View File

@@ -0,0 +1,6 @@
1,/DISPATCH2/c\
.TS\
r l l l l l l l l.
s/-/\\-/g
/DISPATCH3/,$c\
.TE

6
doc/em/dispat3.sed Normal file
View File

@@ -0,0 +1,6 @@
1,/DISPATCH3/c\
.TS\
r l l l l l l l l.
s/-/\\-/g
$a\
.TE

377
doc/em/dspace.nr Normal file
View File

@@ -0,0 +1,377 @@
.BP
.SN 4
.S1 "DATA ADDRESS SPACE"
The data address space is divided into three parts, called 'areas',
each with its own addressing method:
global data area,
local data area (including the stack),
and heap data area.
These data areas must be part of the same
address space because all data is accessed by
the same type of pointers.
.P
Space for global data is reserved using several pseudoinstructions in the
assembly language, as described in
the next paragraph and chapter 11.
The size of the global data area is fixed per program.
.A
Global data is addressed absolutely in the machine language.
Many instructions are available to address global data.
They all have an absolute address as argument.
Examples are LOE, LAE and STE.
.P
Part of the global data area is initialized by the
compiler, the
rest is not initialized at all or is initialized
with a value, typically \-32768 or 0.
Part of the initialized global data may be made read-only
if the implementation supports protection.
.P
The local data area is used as a stack,
which grows from high to low addresses
and contains some data for each active procedure
invocation, called a 'frame'.
The size of the local data area varies dynamically during
execution.
Below the current procedure frame resides the operand stack.
The stack pointer SP always points to the bottom of
the local data area.
Local data is addressed by offsetting from the local base pointer LB.
LB always points to the frame of the current procedure.
Only the words of the current frame and the parameters
can be addressed directly.
Variables in other active procedures are addressed by following
the chain of statically enclosing procedures using the LXL or LXA instruction.
The variables in dynamically enclosing procedures can be
addressed with the use of the DCH instruction.
.A
Many instructions have offsets to LB as argument,
for instance LOL, LAL and STL.
The arguments of these instructions range from \-1 to some
(negative) minimum
for the access of local storage and from 0 to some (positive)
maximum for parameter access.
.P
The procedure call instructions CAL and CAI each create a new frame
on the stack.
Each procedure has an assembly-time parameter specifying
the number of bytes needed for local storage.
This storage is allocated each time the procedure is called and
must be a multiple of the wordsize.
Each procedure, therefore, starts with a stack with the local variables
already allocated.
The return instructions RET and RTT remove a frame.
The actual parameters must be removed by the calling procedure.
.P
RET may copy some words from the stack of
the returning procedure to an unnamed 'function return area'.
This area is available for 'READ-ONCE' access using the LFR instruction.
The result of a LFR is only defined if the size used to fetch
is identical to the size used in the last return.
The instruction ASP, used to remove the parameters from the
stack, the branch instruction BRA and the non-local goto
instrucion GTO are the only ones that leave the contents of
the 'function return area' intact.
All other instructions are allowed to destroy the function
return area.
Thus parameters can be popped before fetching the function result.
The maximum size of all function return areas is
implementation dependent,
but should allow procedure instance identifiers and all
implemented objects of type integer, unsigned, float
and pointer to be returned.
In most implementations
the maximum size of the function return
area is twice the pointer size,
because we want to be able to handle 'procedure instance
identifiers' which consist of a procedure identifier and the LB
of a frame belonging to that procedure.
.P
The heap data area grows upwards, to higher numbered
addresses.
It is initially empty.
The initial value of the heap pointer HP
marks the low end.
The heap pointer may be manipulated
by the LOR and STR instructions.
The heap can only be addressed indirectly,
by pointers derived from previous values of HP.
.S2 "Global data area"
The initial size of the global data area is determined at assembly time.
Global data is allocated by several
pseudoinstructions in the EM assembly
language.
Each pseudoinstruction allocates one or more bytes.
The bytes allocated for a single pseudo form
a 'block'.
A block differs from a fragment, because,
under certain conditions, several blocks are allocated
in a single fragment.
This guarantees that the bytes of these blocks
are consecutive.
.P
Global data is addressed absolutely in binary
machine language.
Most compilers, however,
cannot assign absolute addresses to their global variables,
especially not if the language
allows programs to be composed of several separately compiled modules.
The assembly language therefore allows the compiler to name
the first address of a global data block with an alphanumeric label.
Moreover, the only way to address such a named global data block
in the assembly language is by using its name.
It is the task of the assembler/loader to
translate these labels into absolute addresses.
These labels may also be used
in CON and ROM pseudoinstructions to initialize pointers.
.P
The pseudoinstruction CON allocates initialized data.
ROM acts like CON but indicates that the initialized data will
not change during execution of the program.
The pseudoinstruction BSS allocates a block of uninitialized
or identically initialized
data.
The pseudoinstruction HOL is similar to BSS,
but it alters the meaning of subsequent absolute addressing in
the assembly language.
.P
Another type of global data is a small block,
called the ABS block, with an implementation defined size.
Storage in this type of block can only be addressed
absolutely in assembly language.
The first word has address 0 and is used to maintain the
source line number.
Special instructions LIN and LNI are provided to
update this counter.
A pointer at location 4 points to a string containing the
current source file name.
The instruction FIL can be used to update the pointer.
.P
All numeric arguments of the instructions that address
the global data area refer to locations in the
ABS block unless
they are preceded by at least one HOL pseudo in the same
module,
in which case they refer to the storage area allocated by the
last HOL pseudoinstruction.
Thus LOE 0 loads the zeroth word of the most recent HOL, unless no HOL has
appeared in the current file so
far, in which case it loads the zeroth word of the
ABS fragment.
.P
The global data area is highly fragmented.
The ABS block and each HOL and BSS block are separate fragments.
The way fragments are formed from CON and ROM blocks is more complex.
The assemblers group several blocks into a single fragment.
A fragment only contains blocks of the same type: CON or ROM.
It is guaranteed that the bytes allocated for two consecutive CON pseudos are
allocated consecutively in a single fragment, unless
these CON pseudos are separated in the assembly language program
by a data label definition or one or more of the following pseudos:
.DS
ROM, BSS, HOL and END
.DE
An analogous rule holds for ROM pseudos.
.S2 "Local data area"
The local data area consists of a sequence of frames, one for
each active procedure.
Below the frame of the current procedure resides the
expression stack.
Frames are generated by procedure calls and are
removed by procedure returns.
A procedure frame consists of six 'zones':
.DS
1. The return status block
2. The local variables and compiler temporaries
3. The register save block
4. The dynamic local generators
5. The operand stack.
6. The parameters of a procedure one level deeper
.DE
A sample frame is shown in Figure 1.
.P
Before a procedure call is performed the actual
parameters are pushed onto the stack of the calling procedure.
The exact details are compiler dependent.
EM allows procedures to be called with a variable number of
parameters.
The implementation of the C-language almost forces its runtime
system to push the parameters in reverse order, that is,
the first positional parameter last.
Most compilers use the C calling convention to be compatible.
The parameters of a procedure belong to the frame of the
calling procedure.
Note that the evaluation of the actual parameters may imply
the calling of procedures.
The parameters can be accessed with certain instructions using
offsets of 0 and greater.
The first byte of the last parameter pushed has offset 0.
Note that the parameter at offset 0 has a special use in the
instructions following the static chain (LXL and LXA).
These instructions assume that this parameter contains the LB of
the statically enclosing procedure.
Procedures that do not have a dynamically enclosing procedure
do not need a static link at offset 0.
.P
Two instructions are available to perform procedure calls, CAL
and CAI.
Several tasks are performed by these call instructions.
.A
First, a part of the status of the calling procedure is
saved on the stack in the return status block.
This block should contain the return address of the calling
procedure, its LB and other implementation dependent data.
The size of this block is fixed for any given implementation
because the lexical instructions LPB, LXL and LXA must be able to
obtain the base addresses of the procedure parameters \fBand\fP local
variables.
An alternative solution can be used on machines with a highly
segmented address space.
The stack frames need not be contiguous then and the first
status save area can contain the parameter base AB,
which has the value of SP just after the last parameter has
been pushed.
.A
Second, the LB is changed to point to the
first word above the local variables.
The new LB is a copy of the SP after the return status
block has been pushed.
.A
Third, the amount of local storage needed by the procedure is
reserved.
The parameters and local storage are accessed by the same instructions.
Negative offsets are used for access to local variables.
The highest byte, that is the byte nearest
to LB, has to be accessed with offset \-1.
The pseudoinstruction specifying the entry point of a
procedure, has an argument that specifies the amount of local
storage needed.
The local variables allocated by the CAI or CAL instructions
are the only ones that can be accessed with a fixed negative offset.
The initial value of the allocated words is
not defined, but implementations that check for undefined
values will probably initialize them with a
special 'undefined' pattern, typically \-32768.
.A
Fourth, any EM implementation is allowed to reserve a variable size
block beneath the local variables.
This block could, for example, be used to save a variable number
of registers.
.A
Finally, the address of the entry point of the called procedure
is loaded into the Program Counter.
.P
The ASP instruction can be used to allocate further (dynamic)
local storage.
The base address of such storage must be obtained with a LOR~SP
instruction.
This same instruction ASP may also be used
to remove some words from the stack.
.P
There is a version of ASP, called ASS, which fetches the number
of bytes to allocate from the stack.
It can be used to allocate space for local
objects whose size is unknown at compile time,
so called 'dynamic local generators'.
.P
Control is returned to the calling procedure with a RET instruction.
Any return value is then copied to the 'function return area'.
The frame created by the call is deallocated and the status of
the calling procedure is restored.
The value of SP just after the return value has been popped must
be the same as the
value of SP just before executing the first instruction of this
invocation.
This means that when a RET is executed the operand stack can
only contain the return value and all dynamically generated locals must be
deallocated.
Violating this restriction might result in hard to detect
errors.
The calling procedure has to remove the parameters from the stack.
This can be done with the aforementioned ASP instruction.
.P
Each procedure frame is a separate fragment.
Because any fragment may be placed anywhere in memory,
procedure frames need not be contiguous.
.Dr 47
|===============================|
| actual parameter n-1 |
|-------------------------------|
| . |
| . |
| . |
|-------------------------------|
| actual parameter 0 | ( <\- AB )
|===============================|
|===============================|
|///////////////////////////////|
|///// return status block /////|
|///////////////////////////////| <\- LB
|===============================|
| |
| local variables |
| |
|-------------------------------|
| |
| compiler temporaries |
| |
|===============================|
|///////////////////////////////|
|///// register save block /////|
|///////////////////////////////|
|===============================|
| |
| dynamic local generators |
| |
|===============================|
| operand |
|-------------------------------|
| operand |
|===============================|
| parameter m-1 |
|-------------------------------|
| . |
| . |
| . |
|-------------------------------|
| parameter 0 | <\- SP
|===============================|
.Df
Figure 1. A sample procedure frame and parameters.
.De
.S2 "Heap data area"
The heap area starts empty, with HP
pointing to the low end of it.
HP always contains a word address.
A copy of HP can always be obtained with the LOR instruction.
A new value may be stored in the heap pointer using the STR instruction.
If the new value is greater than the old one,
then the heap grows.
If it is smaller, then the heap shrinks.
HP may never point below its original value.
All words between the current HP and the original HP
are allocated to the heap.
The heap may not grow into a part of memory that is already allocated
for the stack.
When this is attempted, the STR instruction will cause a trap to occur.
.P
The only way to address the heap is indirectly.
Whenever an object is allocated by increasing HP,
then the old HP value must be saved and can be used later to address
the allocated object.
If, in the meantime, HP is decreased so that the object
is no longer part of the heap, then an attempt to access
the object is not allowed.
Furthermore, if the heap pointer is increased again to above
the object address, then access to the old object gives undefined results.
.P
The heap is a single fragment.
All bytes have consecutive addresses.
No limits are imposed on the size of the heap as long as it fits
in the available data address space.

1666
doc/em/em.i Normal file

File diff suppressed because it is too large Load Diff

210
doc/em/env.nr Normal file
View File

@@ -0,0 +1,210 @@
.SN 8
.VS 1 0
.BP
.S1 "ENVIRONMENT INTERACTIONS"
EM programs can interact with their environment in three ways.
Two, starting/stopping and monitor calls, are dealt with in this chapter.
The remaining way to interact, interrupts, will be treated
together with traps in chapter 9.
.S2 "Program starting and stopping"
EM user programs start with a call to a procedure called
m_a_i_n.
The assembler and backends look for the definition of a procedure
with this name in their input.
The call passes three parameters to the procedure.
The parameters are similar to the parameters supplied by the
UNIX
.FS
UNIX is a Trademark of Bell Laboratories.
.FE
operating system to C programs.
These parameters are often called
.BW argc ,
.B argv
and
.BW envp .
Argc is the parameter nearest to LB and is a wordsized integer.
The other two are pointers to the first element of an array of
string pointers.
.N
The
.B argv
array contains
.B argc
strings, the first of which contains the program call name.
The other strings in the
.B argv
array are the program parameters.
.P
The
.B envp
array contains strings in the form "name=string", where 'name'
is the name of an environment variable and string its value.
The
.B envp
is terminated by a zero pointer.
.P
An EM user program stops if the program returns from the first
invocation of m_a_i_n.
The contents of the function return area are used to procure a
wordsized program return code.
EM programs also stop when traps and interrupts occur that are
not caught and when the exit monitor call is executed.
.S2 "Input/Output and other monitor calls"
EM differs from most conventional machines in that it has high level i/o
instructions.
Typical instructions are OPEN FILE and READ FROM FILE instead
of low level instructions such as setting and clearing
bits in device registers.
By providing such high level i/o primitives, the task of implementing
EM on various non EM machines is made considerably easier.
.P
I/O is initiated by the MON instruction, which expects an iocode on top
of the stack.
Often there are also parameters which are pushed on the
stack in reverse order, that is: last
parameter first.
Some i/o functions also provide results, which are returned on the stack.
In the list of monitor calls we use several types of parameters and results,
these types consist of integers and unsigneds of varying sizes, but never
smaller than the wordsize, and the two pointer types.
.N 1
The names of the types used are:
.IS 4
.PS - 10
.PT int
an integer of wordsize
.PT int2
an integer whose size is the maximum of the wordsize and 2
bytes
.PT int4
an integer whose size is the maximum of the wordsize and 4
bytes
.PT intp
an integer with the size of a pointer
.PT uns2
an unsigned integer whose size is the maximum of the wordsize and 2
.PT unsp
an unsigned integer with the size of a pointer
.PT ptr
a pointer into data space
.PE 1
.IE 0
The table below lists the i/o codes with their results and
parameters.
This list is similar to the system calls of the UNIX Version 7
operating system.
.A
To execute a monitor call, proceed as follows:
.IS 2
.N 1
.PS a 4 "" )
.PT
Stack the parameters, in reverse order, last parameter first.
.PT
Push the monitor call number (iocode) onto the stack.
.PT
Execute the MON instruction.
.PE 1
.IE
An error code is present on the top of the stack after
execution of most monitor calls.
If this error code is zero, the call performed the action
requested and the results are available on top of the stack.
Non-zero error codes indicate a failure, in this case no
results are available and the error code has been pushed twice.
This construction enables programs to test for failure with a
single instruction (~TEQ or TNE~) and still find out the cause of
the failure.
The result name 'e' is reserved for the error code.
.N 1
List of monitor calls.
.DS B
.ta 2n 8n 16n 32n 48n
number name parameters results function
1 Exit status:int Terminate this process
2 Fork e,flag,pid:int Spawn new process
3 Read fildes:int;buf:ptr;nbytes:unsp
e:int;rbytes:unsp Read from file
4 Write fildes:int;buf:ptr;nbytes:unsp
e:int;wbytes:unsp Write on a file
5 Open string:ptr;flag:int
e,fildes:int Open file for read and/or write
6 Close fildes:int e:int Close a file
7 Wait e:int;status,pid:int2
Wait for child
8 Creat string:ptr;mode:int
e,fildes:int Create a new file
9 Link string1,string2:ptr
e:int Link to a file
10 Unlink string:ptr e:int Remove directory entry
12 Chdir string:ptr e:int Change default directory
14 Mknod string:ptr;mode,addr:int2
e:int Make a special file
15 Chmod string:ptr;mode:int2
e:int Change mode of file
16 Chown string:ptr;owner,group:int2
e:int Change owner/group of a file
18 Stat string,statbuf:ptr
e:int Get file status
19 Lseek fildes:int;off:int4;whence:int
e:int;oldoff:int4 Move read/write pointer
20 Getpid pid:int2 Get process identification
21 Mount special,string:ptr;rwflag:int
e:int Mount file system
22 Umount special:ptr e:int Unmount file system
23 Setuid userid:int2 e:int Set user ID
24 Getuid e_uid,r_uid:int2 Get user ID
25 Stime time:int4 e:int Set time and date
26 Ptrace request:int;pid:int2;addr:ptr;data:int
e,value:int Process trace
27 Alarm seconds:uns2 previous:uns2 Schedule signal
28 Fstat fildes:int;statbuf:ptr
e:int Get file status
29 Pause Stop until signal
30 Utime string,timep:ptr
e:int Set file times
33 Access string:ptr;mode:int
e:int Determine file accessibility
34 Nice incr:int Set program priority
35 Ftime bufp:ptr e:int Get date and time
36 Sync Update filesystem
37 Kill pid:int2;sig:int
e:int Send signal to a process
41 Dup fildes,newfildes:int
e,fildes:int Duplicate a file descriptor
42 Pipe e,w_des,r_des:int Create a pipe
43 Times buffer:ptr Get process times
44 Profil buff:ptr;bufsiz,offset,scale:intp Execution time profile
46 Setgid gid:int2 e:int Set group ID
47 Getgid e_gid,r_gid:int Get group ID
48 Sigtrp trapno,signo:int
e,prevtrap:int See below
51 Acct file:ptr e:int Turn accounting on or off
53 Lock flag:int e:int Lock a process
54 Ioctl fildes,request:int;argp:ptr
e:int Control device
56 Mpxcall cmd:int;vec:ptr e:int Multiplexed file handling
59 Exece name,argv,envp:ptr
e:int Execute a file
60 Umask complmode:int2 oldmask:int2 Set file creation mode mask
61 Chroot string:ptr e:int Change root directory
.DE 1
Codes 0, 11, 13, 17, 31, 32, 38, 39, 40, 45, 49, 50, 52,
55, 57, 58, 62, and 63 are
not used.
.P
All monitor calls, except fork and sigtrp
are the same as the UNIX version 7 system calls.
.P
The sigtrp entry maps UNIX signals onto EM interrupts.
Normally, trapno is in the range 0 to 252.
In that case it requests that signal signo
will cause trap trapno to occur.
When given trap number \-2, default signal handling is reset, and when given
trap number \-3, the signal is ignored.
.P
The flag returned by fork is 1 in the child process and 0 in
the parent.
The pid returned is the process-id of the other process.

9
doc/em/even.c Normal file
View File

@@ -0,0 +1,9 @@
main() {
register int l,j ;
for ( j=0 ; (l=getchar()) != -1 ; j++ ) {
if ( j%16 == 15 ) printf("%3d\n",l&0377 ) ;
else printf("%3d ",l&0377 ) ;
}
printf("\n") ;
}

178
doc/em/exam.e Normal file
View File

@@ -0,0 +1,178 @@
mes 2,2,2 ; wordsize 2, pointersize 2
.1
rom 't.p\000' ; the name of the source file
hol 552,-32768,0 ; externals and buf occupy 552 bytes
exp $sum ; sum can be called from other modules
pro $sum,2 ; procedure sum; 2 bytes local storage
lin 8 ; code from source line 8
ldl 0 ; load two locals ( a and b )
adi 2 ; add them
ret 2 ; return the result
end 2 ; end of procedure ( still two bytes local storage )
.2
rom 1,99,2 ; descriptor of array a[]
exp $test ; the compiler exports all level 0 procedures
pro $test,226 ; procedure test, 226 bytes local storage
.3
rom 4.8F8 ; assemble Floating point 4.8 (8 bytes) in
.4 ; global storage
rom 0.5F8 ; same for 0.5
mes 3,-226,2,2 ; compiler temporary not referenced indirect
mes 3,-24,2,0 ; the same is true for i, j, b and c in test
mes 3,-22,2,0
mes 3,-4,2,0
mes 3,-2,2,0
mes 3,-20,8,0 ; and for x and y
mes 3,-12,8,0
lin 20 ; maintain source line number
loc 1
stl -4 ; j := 1
lni ; was lin 21 prior to optimization
lol -4
loc 3
mli 2
loc 6
adi 2
stl -2 ; i := 3 * j + 6
lni ; was lin 22 prior to optimization
lae .3
loi 8
lal -12
sti 8 ; x := 4.8
lni ; was lin 23 prior to optimization
lal -12
loi 8
lae .4
loi 8
dvf 8
lal -20
sti 8 ; y := x / 0.5
lni ; was lin 24 prior to optimization
loc 1
stl -22 ; b := true
lni ; was lin 25 prior to optimization
loc 122
stl -24 ; c := 'z'
lni ; was lin 26 prior to optimization
loc 1
stl -2 ; for i:= 1
2
lol -2
dup 2
mli 2 ; i*i
lal -224
lol -2
lae .2
sar 2 ; a[i] :=
lol -2
loc 100
beq *3 ; to 100 do
inl -2 ; increment i and loop
bra *2
3
lin 27
lol -4
loc 27
adi 2 ; j + 27
sil 0 ; r.r1 :=
lni ; was lin 28 prior to optimization
lol -22 ; b
lol 0
stf 10 ; r.r3 :=
lni ; was lin 29 prior to optimization
lal -20
loi 16
adf 8 ; x + y
lol 0
adp 2
sti 8 ; r.r2 :=
lni ; was lin 23 prior to optimization
lal -224
lol -4
lae .2
lar 2 ; a[j]
lil 0 ; r.r1
cal $sum ; call now
asp 4 ; remove parameters from stack
lfr 2 ; get function result
stl -2 ; i :=
4
lin 31
lol -2
zle *5 ; while i > 0 do
lol -4
lil 0
adi 2
stl -4 ; j := j + r.r1
del -2 ; i := i - 1
bra *4 ; loop
5
lin 32
lol 0
stl -226 ; make copy of address of r
lol -22
lol -226
stf 10 ; r3 := b
lal -20
loi 16
adf 8
lol -226
adp 2
sti 8 ; r2 := x + y
loc 0
sil -226 ; r1 := 0
lin 34 ; note the abscence of the unnecesary jump
lae 22 ; address of output structure
lol -4
cal $_wri ; write integer with default width
asp 4 ; pop parameters
lae 22
lol -2
loc 6
cal $_wsi ; write integer width 6
asp 6
lae 22
lal -12
loi 8
loc 9
loc 3
cal $_wrf ; write fixed format real, width 9, precision 3
asp 14
lae 22
lol -22
cal $_wrb ; write boolean, default width
asp 4
lae 22
cal $_wln ; writeln
asp 2
ret 0 ; return, no result
end 226
exp $_main
pro $_main,0 ; main program
.6
con 2,-1,22 ; description of external files
.5
rom 15.96F8
fil .1 ; maintain source file name
lae .6 ; description of external files
lae 0 ; base of hol area to relocate buffer addresses
cal $_ini ; initialize files, etc...
asp 4
lin 37
lae .5
loi 8
lae 2
sti 8 ; x := 15.9
lni ; was lin 38 prior to optimization
loc 99
ste 0 ; mi := 99
lni ; was lin 39 prior to optimization
lae 10 ; address of r
cal $test
asp 2
loc 0 ; normal exit
cal $_hlt ; cleanup and finish
asp 2
end 0
mes 4,40 ; length of source file is 40 lines
mes 5 ; reals were used

Some files were not shown because too many files have changed in this diff Show More