Commit 15eb9d55 authored by Arthur Hugonnot's avatar Arthur Hugonnot
Browse files

tc_9: update TC-9 for 2023

    * source/compiler_stages/tc_9/code_to_write.rst,
    * source/compiler_stages/tc_9/goals.rst,
    * source/compiler_stages/tc_9/tc_9.rst: Here.
parent df71ca73
......@@ -3,13 +3,14 @@
TC-9 Code to Write
------------------
src/regalloc/color.hh
src/regalloc/color.*
Implement the graph coloring. The skeleton we provided is an exact copy
of the implementation of the code suggest by Andrew Appel in the section
11.4 "Graph Coloring Implementation" of his book. A lot of comments
that are verbatim copies of his comments are left in the code.
Unfortunately, the books have several nasty mistakes on the algorithm,
they reported on his web page (:ref:`Modern Compiler Implementation`);
they reported on his web page (`Errata: Modern Compiler Implementation in ML\
<https://www.cs.princeton.edu/~appel/modern/ml/errata98.html>`_);
be sure to fix your books.
Pay attention to :code:`misc::set`: there is a lot of syntactic sugar
......@@ -21,6 +22,5 @@ src/regalloc/regallocator.cc
Run the register allocation on each code fragment. Remove the useless
moves.
src/target/mips/epilogue.cc
If your compiler supports spills, implement
:code:`Codegen::rewrite_program`.
src/target/mips/spim-codegen.cc
If your compiler supports spills, implement :code:`Codegen::rewrite_program`.
......@@ -5,6 +5,10 @@ TC-9 Goals
Things to learn during this stage that you should remember:
- Use of work lists for efficiency
- Attacking NP complete problems
- Register allocation as graph coloring
**Use of work lists for efficiency**
We maintain multiple work lists in sets to retain nodes in categories
and avoid quadratic complexity in finding coalesceable nodes.
**Register allocation as graph coloring**
Graph coloring is an NP complete problem. In TC-9 we use a simple algorithm
based on Kempe's graph coloring algorithm.
......@@ -5,14 +5,21 @@ TC-9, Register Allocation
|class|-TC-9 is a part of the TC Back End option.
|class|-TC-9 submission is Saturday, June 26th |year| at 23:42.
|class|-TC-9 submission is Saturday, July 3rd |year| at 23:42.
This section has been updated for EPITA- |class| on 2016-01-27.
This section has been updated for EPITA-2023 on 2021-06-06.
At the end of this stage, the compiler produces code that is runnable
using Nolimips.
Relevant lecture notes include :lectures:`10-regalloc.pdf`.
Relevant lecture notes include :lectures:`52-register-allocation.pdf`,
:lectures:`53-spilling.pdf`, :lectures:`54-coalescing.pdf`,
:lectures:`55-home-run-example.pdf`.
For further information on register allocation, instruction scheduling and
compiler optimizations : :lectures:`56-linear-scan.pdf`,
:lectures:`57-risc-dependencies.pdf`, :lectures:`58-instruction-scheduling.pdf`,
:lectures:`59-loop-unrolling.pdf`.
.. **TC-9 Goals**: What this stage teaches
..
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment