[net.micro.68k] Re M680*0 "small model"

hansche@mot.UUCP (Brian Hansche) (06/18/85)

>
>> It sounds to me like what the 68000 needs is an optimizing assembler.
>> On Perkin-Elmer 3200 series computers there are several addressing
>> modes, using from 2 to 6 bytes per instruction. The assembler
>> automatically figures the best addressing mode and generates the
>> appropiate object code.
>
>Actually the better 8086 assemblers do this.  And in the days back when I
>used to write 8086 assemblers I used an algorithm very similar to the one
>you're describing to do it.  It is fairly complicated to do, because the
>iterative algorithm can loop forever in pathological cases if you don't
>keep track of what you're doing.
>
>Well, actually the Intel assemblers do even more than that... some mnemonics,
>such as MOV, can generate 8 or so different opcodes, depending on the
>operands, before you even get to all the small details like the addressing
>modes, selecting the destination operand and size of immediates, etc.

Actually the assembler in the system V micro port (68k version) does all the
above optimizations including branch shortning and selecting the correct
opcode from several choices.

The real "problem" which causes the large model to be selected is linkages
to externally compiled modules and data.  Within a single assembly, text
can easily be optimized to use the shortest branch addressing mode possible.
However, when linking to static data segments, or externally compiled text
segments either a limitation on address space (small model) must be assumed,
or the worst case instructions (large model) must be assumed.  In the 68k
micro port, a large model was used consistantly for the following reasons:

    1) The performance penelty of large over small model is not large
       on the 68k family.
    2) There is a large number of SYSTEM V utilities which require the
       large model.
    3) The difficulties of trying to mix large and small models in the
       same compilation system are significiant.  Multiple libraries are
       required, if a program crosses the boundries between large and
       small then everything must be recompiled...