summaryrefslogtreecommitdiff
path: root/cparser/Bitfields.ml
diff options
context:
space:
mode:
authorGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2011-08-17 13:34:12 +0000
committerGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2011-08-17 13:34:12 +0000
commit84cb73abe0f777521ee67cec2405c9593420d3da (patch)
tree132aaf0717d782d9d4e0bdb87eff14e55bd29b6d /cparser/Bitfields.ml
parent8c2d07d888779c2dbe610da15cac5bae39e17fd0 (diff)
Factor out bind_lvalue
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1715 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'cparser/Bitfields.ml')
-rw-r--r--cparser/Bitfields.ml24
1 files changed, 2 insertions, 22 deletions
diff --git a/cparser/Bitfields.ml b/cparser/Bitfields.ml
index 5ab4eb4..ff4c0c6 100644
--- a/cparser/Bitfields.ml
+++ b/cparser/Bitfields.ml
@@ -15,8 +15,8 @@
(* Elimination of bit fields in structs *)
-(* Assumes: unblocked, simplified code.
- Preserves: unblocked, simplified code. *)
+(* Assumes: unblocked code.
+ Preserves: unblocked code. *)
open Printf
open Machine
@@ -201,26 +201,6 @@ let bitfield_assign bf carrier newval =
{edesc = EBinop(Oor, oldval_masked, newval_masked, TInt(IUInt,[]));
etyp = TInt(IUInt,[])}
-(* Detect invariant l-values *)
-
-let rec invariant_lvalue e =
- match e.edesc with
- | EVar _ -> true
- | EUnop(Oderef, {edesc = EVar _}) -> true (* to check *)
- | EUnop(Odot _, e1) -> invariant_lvalue e1
- | _ -> false
-
-(* Bind a l-value to a temporary variable if it is not invariant. *)
-
-let bind_lvalue e fn =
- if invariant_lvalue e then
- fn e
- else begin
- let tmp = new_temp (TPtr(e.etyp, [])) in
- ecomma (eassign tmp (eaddrof e))
- (fn {edesc = EUnop(Oderef, tmp); etyp = e.etyp})
- end
-
(* Transformation of operators *)
let op_for_incr_decr = function