Skip to content

zzzDavid/cs6120-a3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CS6120 Lesson 3 Local Analysis and Optimizations

Description

This repository implements two optimizations:

  • Dead code elimination (DCE): dce.py
  • Local value numbering (LVN): lvn.py
    • Constant propagation
    • Sub-expression elimination
    • Constant folding

Run

Run DCE pass:

bril2json < *.bril | python dce.py | bril2txt
bril2json < *.bril | python dce.py | brili -p # profile dynamic instr count

Default DCE is local optimization. To run global DCE, add -g:

bril2json < *.bril | python dce.py -g | bril2txt

Run LVN Pass

bril2json < *.bril | python lvn.py | bril2txt
bril2json < *.bril | python lvn.py | brili -p # profile dynamic instr count

Run both:

bril2json < *.bril | python dce.py | python lvn.py | bril2txt

Test

This repository includes two test folders for both optimizations. To run a test:

turnt tdce/*.bril
turnt lvn/*.bril

About

Cornell CS6120 Advanced Compiler Assignment 3

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages