summaryrefslogtreecommitdiff
path: root/cparser/Transform.mli
diff options
context:
space:
mode:
authorGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2011-11-26 15:40:57 +0000
committerGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2011-11-26 15:40:57 +0000
commit60b6624ae2b28ebe9fb30c2aa6115e4d5c1ab436 (patch)
treea78b0a79576773ead96a8d39902ad3a19b20ed2d /cparser/Transform.mli
parent015c64c64a5a547dcef81a75a589eeaf034654cd (diff)
cparser/*: refactoring of the expansion of read-modify-write operators
cparser/PackedStructs: treat r-m-w operations over byte-swapped fields cparser/PackedStructs: allow static initialization of packed structs test/regression: more packedstruct tests git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1738 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'cparser/Transform.mli')
-rw-r--r--cparser/Transform.mli27
1 files changed, 25 insertions, 2 deletions
diff --git a/cparser/Transform.mli b/cparser/Transform.mli
index 8215997..5736abc 100644
--- a/cparser/Transform.mli
+++ b/cparser/Transform.mli
@@ -15,18 +15,41 @@
(** Creation of fresh temporary variables. *)
val reset_temps : unit -> unit
+val get_temps : unit -> C.decl list
val new_temp_var : ?name:string -> C.typ -> C.ident
val new_temp : ?name:string -> C.typ -> C.exp
-val get_temps : unit -> C.decl list
+val mk_temp : Env.t -> ?name:string -> C.typ -> C.exp
(** Avoiding repeated evaluation of a l-value *)
val bind_lvalue: Env.t -> C.exp -> (C.exp -> C.exp) -> C.exp
-(** Generic transformation of a statement *)
+(* Most transformations over expressions can be optimized if the
+ value of the expression is not needed and it is evaluated only
+ for its side-effects. The type [context] records whether
+ we are in a side-effects-only position ([Effects]) or not ([Val]). *)
type context = Val | Effects
+(** Expansion of assignment expressions *)
+val op_for_assignop : C.binary_operator -> C.binary_operator
+val op_for_incr_decr : C.unary_operator -> C.binary_operator
+val assignop_for_incr_decr : C.unary_operator -> C.binary_operator
+val expand_assign :
+ write:(C.exp -> C.exp -> C.exp) ->
+ Env.t -> context -> C.exp -> C.exp -> C.exp
+val expand_assignop :
+ read:(C.exp -> C.exp) -> write:(C.exp -> C.exp -> C.exp) ->
+ Env.t -> context -> C.binary_operator -> C.exp -> C.exp -> C.typ -> C.exp
+val expand_preincrdecr :
+ read:(C.exp -> C.exp) -> write:(C.exp -> C.exp -> C.exp) ->
+ Env.t -> context -> C.unary_operator -> C.exp -> C.exp
+val expand_postincrdecr :
+ read:(C.exp -> C.exp) -> write:(C.exp -> C.exp -> C.exp) ->
+ Env.t -> context -> C.unary_operator -> C.exp -> C.exp
+
+(** Generic transformation of a statement *)
+
val stmt : (C.location -> Env.t -> context -> C.exp -> C.exp) ->
Env.t -> C.stmt -> C.stmt