Skip to content

pronesto/DCC888

Folders and files

NameName
Last commit message
Last commit date

Latest commit

b1cf9b8 · Mar 21, 2025
Apr 30, 2024
Mar 21, 2025
Feb 11, 2024
May 2, 2024
Mar 22, 2024
Mar 22, 2024
May 9, 2024
Jul 23, 2024
Jun 19, 2024
Mar 22, 2024
Jun 24, 2024
Dec 29, 2023
Mar 7, 2024
Jul 22, 2024

Repository files navigation

Introduction to Static Program Analyses

This repository holds some of the project assignments used in DCC888 - Introduction to Program Analysis, a course offered by the Department of Computer Science of the Federal University of Minas Gerais, as part of the courses of UFMG's Compilers Lab. For the course material, check its website. A full list of the topics covered is available in the syllabus.

Building and Running

This webpage contains a few labs: short project assignments. In practice, these assignments are automatically graded using UFMG's Moodle. However, the labs can be used independently. They are all implemented in Python. Each program contains lots of doctests. Thus, to test, say, your implementation of dataflow.py, just do:

python3 -m doctest dataflow.py

Additionally, most of the labs contain a folder called tests, with some text files that you can run using the main routine, in driver.py, e.g.:

python3 driver.py < tests/fib.txt

Table of Contents

The following labs are available:

Control-Flow Graphs

In this lab, the student will create simple control-flow graphs using a toy, assembly-like, programming language.

Parsing

In this lab, the student will create a small parser that will convert text files into control-flow graphs.

Data-Flow Analysis

In this lab, the student will implement liveness analysis and run this implementation onto our toy language.

Worklist Algorithms

In this lab, the student will implement a worklist-based solver for dataflow analyses.

Dominators

In this lab, the student will implement a data-flow analysis to compute the dominance tree of a program.

Semantics of Phi-Functions

In this lab, the student will add phi-functions to our toy three-address code language, so that we can write programs in Static Single-Assignment Form.

Constant Propagation

In this lab, the student will implement the sparse data-flow equations for constant propagation. The student will use the results of this analysis to remove some instructions (those whose value can be computed at compilation time) from the program.

Alias Analysis

In this lab, the student will implement a version of Andersen-style Alias Analysis, following the lecture notes seen in class.

Type Checking

In this lab, the student will implement Type-Checking to verify if programs are Safe, as seen in class

Register Allocation by coloring chordal graphs

In this lab, the student will build and color the interference graph of programs in SSA-form using maximum cardinality search and greedy coloring. The resulting coloring represents the minimum register allocation without spilling, as seen in SSA-Based Register Allocation