Skip to content

PA5 - Assembly Code Generation

Latest
Compare
Choose a tag to compare
@noschiff noschiff released this 26 Apr 00:41
· 231 commits to master since this release

Assignment Specs

https://www.cs.cornell.edu/courses/cs4120/2023sp/pa/pa5/pa5.pdf

Summary

We designed a tiling system with a representation of tiles that transformed our tree-based IR into a representation of x86 assembly, and created a RegisterAllocator to implement trivial register allocation where all temporaries were spilled onto the stack. Both of these had several iterations of designs before we settled on the final class structures in our package. We embed x86 assembly instructions through a series of data classes and sealed subclasses to classify different varieties of instructions and constructs in assembly. Moreover, we build representations of tiles and a helper TileBuilder class to tile our tree-based IR into assembly instructions, with a ConventionalCaller that aids us in following the correct calling conventions. We convert a list of Instruction constructs into our outputted assembly in the end, which we can link and run successfully.