CIS-4050 Homework #4 (LLVM Code Generation)

Due: Wednesday, April 19, 2019

The goal of this assignment is to finish the CodeGenerator class in the Augusta code base to a sufficient degree that the prime1 example will compile and produce reasonable code. Note that we are using the SLEM library to output LLVM assembly language. Your changes will entail writing the code that will generate an appropriate LLVM assembly language abstract syntax tree.

  1. Fix all the TODO items in CodeGenerator.scala. This is going to entail some study of the Graph for Scala library. You will need to come up with a way to label basic blocks.

  2. You will also need to fix the TODO item in the CFG builder class about how the initialized declarations need to be put into the first block(s) of the CFG. In effect, they must be converted to a sequence of assignment statements. The order matters.

  3. The CFG builder currently does not handle if statements. It will need to be enhanced to add support for those statement forms in order to correctly process the prime1 example.

When all the changes are done it should be possible to run the sample in the "sbt shell" window of IntelliJ (or at the SBT prompt) using:

      > run testData/prime1.adb
    

Submit a zip archive of your modified files. Do not submit the entire project!


Last Revised: 2019-04-01
© Copyright 2019 by Peter C. Chapin <pchapin@vtc.edu>