aboutsummaryrefslogtreecommitdiffstats
path: root/backend/RTLtypingaux.ml
diff options
context:
space:
mode:
authorxleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2010-06-29 08:27:14 +0000
committerxleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2010-06-29 08:27:14 +0000
commit9c7c84cc40eaacc1e2c13091165785cddecba5ad (patch)
tree65eafe51ad284d88fd5a949e1b2a54cd272f9f91 /backend/RTLtypingaux.ml
parentf4b416882955d9d91bca60f3eb35b95f4124a5be (diff)
downloadcompcert-9c7c84cc40eaacc1e2c13091165785cddecba5ad.tar.gz
compcert-9c7c84cc40eaacc1e2c13091165785cddecba5ad.zip
Support for inlined built-ins.
AST: add ef_inline flag to external functions. Selection: recognize calls to inlined built-ins and inline them as Sbuiltin. CminorSel to Asm: added Sbuiltin/Ibuiltin instruction. PrintAsm: adapted expansion of builtins. C2Clight: adapted detection of builtins. Conventions: refactored in a machine-independent part (backend/Conventions) and a machine-dependent part (ARCH/SYS/Conventions1). git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1356 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'backend/RTLtypingaux.ml')
-rw-r--r--backend/RTLtypingaux.ml11
1 files changed, 11 insertions, 0 deletions
diff --git a/backend/RTLtypingaux.ml b/backend/RTLtypingaux.ml
index 868fb8df..657c4daa 100644
--- a/backend/RTLtypingaux.ml
+++ b/backend/RTLtypingaux.ml
@@ -86,6 +86,17 @@ let type_instr retty (Coq_pair(pc, i)) =
raise(Type_error (Printf.sprintf "type mismatch in Itailcall(%s): %s"
name msg))
end
+ | Ibuiltin(ef, args, res, _) ->
+ begin try
+ let sg = ef_sig ef in
+ set_types args sg.sig_args;
+ set_type res (match sg.sig_res with None -> Tint | Some ty -> ty);
+ if not (Conventions.arity_ok sg.sig_args) then
+ raise(Type_error "wrong arity")
+ with Type_error msg ->
+ raise(Type_error (Printf.sprintf "type mismatch in Ibuiltin(%s): %s"
+ (extern_atom ef.ef_id) msg))
+ end
| Icond(cond, args, _, _) ->
set_types args (type_of_condition cond)
| Ijumptable(arg, _) ->