| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectscale.test.Scale
public class Scale
This class provides the top-level control for the Scale compiler.
$Id: Scale.java,v 1.335 2007-10-04 19:53:33 burrill Exp $
 Copyright 2008 by the
 Scale Compiler Group,
 Department of Computer Science
 University of Massachusetts,
 Amherst MA. 01003, USA
 All Rights Reserved.
 
 
 
 Like all compilers the Scale compiler follows the following high
 level flow.  The front end of the compiler parses the source
 program and converts it into the form upon which the compiler
 performs optimizations.  Once the program has been transformed by
 the various optimizations, it is converted to the machine language
 of the target system.  Scale generates assembly language and calls
 the native assembler to generate the actual object modules (i.e.,
 .o files).
 
 While not shown on this diagram or the more detailed diagrams of
 the major parts of the compiler, it is possible to generate
 .c files and/or graphical displays after any part of
 the compiler.  These .c files and graphical displays
 are used primarily as an aid to debugging the compiler.  Command
 line switches are provided to control the generation of the files
 and displays.
 
 The front end parses the source program and converts it to a
 high-level, program-language dependent form called the Abstract
 Syntax Tree (AST) which we call Clef.  This
 AST form is then converted to a machine-independent form called the
 Control Flow Graph (CFG) which we call Scribble.
 
 The parsers generates an AST file which Scale then
 reads and converts to Clef.  The Clef AST is then converted to Scribble
 by the Clef2Scribble
 package.
 
 
 
 Scale provides many different optimizations.  (The optimizations
 performed and the order in which they are performed is controllable
 by command line switches.)  Most Scale optimizations are performed
 when the CFG is in Static Single Assignment (SSA) form.  The Scale compiler will converted the CFG to and from
 this form as needed.
 
 The Scale back end is very simple conceptually.  The Generator module simply converts from the
 CFG to assembly language.  The back end converts the CFG into
 machine specific instructions.  However, the instruction representation allows the
 instructions to be manipulated in a machine independent way.  (This
 object-oriented approach is used by the register allocator.)  Once the
 instructions are generated and the registers are allocated the
 sequence of instructions is converted to assembly language by the
 Assembler module.
 
Currently Scale can generate assembly language for four different systems:
Alpha EV5
 Sparc V8
 PowerPC
 Mips M10000 (incomplete)
 Trips
 added.
 
Execute
java scale.test.Scale -helpto see the list of command line switches available.
Scale can be used as a cross compiler when the host machine architecture is different from the target machine architecture. The target machine architecture is specified using the -arch architecture command line switch. When Scale is used as a cross compiler the include file directories must be explicitly enumerated using the -I command line switch to specify include files for the target system. Also, since Scale produces assembly language files, and calls the assembler to convert them to .o files, the -oa switch cannot be used; use only the -a or -c command line switches.
This page describes the data flow in the Scale compiler at a macro level. At this level the data flow is basically a pipeline so no diagram is provided. At a lower level, each component of the data flow of the compiler is best described using control flow.
The front end converts from the source language program to an internal representation called the abstract syntax tree (AST). The AST is language dependent. Conceptually, this form is a tree but for practical reasons a directed acyclic graph (DAG) representation is used so that some leaf nodes, such as constants and types, do not need to be duplicated.
 
 The parsers convert the source program to the Scale form of the AST
 which is called Clef (Common Language Encoding Form).  Currently,
 two parsers are available.  Others may be added.
 
 Scale uses the ANTLR tool to
 create the C parser.  This parser handles
 standard C, K&R C, and C99 along with some GNUisms.
 
 The Fortran parser uses recursive
 descent and handles Fortran 77 with Fortran F90 under development.
 
 
 
 Clef2Scribble converts from the AST to
 the control flow graph (CFG).  The CFG is called
 scribble (for no currently valid reason) and is language
 independent because Clef2Scribble performs
 lowering.  (It is also supposed to be architecture
 independent but is not completely due to lowering performed by
 the front end parsers and the architecture-and-operating-system
 dependent include files used by C programs.)
 
A basic block is defined as a sequence of CFG nodes such that:
 The lowering performed converts do-loops,
 for-loops, etc to a common form where special nodes are
 inserted into the CFG to mark the start of a loop and the exits from a
 loop.
 
Lowering also converts complicated forms to simpler forms. For example,
    if (exp1 && exp2) {
      body;
    }
 
 is converted to
 
    if (exp1) {
     if (exp2) {
       body;
     }
   }
 
 
Once the CFG is complete if-conversion and if-combining are performed in order to create larger basic blocks.
Simple if-conversion is performed for target architectures that have a conditional move capability. A conditional move provides the capability to select one out of a set of values without performing a branch. For example,
    if (exp) {
      a = 1;
    } else
      a = 2;
    }
 
 is converted to
 
    a = exp ? 1 : 2;
 
 
 In order for this conversion to take place, there can be no
 side-effects from the right-hand-sides of the assignment statements
 because the right-hand-side of the assignments are always evaluated.
 To make the if-conversion more productive, if-combining is also performed. For example,
    if (A) {
      if (B) {
        body;
      }
 }
 
 is converted to
 
    if (A & B) {
      body;
    }
 
 
 (Note - the operation is simple "and" - not the C conditonal
 "and".)  For this conversion to take place neither expression
 A or B can cause a side-effect because both
 are always evaluated.
 
 Note - this if-combining is the opposite operation to the lowering of complex if-forms performed earlier. But, it does not reverse all such conversions and it converts some original programmer written forms.
 
 Programmers often write spaghetti code using goto
 statements.  This can result in an irreducible graph.  An
 irreducible graph is one with two nodes (x &
 y) that are each in the dominance frontier of the
 other.
 
 In order to have well-delineated loops in the CFG, Scale
 converts irreducible graphs to reducible graphs using node
 splitting.  Node splitting duplicates parts of the graph so
 that node x is in the dominance frontier of node
 y and node y´ is in the dominance
 frontier of node x.
 
 
 Programmers often write spaghetti code using goto
 statements.  This can result in non-structured loops.  In order to
 have well-delineated loops in the CFG, Scale converts
 non-structured loops to structured loops by inserting the loop
 markers.
 
 Programmers often write spaghetti code using goto
 statements.  This can result in exits from loops that are not marked.
 In order to have well-delineated loops in the CFG, Scale
 detects such exits and marks them with loop exit nodes.
 
Inlining inserts the body of a function in place of a call to that function and renames the variables in the inlined body appropriately. In order to inline a function the body (CFG) of that function must be available. Scale restricts inlining to non-recursive functions below a user-selectable size. And, Scale will not expand a CFG above a certain user-selectable multiple.
Alias analysis detects aliases between variables and references using C pointers. When there is such an alias, performing optimizations involving the variable may lead to incorrect code.
Scalar optimizations are performed in the order specified by the user of the compiler. The CFG is converted, as needed, between the SSA form of the CFG and the normal form. The optimizations make use of various information about the program. Some of this information is computed as needed.
On-demand services:
The scalar optimizations include:
n times to increase basic block size
 SSA form is a significantly more complicated form of the CFG. In this form, it is very difficult to add new CFG paths. SSA form provides liveness information by converting to a form where local variables are set only once and links are provided between the set and each use of the variable. There are often un-wanted results when the SSA form is converted back to the normal CFG form. For example, if an optimization moves a reference to a variable it may result in an additional local variable and copy operation.
On architectures that have a predication capability several small basic blocks may be combined into a larger hyper-block using predication. For example,
    if (exp) {
      body1;
    } else {
      body2;
    }
 
 consists of 3 basic blocks.
 
 Using predication, larger blocks can be constructed with the result that there are fewer branch instructions and, as a consequence, fewer branch mis-predictions. In a predicated architecture, the above example can be converted to
    p = exp != 0;
    if (p) body1;
    if (!p) body2;
 
 where the if is a special predicate operation and does
 not result in a branch.  This differs from the above if-conversion
 in that the body may cause side effects; the
 body is not evaluated unless the predicate
 (p or !p) is true.
 
Scale creates the largest hyper-blocks possible under the following constraints:
Hyperblock class or CFG markers are used to
 delineate hyper-blocks.  A hyper-block is simply a normal Scale
 basic block as defined above but which uses predicated
 stores.  A predicated store is specified using the
 ExprChord class and includes an additional in-coming
 data-edge that is the predicate value.  For example,
 
 
    if (pexp) {
      a = exp1;
      b = exp2;
    } else {
      c = exp3;
    }
 
 
 is converted to 
 
 
    t = pexp;
    if (t) a = exp1;
    if (t) b = exp2;
    if (!t) c = exp3;
 
 where the if is the special predicated store
 expression with three in-coming data edges (e.g., t,
 a, and exp1).
 
 Each predicated store is converted by the architecture-specific backend to the appropriate code. For example, the backend that generates C code converts a predicated store to
     if (predicate) lhs = rhs;
 
 
 where lhs is the left-hand-side expression of the store
 and rhs> is the right-hand-side expression.
 
 
 
Predication Optimizations
 
 TBD
 
 
Reverse If-conversion
 
 
 For systems that do not have predication the paper "A Framework
 for Balancing Control Flow and Predication" by D. August, et al
 indicates that some benefit may be obtained by forming hyper-blocks,
 performing the predicated optimizations, and then converting back into
 un-predicated code.  Therefore, if hyperblocks have been formed and
 the target architetcure does not support predication, this pass of the
 compiler will remove the predication.
 
 
 
Profiling
 
 Profiling instruments the CFG by adding CFG nodes that generate
 profiling information.  Block, edge, path, and loop profiling are
 available profiling options.
 
 
Backend
 
 The backend converts the architecture independent CFG into
 architecture dependent instructions.  For Scale, the backend
 generates an assembly language file and expects that file to be
 processed by a native assembler tool.
 
 The definition of a basic block from this point on is slightly
 different;  The new definition is that a basic block is defined as a
 sequence of instructions such that:
 
 - A basic block begins swith a label that has more than
 one in-coming graph edge or whose parent has more than one out-going
 graph edge or its predecessor is a call instruction.
 
- A basic block ends with an instruction that has more than one
 out-going graph edge or whose successor node has more than one
 in-coming graph edge or is a call instruction.
 
 
Instruction generation
 
 Each CFG node is converted to a sequence of instructions which
 reference virtual registers.  Using virtual registers provides
 an infinite number of registers which results in much simpler
 instruction generation.
 
 For predicated store instances the appropriate
 predicated instructions are generated.  Note, even though a complete
 right-hand-side of an assigment is predicated, it is not necessary to
 predicate every instruction that results from that right-hand-side.
 Those instructions that do not cause side effects (e.g., a load or an
 integer add) on the target architecture do not need to be predicated.
 The fan-out of the predicated value is reduced by not predicating
 these instructions.
 
 
Register Allocation
 
 References to virtual registers are converted to references to
 actual hardware registers on the target architecture.  An
 architecture independent register allocated is used.  It
 knows only whether an instructions defines or uses a specific
 register (real or virtual).  The register allocator is able to
 construct register live range information from this.
 
 
 For Trips, only registers that are live at the beginning of a basic
 block are allocated.  It is assumed that the remaining virtual
 registers will become dataflow edges in the Trips grid.  It is
 possible for the register allocator to annotate each basic block with
 this liveness information.
 
 
TIL Generation
 
 The instruction sequence is converted to the assembly language of the
 target architecture.  For Trips this is the Trips Intermediate
 Language which is intended to be human readable and writable.
 
 
Post Compiler
 
 These steps occur after the compiler is used to generate an
 assembly language file.
 
 
Trips Scheduler
 
 The Trips scheduler is responsible for converting the instructions of
 Trips Intermediate Language, that are in operand form, to the
 actual Trips instructions, that are in target form.  The
 scheduler must then assign these instructions to the grid and handle
 the fan-out issues, etc.  The scheduler must do this only on a basic
 block by basic block basis.
 
 It is possible that a basic block may be too large to schedule on the
 grid.  In this case, either the estimates used by the compiler must be
 adjusted so that this does not occur.  Or, the scheduler must be able
 to split a basic block into two blocks and must be able to do a
 reverse if-conversion (see above) to remove the predication as needed.
 
 Splitting a basic block into two or more parts does not
 introduce any register allocation problems.  Data edges between
 the two parts must be passed in global registers.  If the scheduler
 knows which global registers are live at the begining of the
 original block, it need only use registers that are not live to
 hold the values between the two parts.  No other register
 allocation need be performed and no spilling results.
 
 It is possible, but unlikely that there will be insufficient
 registers available.  It should be possible to prevent this problem
 by analysis during hyper-block formation.
Constructor Summary 
 
protected  
Scale()
            
 
Method Summary 
 
protected  void 
addWarning(int msg,
           int level)
          Add a warning message and display it if needed. 
protected  void 
addWarning(int msg,
           java.lang.String text,
           int level)
          Add a warning message and display it if needed. 
protected  void 
addWarning(int msg,
           java.lang.String text1,
           java.lang.String text2)
          Add a warning message and display it if needed. 
 void 
compile(java.lang.String[] args)
          Compile a C or Fortran program. 
protected  void 
convertToScribble(CallGraph cg)
          Convert each RoutineDecl in a CallGraph to a CFG. 
static java.lang.String 
dd()
          Return the number of data dependence level selected. 
protected  void 
displayClef(CallGraph cg,
            java.lang.String rname,
            java.lang.String name)
          Display a Clef AST. 
 void 
displayScribble(Scribble scribble,
                java.lang.String name)
          Display a CFG. 
static boolean 
executeCommand(java.lang.String cmd)
          Execute an OS command represented by a string. 
protected  boolean 
executeCommand(java.lang.String[] cmd)
          Execute an OS command represented by an array of strings. 
protected  boolean 
executeCommand(Vector<java.lang.String> command)
          Execute an OS command represented by a list of strings. 
protected  void 
genAssemblyfromCallGraph(CallGraph cg)
          Generate an assembly file from a CallGraph using each
 RoutineDecl's CFG. 
protected  void 
genCfromCallGraph(CallGraph cg)
          Generate a .c file from a CallGraph using each RoutineDecl's CFG. 
protected  void 
genCfromClef(CallGraph cg,
             java.lang.String name)
          Print out the C representation of the Clef AST. 
protected  void 
genCfromScribble(Scribble scribble,
                 java.lang.String name)
          Print out the C representation of the Scribble form. 
protected  java.lang.String 
genFileName(java.lang.String name,
            java.lang.String extension)
          Return a path name for the new file including the directory
 specified by the "dir" switch. 
static int 
globalVariables()
          Return the number of global variables. 
 boolean 
isCrossCompile()
          Return true if cross-compiling. 
static void 
main(java.lang.String[] args)
          Compile a C or Fortran program. 
protected  void 
multiCompilation()
          Compile all source files together. 
protected  void 
optimizeClef(CallGraph cg)
          Once a Clef AST has been generated, this method is called to
 perform any transformations on it. 
protected  void 
optimizeScribble(Scribble scribble,
                 java.lang.String name)
          This method performs any optimizations/transformations on a CFG. 
static java.lang.String 
opts()
          Return the optimizations in use. 
protected  boolean 
parseAA()
          Process the alias analysis parameters. 
protected  boolean 
parseArchParams()
            
protected  void 
parseCmdLine(java.lang.String[] args,
             CmdParam[] params)
          Process the command line parameters. 
protected  Vector<java.lang.String> 
parseCmdLine(java.lang.String[] args,
             CmdParam[] params,
             CmdParam files)
            
protected  void 
parseFlagFile(java.lang.String filename)
          Process the flag settings from the specified file. 
protected  void 
parseFlags(Vector<java.lang.String> trs)
          Process the flag settings from the command line -f switch. 
protected  void 
parseHyperblockParams()
          Parse options for the hyperblock generator. 
protected  void 
parseMiscellaneousParams(java.lang.String forWhat)
            
protected  void 
parseOptHeuristics(java.lang.String optLetters,
                   java.lang.String forWhat)
          Parse the string of letters that specify the optimizations to be applied. 
protected  void 
parseOpts(java.lang.String optLetters,
          java.lang.String forWhat)
          Parse the string of letters that specify the optimizations to be applied. 
protected  boolean 
parseReportParams(java.lang.String forWhat)
          Return true if there is no routine name selected for special
 debugging. 
protected  void 
parseTraces(Vector<java.lang.String> trs)
          Process the trace flag settings from the command line -t switch. 
protected  java.lang.String 
parseWhichParam()
            
protected  void 
processFile(java.lang.String firstInputFile,
            Suite suite)
          Convert the source file to Clef and add it to the set of Clef
 ASTs. 
protected  void 
processSuite(Suite suite)
          This method is called to add user-specified annotations and
 perform alias analysis. 
protected  void 
removeFile(java.lang.String file)
          Remove a file 
protected  void 
separateCompilation()
          Compile each source file separately. 
protected  void 
splitString(java.lang.String str,
            Vector<java.lang.String> v)
            
static java.lang.String 
version()
          Return the compiler version. 
 
Methods inherited from class java.lang.Object 
 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
 
Field Detail 
 
classTrace
public static boolean classTrace
- True if traces are to be performed.
 
 
hostArch
public static final java.lang.String hostArch
- The machine the compiler is running on.
 
 
hostOS
public static final java.lang.String hostOS
- The operating the compiler is running on.
 
 
version
public static final java.lang.String version
- The version of the compiler.
 
- See Also:
- Constant Field Values
 
int0
protected static final java.lang.Integer int0
int1
protected static final java.lang.Integer int1
int2
protected static final java.lang.Integer int2
int4
protected static final java.lang.Integer int4
on
protected static final java.lang.Boolean on
off
protected static final java.lang.Boolean off
cpInl
public CmdParam cpInl
cpAA
public CmdParam cpAA
cpCat
public CmdParam cpCat
cpDebug
public CmdParam cpDebug
cpStat
public CmdParam cpStat
cpCdd
public CmdParam cpCdd
cpSan
public CmdParam cpSan
cpFiles
public CmdParam cpFiles
cpIncl
public CmdParam cpIncl
cpIncls
public CmdParam cpIncls
cpAnnot
public CmdParam cpAnnot
cpD
public CmdParam cpD
cpU
public CmdParam cpU
cpTcl
public CmdParam cpTcl
cpFcl
public CmdParam cpFcl
cpPp
public CmdParam cpPp
cpNW
public CmdParam cpNW
cpIcf
public CmdParam cpIcf
cpCmi
public CmdParam cpCmi
cpMulti
public CmdParam cpMulti
cpPrePro
public CmdParam cpPrePro
cpSla
public CmdParam cpSla
cpOfile
public CmdParam cpOfile
cpOs
public CmdParam cpOs
cpOa
public CmdParam cpOa
cpOc
public CmdParam cpOc
cpCcb
public CmdParam cpCcb
cpCca
public CmdParam cpCca
cpCgb
public CmdParam cpCgb
cpCga
public CmdParam cpCga
cpDcg
public CmdParam cpDcg
cpC89
public CmdParam cpC89
cpC99
public CmdParam cpC99
cpGcc
public CmdParam cpGcc
cpCkr
public CmdParam cpCkr
cpAnsi
public CmdParam cpAnsi
cpUnsafe
public CmdParam cpUnsafe
cpVers
public CmdParam cpVers
cpSnap
public CmdParam cpSnap
cpG
public CmdParam cpG
cpNaln
public CmdParam cpNaln
cpIs
public CmdParam cpIs
cpBi
public CmdParam cpBi
cpPh
public CmdParam cpPh
cpNp
public CmdParam cpNp
cpDm
public CmdParam cpDm
cpQuiet
public CmdParam cpQuiet
cpNoWarn
public CmdParam cpNoWarn
cpDaVinci
public CmdParam cpDaVinci
cpVcg
public CmdParam cpVcg
cpHda
public CmdParam cpHda
cpFpr
public CmdParam cpFpr
cpSc
public CmdParam cpSc
cpUc
public CmdParam cpUc
cpSuspend
public CmdParam cpSuspend
cpPg
public CmdParam cpPg
cpPi
public CmdParam cpPi
cpInls
public CmdParam cpInls
cpScb
public CmdParam cpScb
cpSca
public CmdParam cpSca
cpSgb
public CmdParam cpSgb
cpSga
public CmdParam cpSga
cpArch
public CmdParam cpArch
cpCc
public CmdParam cpCc
cpAsm
public CmdParam cpAsm
cpDir
public CmdParam cpDir
cpR
public CmdParam cpR
cpWhich
public CmdParam cpWhich
cpGphType
public CmdParam cpGphType
cpDd
public CmdParam cpDd
cpO
public CmdParam cpO
cpIh
public CmdParam cpIh
cpWrap
public CmdParam cpWrap
cpHb
public CmdParam cpHb
cpSf
public CmdParam cpSf
cpFf
public CmdParam cpFf
params
protected CmdParam[] params
inputFiles
protected Vector<java.lang.String> inputFiles
profilePaths
protected Vector<java.lang.String> profilePaths
warnings
protected Vector<java.lang.String> warnings
doSingle
protected boolean doSingle
doOfile
protected boolean doOfile
doC
protected boolean doC
doA
protected boolean doA
debugging
protected boolean debugging
all
protected boolean all
doLines
protected boolean doLines
readClassFiles
protected boolean readClassFiles
crossCompile
protected boolean crossCompile
inllev
protected double inllev
aaLevel
protected int aaLevel
categories
protected int categories
backendFeatures
protected int backendFeatures
profInstOps
protected int profInstOps
profGuidedOps
protected int profGuidedOps
architecture
protected java.lang.String architecture
opts
protected java.lang.String opts
targetArch
protected java.lang.String targetArch
aliases
protected Aliases aliases
inlfos
protected java.io.FileOutputStream inlfos
inlStatusStream
protected java.io.PrintWriter inlStatusStream
Constructor Detail 
 
Scale
protected Scale()
Method Detail 
 
dd
public static java.lang.String dd()
- Return the number of data dependence level selected.
 
- 
 
opts
public static java.lang.String opts()
- Return the optimizations in use.
 
- 
 
globalVariables
public static int globalVariables()
- Return the number of global variables.
 
- 
 
version
public static java.lang.String version()
- Return the compiler version.
 
- 
 
main
public static void main(java.lang.String[] args)
- Compile a C or Fortran program.
 
- 
- Parameters:
- args- the command line arguments
 
compile
public void compile(java.lang.String[] args)
- Compile a C or Fortran program.
 
- 
- Parameters:
- args- the command line arguments
 
isCrossCompile
public boolean isCrossCompile()
- Return true if cross-compiling.  We are cross-compiling if the
 compiler host architecture is not the same as the target
 architecture.
 
- 
 
addWarning
protected void addWarning(int msg,
                          int level)
- Add a warning message and display it if needed.
 
- 
 
addWarning
protected void addWarning(int msg,
                          java.lang.String text,
                          int level)
- Add a warning message and display it if needed.
 
- 
 
addWarning
protected void addWarning(int msg,
                          java.lang.String text1,
                          java.lang.String text2)
- Add a warning message and display it if needed.
 
- 
 
parseCmdLine
protected void parseCmdLine(java.lang.String[] args,
                            CmdParam[] params)
- Process the command line parameters.
 
- 
- Parameters:
- args- the array of command line parameters
- params- an array of allowed command line parameters
 
parseCmdLine
protected Vector<java.lang.String> parseCmdLine(java.lang.String[] args,
                                                CmdParam[] params,
                                                CmdParam files)
- 
 
parseWhichParam
protected java.lang.String parseWhichParam()
- 
 
parseReportParams
protected boolean parseReportParams(java.lang.String forWhat)
- Return true if there is no routine name selected for special
 debugging.
 
- 
 
parseArchParams
protected boolean parseArchParams()
- 
 
parseMiscellaneousParams
protected void parseMiscellaneousParams(java.lang.String forWhat)
- 
 
parseHyperblockParams
protected void parseHyperblockParams()
- Parse options for the hyperblock generator.
 
- 
 
parseOpts
protected void parseOpts(java.lang.String optLetters,
                         java.lang.String forWhat)
- Parse the string of letters that specify the optimizations to be applied.
 
- 
- Parameters:
- optLetters- is the String specifying the optimizations
- forWhat- specifies the module for the statistics generated
 
parseOptHeuristics
protected void parseOptHeuristics(java.lang.String optLetters,
                                  java.lang.String forWhat)
- Parse the string of letters that specify the optimizations to be applied.
 
- 
- Parameters:
- optLetters- is the String specifying the optimizations
- forWhat- specifies the module for the statistics generated
 
parseAA
protected boolean parseAA()
- Process the alias analysis parameters.
 
- 
- Returns:
- true if this is a single compilation.
 
parseTraces
protected void parseTraces(Vector<java.lang.String> trs)
- Process the trace flag settings from the command line -t switch.
 
- 
 
parseFlagFile
protected void parseFlagFile(java.lang.String filename)
- Process the flag settings from the specified file.
 
- 
 
parseFlags
protected void parseFlags(Vector<java.lang.String> trs)
- Process the flag settings from the command line -f switch.
 
- 
 
multiCompilation
protected void multiCompilation()
                         throws java.lang.Exception
- Compile all source files together.
 
- 
- Throws:
- java.lang.Exception
 
separateCompilation
protected void separateCompilation()
                            throws java.lang.Exception
- Compile each source file separately.  Note that profiling is not
 compatible with separate compilation.
 
- 
- Throws:
- java.lang.Exception
 
processFile
protected void processFile(java.lang.String firstInputFile,
                           Suite suite)
                    throws java.lang.Exception
- Convert the source file to Clef and add it to the set of Clef
 ASTs.
 
- 
- Throws:
- java.lang.Exception
 
convertToScribble
protected void convertToScribble(CallGraph cg)
- Convert each RoutineDecl in a CallGraph to a CFG.
 
- 
- Parameters:
- cg- is the CallGraph
 
optimizeClef
protected void optimizeClef(CallGraph cg)
- Once a Clef AST has been generated, this method is called to
 perform any transformations on it.
 
- 
- Parameters:
- cg- is the Clef AST
 
processSuite
protected void processSuite(Suite suite)
- This method is called to add user-specified annotations and
 perform alias analysis.
 
- 
- Parameters:
- suite- is the suite of call graphs.
- See Also:
- Suite
 
optimizeScribble
protected void optimizeScribble(Scribble scribble,
                                java.lang.String name)
- This method performs any optimizations/transformations on a CFG.
 
- 
- Parameters:
- scribble- the scribble graph
- name- is the name of the routine to be optimized
- See Also:
- Scribble
 
genFileName
protected java.lang.String genFileName(java.lang.String name,
                                       java.lang.String extension)
- Return a path name for the new file including the directory
 specified by the "dir" switch.
 
- 
- Parameters:
- name- a file path from which to extract the file name
- extension- the extension to use for the new file
 
genCfromClef
protected void genCfromClef(CallGraph cg,
                            java.lang.String name)
                     throws java.lang.Exception
- Print out the C representation of the Clef AST.
 
- 
- Parameters:
- cg- is the Clef AST
- name- is is used to create the result file name
- Throws:
- java.lang.Exception
 
genCfromScribble
protected void genCfromScribble(Scribble scribble,
                                java.lang.String name)
- Print out the C representation of the Scribble form.
 
- 
- Parameters:
- scribble- is the CFG
- name- is is used to create the result file name
 
displayScribble
public void displayScribble(Scribble scribble,
                            java.lang.String name)
- Display a CFG.
 
- 
- Parameters:
- scribble- is the CFG
- name- is the display name
 
displayClef
protected void displayClef(CallGraph cg,
                           java.lang.String rname,
                           java.lang.String name)
- Display a Clef AST.  If the specified routine name is not
 nullthen only the AST for that routine is
 displayed.  Otherwise, the AST for the entire call graph is
 displayed.
 
- 
- Parameters:
- cg- is the call graph containing the Clef AST
- rname- is the name of the routine or null
- name- is the display name
 
splitString
protected void splitString(java.lang.String str,
                           Vector<java.lang.String> v)
- 
 
executeCommand
public static boolean executeCommand(java.lang.String cmd)
                              throws java.lang.Exception
- Execute an OS command represented by a string.  Display the
 command output on System.out.
 
- 
- Parameters:
- cmd- is the command to execute
- Returns:
- true if the command failed
- Throws:
- java.lang.Exception
 
executeCommand
protected boolean executeCommand(java.lang.String[] cmd)
                          throws java.lang.Exception
- Execute an OS command represented by an array of strings.
 Display the command output on System.out.
 
- 
- Parameters:
- cmd- is the command to execute
- Returns:
- true if the command failed
- Throws:
- java.lang.Exception
 
executeCommand
protected boolean executeCommand(Vector<java.lang.String> command)
                          throws java.lang.Exception
- Execute an OS command represented by a list of strings.
 
- 
- Parameters:
- command- is the command to execute
- Returns:
- true if the command failed
- Throws:
- java.lang.Exception
 
removeFile
protected void removeFile(java.lang.String file)
                   throws java.lang.Exception
- Remove a file
 
- 
- Parameters:
- file- is the full pathname for the file
- Throws:
- java.lang.Exception
 
genCfromCallGraph
protected void genCfromCallGraph(CallGraph cg)
                          throws java.lang.Exception
- Generate a .c file from a CallGraph using each RoutineDecl's CFG.
 
- 
- Parameters:
- cg- is the CallGraph
- Throws:
- java.lang.Exception
 
genAssemblyfromCallGraph
protected void genAssemblyfromCallGraph(CallGraph cg)
                                 throws java.lang.Exception
- Generate an assembly file from a CallGraph using each
 RoutineDecl's CFG.
 
- 
- Parameters:
- cg- is the CallGraph
- Throws:
- java.lang.Exception
 
  
      Overview  
      Package  
    Class  
      Tree  
      Deprecated  
      Index  
      Help  
   
 
 
 
 PREV CLASS 
 NEXT CLASS 
  FRAMES   
 NO FRAMES   
 
 
 
  SUMMARY: NESTED | FIELD | CONSTR | METHOD 
DETAIL: FIELD | CONSTR | METHOD