aboutsummaryrefslogtreecommitdiffstats
path: root/cparser/Cleanup.ml
diff options
context:
space:
mode:
authorxleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2012-12-18 07:54:35 +0000
committerxleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2012-12-18 07:54:35 +0000
commit712f3cbae6bfd3c6f6cc40d44f438aa0affcd371 (patch)
tree913762a241b5f97b3ef4df086ba6adaeb2ff45c4 /cparser/Cleanup.ml
parentc629161139899e43a2fe7c5af59ca926cdab370e (diff)
downloadcompcert-kvx-712f3cbae6bfd3c6f6cc40d44f438aa0affcd371.tar.gz
compcert-kvx-712f3cbae6bfd3c6f6cc40d44f438aa0affcd371.zip
Support for inline assembly (asm statements).
cparser: add primitive support for enum types. bitfield emulation: for bitfields with enum type, choose signed/unsigned as appropriate git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2074 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'cparser/Cleanup.ml')
-rw-r--r--cparser/Cleanup.ml11
1 files changed, 7 insertions, 4 deletions
diff --git a/cparser/Cleanup.ml b/cparser/Cleanup.ml
index 54dfd679..00ff662a 100644
--- a/cparser/Cleanup.ml
+++ b/cparser/Cleanup.ml
@@ -47,6 +47,7 @@ let rec add_typ = function
| TNamed(id, _) -> addref id
| TStruct(id, _) -> addref id
| TUnion(id, _) -> addref id
+ | TEnum(id, _) -> addref id
| _ -> ()
and add_vars vl =
@@ -96,6 +97,7 @@ let rec add_stmt s =
| Sreturn(Some e) -> add_exp e
| Sblock sl -> List.iter add_stmt sl
| Sdecl d -> add_decl d
+ | Sasm _ -> ()
let add_fundef f =
add_typ f.fd_ret;
@@ -107,7 +109,7 @@ let add_field f = add_typ f.fld_typ
let add_enum e =
List.iter
- (fun (id, opt_e) -> match opt_e with Some e -> add_exp e | None -> ())
+ (fun (id, v, opt_e) -> match opt_e with Some e -> add_exp e | None -> ())
e
(* Saturate the set of referenced identifiers, starting with externally
@@ -152,8 +154,8 @@ let rec add_needed_globdecls accu = function
if needed id
then (add_typ ty; add_needed_globdecls accu rem)
else add_needed_globdecls (g :: accu) rem
- | Genumdef(id, enu) ->
- if List.exists (fun (id, _) -> needed id) enu
+ | Genumdef(id, _, enu) ->
+ if needed id || List.exists (fun (id, _, _) -> needed id) enu
then (add_enum enu; add_needed_globdecls accu rem)
else add_needed_globdecls (g :: accu) rem
| _ ->
@@ -180,7 +182,8 @@ let rec simpl_globdecls accu = function
| Gcompositedecl(_, id, _) -> needed id
| Gcompositedef(_, id, _, flds) -> needed id
| Gtypedef(id, ty) -> needed id
- | Genumdef(id, enu) -> List.exists (fun (id, _) -> needed id) enu
+ | Genumdef(id, _, enu) ->
+ needed id || List.exists (fun (id, _, _) -> needed id) enu
| Gpragma s -> true in
if need
then simpl_globdecls (g :: accu) rem