aboutsummaryrefslogtreecommitdiffstats
path: root/backend/LTLin.v
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/LTLin.v
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/LTLin.v')
-rw-r--r--backend/LTLin.v10
1 files changed, 8 insertions, 2 deletions
diff --git a/backend/LTLin.v b/backend/LTLin.v
index 806a7aa9..ee4cb943 100644
--- a/backend/LTLin.v
+++ b/backend/LTLin.v
@@ -47,6 +47,7 @@ Inductive instruction: Type :=
| Lstore: memory_chunk -> addressing -> list loc -> loc -> instruction
| Lcall: signature -> loc + ident -> list loc -> loc -> instruction
| Ltailcall: signature -> loc + ident -> list loc -> instruction
+ | Lbuiltin: external_function -> list loc -> loc -> instruction
| Llabel: label -> instruction
| Lgoto: label -> instruction
| Lcond: condition -> list loc -> label -> instruction
@@ -68,8 +69,8 @@ Definition program := AST.program fundef unit.
Definition funsig (fd: fundef) :=
match fd with
- | Internal f => f.(fn_sig)
- | External ef => ef.(ef_sig)
+ | Internal f => fn_sig f
+ | External ef => ef_sig ef
end.
Definition genv := Genv.t fundef unit.
@@ -186,6 +187,11 @@ Inductive step: state -> trace -> state -> Prop :=
Mem.free m stk 0 f.(fn_stacksize) = Some m' ->
step (State s f (Vptr stk Int.zero) (Ltailcall sig ros args :: b) rs m)
E0 (Callstate s f' (List.map rs args) m')
+ | exec_Lbuiltin:
+ forall s f sp rs m ef args res b t v m',
+ external_call ef ge (map rs args) m t v m' ->
+ step (State s f sp (Lbuiltin ef args res :: b) rs m)
+ t (State s f sp b (Locmap.set res v rs) m')
| exec_Llabel:
forall s f sp lbl b rs m,
step (State s f sp (Llabel lbl :: b) rs m)