|
ROSE is an open source compiler infrastructure to build source-to-source program
transformation and analysis tools for large-scale Fortran 77/95/2003, C, C++, OpenMP,
and UPC applications. The intended users of ROSE could be either experienced compiler
researchers or library and tool developers who may have minimal compiler experience.
ROSE is particularly well suited for building custom tools for static analysis, program
optimization, arbitrary program transformation, domain-specific optimizations, complex
loop optimizations, performance analysis, and cyber-security.
Like other compiler infrastructures, ROSE consists of front-ends, a midend,
and backends, but ROSE backends generate (unparse) source code. Thus ROSE is a source-to-source
compiler infrastructure. The intermediate representation (IR) used in ROSE is high
level to build an abstract syntax tree (AST) that is well suited to source-to-source
(so ROSE does not loose any information about the structure of the original source
code). The midend contains an evolving set of analyzes and optimizations. The
Edison Design Group (EDG) front-end is used to parse C and C++ applications. Although the EDG
source code and interfaces are protected, they may be distributed freely in binary
form. Language support for Fortran 2003 and earlier versions (including Fortran 90/95,
F77, F66, and Fortran 4) is based on the Open Fortran Parser (OFP) developed at Los Alamos
National Laboratory. ROSE converts the intermediate representations (IRs) produced by
the front-ends into abstract syntax trees.
The Sage III IR used by ROSE is an intuitive,
object-oriented IR with several levels of interfaces for building source-to-source
translators. All information in the original application is carefully preserved in
its ROSE AST, including C preprocessor control structure, source comments, source
position information, and template information (e.g., template arguments). Generic
and custom program analysis and optimization tools can be built on top of the AST
or any of the other graphs generated internally within ROSE. The ROSE unparsers
generate source code in the original
source languages from the optimized AST, with all original comments and C preprocessor
control structures preserved. Finally, vendor compilers are used to compile the
optimized source code into executables for different platforms. ROSE translators
can completely replace the vendor compiler, while still using it for the
compilation of the generated source code.
A number of program analyzes and transformations have been developed for ROSE.
They are designed to be utilized by users via simple function calls to interfaces.
The program analysis available include call graph analysis, control flow analysis,
data flow analysis (live variables, def-use chain, reaching definition, alias
analysis, etc.), class hierarchy analysis, data dependence and system dependence
analysis, and MPI communication pattern analysis. Representative program
optimizations and translations developed with ROSE are partial redundancy
elimination, constant folding, inlining, outlining (separating out a portion of
code as a function), OpenMP directive lowering, and loop transformations (a loop
optimizer supporting aggressive loop optimizations such as fusion, fission,
interchange, unrolling, and blocking).
ROSE is released under a BSD-style license and is portable to Linux and Mac OS X
on IA-32 and x86-64 platforms. It has attracted more than three dozen user groups
worldwide for various research, development, and education purposes. For example,
internal users at Lawrence Livermore National Laboratory are using it for optimizing
data structure abstractions and components. External users from other national
laboratories and universities have been using ROSE for code instrumentation,
static analysis, formal rewrite systems, empirical tuning, MPI verification, etc.
It also is being used by five universities for teaching and seven companies to
support the development of commercial products. We welcome both external users and
potential collaborators to work with us.
|