diff options
author | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2020-04-09 16:28:05 +0200 |
---|---|---|
committer | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2020-04-09 16:28:05 +0200 |
commit | 47ecb1ec8d00636d6e7bb4cebd21df5d0b9b5ac7 (patch) | |
tree | b4cee1012000686f604c0fd7f00a562562e5c8ce /cfrontend/C2C.ml | |
parent | f2e6e7ff8aedb94b42da53ddc6bcd1c9ada38b80 (diff) | |
parent | d11616ef3d2561e9cdbc819a7b8b101875fdea09 (diff) | |
download | compcert-kvx-47ecb1ec8d00636d6e7bb4cebd21df5d0b9b5ac7.tar.gz compcert-kvx-47ecb1ec8d00636d6e7bb4cebd21df5d0b9b5ac7.zip |
Merge remote-tracking branch 'origin/mppa-expect3' into mppa-work
Diffstat (limited to 'cfrontend/C2C.ml')
-rw-r--r-- | cfrontend/C2C.ml | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/cfrontend/C2C.ml b/cfrontend/C2C.ml index f637b5e4..75f5eb3e 100644 --- a/cfrontend/C2C.ml +++ b/cfrontend/C2C.ml @@ -181,9 +181,10 @@ let ais_annot_functions = let builtins_generic = { builtin_typedefs = []; builtin_functions = - ais_annot_functions - @ + ais_annot_functions @ [ + "__builtin_expect", + (TInt(ILong, []), [TInt(ILong, []); TInt(ILong, [])], false); (* Integer arithmetic *) "__builtin_bswap64", (TInt(IULongLong, []), [TInt(IULongLong, [])], false); @@ -912,6 +913,14 @@ let rec convertExpr env e = | C.ECompound(ty1, ie) -> unsupported "compound literals"; ezero + | C.ECall({edesc = C.EVar {name = "__builtin_expect"}}, args) -> + (match args with + | [e1; e2] -> + ewrap (Ctyping.ebinop Cop.Oexpect (convertExpr env e1) (convertExpr env e2)) + | _ -> + error "__builtin_expect wants two arguments"; + ezero) + | C.ECall({edesc = C.EVar {name = "__builtin_debug"}}, args) when List.length args < 2 -> error "too few arguments to function call, expected at least 2, have 0"; ezero |