aboutsummaryrefslogtreecommitdiffstats
path: root/cfrontend
diff options
context:
space:
mode:
Diffstat (limited to 'cfrontend')
-rw-r--r--cfrontend/C2C.ml40
1 files changed, 36 insertions, 4 deletions
diff --git a/cfrontend/C2C.ml b/cfrontend/C2C.ml
index 293e79f0..ec5fb4dc 100644
--- a/cfrontend/C2C.ml
+++ b/cfrontend/C2C.ml
@@ -164,7 +164,7 @@ let ais_annot_functions =
true);]
else
[]
-
+
let builtins_generic = {
builtin_typedefs = [];
builtin_functions =
@@ -312,7 +312,31 @@ let builtins_generic = {
"__compcert_i64_umulh",
(TInt(IULongLong, []),
[TInt(IULongLong, []); TInt(IULongLong, [])],
- false)
+ false);
+ "__compcert_i32_sdiv",
+ (TInt(IInt, []),
+ [TInt(IInt, []); TInt(IInt, [])],
+ false);
+ "__compcert_i32_udiv",
+ (TInt(IUInt, []),
+ [TInt(IUInt, []); TInt(IUInt, [])],
+ false);
+ "__compcert_i32_smod",
+ (TInt(IInt, []),
+ [TInt(IInt, []); TInt(IInt, [])],
+ false);
+ "__compcert_i32_umod",
+ (TInt(IUInt, []),
+ [TInt(IUInt, []); TInt(IUInt, [])],
+ false);
+ "__compcert_f32_div",
+ (TFloat(FFloat,[]),
+ [TFloat(FFloat,[]); TFloat(FFloat,[])],
+ false);
+ "__compcert_f64_div",
+ (TFloat(FDouble,[]),
+ [TFloat(FDouble,[]); TFloat(FDouble,[])],
+ false);
]
}
@@ -1248,7 +1272,10 @@ let convertFundef loc env fd =
(** External function declaration *)
let re_builtin = Str.regexp "__builtin_"
-let re_runtime = Str.regexp "__compcert_i64_"
+let re_runtime64 = Str.regexp "__compcert_i64"
+let re_runtime32 = Str.regexp "__compcert_i32"
+let re_runtimef32 = Str.regexp "__compcert_f32"
+let re_runtimef64 = Str.regexp "__compcert_f64"
let convertFundecl env (sto, id, ty, optinit) =
let (args, res, cconv) =
@@ -1261,7 +1288,12 @@ let convertFundecl env (sto, id, ty, optinit) =
let ef =
if id.name = "malloc" then AST.EF_malloc else
if id.name = "free" then AST.EF_free else
- if Str.string_match re_runtime id.name 0 then AST.EF_runtime(id'', sg) else
+ if Str.string_match re_runtime64 id.name 0
+ || Str.string_match re_runtime32 id.name 0
+ || Str.string_match re_runtimef64 id.name 0
+ || Str.string_match re_runtimef32 id.name 0
+ then AST.EF_runtime(id'', sg)
+ else
if Str.string_match re_builtin id.name 0
&& List.mem_assoc id.name builtins.builtin_functions
then AST.EF_builtin(id'', sg)