interf: il faut garantir que toutes les preferences ont un poids > 0.

Une preference de poids 0 peut en effet rendre assignable un registre
interdit.


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@475 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Xavier Leroy 1995-11-27 14:12:14 +00:00
parent 078a661b3d
commit bff096758b
1 changed files with 12 additions and 10 deletions

View File

@ -111,16 +111,18 @@ let build_graph fundecl =
or if the source register already has a location. *)
let add_pref weight r1 r2 =
let i = r1.stamp and j = r2.stamp in
if i = j then () else begin
match r1.loc with
Unknown ->
let n = if i < j then ((j * (j + 1)) lsr 1) + i
else ((i * (i + 1)) lsr 1) + j in
let b = Char.code(mat.[n lsr 3]) in
let msk = 1 lsl (n land 7) in
if b land msk = 0 then r1.prefer <- (r2, weight) :: r1.prefer
| _ -> ()
if weight > 0 then begin
let i = r1.stamp and j = r2.stamp in
if i = j then () else begin
match r1.loc with
Unknown ->
let n = if i < j then ((j * (j + 1)) lsr 1) + i
else ((i * (i + 1)) lsr 1) + j in
let b = Char.code(mat.[n lsr 3]) in
let msk = 1 lsl (n land 7) in
if b land msk = 0 then r1.prefer <- (r2, weight) :: r1.prefer
| _ -> ()
end
end in
(* Add a mutual preference between two regs *)