Re: deadcode optimization

rog@vitanuova.com (Roger Peppé)
8 Mar 2001 13:16:02 -0500

          From comp.compilers

Related articles
[2 earlier articles]
Re: deadcode optimization broeker@physik.rwth-aachen.de (Hans-Bernhard Broeker) (2001-03-01)
Re: deadcode optimization Bjorn.DeSutter@rug.ac.be (Bjorn De Sutter) (2001-03-01)
Re: deadcode optimization guerby@acm.org (Laurent Guerby) (2001-03-01)
Re: deadcode optimization stonybrk@fubar.com (Norman Black) (2001-03-04)
Re: deadcode optimization fjh@cs.mu.OZ.AU (2001-03-08)
Re: deadcode optimization tgi@netgem.com (2001-03-08)
Re: deadcode optimization rog@vitanuova.com (2001-03-08)
Re: deadcode optimization stonybrk@ix.netcom.com (Norman Black) (2001-03-10)
Re: deadcode optimization stonybrk@ix.netcom.com (Norman Black) (2001-03-10)
Re: deadcode optimization fjh@cs.mu.OZ.AU (2001-03-10)
Re: deadcode optimization fjh@cs.mu.OZ.AU (2001-03-12)
Re: deadcode optimization stonybrk@ix.netcom.com (Norman Black) (2001-03-14)
Re: deadcode optimization stonybrk@ix.netcom.com (Norman Black) (2001-03-14)
[4 later articles]
| List of all articles for this month |
From: rog@vitanuova.com (Roger Peppé)
Newsgroups: comp.compilers
Date: 8 Mar 2001 13:16:02 -0500
Organization: Compilers Central
References: 01-03-012 01-03-022 01-03-034
Keywords: linker, optimize, comment
Posted-Date: 08 Mar 2001 13:16:02 EST

Norman Black wrote:
> "Smart linking" is trivial for a compiler do handle and have ALL
> linkers in existence support the unused code "removal".
>
> All that need be done is have the compiler output library/archive
> files directly with one procedure per object in the library. Our
> compilers have done this since 1987 and any linker appropriately does
> not link in unused code.


Using a smarter linker can do more than just eliminate dead code.


For instance, the Plan 9/Inferno C compilers emit "high level" machine
code which is translated as appropriate by the linker (e.g. the
emitted code can reference the "frame pointer" when none actually
exists - the linker statically keeps track of the stack pointer and
inserts the appropriate offsets)


The linker can then do all sorts of interesting things: automatically
inline small procedures, remove unreferenced global data and functions
(the former can be a big win on space), peephole and interprocedural
optimisation, etc.


Another example of the flexibility of this approach: we've got a
linker for the ARM that can generate ARM or Thumb code - the compiler
produces the same intermediate files for both.


    cheers,
        rog.
[I've always been surprised we don't see more link-time optimization,
since the linker is usually the only phase of the compilation process
that sees the entire program. -John]


Post a followup to this message

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