Skip to content

Commit

Permalink
[interf] Don't record "ill-typed" interferences.
Browse files Browse the repository at this point in the history
The coloring algorithm uses only the "well-typed" interferences (registers
with same class). This is because we don't assign the same stack slot to
registers of different register class.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13207 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
  • Loading branch information
bmeurer committed Jan 7, 2013
1 parent 945c79b commit c61f2d7
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions asmcomp/interf.ml
Expand Up @@ -29,20 +29,21 @@ let build_graph fundecl =

(* Record an interference between two registers *)
let add_interf ri rj =
let update rs rt =
if rs.loc = Unknown then begin
rs.interf <- rt :: rs.interf;
if not rt.spill
&& Proc.register_class rs = Proc.register_class rt
then rs.degree <- rs.degree + 1
end in
let i = ri.stamp and j = rj.stamp in
if i <> j then begin
let p = if i < j then (i, j) else (j, i) in
if not(IntPairSet.mem p !mat) then begin
mat := IntPairSet.add p !mat;
update ri rj;
update rj ri
if Proc.register_class ri = Proc.register_class rj then begin
let i = ri.stamp and j = rj.stamp in
if i <> j then begin
let p = if i < j then (i, j) else (j, i) in
if not(IntPairSet.mem p !mat) then begin
mat := IntPairSet.add p !mat;
if ri.loc = Unknown then begin
ri.interf <- rj :: ri.interf;
if not rj.spill then ri.degree <- ri.degree + 1
end;
if rj.loc = Unknown then begin
rj.interf <- ri :: rj.interf;
if not ri.spill then rj.degree <- rj.degree + 1
end
end
end
end in

Expand Down

0 comments on commit c61f2d7

Please sign in to comment.