Git Product home page Git Product logo

kobayashi-compiler's Introduction

Kobayashi Compiler

An optimizing compiler of SysY, a subset of C. Supported targets are armv7 and risc-v32. (To be accurate, armv7ve and rv32im.)

SysY is the language used by the Collegiate Student System Capability Challenge (Compiler Track) 2021, a compiler contest in China. (contest homepage)

For SysY specification (in Chinese), runtime, and testcases, see here.

README in Chinese

Statistics

Testcases of the contest consist of two parts: functional testcases and performance testcases. The functional testcases were scored by correctness, and the performance testcases were scored based on the running time of the compiler output. In the contest, we passed all the functional testcases, so did most of the teams in the final round. Our performance score and total score both took the first place.

Here are some test results on the performance testcases of the contest. The test environment is a Raspberry Pi 4B. As a comparison, the performance of the code generated by gcc (Raspbian 8.3.0-6+rpi1) 8.3.0 is also listed.

Arguments for gcc are -march=armv7ve -Ofast.

Test results when automatic parallelization is disabled: no parallelization

Test results when automatic parallelization is enabled (add --enable-loop-parallel to this compiler, -ftree-parallelize-loops=4 to gcc): parallelization

Usage

  1. Build
mkdir build
cd build
cmake ..
make -j$(nproc)
  1. Run
./compiler <source_code>.sy -o <output_asm>.s

Additional Arguments

Use --set-<key>=<value> to specify key-value pairs. Here are the available options:

key value default hint
arch armv7, rv32 armv7
num-thread positive integer 4 The number of threads in auto parallelization when --enable-loop-parallel is specified.

Other flags:

flag hint
--enable-loop-parallel Enable automatic parallelization. Currently it's not available for rv32.
--exec Simulate the execution of IR instead of generating assembly code.
--debug, --info, --warning, --error Different levels of logging. default to warning level.

Also, remember to link the output with the runtime under runtime/.

Slides

doc/intro.pdf
doc/pre.pdf

About Us

Kobayashi is a name from the anime Miss Kobayashi's Dragon Maid, and our team name in the contest is Miss Kobayashi's Compiler.

kobayashi-compiler's People

Contributors

lkmcfj avatar lwpie 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.