diff options
Diffstat (limited to 'cparser')
-rw-r--r-- | cparser/Cutil.mli | 2 | ||||
-rw-r--r-- | cparser/Parse.ml | 21 | ||||
-rw-r--r-- | cparser/Parse.mli | 2 |
3 files changed, 16 insertions, 9 deletions
diff --git a/cparser/Cutil.mli b/cparser/Cutil.mli index deee9f08..9d41f8fa 100644 --- a/cparser/Cutil.mli +++ b/cparser/Cutil.mli @@ -94,6 +94,8 @@ val incomplete_type : Env.t -> typ -> bool declared but not defined struct or union, or array type without a size. *) val sizeof_ikind: ikind -> int (* Return the size of the given integer kind. *) +val sizeof_fkind: fkind -> int + (* Return the size of the given float kind. *) val is_signed_ikind: ikind -> bool (* Return true if the given integer kind is signed, false if unsigned. *) diff --git a/cparser/Parse.ml b/cparser/Parse.ml index 59b04e7a..645465c3 100644 --- a/cparser/Parse.ml +++ b/cparser/Parse.ml @@ -17,14 +17,19 @@ module CharSet = Set.Make(struct type t = char let compare = compare end) -let transform_program t p = +let transform_program t p name = let run_pass pass flag p = if CharSet.mem flag t then pass p else p in - Rename.program - (run_pass StructReturn.program 's' + let p1 = (run_pass StructReturn.program 's' (run_pass PackedStructs.program 'p' (run_pass Bitfields.program 'f' (run_pass Unblock.program 'b' - p)))) + p)))) in + let debug = + if !Clflags.option_g && Configuration.advanced_debug then + Some (CtoDwarf.program_to_dwarf p p1 name) + else + None in + (Rename.program p1),debug let parse_transformations s = let t = ref CharSet.empty in @@ -41,7 +46,7 @@ let parse_transformations s = let preprocessed_file transfs name sourcefile = Cerrors.reset(); let ic = open_in sourcefile in - let p = + let p,d = try let t = parse_transformations transfs in let lb = Lexer.init name ic in @@ -57,9 +62,9 @@ let preprocessed_file transfs name sourcefile = | Parser.Parser.Inter.Timeout_pr -> assert false | Parser.Parser.Inter.Parsed_pr (ast, _ ) -> ast) in let p1 = Timing.time "Elaboration" Elab.elab_file ast in - Timing.time2 "Emulations" transform_program t p1 + Timing.time2 "Emulations" transform_program t p1 name with | Cerrors.Abort -> - [] in + [],None in close_in ic; - if Cerrors.check_errors() then None else Some p + if Cerrors.check_errors() then None,None else Some p,d diff --git a/cparser/Parse.mli b/cparser/Parse.mli index 58c3cfb9..ac8feb70 100644 --- a/cparser/Parse.mli +++ b/cparser/Parse.mli @@ -15,7 +15,7 @@ (* Entry point for the library: parse, elaborate, and transform *) -val preprocessed_file: string -> string -> string -> C.program option +val preprocessed_file: string -> string -> string -> C.program option * DwarfTypes.dw_entry option (* first arg: desired transformations second arg: source file name before preprocessing |