From 84cb73abe0f777521ee67cec2405c9593420d3da Mon Sep 17 00:00:00 2001 From: xleroy Date: Wed, 17 Aug 2011 13:34:12 +0000 Subject: Factor out bind_lvalue git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1715 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e --- cparser/Bitfields.ml | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) (limited to 'cparser/Bitfields.ml') 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 -- cgit v1.2.3