Project for CSC 255/455, Spring 2010

Introduction

We have one warm-up project based on GCC, and four URCC-based projects which mainly focus on implementing automatic parallelization step by step. In the project, you will add your own passes in your ruby C Compiler, URCC. You have to know the basic framework of URCC and how to manipulate the intermediate form, for program analysis and transformation. This page includes many suggestions that will help you in the process. Please read the entire page before you start.

Install GCC

You have to work on GCC for your first project. Here we use GCC-4.2.2. It is not the most recent GCC, but should be sufficient for our project. Check out the code from GCC read-only repository, following the commands below. For more information about GCC debugging and data structure, please click here.

**step #1 Check out gcc source code

    cd  /localdisk
        // change to your work directory, such as /localdisk
    mkdir gcc
    cd gcc
    svn co svn://gcc.gnu.org/svn/gcc/tags/gcc_4_2_2_release gcc-4.2.2

**step #2 Check out padding files using mercurial. Run "which hg" to see whether there is mercurial version control on your machine. If not, download one from here. Then Create .hg/hgrc file and put the following line in it.

    [paths]
    default = ssh://cs255@node1x4a.cs.rochester.edu//localdisk/xiang/cs255/
    default-push = ssh://cs255@node1x4a.cs.rochester.edu//localdisk/xiang/cs255/
Now run the following commands step by step. The password for account cs255 is cs455.
    hg pull -u
    cd padding
    bash padding.sh
    cd ..

**step #3 Install GCC

    mkdir obj
    cd obj
    ../gcc-4.2.2/configure --prefix=$INSTALL_DIR 
        // $INSTALL_DIR is the directory you want to install your compiler, such as $HOME/gcc-build
        // If you encounter the error "error: Building GCC requires GMP 4.1+ and MPFR 2.3.0+", 
        // please download gmp or mpfr from ftp://gcc.gnu.org/pub/gcc/infrastructure 
        // and put the extracted directory under $HOME/gcc/gcc-4.2.2/
    make
    make install
* Use either our desktop or personal machine or one of the public use machines in the CS department. When using department machines, due to the shortage of space for the /home directory, it is better to put your code under /localdisk .

**step #4 Use make for your testing. Makefile is in the directory test_cases.

About turn in

You need to turn in the file containing source code (only cs255.c for project #1), along with the README document describing the design, implementation and testing results when applicable. README is a very important part of your project, so lease take it seriously. To submit your work, make a new folder, put cs255.c and README into it, and then call /u/cs455/TURN_IN . in the folder (Don't forget the "."). If you have problem with the submit script, feel free to send the two files to me by email.

* To prevent the problem of hardware incompatibility, you'd better build your compiler and use it and run the compiled executables on the same kind of machines.

* If you are not familiar with subversion, take a look at the VersionStuff page.

* Gnu's wiki page on the generic installation procedure for GCC.

Part 1: Trivial (5%)(Individual Project) (Due: Feb. 21 11:59pm)

In this part, you will add a pass that will insert code into a program to count and output the number of executed statements when the program executes. You need to first add a call at the beginning of the main function, which has a global counter initialized to 0; then add a call before each gimple statement, which increments the counter; and finally add a call at the exit, which reports the run-time instruction counts. The three functions are provided in cs255-lib.c and cs255-lib.h. These two files are already included in test_cases directory when you check out padding files.

* Put your own code into gcc-4.2.2/gcc/cs255.c

* Initialization: you'll need to add it at the entry of the main function

* Increment: to be added before each real gimple statements (all except for labels)

* Report: to be added at all possible exits of the program

* Remember to add #include "cs255-lib.h" in your own testing programs.

* Invoke your pass: use -O2 -fcs255

This part should take at most tens of lines of code and no more than a day (including half an hour compiling the compiler for the first time). The purpose is to get you familiar with GCC and the basic GCC functions that you'll need for adding your optimization passes. Reading the relevant, existing code (in gcc-4.2.2/gcc/cs255.c) is the best way to help you writing your new code in an existing system. For instance, the code for counting the number of basic blocks and statements statically is already in the file. The code for getting the dynamic count of the basic blocks is also given.

For testing, there are some test case in directory test_cases. You may use the results from them to check your code with your classmates. And they are very useful in following parts and final competition.

Part 2: Loop representation (20%)(Individual Project) (Due: Mar. 22 11:59pm)

Using the provided URCC compiler, recognize loops in programs written in a reduced C language.

* Set ALLOWTOPICCHANGE = ChenDing, XiaoyaXiang

Edit | Attach | Watch | Print version | History: r17 | r11 < r10 < r9 < r8 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r9 - 2010-03-15 - XiaoyaXiang
 
  • Edit
  • Attach
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding URCS? Send feedback