Skip to content

Commit

Permalink
interf: il faut garantir que toutes les preferences ont un poids > 0.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
xavierleroy committed Nov 27, 1995
1 parent 078a661 commit bff0967
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions asmcomp/interf.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 *)
Expand Down

0 comments on commit bff0967

Please sign in to comment.