Project-stage 3

 This is the project stage 3. For this stage, my main task is to wrap and tidy the tasks I have done in stage 2 and manage the code to git for sharing. I have pushed the file I have created and for passes code and the modify file. They are Makefile.in, passes.def, tree-mypass.cc and tree-pass.h. You can just go my public GitHun repository and pull these files and then add the file tree-mypass.cc into the directory gcc under your GCC codebase. Then replace the files Makefile.in, passes.def, tree-pass.h under gcc directory with the files I provided for u. If you run the command to make the file again it will run successfully and create your custom GCC.  The GitHub repository: https://github.com/haolinma1/spo600-project1


After integrate my own pass in gcc and make it and install it. I got my custom GCC under the bin in my custom install folder. I locate the test-clone directory where the professor provide for me, and use command make CC=~/gcc/gcc-build/install/bin/gcc CFLAGS="-fdump-tree-all -g -O2" to generate all the dump files. I saw a lot of dump files for clone-test-aarch64-prune and clone-test-aarch64-noprune like original, gimple, lower and so on. But I didn't find the my_pass dump file which is created by me. It seem like there is nothing in the test that match the condition in my pass so there is nothing to be written in my dump file.


For what I have done in this project, I basically just follow the professor instructions to develop a passes that compare the gimple representation of funtions and in these passes to identify if they should be pruned. My passes can be successfully be integrated into the gcc and make.


The code in tree-mypass.cc hasn't been changed significantly, I use do some tidy up and make sure it can work in the newest GCC make file. The issue I have encounter for developing the stage 2 and stage 3 is that there are so many things has been changed and if your just look at the code which is oldest version, you may just follow the format they have developed. For example we need add the NEXT_PASS(pass_my_pass); in file passes.def, but the thing is if your just look at how other developers write they own NEXT_PASS, it just require one argument so if you write your NEXT_PASS(pass_my_pass) and follow the format you will get a error stating that it require two arguments so you have to change it to NEXT_PASS(pass_my_pass,1);. Also, when I tried to run the make with my new passes, there are so many methods that are not supported anymore. It is quite painful to solve these problems since we are not the developer who work on this project for long time so we didn't catch up how this project changed these days. Also, there are not much information in Google for me to check what is the problem or maybe I was not familiar of the process to solves these questions.


For the next steps of this project, I can develop more passes for example the removing unused variable assignment for software optimization. Unlike golang which even doesn't allow developer to initialize unused variable in the program. 


Conclusion, I think finishing this project is quite challenage since we not only need to design how to make the pass for clone-pruning analysis. This require a deep understanding the passes in gcc also we need to figure out countless error when we tried to build our passes and integrate it since there are lots of things or rules have been changed. And it is quite hard to debug in such a huge program.

评论

此博客中的热门博文

Project-stage 2

Project- Stage 1

lab1