From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c30642befcd7bf85 X-Google-Attributes: gid103376,public From: ok@goanna.cs.rmit.EDU.AU (Richard A. O'Keefe) Subject: Re: New GNAT ports (was Re: Ada and Automotive Industry) Date: 1997/01/13 Message-ID: <5bcb7t$plu$1@goanna.cs.rmit.EDU.AU>#1/1 X-Deja-AN: 209455922 references: <5asvku$jtu$1@goanna.cs.rmit.edu.au> <32D39F37.7F1F@mailgw.sanders.lockheed.com> <5b252e$fk4$1@goanna.cs.rmit.edu.au> organization: Comp Sci, RMIT, Melbourne, Australia nntp-posting-user: ok newsgroups: comp.lang.ada Date: 1997-01-13T00:00:00+00:00 List-Id: >Robert Eachus says >" For the 8051, starting with an the a version of gcc for the Intel >8086, 80186, 80286, or even the Z-80 should be a good start. The 8086 and the 8051 aren't all that much alike. The 8086 is a 16 bit machine, extended with segments. The 8051 is an 8 bit machine, without segments. For example, suppose we have something like type R is record x: Byte end; RV: R; and want to do RV.x := RV.x + 1; Assuming that the address of RV is known at link time, we can do inc RV'Address + 1 in the 8086. In the 8051, it's load DPTR with (RV'Address + 1) ld A, @DPTR inc A st A, @DPTR All external RAM references have to share a single 16-bit address register, and the set of operations on that register is rather restricted. (For example, to add something to DPTR, you must operate on its separate halves using 8-bit instructions.) In particular, the major reason why I would expect to use a pragma No_Recursion for Ada-8051 is not that it _can't_ be done (it can) but that it would seriously complicate the use of DPTR. One reason why I would expect Ada-8051 code to be easier to write than 8051 assembler is simply that the compiler would be able to keep track of the contents of DPTR more reliably than I can, and that it could schedule things in interesting ways to reduce DPTR reloads. Another difference is the fact that the 8086 has 16-bit and 32-bit pointers, both of which can point to the same memory locations, while the 8051 has 8-bit and 16-bit pointers, that canNOT point to the same memory locations. The thing that makes something like this practical, in my view, is that the goal is NOT to optimise arbitrary Ada code, but simply to do a reasonable job with code written specifically for the 8051. My claim is not that the 8051 is a good machine for Ada (which it clearly is NOT) but that an Ada SUBSET is a good language for the 8051. I believe that starting from a code generator for right machine (but wrong compiler front end) would be better than starting from a code generator for the wrong machine (but write compiler front end), since converting between intermediate representations (which GNAT already does) just takes compile time, while code generation affects the final code. -- My tertiary education cost a quarter of a million in lost income (assuming close-to-minimum wage); why make students pay even more? Richard A. O'Keefe; http://www.cs.rmit.edu.au/%7Eok; RMIT Comp.Sci.