[Oberon] O-7 code generation

Jan de Kruyf jan.de.kruyf at gmail.com
Mon Nov 23 16:24:27 CET 2015


Hallo,

I stumbled onto something I do not understand, but perhaps there is a
compiler specialist.

Here it is:
MODULE Test1;
VAR t : INTEGER;
BEGIN
   t := 9;
END Test1.


code
   0     4EE90004       SUB SP SP      4
   1     AFE00000       STR  LNK SP       0
   2     40000009       MOV  R0  R0      9
   3     8D000003       LDR SB  R0       3
   4     A0D00000       STR   R0 SB       0
   5     8FE00000       LDR LNK SP       0
   6     4EE80004       ADD SP SP      4
   7     C700000F       B LNK


So I assign '9' to 'local' global variable 't'.

In line 2 constant 9 is moved into R0
in line 3 SB is loaded with the data from [R0 + 3]
in line 4 R0 is stored in [SB + 3]

So R0 is overwritten, unless this is patched by the module loader.

But the book says that line 3 was designed to read:

LDR SB R12  3      ;(section 12.7.9 -- 2nd last paragraph)


Does anyone know what is up here?

Thanks,

j.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.inf.ethz.ch/pipermail/oberon/attachments/20151123/cfa1f0dd/attachment.html>


More information about the Oberon mailing list