Re: code generation on 8086? (Norman Hilton)
Mon, 6 Mar 1995 16:23:35 GMT

          From comp.compilers

Related articles
Re: code generation on 8086? (1995-03-01)
Re: code generation on 8086? (1995-03-06)
Re: code generation on 8086? john_reiser@MENTORG.COM (1995-03-07)
| List of all articles for this month |

Newsgroups: comp.compilers
From: (Norman Hilton)
Keywords: code, 386
Organization: BT Labs, Martlesham Heath, Ipswich, UK
References: 95-02-194 95-03-021
Date: Mon, 6 Mar 1995 16:23:35 GMT

: (Paul Rubin) wrote:
: > What are the basic techniques for code generation on the 8086?
: >
: > This mainly means register allocation on a cpu where every register
: > is weird and special in a different way. (If you're familiar
: > with the 386, you may not know that the 8086 is a *lot* worse).
: >
: > The other issue is near/far pointers and calls, etc.

{ The work described below was not done for my present employer. }

A long time ago I worked on compilers for the 8080 and for the 8086
when it first came out. The 8080 code was poor because we used certain
registers for certain things and so wasted a lot of code moving things
about. (A peepholer would have helped here.)

In the 8086 compiler we improved on this by keeping a list of registers
along with what they could be used for and whether they were in use at the
time. When we wanted a register for some purpose we searched the list for
a suitable free one. If we found one we would mark it busy and use it,
otherwise we would have to save one which was in use. We did a "logical"
save when we chose the register and only physically saved it when we wrote
to it.

Many entries on the list had links to other related entries, eg
AX had links to AH and AL.

At the time, the various addressing models had not been invented for the
8086 so our use of near and far was not very good. (We wanted the
generality of far with the efficiency of near.)

All this was so long ago that I no longer have the details, sorry.


Norm (

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.