Scale Compilation

There are two modes for using the Scale compiler: single compilation and multi-compilation. In single compilation, the compiler compiles one source file at a time. The compiler removes information generated for each source file before another source file is compiled. In multi-compilation, the compiler saves the information from each source file compilation.
   if single compilation

     for each source file
        create call-graph
        convert source file to Clef AST

        for each routine in Clef AST
           convert routine from Clef AST to Scribble CFG
           add Scribble CFG to call-graph

        determine call sites from call-graph

        perform alias analysis on all Scribble CFG graphs together

        for each Scribble CFG in call-graph
           optimize Scribble CFG

        generate C code for top-level declarations
        generate C code for all Scribble CFGs in call-graph

        remove Clef AST, Scribble CFGs, and other information

   else // multi-compilation

     for each source file
        create call-graph
        convert source file to Clef AST

        for each routine in Clef AST
           convert routine from Clef AST to Scribble CFG
           add Scribble CFG to call-graph

        determine call sites from call-graph

     perform alias analysis on all Scribble CFG graphs together

     for each call-graph
        for each Scribble CFG in call-graph
           optimize Scribble CFG

     for each call-graph
        generate C code for top-level declarations
        generate C code for all Scribble CFGs in call-graph
The primary advantage of selecting multi-compilation is that the alias analysis may be done interprocedurally. The primary dis-advantage is the memory space required for the complete compilation.

For each source file a call-graph structure is used to keep track of the Scribble CFGs generated for each routine in the source file. A call-graph:


Return to Scale home page.
(Last changed: March 21, 2007.)