next up previous
Next: Back-end Up: Code Analysis and Optimization Previous: The Bytecode IR


Generalized Interface

Both the bytecode and the Quad intermediate representations implement a single, generalized compiler interface. Individual bytecodes and Quads implement the CodeElement interface, which provides basic functionality such as finding possible successors, and returning the uses and definitions. Code written to this generalized compiler interface will work regardless of the specific IR being used. This allows the implementation of many data-flow analyses, such as calculating def-use chains and dead code elimination, to be shared between the two IRs.

The compiler makes very extensive use of the visitor design pattern[6,15]. The visitor pattern allows the traversal order to be effectively separated from the operations performed on each element. This makes writing compiler passes very easy -- all compiler passes are implemented as visitors over various structures in the IR.

Joeq includes a dataflow framework and a few optimizations. Some whole program analyses, such as pointer analysis, have also been implemented[27]. Work on more optimizations and analyses is ongoing.



John Whaley 2003-03-15