TC-8 FAQ

Why do we have a TempMap, and not Appel?

Refer to $fp or fp, in TC-5 FAQ, for all the details. Pay special attention to converting the temporaries where needed:

  • the flow graph is independent of the temporaries

  • the liveness graph, when computing live-in and live-out sets, must of course convert the “def” and “use” sets

  • the interference graph, when attributing a node number for each temporary (InterferenceGraph::node_of), must allocate the same number to corresponding temporaries (e.g., $fp and fp must bear the same number).

We also use a TempMap here to build the liveness graph after register allocation, to check the compiler.

and.tig
1 & 2
tc -sV and.tig
$ tc -sV and.tig

$ echo $?
0
/* Graph Visualization */
digraph "and.main._main.liveness.gv" {
  node [shape=box];
  "0" [label="tc_main:"]
  "1" [label="# Allocate frame"]
  "2" [label="l3:"]
  "3" [label="	li	$t0, 1"]
  "4" [label="	bne	$t0, 0, l0"]
  "5" [label="l1:"]
  "6" [label="l2:"]
  "7" [label="	j	l4"]
  "8" [label="l0:"]
  "9" [label="	j	l2"]
  "10" [label="l4:"]
  "11" [label="# Deallocate frame"]
  "12" [label="	jr	$ra"]
  "0" -> "1" [label="$fp $ra $s0 $s1 $s2 $s3 $s4 $s5 $s6 $s7 $sp $v0 $zero"]
  "1" -> "2" [label="$fp $ra $s0 $s1 $s2 $s3 $s4 $s5 $s6 $s7 $sp $v0 $zero"]
  "2" -> "3" [label="$fp $ra $s0 $s1 $s2 $s3 $s4 $s5 $s6 $s7 $sp $v0 $zero"]
  "3" -> "4" [label="$fp $ra $s0 $s1 $s2 $s3 $s4 $s5 $s6 $s7 $sp $t0 $v0 $zero"]
  "5" -> "6" [label="$fp $ra $s0 $s1 $s2 $s3 $s4 $s5 $s6 $s7 $sp $v0 $zero"]
  "6" -> "7" [label="$fp $ra $s0 $s1 $s2 $s3 $s4 $s5 $s6 $s7 $sp $v0 $zero"]
  "8" -> "9" [label="$fp $ra $s0 $s1 $s2 $s3 $s4 $s5 $s6 $s7 $sp $v0 $zero"]
  "10" -> "11" [label="$fp $ra $s0 $s1 $s2 $s3 $s4 $s5 $s6 $s7 $sp $v0 $zero"]
  "11" -> "12" [label="$fp $ra $s0 $s1 $s2 $s3 $s4 $s5 $s6 $s7 $sp $v0 $zero"]
  "4" -> "8" [label="$fp $ra $s0 $s1 $s2 $s3 $s4 $s5 $s6 $s7 $sp $v0 $zero"]
  "4" -> "5" [label="$fp $ra $s0 $s1 $s2 $s3 $s4 $s5 $s6 $s7 $sp $v0 $zero"]
  "7" -> "10" [label="$fp $ra $s0 $s1 $s2 $s3 $s4 $s5 $s6 $s7 $sp $v0 $zero"]
  "9" -> "6" [label="$fp $ra $s0 $s1 $s2 $s3 $s4 $s5 $s6 $s7 $sp $v0 $zero"]
}

and.main._main.liveness.gv