coins.lparallel
Class LoopPara

java.lang.Object
  extended bycoins.driver.Driver
      extended bycoins.lparallel.LoopPara
All Implemented Interfaces:
CompilerImplementation
Direct Known Subclasses:
F77LoopPara

public class LoopPara
extends Driver

A driver implementation using COINS Compiler Driver API.


Field Summary
protected static java.lang.String DEFAULT_OPENMP_NAME
           
(package private)  java.io.File fHir2CFile
           
(package private)  java.lang.String fOpenMPTmpFileName
           
 boolean fstophir2c
           
protected  java.util.Set fSubprogramsToBeParallelized
           
 TemporaryFileManager fTemporaryFileManager
           
 
Fields inherited from class coins.driver.Driver
ASSEMBLER_NAME_OPTION, CG_PARALLEL, CHECK_HIR_OPTION, CHECK_SYMBOL_TABLE_OPTION, COARSE_GRAIN_PARALLEL, COINS_OPTION_DELIMITER, DEBUG_OPTION, DEFAULT_ASSEMBLER_NAME, DEFAULT_LINKER_NAME, DEFAULT_LINKER_OPTIONS_PROPERTY, DEFAULT_LIR_OPTION, DEFAULT_OPTIMIZATION_LEVEL, DEFAULT_PREPROCESSOR_NAME, DEFAULT_SETTING, defaultSettings, DUMP_HIR_OPTION, DUMP_HIR_OPTION_DELIMITER, FLOW_ANAL_OPTION_DELIMITER, HIR_FLOW_ANAL_OPTION, HIR_OPT_ARG_FROMC, HIR_OPTIMIZATION_ARGS, HIR_TO_C_OPTION, HIR_TO_C_OPTION_DELIMITER, hirFlowRoot, LINKER_NAME_OPTION, LIR_OPTIMIZATION_ARGS, LIR_TO_C_OPTION, LIR_TO_C_OPTION_DELIMITER, MACRO_DATA_FLOW_OPTION, MAX_OPTIMIZATION_LEVEL, myName, NEW_LIR_OPTION, OLD_LIR_OPTION, OPENMP_OPTION, OUT_NEW_LIR_OPTION, PARALLEL_DO_ALL, PREPROCESSOR_NAME_OPTION, SIMULATE_OPTION, SSA_OPTIMIZATION_ARGS, SSA_OPTION, STOP_AFTER_HIR_TO_C_OPTION, STOP_AFTER_LIR_TO_C_OPTION, SYSTEM_INCLUDE_PATH_PROPERTY, TARGET_ARCH_OPTION, TARGET_CONVENTION_OPTION, VERBOSE_FLAG
 
Constructor Summary
LoopPara()
           
 
Method Summary
 void assemble(java.io.File sourceFile, Suffix suffix, java.io.InputStream in, java.io.File out, IoRoot io)
          Assembler.
Invokes an assembler command with options specified in a command line.
Input lines can be read from an InputStream.
 void cleanup(CompileSpecification spec)
           
 void compile(java.io.File sourceFile, Suffix suffix, java.io.InputStream in, java.io.OutputStream out, IoRoot io)
          Compiler.
This sample compiler has eight passes: C source to HIR-C(*), HIR-C to HIR-Base(*), Flow analysis on HIR(*), Optimization and Parallelization on HIR, HIR to LIR(*), Assembly code generation(*).
 java.util.Set getSubprogramsToBeParallelized(HirRoot hirRoot, SymRoot symRoot, IoRoot ioRoot)
           
protected  void go(java.lang.String[] args)
          Makes a compile specification from a command line.
 void hir2OpenMP(HirRoot pHirRoot, SymRoot pSymRoot, IoRoot pIoRoot)
           
 void link(java.io.File out, IoRoot io)
          Linker.
Invokes a linker command with options specified in a command line.
Output executable file should be written to a File.
 void LoopParallel(HirRoot hirRoot, SymRoot symRoot, IoRoot ioRoot)
          LoopParallel:
static void main(java.lang.String[] args)
          A main function.
Makes a compile specification from a command line.
 boolean makeCSourceFromHirBase(java.lang.String pModifier, HirRoot hirRoot, SymRoot symRoot, IoRoot io)
           
protected  void OpenMPCompile(java.lang.String timing, HirRoot hirRoot, SymRoot symRoot, java.io.OutputStream out, IoRoot io)
          OpenMPCompile:
protected  void optimizeHir(HirRoot hirRoot, FlowRoot hirFlowRoot, SymRoot symRoot, IoRoot io)
          HIR-level optimizations.
protected  void testHir(HirRoot hirRoot, FlowRoot hirFlowRoot, IoRoot io)
          Tests HIR before converting it to LIR.
protected  void testSym(HirRoot pHirRoot, IoRoot io)
          Tests Symbol Table before converting HIR to LIR.
 
Methods inherited from class coins.driver.Driver
basicHIROptimizations, callHirBaseToC, callLirToC, checkHirToCStopCondition, checkLIROptionsIntegrity, checkLirToCStopCondition, dumpHirBase, dumpHirBase, dumpHirBase, includedInDelimitedList, makeCommandLine, makeCSourceFromHirBase, makeCSourceFromHirBase, makeCSourceFromLir, makeCSourceFromLir, makeHIRFlowAnalysis, makeHirFromSource, makeLIRFromLIRSource, makeNewLirFromHir, matchDumpHirTiming, matchHirToCTiming, matchLirToCTiming, optimizeHirAfterFlowAnalysis, optimizeHirBeforeFlowAnalysis, preprocess, runProgram, runProgram, runProgram, separateDelimitedList, setDefaultLinkerOptions, setOptimizationOptions, setSystemIncludePathOptions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fTemporaryFileManager

public TemporaryFileManager fTemporaryFileManager

fHir2CFile

java.io.File fHir2CFile

fstophir2c

public boolean fstophir2c

fOpenMPTmpFileName

java.lang.String fOpenMPTmpFileName

DEFAULT_OPENMP_NAME

protected static final java.lang.String DEFAULT_OPENMP_NAME
See Also:
Constant Field Values

fSubprogramsToBeParallelized

protected java.util.Set fSubprogramsToBeParallelized
Constructor Detail

LoopPara

public LoopPara()
Method Detail

makeCSourceFromHirBase

public boolean makeCSourceFromHirBase(java.lang.String pModifier,
                                      HirRoot hirRoot,
                                      SymRoot symRoot,
                                      IoRoot io)
                               throws java.io.IOException,
                                      PassException
Throws:
java.io.IOException
PassException

OpenMPCompile

protected void OpenMPCompile(java.lang.String timing,
                             HirRoot hirRoot,
                             SymRoot symRoot,
                             java.io.OutputStream out,
                             IoRoot io)
                      throws java.io.IOException,
                             PassException
OpenMPCompile:

Throws:
java.io.IOException
PassException

LoopParallel

public void LoopParallel(HirRoot hirRoot,
                         SymRoot symRoot,
                         IoRoot ioRoot)
LoopParallel:


hir2OpenMP

public void hir2OpenMP(HirRoot pHirRoot,
                       SymRoot pSymRoot,
                       IoRoot pIoRoot)
                throws java.io.IOException,
                       PassException
Throws:
java.io.IOException
PassException

getSubprogramsToBeParallelized

public java.util.Set getSubprogramsToBeParallelized(HirRoot hirRoot,
                                                    SymRoot symRoot,
                                                    IoRoot ioRoot)

compile

public void compile(java.io.File sourceFile,
                    Suffix suffix,
                    java.io.InputStream in,
                    java.io.OutputStream out,
                    IoRoot io)
             throws java.io.IOException,
                    PassException
Compiler.
This sample compiler has eight passes:
  1. C source to HIR-C(*),
  2. HIR-C to HIR-Base(*),
  3. Flow analysis on HIR(*),
  4. Optimization and Parallelization on HIR,
  5. HIR to LIR(*),
  6. Assembly code generation(*).
Five of the above (*) are already implemented.

Specified by:
compile in interface CompilerImplementation
Overrides:
compile in class Driver
Parameters:
sourceFile - the source file name.
in - input.
out - output.
suffix - suffix rule of the source file.
io - the IoRoot.
Throws:
PassException - unrecoverable error(s) found in processing.
java.io.IOException - any IO error.

testSym

protected void testSym(HirRoot pHirRoot,
                       IoRoot io)
                throws java.io.IOException,
                       PassException
Tests Symbol Table before converting HIR to LIR.

Overrides:
testSym in class Driver
Parameters:
io - an IoRoot object.
Throws:
java.io.IOException - any IO error.
PassException - unrecoverable error(s) found in processing.

testHir

protected void testHir(HirRoot hirRoot,
                       FlowRoot hirFlowRoot,
                       IoRoot io)
                throws java.io.IOException,
                       PassException
Tests HIR before converting it to LIR.

Overrides:
testHir in class Driver
Parameters:
hirRoot - an HirRoot object.
hirFlowRoot - an HIR-based flow analysis result.
io - an IoRoot object.
Throws:
java.io.IOException - any IO error.
PassException - unrecoverable error(s) found in processing.

optimizeHir

protected void optimizeHir(HirRoot hirRoot,
                           FlowRoot hirFlowRoot,
                           SymRoot symRoot,
                           IoRoot io)
HIR-level optimizations.

Parameters:
hirRoot - an HirRoot object
hirFlowRoot - an HIR-based flow analysis result
symRoot - a SymRoot object
io - an IoRoot object

assemble

public void assemble(java.io.File sourceFile,
                     Suffix suffix,
                     java.io.InputStream in,
                     java.io.File out,
                     IoRoot io)
              throws java.io.IOException,
                     PassException
Assembler.
Invokes an assembler command with options specified in a command line.
Input lines can be read from an InputStream. Output lines should be written to a File. The original source file name of the input can be obtained as a File. Command line options and arguments can be obtained from a CompileSpecification.

Specified by:
assemble in interface CompilerImplementation
Overrides:
assemble in class Driver
Parameters:
sourceFile - the source file name
in - the InputStream
out - the output File
suffix - suffix rule of the source file.
io - the IoRoot.
Throws:
PassException - unrecoverable error(s) found in processing.
java.io.IOException - any IO error.

link

public void link(java.io.File out,
                 IoRoot io)
          throws java.io.IOException,
                 PassException
Linker.
Invokes a linker command with options specified in a command line.
Output executable file should be written to a File. Command line options and arguments can be obtained from a CompileSpecification.

Specified by:
link in interface CompilerImplementation
Overrides:
link in class Driver
Parameters:
out - the output File
io - the IoRoot.
Throws:
java.io.IOException - any IO error.
PassException - unrecoverable error(s) found in processing.

cleanup

public void cleanup(CompileSpecification spec)

go

protected void go(java.lang.String[] args)
Description copied from class: Driver
Makes a compile specification from a command line. Creates an compiler driver API object giving the compile specification. Creates a driver implementation object and pass it to the API object to start compilation. Exit()s with a return code of the compilation.

Overrides:
go in class Driver
Parameters:
args - a command line.

main

public static void main(java.lang.String[] args)
A main function.
Makes a compile specification from a command line. Creates an compiler driver API object giving the compile specification. Creates a driver implementation object and pass it to the API object to start compilation.

Parameters:
args - a command line.