Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!sunybcs!bingvaxu!leah!uwmcsd1!uwmacc!hobbes!root From: root@hobbes.UUCP Newsgroups: comp.lang.c Subject: Re: Types Message-ID: <200@hobbes.UUCP> Date: Thu, 27-Aug-87 02:25:17 EDT Article-I.D.: hobbes.200 Posted: Thu Aug 27 02:25:17 1987 Date-Received: Sat, 29-Aug-87 07:45:38 EDT References: <7264@brl-adm.ARPA> <734@sdchema.sdchem.UUCP> Reply-To: root@hobbes.UUCP (John Plocher) Followup-To: comp.lang.c Organization: U of Wisconsin - Madison Spanish Department Lines: 43 +---- Tim Olson writes in <18042@amdcad.AMD.COM> ---- | +---- John Plocher ( that's *me* ) wrote ---- | | Along came the 808x and I find that there were 2 modes for addresses: | |short and fast -vs- big and slow; these addresses could be used for code | |and data. Obviously the compiler/linker/loader should be the one to | |determine which to use, right? | +----- | | That has to be a pretty smart linker, as far as linkers go. It is an | N-P complete problem to "optimally" change "far" references to "near" | references (and compact the code) at link time. +---- Why couldn't this be done in the compiler when everything is still in 3-address form IN THE COMPILER? Don't wait to do this until after the code has been generated! Start off assuming that everything is "far", and go thru marking things that can be proved "near". At this point, labels are still symbolic, and since we have an arbitrary data structure for the 3-address code there is no need for compaction or filling with 'nops'. This would (obviously?) mean that there needs to be more or different info stored in ".obj" files - the linker might even need to include the traditional "code generator" found in today's compilers. Off the top of my head I'd think that a "P-code" object file with the needed symbol table info could be a place to start. If the "super-linker" uses a few heuristics like: The total size of this program is < 64K so all code pointers can be "near" The total static/Global/BSS... data is < 64K, ... Aliasing is detected; assume "far" pointers for this ... it could do a passable job. There are cases where things get very rough - I've done a lot of what is now being called "mixed model" programming; using printf() when you have both "near" and "far" strings is not for the masses! I just think that the computer should be able to do this sort of mundaine thing for me. Right now, I have to determine that my code is > 64K and add the -Ml flag to my compiles. At the very least, the compiler should be able to do this! -- John Plocher uwvax!geowhiz!uwspan!plocher plocher%uwspan.UUCP@uwvax.CS.WISC.EDU