A Common Bernoulli Compiler Framework
(DRAFT - October 23, 1998)

Paul Stodghill

1. Overview

This document summaries some of the issues and ideas that were raised in our meeting on May 13. The basic thrust of this is to come up with a strategy and implementation plan for developing a common framework for compiler development for the group.

2. Priorities

As I see it, our priorities in this effort, in rapidly decreasing order of importance, should be,
1.
The framework should make it easier for us to mix and match compiler modules that have been developed within the group.
2.
The framework should make it easier for us to import foreign modules into our systems.
5.
The framework should not impede the process of ``delivering'' a compiler system to users outside of our group.
10.
Certain components of the framework should be a solid pieces of engineering that can be marketed in their own right (e.g., as a competitor to the NCI).
100.
The framework may end up providing a vehicle for experimenting with ``open compiling'' and ``aspect-oriented programming'' ideas.

3. The implementation substrate

I strongly believe that one of the first problems to be tackled in developing a common compiler framework is determining how modules will communicate with one another. I do not mean specifying the interfaces between modules; I mean specifying the underlying technology that will be used to pass data between modules.

Some of the functionality that must be provided by such a substrate is,

As was pointed out at the meeting, there are at least two general approaches to this problem:

These two general approaches are not mutually exclusive. In particular, the first (one module per executable) can be built on top of the second (multiple modules per executable). The opposite is not true.

I intend to take the code that currently exists within the Bernoulli compiler, generalize it and separate it out into a separate package, tentatively called the Bernoulli Open Compiler Infrastructure (BOCI). I intend to implement both the ``modules as programs'' and ``single executable'' approaches into this system and to provide interoperability between the implementation languages that are currently used within the group (C, C++, O'Caml, Java).

My intention is to make the BOCI so simple enough to use that others in the group will find it worth using. The net gain for the people that use the BOCI will be instant low-level interoperability with other BOCI codes.

4. Reconciling modules interfaces

Suppose that one of us (call him, the developer) develops a module that performs a particular optimization (say, constant propagation (CP)) on top of the BOCI. Later, another of us (call him, the client), working on a different compiler system realizes that he needs a module to perform CP. The client would like to use the developer's CP module, but what if the client cannot easily convert their program representation to the one specified by the developer's interface?

Here are a some approaches that might be taken:

Unfortunately, there is no general solution to this problem. As a last resort, the client can decide to implement their own CP module.

There is no magic here. We will just have to start packaging and using modules and learn from our mistakes.

5. Examples

5.1 The Bernoulli Sparse Compiler Toolkit (BSCT)

Here are my plans for the BSCT,

The net gain from this plan will be that,

5.2 Vijay's Matlab Compiler

Suppose that Vijay discovers that he needs certain dense optimizations to be performed by his compiler.

Perhaps the dense optimizations that I have found to use in my reconstituted BSCT meet his needs. If he ports the Matlab front-end to BOCI, then he can use those optimizations (and I can use his front-end).

Perhaps these optimizations don't meet his needs because the interface for program representation is wrong. In this case, there are several options,

The net gains in this scenario are as follows,

6. Summary

Here is what I see as being require of us to establish a common framework for compiler development:

Once the low level interoperability mechanisms are sorted out, the difficult work lies in specifying and then iteratively improving the interfaces of the modules that we develop.



Paul Stodghill
1998-10-23