Code Monkey home page Code Monkey logo

compiler2016's Introduction

Compiler 2016

This is a toy compiler for the course Compiler 2016 at ACM Class, SJTU. The source language is Mx*. The target is MIPS assembly (in SPIM format).

You can refer to my presentation slides (or on SlideShare) to know something about this compiler and also what I've learnt during the course.

When debugging this compiler, I wrote another project LLIRInterpreter which reads text IR and does interpretation.

Feature (what you can find in the source code)

  • Copy elimination
  • Function inlining
  • SSA Transform
    • Construction
    • Destruction
    • Naive dead code elimination
    • Simple constant propagation
  • Register Allocation
    • Local bottom-up allocator
    • Interference graph coloring allocator

Usage

$ java com.abcdabcd987.compiler2016.Mill --help
Mill - Mx* language implementation made with love by abcdabcd987
Usage: mill [options] [input]
Options:
  -help              Print this help message
  -o <file>          Write output to <file>
  -reg-alloc <val>   Set register allocator to <val>
                     Available register allocators:
                       no:    Don't allocate at all. (CISC-like)
                       local: Local bottom-up allocator
                       color: Global allocation by interference graph coloring
  -print-ast         Print the abstract semantic tree
  -print-ir          Print the intermediate representation
  -print-ssa-ir      Print the intermediate representation after SSA transforms
  -no-inline         Disable function inlining
  -no-ssa            Disable single static assignment analysis and transforms
  -no-naive-dce      Disable naive dead code elimination
  -no-scp            Disable simple constant propagate

compiler2016's People

Contributors

abcdabcd987 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.