source: extracted/compiler.ml @ 2909

Last change on this file since 2909 was 2909, checked in by sacerdot, 7 years ago

New extraction.

File size: 24.3 KB
Line 
1open Preamble
2
3open CostLabel
4
5open Coqlib
6
7open Proper
8
9open PositiveMap
10
11open Deqsets
12
13open ErrorMessages
14
15open PreIdentifiers
16
17open Errors
18
19open Extralib
20
21open Lists
22
23open Positive
24
25open Identifiers
26
27open Exp
28
29open Arithmetic
30
31open Vector
32
33open Div_and_mod
34
35open Util
36
37open FoldStuff
38
39open BitVector
40
41open Jmeq
42
43open Russell
44
45open List
46
47open Setoids
48
49open Monad
50
51open Option
52
53open Extranat
54
55open Bool
56
57open Relations
58
59open Nat
60
61open Integers
62
63open Hints_declaration
64
65open Core_notation
66
67open Pts
68
69open Logic
70
71open Types
72
73open AST
74
75open Csyntax
76
77open Label
78
79open Sets
80
81open Listb
82
83open Star
84
85open Frontend_misc
86
87open CexecInd
88
89open CexecSound
90
91open Casts
92
93open ClassifyOp
94
95open Smallstep
96
97open Extra_bool
98
99open FrontEndVal
100
101open Hide
102
103open ByteValues
104
105open GenMem
106
107open FrontEndMem
108
109open Globalenvs
110
111open Csem
112
113open SmallstepExec
114
115open Division
116
117open Z
118
119open BitVectorZ
120
121open Pointers
122
123open Values
124
125open Events
126
127open IOMonad
128
129open IO
130
131open Cexec
132
133open TypeComparison
134
135open SimplifyCasts
136
137open MemProperties
138
139open MemoryInjections
140
141open Fresh
142
143open SwitchRemoval
144
145open FrontEndOps
146
147open Cminor_syntax
148
149open ToCminor
150
151open Initialisation
152
153open BitVectorTrie
154
155open Graphs
156
157open Order
158
159open Registers
160
161open RTLabs_syntax
162
163open ToRTLabs
164
165open Deqsets_extra
166
167open CostMisc
168
169open Listb_extra
170
171open CostSpec
172
173open CostCheck
174
175open Executions
176
177open StructuredTraces
178
179open RTLabs_semantics
180
181open RTLabs_abstract
182
183open RTLabs_traces
184
185open CostInj
186
187open State
188
189open Bind_new
190
191open BindLists
192
193open Blocks
194
195open TranslateUtils
196
197open String
198
199open LabelledObjects
200
201open I8051
202
203open BackEndOps
204
205open Joint
206
207open RTL
208
209open RTLabsToRTL
210
211open ERTL
212
213open RegisterSet
214
215open RTLToERTL
216
217open ERTLptr
218
219open ERTLToERTLptr
220
221open Fixpoints
222
223open Set_adt
224
225open Liveness
226
227open Interference
228
229open Joint_LTL_LIN
230
231open LTL
232
233open ERTLptrToLTL
234
235open LIN
236
237open Linearise
238
239open LTLToLIN
240
241open ASM
242
243open BitVectorTrieSet
244
245open LINToASM
246
247type pass =
248| Clight_pass
249| Clight_switch_removed_pass
250| Clight_label_pass
251| Clight_simplified_pass
252| Cminor_pass
253| Rtlabs_pass
254| Rtl_separate_pass
255| Rtl_uniq_pass
256| Ertl_pass
257| Ertlptr_pass
258| Ltl_pass
259| Lin_pass
260| Assembly_pass
261| Object_code_pass
262
263(** val pass_rect_Type4 :
264    'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1
265    -> 'a1 -> 'a1 -> 'a1 -> pass -> 'a1 **)
266let rec pass_rect_Type4 h_clight_pass h_clight_switch_removed_pass h_clight_label_pass h_clight_simplified_pass h_cminor_pass h_rtlabs_pass h_rtl_separate_pass h_rtl_uniq_pass h_ertl_pass h_ertlptr_pass h_ltl_pass h_lin_pass h_assembly_pass h_object_code_pass = function
267| Clight_pass -> h_clight_pass
268| Clight_switch_removed_pass -> h_clight_switch_removed_pass
269| Clight_label_pass -> h_clight_label_pass
270| Clight_simplified_pass -> h_clight_simplified_pass
271| Cminor_pass -> h_cminor_pass
272| Rtlabs_pass -> h_rtlabs_pass
273| Rtl_separate_pass -> h_rtl_separate_pass
274| Rtl_uniq_pass -> h_rtl_uniq_pass
275| Ertl_pass -> h_ertl_pass
276| Ertlptr_pass -> h_ertlptr_pass
277| Ltl_pass -> h_ltl_pass
278| Lin_pass -> h_lin_pass
279| Assembly_pass -> h_assembly_pass
280| Object_code_pass -> h_object_code_pass
281
282(** val pass_rect_Type5 :
283    'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1
284    -> 'a1 -> 'a1 -> 'a1 -> pass -> 'a1 **)
285let rec pass_rect_Type5 h_clight_pass h_clight_switch_removed_pass h_clight_label_pass h_clight_simplified_pass h_cminor_pass h_rtlabs_pass h_rtl_separate_pass h_rtl_uniq_pass h_ertl_pass h_ertlptr_pass h_ltl_pass h_lin_pass h_assembly_pass h_object_code_pass = function
286| Clight_pass -> h_clight_pass
287| Clight_switch_removed_pass -> h_clight_switch_removed_pass
288| Clight_label_pass -> h_clight_label_pass
289| Clight_simplified_pass -> h_clight_simplified_pass
290| Cminor_pass -> h_cminor_pass
291| Rtlabs_pass -> h_rtlabs_pass
292| Rtl_separate_pass -> h_rtl_separate_pass
293| Rtl_uniq_pass -> h_rtl_uniq_pass
294| Ertl_pass -> h_ertl_pass
295| Ertlptr_pass -> h_ertlptr_pass
296| Ltl_pass -> h_ltl_pass
297| Lin_pass -> h_lin_pass
298| Assembly_pass -> h_assembly_pass
299| Object_code_pass -> h_object_code_pass
300
301(** val pass_rect_Type3 :
302    'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1
303    -> 'a1 -> 'a1 -> 'a1 -> pass -> 'a1 **)
304let rec pass_rect_Type3 h_clight_pass h_clight_switch_removed_pass h_clight_label_pass h_clight_simplified_pass h_cminor_pass h_rtlabs_pass h_rtl_separate_pass h_rtl_uniq_pass h_ertl_pass h_ertlptr_pass h_ltl_pass h_lin_pass h_assembly_pass h_object_code_pass = function
305| Clight_pass -> h_clight_pass
306| Clight_switch_removed_pass -> h_clight_switch_removed_pass
307| Clight_label_pass -> h_clight_label_pass
308| Clight_simplified_pass -> h_clight_simplified_pass
309| Cminor_pass -> h_cminor_pass
310| Rtlabs_pass -> h_rtlabs_pass
311| Rtl_separate_pass -> h_rtl_separate_pass
312| Rtl_uniq_pass -> h_rtl_uniq_pass
313| Ertl_pass -> h_ertl_pass
314| Ertlptr_pass -> h_ertlptr_pass
315| Ltl_pass -> h_ltl_pass
316| Lin_pass -> h_lin_pass
317| Assembly_pass -> h_assembly_pass
318| Object_code_pass -> h_object_code_pass
319
320(** val pass_rect_Type2 :
321    'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1
322    -> 'a1 -> 'a1 -> 'a1 -> pass -> 'a1 **)
323let rec pass_rect_Type2 h_clight_pass h_clight_switch_removed_pass h_clight_label_pass h_clight_simplified_pass h_cminor_pass h_rtlabs_pass h_rtl_separate_pass h_rtl_uniq_pass h_ertl_pass h_ertlptr_pass h_ltl_pass h_lin_pass h_assembly_pass h_object_code_pass = function
324| Clight_pass -> h_clight_pass
325| Clight_switch_removed_pass -> h_clight_switch_removed_pass
326| Clight_label_pass -> h_clight_label_pass
327| Clight_simplified_pass -> h_clight_simplified_pass
328| Cminor_pass -> h_cminor_pass
329| Rtlabs_pass -> h_rtlabs_pass
330| Rtl_separate_pass -> h_rtl_separate_pass
331| Rtl_uniq_pass -> h_rtl_uniq_pass
332| Ertl_pass -> h_ertl_pass
333| Ertlptr_pass -> h_ertlptr_pass
334| Ltl_pass -> h_ltl_pass
335| Lin_pass -> h_lin_pass
336| Assembly_pass -> h_assembly_pass
337| Object_code_pass -> h_object_code_pass
338
339(** val pass_rect_Type1 :
340    'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1
341    -> 'a1 -> 'a1 -> 'a1 -> pass -> 'a1 **)
342let rec pass_rect_Type1 h_clight_pass h_clight_switch_removed_pass h_clight_label_pass h_clight_simplified_pass h_cminor_pass h_rtlabs_pass h_rtl_separate_pass h_rtl_uniq_pass h_ertl_pass h_ertlptr_pass h_ltl_pass h_lin_pass h_assembly_pass h_object_code_pass = function
343| Clight_pass -> h_clight_pass
344| Clight_switch_removed_pass -> h_clight_switch_removed_pass
345| Clight_label_pass -> h_clight_label_pass
346| Clight_simplified_pass -> h_clight_simplified_pass
347| Cminor_pass -> h_cminor_pass
348| Rtlabs_pass -> h_rtlabs_pass
349| Rtl_separate_pass -> h_rtl_separate_pass
350| Rtl_uniq_pass -> h_rtl_uniq_pass
351| Ertl_pass -> h_ertl_pass
352| Ertlptr_pass -> h_ertlptr_pass
353| Ltl_pass -> h_ltl_pass
354| Lin_pass -> h_lin_pass
355| Assembly_pass -> h_assembly_pass
356| Object_code_pass -> h_object_code_pass
357
358(** val pass_rect_Type0 :
359    'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1
360    -> 'a1 -> 'a1 -> 'a1 -> pass -> 'a1 **)
361let rec pass_rect_Type0 h_clight_pass h_clight_switch_removed_pass h_clight_label_pass h_clight_simplified_pass h_cminor_pass h_rtlabs_pass h_rtl_separate_pass h_rtl_uniq_pass h_ertl_pass h_ertlptr_pass h_ltl_pass h_lin_pass h_assembly_pass h_object_code_pass = function
362| Clight_pass -> h_clight_pass
363| Clight_switch_removed_pass -> h_clight_switch_removed_pass
364| Clight_label_pass -> h_clight_label_pass
365| Clight_simplified_pass -> h_clight_simplified_pass
366| Cminor_pass -> h_cminor_pass
367| Rtlabs_pass -> h_rtlabs_pass
368| Rtl_separate_pass -> h_rtl_separate_pass
369| Rtl_uniq_pass -> h_rtl_uniq_pass
370| Ertl_pass -> h_ertl_pass
371| Ertlptr_pass -> h_ertlptr_pass
372| Ltl_pass -> h_ltl_pass
373| Lin_pass -> h_lin_pass
374| Assembly_pass -> h_assembly_pass
375| Object_code_pass -> h_object_code_pass
376
377(** val pass_inv_rect_Type4 :
378    pass -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__
379    -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) ->
380    (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1)
381    -> 'a1 **)
382let pass_inv_rect_Type4 hterm h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 =
383  let hcut =
384    pass_rect_Type4 h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 hterm
385  in
386  hcut __
387
388(** val pass_inv_rect_Type3 :
389    pass -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__
390    -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) ->
391    (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1)
392    -> 'a1 **)
393let pass_inv_rect_Type3 hterm h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 =
394  let hcut =
395    pass_rect_Type3 h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 hterm
396  in
397  hcut __
398
399(** val pass_inv_rect_Type2 :
400    pass -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__
401    -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) ->
402    (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1)
403    -> 'a1 **)
404let pass_inv_rect_Type2 hterm h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 =
405  let hcut =
406    pass_rect_Type2 h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 hterm
407  in
408  hcut __
409
410(** val pass_inv_rect_Type1 :
411    pass -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__
412    -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) ->
413    (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1)
414    -> 'a1 **)
415let pass_inv_rect_Type1 hterm h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 =
416  let hcut =
417    pass_rect_Type1 h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 hterm
418  in
419  hcut __
420
421(** val pass_inv_rect_Type0 :
422    pass -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__
423    -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) ->
424    (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1)
425    -> 'a1 **)
426let pass_inv_rect_Type0 hterm h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 =
427  let hcut =
428    pass_rect_Type0 h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 hterm
429  in
430  hcut __
431
432(** val pass_discr : pass -> pass -> __ **)
433let pass_discr x y =
434  Logic.eq_rect_Type2 x
435    (match x with
436     | Clight_pass -> Obj.magic (fun _ dH -> dH)
437     | Clight_switch_removed_pass -> Obj.magic (fun _ dH -> dH)
438     | Clight_label_pass -> Obj.magic (fun _ dH -> dH)
439     | Clight_simplified_pass -> Obj.magic (fun _ dH -> dH)
440     | Cminor_pass -> Obj.magic (fun _ dH -> dH)
441     | Rtlabs_pass -> Obj.magic (fun _ dH -> dH)
442     | Rtl_separate_pass -> Obj.magic (fun _ dH -> dH)
443     | Rtl_uniq_pass -> Obj.magic (fun _ dH -> dH)
444     | Ertl_pass -> Obj.magic (fun _ dH -> dH)
445     | Ertlptr_pass -> Obj.magic (fun _ dH -> dH)
446     | Ltl_pass -> Obj.magic (fun _ dH -> dH)
447     | Lin_pass -> Obj.magic (fun _ dH -> dH)
448     | Assembly_pass -> Obj.magic (fun _ dH -> dH)
449     | Object_code_pass -> Obj.magic (fun _ dH -> dH)) y
450
451(** val pass_jmdiscr : pass -> pass -> __ **)
452let pass_jmdiscr x y =
453  Logic.eq_rect_Type2 x
454    (match x with
455     | Clight_pass -> Obj.magic (fun _ dH -> dH)
456     | Clight_switch_removed_pass -> Obj.magic (fun _ dH -> dH)
457     | Clight_label_pass -> Obj.magic (fun _ dH -> dH)
458     | Clight_simplified_pass -> Obj.magic (fun _ dH -> dH)
459     | Cminor_pass -> Obj.magic (fun _ dH -> dH)
460     | Rtlabs_pass -> Obj.magic (fun _ dH -> dH)
461     | Rtl_separate_pass -> Obj.magic (fun _ dH -> dH)
462     | Rtl_uniq_pass -> Obj.magic (fun _ dH -> dH)
463     | Ertl_pass -> Obj.magic (fun _ dH -> dH)
464     | Ertlptr_pass -> Obj.magic (fun _ dH -> dH)
465     | Ltl_pass -> Obj.magic (fun _ dH -> dH)
466     | Lin_pass -> Obj.magic (fun _ dH -> dH)
467     | Assembly_pass -> Obj.magic (fun _ dH -> dH)
468     | Object_code_pass -> Obj.magic (fun _ dH -> dH)) y
469
470type 'x with_stack_model = ('x, AST.ident -> Nat.nat Types.option) Types.prod
471
472type syntax_of_pass = __
473
474type observe_pass = pass -> syntax_of_pass -> Types.unit0
475
476(** val front_end :
477    observe_pass -> Csyntax.clight_program -> ((CostLabel.costlabel,
478    Csyntax.clight_program) Types.prod, RTLabs_syntax.rTLabs_program)
479    Types.prod Errors.res **)
480let front_end observe p =
481  let i = Obj.magic observe Clight_pass p in
482  let p0 = SwitchRemoval.program_switch_removal p in
483  let i0 = Obj.magic observe Clight_switch_removed_pass p0 in
484  let { Types.fst = p'; Types.snd = init_cost } = Label.clight_label p0 in
485  let i1 = Obj.magic observe Clight_label_pass p' in
486  let p1 = SimplifyCasts.simplify_program p' in
487  let i2 = Obj.magic observe Clight_simplified_pass p1 in
488  Obj.magic
489    (Monad.m_bind0 (Monad.max_def Errors.res0)
490      (Obj.magic (ToCminor.clight_to_cminor p1)) (fun p2 ->
491      let i3 = observe Cminor_pass p2 in
492      let p3 = ToRTLabs.cminor_to_rtlabs init_cost (Obj.magic p2) in
493      let i4 = Obj.magic observe Rtlabs_pass p3 in
494      (match CostCheck.check_cost_program p3 with
495       | Bool.True ->
496         (match CostInj.check_program_cost_injectivity p3 with
497          | Bool.True ->
498            Monad.m_return0 (Monad.max_def Errors.res0) { Types.fst =
499              { Types.fst = init_cost; Types.snd = p' }; Types.snd = p3 }
500          | Bool.False ->
501            Obj.magic (Errors.Error
502              (Errors.msg ErrorMessages.RepeatedCostLabel0)))
503       | Bool.False ->
504         Obj.magic (Errors.Error (Errors.msg ErrorMessages.BadCostLabelling)))))
505
506open Uses
507
508(** val compute_fixpoint : Fixpoints.fixpoint_computer **)
509let compute_fixpoint = Compute_fixpoints.compute_fixpoint
510
511(** val colour_graph : Interference.coloured_graph_computer **)
512let colour_graph = Compute_colouring.colour_graph
513
514open AssocList
515
516(** val lookup_stack_cost :
517    Joint.params -> Joint.joint_program -> PreIdentifiers.identifier ->
518    Nat.nat Types.option **)
519let lookup_stack_cost p p0 id =
520  AssocList.assoc_list_lookup id
521    (Identifiers.eq_identifier PreIdentifiers.SymbolTag)
522    (Joint.stack_cost p p0)
523
524(** val back_end :
525    observe_pass -> RTLabs_syntax.rTLabs_program ->
526    ((ASM.pseudo_assembly_program, Joint.stack_cost_model) Types.prod,
527    Nat.nat) Types.prod Errors.res **)
528let back_end observe p =
529  let p0 = RTLabsToRTL.rtlabs_to_rtl p in
530  let st = lookup_stack_cost (Joint.graph_params_to_params RTL.rTL) p0 in
531  let i =
532    Obj.magic observe Rtl_separate_pass { Types.fst = p0; Types.snd = st }
533  in
534  let i0 = Obj.magic observe Rtl_uniq_pass { Types.fst = p0; Types.snd = st }
535  in
536  let p1 = RTLToERTL.rtl_to_ertl p0 in
537  let st0 = lookup_stack_cost (Joint.graph_params_to_params ERTL.eRTL) p1 in
538  let i1 = Obj.magic observe Ertl_pass { Types.fst = p1; Types.snd = st0 } in
539  let p2 = ERTLToERTLptr.ertl_to_ertlptr p1 in
540  let st1 =
541    lookup_stack_cost (Joint.graph_params_to_params ERTLptr.eRTLptr) p2
542  in
543  let i2 = Obj.magic observe Ertlptr_pass { Types.fst = p2; Types.snd = st1 }
544  in
545  let { Types.fst = eta29116; Types.snd = max_stack } =
546    ERTLptrToLTL.ertlptr_to_ltl compute_fixpoint colour_graph p2
547  in
548  let { Types.fst = p3; Types.snd = stack_cost } = eta29116 in
549  let st2 = lookup_stack_cost (Joint.graph_params_to_params LTL.lTL) p3 in
550  let i3 = Obj.magic observe Ltl_pass { Types.fst = p3; Types.snd = st2 } in
551  let st3 = lookup_stack_cost (Joint.graph_params_to_params LTL.lTL) p3 in
552  let p4 = LTLToLIN.ltl_to_lin p3 in
553  let st4 = lookup_stack_cost (Joint.lin_params_to_params LIN.lIN) p4 in
554  let i4 = Obj.magic observe Lin_pass { Types.fst = p4; Types.snd = st4 } in
555  Obj.magic
556    (Monad.m_bind0 (Monad.max_def Errors.res0)
557      (Obj.magic
558        (Errors.opt_to_res (Errors.msg ErrorMessages.AssemblyTooLarge)
559          (LINToASM.lin_to_asm p4))) (fun p5 ->
560      Monad.m_return0 (Monad.max_def Errors.res0) { Types.fst = { Types.fst =
561        p5; Types.snd = stack_cost }; Types.snd = max_stack }))
562
563open Assembly
564
565open Status
566
567open Fetch
568
569open PolicyFront
570
571open PolicyStep
572
573open Policy
574
575(** val assembler :
576    observe_pass -> ASM.pseudo_assembly_program -> ASM.labelled_object_code
577    Errors.res **)
578let assembler observe p =
579  Obj.magic
580    (Monad.m_bind0 (Monad.max_def Errors.res0)
581      (Obj.magic
582        (Errors.opt_to_res (Errors.msg ErrorMessages.Jump_expansion_failed)
583          (Policy.jump_expansion' p))) (fun sigma_pol ->
584      let sigma = fun ppc -> (Types.pi1 sigma_pol).Types.fst ppc in
585      let pol = fun ppc -> (Types.pi1 sigma_pol).Types.snd ppc in
586      let i =
587        Obj.magic observe Assembly_pass { Types.fst = { Types.fst = p;
588          Types.snd = sigma }; Types.snd = pol }
589      in
590      let p0 = Assembly.assembly p sigma pol in
591      let i0 = Obj.magic observe Object_code_pass (Types.pi1 p0) in
592      Obj.magic (Errors.OK (Types.pi1 p0))))
593
594open AbstractStatus
595
596open StatusProofs
597
598open Interpret
599
600open ASMCosts
601
602(** val lift_cost_map_back_to_front :
603    Csyntax.clight_program -> ASM.labelled_object_code ->
604    StructuredTraces.as_cost_map -> Label.clight_cost_map **)
605let lift_cost_map_back_to_front clight oc k asm_cost_map =
606  StructuredTraces.lift_sigma_map_id Nat.O
607    (BitVectorTrie.strong_decidable_in_codomain
608      (Identifiers.deq_identifier PreIdentifiers.CostTag) (Nat.S (Nat.S
609      (Nat.S (Nat.S (Nat.S (Nat.S (Nat.S (Nat.S (Nat.S (Nat.S (Nat.S (Nat.S
610      (Nat.S (Nat.S (Nat.S (Nat.S Nat.O))))))))))))))))
611      (Obj.magic oc.ASM.costlabels)) (Obj.magic k) (Obj.magic asm_cost_map)
612
613open UtilBranch
614
615open ASMCostsSplit
616
617type compiler_output = { c_labelled_object_code : ASM.labelled_object_code;
618                         c_stack_cost : Joint.stack_cost_model;
619                         c_max_stack : Nat.nat;
620                         c_labelled_clight : Csyntax.clight_program;
621                         c_clight_cost_map : Label.clight_cost_map }
622
623(** val compiler_output_rect_Type4 :
624    (ASM.labelled_object_code -> Joint.stack_cost_model -> Nat.nat ->
625    Csyntax.clight_program -> Label.clight_cost_map -> 'a1) ->
626    compiler_output -> 'a1 **)
627let rec compiler_output_rect_Type4 h_mk_compiler_output x_25390 =
628  let { c_labelled_object_code = c_labelled_object_code0; c_stack_cost =
629    c_stack_cost0; c_max_stack = c_max_stack0; c_labelled_clight =
630    c_labelled_clight0; c_clight_cost_map = c_clight_cost_map0 } = x_25390
631  in
632  h_mk_compiler_output c_labelled_object_code0 c_stack_cost0 c_max_stack0
633    c_labelled_clight0 c_clight_cost_map0
634
635(** val compiler_output_rect_Type5 :
636    (ASM.labelled_object_code -> Joint.stack_cost_model -> Nat.nat ->
637    Csyntax.clight_program -> Label.clight_cost_map -> 'a1) ->
638    compiler_output -> 'a1 **)
639let rec compiler_output_rect_Type5 h_mk_compiler_output x_25392 =
640  let { c_labelled_object_code = c_labelled_object_code0; c_stack_cost =
641    c_stack_cost0; c_max_stack = c_max_stack0; c_labelled_clight =
642    c_labelled_clight0; c_clight_cost_map = c_clight_cost_map0 } = x_25392
643  in
644  h_mk_compiler_output c_labelled_object_code0 c_stack_cost0 c_max_stack0
645    c_labelled_clight0 c_clight_cost_map0
646
647(** val compiler_output_rect_Type3 :
648    (ASM.labelled_object_code -> Joint.stack_cost_model -> Nat.nat ->
649    Csyntax.clight_program -> Label.clight_cost_map -> 'a1) ->
650    compiler_output -> 'a1 **)
651let rec compiler_output_rect_Type3 h_mk_compiler_output x_25394 =
652  let { c_labelled_object_code = c_labelled_object_code0; c_stack_cost =
653    c_stack_cost0; c_max_stack = c_max_stack0; c_labelled_clight =
654    c_labelled_clight0; c_clight_cost_map = c_clight_cost_map0 } = x_25394
655  in
656  h_mk_compiler_output c_labelled_object_code0 c_stack_cost0 c_max_stack0
657    c_labelled_clight0 c_clight_cost_map0
658
659(** val compiler_output_rect_Type2 :
660    (ASM.labelled_object_code -> Joint.stack_cost_model -> Nat.nat ->
661    Csyntax.clight_program -> Label.clight_cost_map -> 'a1) ->
662    compiler_output -> 'a1 **)
663let rec compiler_output_rect_Type2 h_mk_compiler_output x_25396 =
664  let { c_labelled_object_code = c_labelled_object_code0; c_stack_cost =
665    c_stack_cost0; c_max_stack = c_max_stack0; c_labelled_clight =
666    c_labelled_clight0; c_clight_cost_map = c_clight_cost_map0 } = x_25396
667  in
668  h_mk_compiler_output c_labelled_object_code0 c_stack_cost0 c_max_stack0
669    c_labelled_clight0 c_clight_cost_map0
670
671(** val compiler_output_rect_Type1 :
672    (ASM.labelled_object_code -> Joint.stack_cost_model -> Nat.nat ->
673    Csyntax.clight_program -> Label.clight_cost_map -> 'a1) ->
674    compiler_output -> 'a1 **)
675let rec compiler_output_rect_Type1 h_mk_compiler_output x_25398 =
676  let { c_labelled_object_code = c_labelled_object_code0; c_stack_cost =
677    c_stack_cost0; c_max_stack = c_max_stack0; c_labelled_clight =
678    c_labelled_clight0; c_clight_cost_map = c_clight_cost_map0 } = x_25398
679  in
680  h_mk_compiler_output c_labelled_object_code0 c_stack_cost0 c_max_stack0
681    c_labelled_clight0 c_clight_cost_map0
682
683(** val compiler_output_rect_Type0 :
684    (ASM.labelled_object_code -> Joint.stack_cost_model -> Nat.nat ->
685    Csyntax.clight_program -> Label.clight_cost_map -> 'a1) ->
686    compiler_output -> 'a1 **)
687let rec compiler_output_rect_Type0 h_mk_compiler_output x_25400 =
688  let { c_labelled_object_code = c_labelled_object_code0; c_stack_cost =
689    c_stack_cost0; c_max_stack = c_max_stack0; c_labelled_clight =
690    c_labelled_clight0; c_clight_cost_map = c_clight_cost_map0 } = x_25400
691  in
692  h_mk_compiler_output c_labelled_object_code0 c_stack_cost0 c_max_stack0
693    c_labelled_clight0 c_clight_cost_map0
694
695(** val c_labelled_object_code :
696    compiler_output -> ASM.labelled_object_code **)
697let rec c_labelled_object_code xxx =
698  xxx.c_labelled_object_code
699
700(** val c_stack_cost : compiler_output -> Joint.stack_cost_model **)
701let rec c_stack_cost xxx =
702  xxx.c_stack_cost
703
704(** val c_max_stack : compiler_output -> Nat.nat **)
705let rec c_max_stack xxx =
706  xxx.c_max_stack
707
708(** val c_labelled_clight : compiler_output -> Csyntax.clight_program **)
709let rec c_labelled_clight xxx =
710  xxx.c_labelled_clight
711
712(** val c_clight_cost_map : compiler_output -> Label.clight_cost_map **)
713let rec c_clight_cost_map xxx =
714  xxx.c_clight_cost_map
715
716(** val compiler_output_inv_rect_Type4 :
717    compiler_output -> (ASM.labelled_object_code -> Joint.stack_cost_model ->
718    Nat.nat -> Csyntax.clight_program -> Label.clight_cost_map -> __ -> 'a1)
719    -> 'a1 **)
720let compiler_output_inv_rect_Type4 hterm h1 =
721  let hcut = compiler_output_rect_Type4 h1 hterm in hcut __
722
723(** val compiler_output_inv_rect_Type3 :
724    compiler_output -> (ASM.labelled_object_code -> Joint.stack_cost_model ->
725    Nat.nat -> Csyntax.clight_program -> Label.clight_cost_map -> __ -> 'a1)
726    -> 'a1 **)
727let compiler_output_inv_rect_Type3 hterm h1 =
728  let hcut = compiler_output_rect_Type3 h1 hterm in hcut __
729
730(** val compiler_output_inv_rect_Type2 :
731    compiler_output -> (ASM.labelled_object_code -> Joint.stack_cost_model ->
732    Nat.nat -> Csyntax.clight_program -> Label.clight_cost_map -> __ -> 'a1)
733    -> 'a1 **)
734let compiler_output_inv_rect_Type2 hterm h1 =
735  let hcut = compiler_output_rect_Type2 h1 hterm in hcut __
736
737(** val compiler_output_inv_rect_Type1 :
738    compiler_output -> (ASM.labelled_object_code -> Joint.stack_cost_model ->
739    Nat.nat -> Csyntax.clight_program -> Label.clight_cost_map -> __ -> 'a1)
740    -> 'a1 **)
741let compiler_output_inv_rect_Type1 hterm h1 =
742  let hcut = compiler_output_rect_Type1 h1 hterm in hcut __
743
744(** val compiler_output_inv_rect_Type0 :
745    compiler_output -> (ASM.labelled_object_code -> Joint.stack_cost_model ->
746    Nat.nat -> Csyntax.clight_program -> Label.clight_cost_map -> __ -> 'a1)
747    -> 'a1 **)
748let compiler_output_inv_rect_Type0 hterm h1 =
749  let hcut = compiler_output_rect_Type0 h1 hterm in hcut __
750
751(** val compiler_output_discr : compiler_output -> compiler_output -> __ **)
752let compiler_output_discr x y =
753  Logic.eq_rect_Type2 x
754    (let { c_labelled_object_code = a0; c_stack_cost = a1; c_max_stack = a2;
755       c_labelled_clight = a3; c_clight_cost_map = a4 } = x
756     in
757    Obj.magic (fun _ dH -> dH __ __ __ __ __)) y
758
759(** val compiler_output_jmdiscr :
760    compiler_output -> compiler_output -> __ **)
761let compiler_output_jmdiscr x y =
762  Logic.eq_rect_Type2 x
763    (let { c_labelled_object_code = a0; c_stack_cost = a1; c_max_stack = a2;
764       c_labelled_clight = a3; c_clight_cost_map = a4 } = x
765     in
766    Obj.magic (fun _ dH -> dH __ __ __ __ __)) y
767
768(** val compile :
769    observe_pass -> Csyntax.clight_program -> compiler_output Errors.res **)
770let compile observe p =
771  Obj.magic
772    (Monad.m_bind3 (Monad.max_def Errors.res0)
773      (Obj.magic (front_end observe p)) (fun init_cost p' p0 ->
774      Monad.m_bind3 (Monad.max_def Errors.res0)
775        (Obj.magic (back_end observe p0)) (fun p1 stack_cost max_stack ->
776        Monad.m_bind0 (Monad.max_def Errors.res0)
777          (Obj.magic (assembler observe p1)) (fun p2 ->
778          let k = ASMCostsSplit.aSM_cost_map p2 in
779          let k' = lift_cost_map_back_to_front p' p2 k in
780          Monad.m_return0 (Monad.max_def Errors.res0)
781            { c_labelled_object_code = p2; c_stack_cost = stack_cost;
782            c_max_stack = max_stack; c_labelled_clight = p';
783            c_clight_cost_map = k' }))))
784
Note: See TracBrowser for help on using the repository browser.