|
Postscript, | Luc Maranget | Le poly |
|
|
|
|
|
type instr = | Oper of string * temp list * temp list * label list option (* Oper (mnémonique, sources, destinations, sauts) *) ... |
|
⎧ ⎨ ⎩ |
t | | | | |
∃ i1 ∈ Succ (i), …, in ∈ Succ (in-1), ∧ | ⎧ ⎨ ⎩ |
|
⎫ ⎬ ⎭ |
⎧ ⎨ ⎩ |
t | | | | |
∃ i1=i, i2 ∈ Succ (i1), …, in ∈ Succ (in-1), ∧ | ⎧ ⎨ ⎩ |
|
⎫ ⎬ ⎭ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for i=1 to n do Out (i) <- Ø done ; O(n) do for i=1 to n do Out' (i) <- Out (i) done ; O(n) for i=1 to n do Out (i) <- (∪j ∈ Succ (i) (Out' (j)\Def (j)) ∪ Use (j)) |Succ (i)| × O(n) done × n → O(n2) until ∀ i ∈ [1,n], Out (i) = Out '(i) × O(n2) → O(n4) |
|
|
|
for i=1 to n do Speed (n) <- Ø done ; let encore = ref true in while !encore do encore := false ; for i=1 to n do let prev = Speed (i) in Speed (i) <- (∪j ∈ Succ (i) (Speed (j)\Def (j))∪ Use (j)) ; encore := !encore || (prev <> Speed (i)) done done |
|
|
|
Speed0 = { i ↦ Ø},
Speedk+1 = FSpeed (Speedk ) |
|
Out ⊆ Speed |
Speedk ⊆ Out |
|
|
|
Éviter le plus possible j ∈ Succ i et j ≥ i. Ici on a Succ (8) = {7, 12}. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Allocation :
e, r et f dans r1,
n dans r2. Les arcs move indiquent de choisir r1 = v0. |
|
function fact ( n : integer) : integer; begin if n <= 1 then fact := 1 else fact := n * fact (n-1) end; |
|
fact: # ⇐ # $a0 $s0 $ra subu $sp, $sp, fact_f # ⇐ # $a0 $s0 $ra move $112, $ra # $112 ⇐ $ra # $a0 $s0 $112 move $113, $s0 # $113 ⇐ $s0 # $a0 $112 $113 move $108, $a0 # $108 ⇐ $a0 # $108 $112 $113 li $114, 1 # $114 ⇐ # $108 $112 $113 $114 ble $108, $114, L12 # ⇐ $108 $114 # $108 $112 $113 L13: # ⇐ # $108 $112 $113 sub $a0, $108, 1 # $a0 ⇐ $108 # $a0 $108 $112 $113 jal fact # $v0 $a0 $ra ⇐ $a0 # $v0 $108 $112 $113 move $109, $v0 # $109 ⇐ $v0 # $108 $109 $112 $113 mul $107, $108, $109 # $107 ⇐ $108 $109 # $107 $112 $113 b fact_end # ⇐ # $107 $112 $113 L12: # ⇐ # $112 $113 li $107, 1 # $107 ⇐ # $107 $112 $113 fact_end: # ⇐ # $107 $112 $113 move $v0, $107 # $v0 ⇐ $107 # $v0 $112 $113 move $ra, $112 # $ra ⇐ $112 # $v0 $113 $115 move $s0, $113 # $s0 ⇐ $113 # $v0 $s0 $115 addu $sp, $sp, fact_f # ⇐ # $v0 $s0 $115 j $ra # ⇐ $v0 $s0 $ra # |
|
|
|
|
|
|
|
|
|
|
|
|
Ce document a été traduit de LATEX par HEVEA.