This is a repository for CS 6120 course projects and assignments. It contains Scala code used to perform operations on Bril programs.
The class bril.run.BrilCfg reads a Bril program in JSON and produces Graphviz output which
can be piped to dot -Tpng to create a graphical representation. The script bril/scripts/run bril.run.BrilCfg
will call the right files.
bril2json < /path/to/bril/program | scripts/run bril.run.BrilCfg | dot -Tpng > cfg.png
Some sample graphs generated by the script can be found in test/graphs; like the one below.
The class bril.run.BrilDegrees reads a Bril program in JSON and calculates how many
basic blocks have a given in-degree and out-degree. The script scripts/run bril.run.BrilDegrees
will call the right files.
bril2json < /path/to/bril/program | scripts/run bril.run.BrilDegrees
There is a Turnt test specification in test/degrees.
The class bril.run.BrilDce reads a Bril program in JSON and performs dead code elimination. It
does both local reassignment elimination and global unused statement removal.
The actual code for performing LVN is in the class
bril.optim.BrilDce. The script
scripts/run bril.run.BrilDce will call the right files.
bril2json < /path/to/bril/program | scripts/run bril.run.BrilDce
There is a Turnt test specification in test/tdce.
The class bril.run.BrilLvn reads a Bril program in JSON and performs local value numbering
based optimisations. The actual code for performing LVN is in the class
bril.optim.BrilLvn. It performs the following optimisations:
- Copy propagation
- Common subexpression elimination
- Constant folding
The script scripts/run bril.run.BrilLvn will call the right files.
bril2json < /path/to/bril/program | scripts/run bril.run.BrilLvn
There is a Turnt test specification in test/lvn and test/dce+lvn to test both a LVN and DCE pass combined.
The class bril.run.BrilDataFlow reads a Bril program in JSON and performs data flow
analysis. The actual code for performing data flow is in the class
bril.structure.BrilDataFlow. The data flow
analysis accepts a generic framework which is an object that contains the methods for performing
any analysis. See bril.run.BrilDataFlow for a sample
implementation of the following analysis:
- Reaching Definitions
- Live Variables
- Constant propagation
The script scripts/run bril.run.BrilDataFlow will call the right files.
bril2json < /path/to/bril/program | scripts/run bril.run.BrilDataFlow [live | const | defs]
There is a Turnt test specification in test/dataflow for the live and const analysis.
