Notes on Possible Global Optimizations
======================================

Global optimizations will be profitable when cross-module information can
be exploited: essentially, any optimization which applies on a module-wide
basis could be performed on a program-wide basis.

Examples:

    Code Generation:
    
        - common-tail sharing
        
        - automatic inlining
        
        
    C++ compiler:
    
        - call-graph information: throwing, null routine bodies
        
        - could also do routine aliasing ( pass-thru inlining, VFT's, etc )
        
        
It is also possible to use a repository to achieve some of the benefits
of global optimization.  When a module by itself establishes information
of use in compiling other modules, that information can be stored in
a repository.

    C++ compiler:
    
        - null routine bodies are completely determined by compiling
          a module
          
        - whether a routine could throw may require analysis of more than
          one module jointly
          
A number of repositories can be used. For example, it would be desirable
to have a repository for each library supplied by WATCOM (this could be
generated by non-compiler means before general compiler support for creation
was present).

Possible implementation of a global optimizer:
    - have a working program
    - global optimizer analyses repository and updates it with further
      optimization information
    - program is re-made (modules are re-compiled automatically) since
      dependent information has changed)
    - any information added by the global optimizer must be undone
      whenever there is a change to a module used to generate that 
      information
