Skip to content

Commit

Permalink
[coloring] Validate physical register offsets.
Browse files Browse the repository at this point in the history
The ARM backend uses several tricks to support selection of
VFP3_D16/VFP3_D32 when ocamlopt is invoked, which introduces
interferences with non-existing floating-point registers when
the VFP3_D16 fpu option is used. These invalid interferences
must be skipped while coloring the graph.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13229 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
  • Loading branch information
bmeurer committed Jan 13, 2013
1 parent 705d706 commit a548922
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions asmcomp/coloring.ml
Expand Up @@ -101,12 +101,16 @@ let allocate_registers() =
iter_preferred
(fun r w ->
match r.loc with
Reg n -> let n = n - first_reg in score.(n) <- score.(n) + w
Reg n -> let n = n - first_reg in
if n < num_regs then
score.(n) <- score.(n) + w
| Unknown ->
List.iter
(fun neighbour ->
match neighbour.loc with
Reg n -> let n = n - first_reg in score.(n) <- score.(n) - w
Reg n -> let n = n - first_reg in
if n < num_regs then
score.(n) <- score.(n) - w
| _ -> ())
r.interf
| _ -> ())
Expand All @@ -116,15 +120,19 @@ let allocate_registers() =
(* Prohibit the registers that have been assigned
to our neighbours *)
begin match neighbour.loc with
Reg n -> let n = n - first_reg in score.(n) <- (-1000000)
Reg n -> let n = n - first_reg in
if n < num_regs then
score.(n) <- (-1000000)
| _ -> ()
end;
(* Avoid the registers that have been assigned to pseudoregs
for which our neighbours have a preference *)
iter_preferred
(fun r w ->
match r.loc with
Reg n -> let n = n - first_reg in score.(n) <- score.(n) - (w-1)
Reg n -> let n = n - first_reg in
if n < num_regs then
score.(n) <- score.(n) - (w-1)
(* w-1 to break the symmetry when two conflicting regs
have the same preference for a third reg. *)
| _ -> ())
Expand Down

0 comments on commit a548922

Please sign in to comment.