Project Plan - SSA intermediate representation for the Solang compiler

Project Plan - SSA intermediate representation for the Solang compiler

Implement an SSA intermediate representation for the Solang compiler

Abstract

Solang is an open-source Solidity compiler written in Rust. It currently generates an intermediate representation in a Control Flow Graph (CFG) for each function in a Solidity contract during compilation. This project aims to implement a lower-level Static Single-Assignment (SSA) intermediate representation between the CFG and the LLVM-IR. The SSA representation will allow further optimizations during compilation, such as liveness analysis and partial redundancy elimination.

Mentor and Mentee

Mentor: Lucas Steuernagel

Mentee: Fanyi Zhao

Fork of official repository for this project: <https://github.com/fanyi-zhao/solang>

Deliverables

  • The three-address code format: implement the data structure of the new three-address code format CFG.

  • The three-address code format: Implement a text dump function for the new CFG. (+ unit tests)

  • The three-address code format: Convert the old CFG into the new CFG of three-address codes. (+ unit tests)

  • Implement SSA: insert phi functions into the new CFG. (+ unit tests)

  • (Optional) Implement SSA: rename variables to generate SSA format. (+ unit tests)

Milestones

From Sep 15, 2023 to Dec 22, 2023.

Prepare

Sep 15, 2023 - Sep 20, 2023 Learn Solidity syntax, Solang project structure, and Rust.

Evaluation 1

Due date: October 20th

Sep 20, 2023 - Sep 29, 2023 The three-address code format: define the data structure of the new three-address code format CFG.
Oct 2, 2023 - Oct 11, 2023 The three-address code format: Implement a text dump function for the new CFG. (+ unit tests)
Oct 11, 2023 - Oct 20, 2023 The three-address code format: Convert the old CFG into the new CFG of three-address codes. (+ unit tests)

Evaluation 2 - Midterm

Due date: November 15th

Oct 26, 2023 - Nov 15, 2023 PR Review & PR fixes.

Evaluation 3

Due date: December 1st

Nov 16, 2023 - Dec 8, 2023 Implement SSA: insert phi functions into the new CFG. (+ unit tests)

Evaluation 4 - Final

Due date: December 22nd

Dec 11, 2023 - Dec 22, 2023 PR Review & PR fixes.
Dec 11, 2023 - Dec 22, 2023 (Optional) Implement SSA: rename variables to generate SSA format. (+ unit tests)

Methodology

Weekly check-ins to report project progress. Chat with Lucas on Discord for questions. Attend daily Solang meetups to report progress and ask questions.

Read the book "SSA-based Compiler Design" for a detailed explanation of all the algorithms required to implement SSA.

SSA-based Compiler Design

SSA-based Compiler Design