Skip to content

Commit

Permalink
Use effects in middle end (#14)
Browse files Browse the repository at this point in the history
* Use effects and coeffects of primitives in middle_end

Currently only used when builtin=true.

* Remove the constraint on builtin=true

Use effect and coeffect of Primitive in Semantics_of_primitives
even for primitives that don't have builtin=true
  • Loading branch information
gretay-js authored Oct 13, 2021
1 parent 123d904 commit 60d446a
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion middle_end/semantics_of_primitives.ml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,19 @@ let for_primitive (prim : Clambda_primitives.primitive) =
( "caml_format_float" | "caml_format_int" | "caml_int32_format"
| "caml_nativeint_format" | "caml_int64_format" ) } ->
No_effects, No_coeffects
| Pccall _ -> Arbitrary_effects, Has_coeffects
| Pccall { prim_effects; prim_coeffects } ->
let effects =
match prim_effects with
| No_effects -> No_effects
| Only_generative_effects -> Only_generative_effects
| Arbitrary_effects -> Arbitrary_effects
in
let coeffects =
match prim_coeffects with
| No_coeffects -> No_coeffects
| Has_coeffects -> Has_coeffects
in
effects, coeffects
| Pprobe_is_enabled _ -> No_effects, Has_coeffects
| Praise _ -> Arbitrary_effects, No_coeffects
| Pnot
Expand Down

0 comments on commit 60d446a

Please sign in to comment.