Path: utzoo!utgpu!water!watmath!clyde!ima!johnl From: andrew@frip.gwd.tek.com (Andrew Klossner) Newsgroups: comp.compilers Subject: Re: Assemblers can be fast Message-ID: <9621@tekecs.TEK.COM> Date: 15 Jan 88 17:10:59 GMT References: <813@ima.ISC.COM> <833@ima.ISC.COM> Sender: johnl@ima.ISC.COM Organization: Tektronix, Wilsonville, Oregon Lines: 27 Approved: compilers@ima.UUCP > "This [one-pass assembly with fixup chains] is easy if you > don't have to worry about instructions that change their size > depending on the expresison value (eg long, short and medium > branch instructions). Many assemblers spend time optimizing > such branches, and this generally requires an extra pass to do > it properly. The gains of optimizing such branches are really > worthwhile." Branch length optimization is a win, but you don't need multiple passes to do it. I recently wrote a one-pass assembler with various sorts of span length optimization. There was nothing particularly clever involved; I just told myself firmly that I wasn't going to do multiple passes, and after some thought the necessary algorithms became clear. It helped, but was not vital, that I had a large virtual memory space and so didn't need to bother with temporary files. In general, a good guiding principle is that it's much quicker to review your generated object code in conjunction with in-memory tables than it is to make another pass over the source code. -=- Andrew Klossner (decvax!tektronix!tekecs!andrew) [UUCP] (andrew%tekecs.tek.com@relay.cs.net) [ARPA] -- Send compilers articles to ima!compilers or, in a pinch, to Levine@YALE.EDU Plausible paths are { ihnp4 | decvax | cbosgd | harvard | yale | bbn}!ima Please send responses to the originator of the message -- I cannot forward mail accidentally sent back to compilers. Meta-mail to ima!compilers-request