POSSIBLE PROGRAMMING ASSIGNMENTS FOR THE NPTEL COURSE ON COMPILER DESIGN Y.N. SRIKANT Computer Science and Automation Indian Institute of Science Bangalore 560012 ======================================================================== 1. Code generator for a C subset (C--) targeting Intel X86 You are required to write a simple code generator that takes an intermediate form for a C source program and generates assembly code for the Intel X86 architecture. Only 'int' and 'char' primitive data types need to be supported. You also need to support arrays. Use simple register allocation (GETREG(), as in ASU) for temporary register allocation in basic blocks and avoid global register allocation by storing and restoring registers at the end and beginning of basic blocks (respectively). The front end you will be using is LANCE which generates tree intermediate code. You may convert this tree code to three address code (if you desire). The code generation algorithm can be the simple basic block code generator as in ASU, or anything superior to it. You must handle function calls and returns appropriately, and carry out storage allocation for data. You are required to generate assembly code that should run using the GNU assembler for the X86. URL for LANCE: http://www.lancecompiler.com/ 2. Add support for enums, structs, and, unions in assignment #1. 3. Add pointers and dynamic storage allocation in assigment #2. 4. Implement assignments #1, #2, and, #3, for a 64-bit Intel x86 architecture. 5. Add floating point types to assigments #1, #2, #3, and, #4. 6. Implement assignment #1 using the code generator generator (CGG) IBURG. URL for IBURG: http://code.google.com/p/iburg/ 7. Use the LLVM front end in the above assignments instead of LANCE. URL for LLVM: http://llvm.org/ 8. Implement a value-numbering based local common subexpression elimination algorithm for LANCE intermediate code. 9. Do assigment #8 for LLVM intermediate code. 10. Implement Partial Redundancy Elimination(PRE) on intermediate code produced by LANCE. 11. Do assignment #10 for LLVM intermediate code. 12. You are required to implement the following optimizations: * Minimal SSA form construction from intermediate code of LANCE * Global Value Numbering (GVN) on the SSA form * Conditional Constant Propagation (CCP) on the SSA form * Reconstruct intermediate code of LANCE from SSA form You are required to show the effect of transformations individually both on the IR and on the machine code (running time). Use your own code generator that you built in a previous assignment. Design several test cases. Run on some standard benchmarks as well (we will not specify any). 13. Do assignment #12 for LLVM code.