source: extracted/compiler.ml @ 3019

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

New extraction after ERTLptr abortion.

File size: 23.4 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 BitVectorTrie
152
153open Graphs
154
155open Order
156
157open Registers
158
159open RTLabs_syntax
160
161open ToRTLabs
162
163open Deqsets_extra
164
165open CostMisc
166
167open Listb_extra
168
169open CostSpec
170
171open CostCheck
172
173open CostInj
174
175open State
176
177open Bind_new
178
179open BindLists
180
181open Blocks
182
183open TranslateUtils
184
185open String
186
187open LabelledObjects
188
189open I8051
190
191open BackEndOps
192
193open Joint
194
195open RTL
196
197open RTLabsToRTL
198
199open ERTL
200
201open RegisterSet
202
203open RTLToERTL
204
205open Fixpoints
206
207open Set_adt
208
209open Liveness
210
211open Interference
212
213open Joint_LTL_LIN
214
215open LTL
216
217open ERTLToLTL
218
219open LIN
220
221open Linearise
222
223open LTLToLIN
224
225open ASM
226
227open BitVectorTrieSet
228
229open LINToASM
230
231type pass =
232| Clight_pass
233| Clight_switch_removed_pass
234| Clight_label_pass
235| Clight_simplified_pass
236| Cminor_pass
237| Rtlabs_pass
238| Rtl_separate_pass
239| Rtl_uniq_pass
240| Ertl_pass
241| Ltl_pass
242| Lin_pass
243| Assembly_pass
244| Object_code_pass
245
246(** val pass_rect_Type4 :
247    'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1
248    -> 'a1 -> 'a1 -> pass -> 'a1 **)
249let 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_ltl_pass h_lin_pass h_assembly_pass h_object_code_pass = function
250| Clight_pass -> h_clight_pass
251| Clight_switch_removed_pass -> h_clight_switch_removed_pass
252| Clight_label_pass -> h_clight_label_pass
253| Clight_simplified_pass -> h_clight_simplified_pass
254| Cminor_pass -> h_cminor_pass
255| Rtlabs_pass -> h_rtlabs_pass
256| Rtl_separate_pass -> h_rtl_separate_pass
257| Rtl_uniq_pass -> h_rtl_uniq_pass
258| Ertl_pass -> h_ertl_pass
259| Ltl_pass -> h_ltl_pass
260| Lin_pass -> h_lin_pass
261| Assembly_pass -> h_assembly_pass
262| Object_code_pass -> h_object_code_pass
263
264(** val pass_rect_Type5 :
265    'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1
266    -> 'a1 -> 'a1 -> pass -> 'a1 **)
267let 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_ltl_pass h_lin_pass h_assembly_pass h_object_code_pass = function
268| Clight_pass -> h_clight_pass
269| Clight_switch_removed_pass -> h_clight_switch_removed_pass
270| Clight_label_pass -> h_clight_label_pass
271| Clight_simplified_pass -> h_clight_simplified_pass
272| Cminor_pass -> h_cminor_pass
273| Rtlabs_pass -> h_rtlabs_pass
274| Rtl_separate_pass -> h_rtl_separate_pass
275| Rtl_uniq_pass -> h_rtl_uniq_pass
276| Ertl_pass -> h_ertl_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_Type3 :
283    'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1
284    -> 'a1 -> 'a1 -> pass -> 'a1 **)
285let 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_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| Ltl_pass -> h_ltl_pass
296| Lin_pass -> h_lin_pass
297| Assembly_pass -> h_assembly_pass
298| Object_code_pass -> h_object_code_pass
299
300(** val pass_rect_Type2 :
301    'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1
302    -> 'a1 -> 'a1 -> pass -> 'a1 **)
303let 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_ltl_pass h_lin_pass h_assembly_pass h_object_code_pass = function
304| Clight_pass -> h_clight_pass
305| Clight_switch_removed_pass -> h_clight_switch_removed_pass
306| Clight_label_pass -> h_clight_label_pass
307| Clight_simplified_pass -> h_clight_simplified_pass
308| Cminor_pass -> h_cminor_pass
309| Rtlabs_pass -> h_rtlabs_pass
310| Rtl_separate_pass -> h_rtl_separate_pass
311| Rtl_uniq_pass -> h_rtl_uniq_pass
312| Ertl_pass -> h_ertl_pass
313| Ltl_pass -> h_ltl_pass
314| Lin_pass -> h_lin_pass
315| Assembly_pass -> h_assembly_pass
316| Object_code_pass -> h_object_code_pass
317
318(** val pass_rect_Type1 :
319    'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1
320    -> 'a1 -> 'a1 -> pass -> 'a1 **)
321let 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_ltl_pass h_lin_pass h_assembly_pass h_object_code_pass = function
322| Clight_pass -> h_clight_pass
323| Clight_switch_removed_pass -> h_clight_switch_removed_pass
324| Clight_label_pass -> h_clight_label_pass
325| Clight_simplified_pass -> h_clight_simplified_pass
326| Cminor_pass -> h_cminor_pass
327| Rtlabs_pass -> h_rtlabs_pass
328| Rtl_separate_pass -> h_rtl_separate_pass
329| Rtl_uniq_pass -> h_rtl_uniq_pass
330| Ertl_pass -> h_ertl_pass
331| Ltl_pass -> h_ltl_pass
332| Lin_pass -> h_lin_pass
333| Assembly_pass -> h_assembly_pass
334| Object_code_pass -> h_object_code_pass
335
336(** val pass_rect_Type0 :
337    'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1 -> 'a1
338    -> 'a1 -> 'a1 -> pass -> 'a1 **)
339let 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_ltl_pass h_lin_pass h_assembly_pass h_object_code_pass = function
340| Clight_pass -> h_clight_pass
341| Clight_switch_removed_pass -> h_clight_switch_removed_pass
342| Clight_label_pass -> h_clight_label_pass
343| Clight_simplified_pass -> h_clight_simplified_pass
344| Cminor_pass -> h_cminor_pass
345| Rtlabs_pass -> h_rtlabs_pass
346| Rtl_separate_pass -> h_rtl_separate_pass
347| Rtl_uniq_pass -> h_rtl_uniq_pass
348| Ertl_pass -> h_ertl_pass
349| Ltl_pass -> h_ltl_pass
350| Lin_pass -> h_lin_pass
351| Assembly_pass -> h_assembly_pass
352| Object_code_pass -> h_object_code_pass
353
354(** val pass_inv_rect_Type4 :
355    pass -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__
356    -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) ->
357    (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> 'a1 **)
358let pass_inv_rect_Type4 hterm h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 =
359  let hcut = pass_rect_Type4 h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 hterm
360  in
361  hcut __
362
363(** val pass_inv_rect_Type3 :
364    pass -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__
365    -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) ->
366    (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> 'a1 **)
367let pass_inv_rect_Type3 hterm h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 =
368  let hcut = pass_rect_Type3 h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 hterm
369  in
370  hcut __
371
372(** val pass_inv_rect_Type2 :
373    pass -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__
374    -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) ->
375    (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> 'a1 **)
376let pass_inv_rect_Type2 hterm h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 =
377  let hcut = pass_rect_Type2 h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 hterm
378  in
379  hcut __
380
381(** val pass_inv_rect_Type1 :
382    pass -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__
383    -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) ->
384    (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> 'a1 **)
385let pass_inv_rect_Type1 hterm h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 =
386  let hcut = pass_rect_Type1 h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 hterm
387  in
388  hcut __
389
390(** val pass_inv_rect_Type0 :
391    pass -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__
392    -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) ->
393    (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> (__ -> 'a1) -> 'a1 **)
394let pass_inv_rect_Type0 hterm h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 =
395  let hcut = pass_rect_Type0 h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 hterm
396  in
397  hcut __
398
399(** val pass_discr : pass -> pass -> __ **)
400let pass_discr x y =
401  Logic.eq_rect_Type2 x
402    (match x with
403     | Clight_pass -> Obj.magic (fun _ dH -> dH)
404     | Clight_switch_removed_pass -> Obj.magic (fun _ dH -> dH)
405     | Clight_label_pass -> Obj.magic (fun _ dH -> dH)
406     | Clight_simplified_pass -> Obj.magic (fun _ dH -> dH)
407     | Cminor_pass -> Obj.magic (fun _ dH -> dH)
408     | Rtlabs_pass -> Obj.magic (fun _ dH -> dH)
409     | Rtl_separate_pass -> Obj.magic (fun _ dH -> dH)
410     | Rtl_uniq_pass -> Obj.magic (fun _ dH -> dH)
411     | Ertl_pass -> Obj.magic (fun _ dH -> dH)
412     | Ltl_pass -> Obj.magic (fun _ dH -> dH)
413     | Lin_pass -> Obj.magic (fun _ dH -> dH)
414     | Assembly_pass -> Obj.magic (fun _ dH -> dH)
415     | Object_code_pass -> Obj.magic (fun _ dH -> dH)) y
416
417(** val pass_jmdiscr : pass -> pass -> __ **)
418let pass_jmdiscr x y =
419  Logic.eq_rect_Type2 x
420    (match x with
421     | Clight_pass -> Obj.magic (fun _ dH -> dH)
422     | Clight_switch_removed_pass -> Obj.magic (fun _ dH -> dH)
423     | Clight_label_pass -> Obj.magic (fun _ dH -> dH)
424     | Clight_simplified_pass -> Obj.magic (fun _ dH -> dH)
425     | Cminor_pass -> Obj.magic (fun _ dH -> dH)
426     | Rtlabs_pass -> Obj.magic (fun _ dH -> dH)
427     | Rtl_separate_pass -> Obj.magic (fun _ dH -> dH)
428     | Rtl_uniq_pass -> Obj.magic (fun _ dH -> dH)
429     | Ertl_pass -> Obj.magic (fun _ dH -> dH)
430     | Ltl_pass -> Obj.magic (fun _ dH -> dH)
431     | Lin_pass -> Obj.magic (fun _ dH -> dH)
432     | Assembly_pass -> Obj.magic (fun _ dH -> dH)
433     | Object_code_pass -> Obj.magic (fun _ dH -> dH)) y
434
435type 'x with_stack_model = ('x, AST.ident -> Nat.nat Types.option) Types.prod
436
437type syntax_of_pass = __
438
439type observe_pass = pass -> syntax_of_pass -> Types.unit0
440
441(** val front_end :
442    observe_pass -> Csyntax.clight_program -> ((CostLabel.costlabel,
443    Csyntax.clight_program) Types.prod, RTLabs_syntax.rTLabs_program)
444    Types.prod Errors.res **)
445let front_end observe p =
446  let i = Obj.magic observe Clight_pass p in
447  let p0 = SwitchRemoval.program_switch_removal p in
448  let i0 = Obj.magic observe Clight_switch_removed_pass p0 in
449  let { Types.fst = p'; Types.snd = init_cost } = Label.clight_label p0 in
450  let i1 = Obj.magic observe Clight_label_pass p' in
451  let p1 = SimplifyCasts.simplify_program p' in
452  let i2 = Obj.magic observe Clight_simplified_pass p1 in
453  Obj.magic
454    (Monad.m_bind0 (Monad.max_def Errors.res0)
455      (Obj.magic (ToCminor.clight_to_cminor p1)) (fun p2 ->
456      let i3 = observe Cminor_pass p2 in
457      let p3 = ToRTLabs.cminor_to_rtlabs (Obj.magic p2) in
458      let i4 = Obj.magic observe Rtlabs_pass p3 in
459      (match CostCheck.check_cost_program p3 with
460       | Bool.True ->
461         (match CostInj.check_program_cost_injectivity p3 with
462          | Bool.True ->
463            Monad.m_return0 (Monad.max_def Errors.res0) { Types.fst =
464              { Types.fst = init_cost; Types.snd = p' }; Types.snd = p3 }
465          | Bool.False ->
466            Obj.magic (Errors.Error
467              (Errors.msg ErrorMessages.RepeatedCostLabel0)))
468       | Bool.False ->
469         Obj.magic (Errors.Error (Errors.msg ErrorMessages.BadCostLabelling)))))
470
471open Uses
472
473(** val compute_fixpoint : Fixpoints.fixpoint_computer **)
474let compute_fixpoint = Compute_fixpoints.compute_fixpoint
475 
476(** val colour_graph : Interference.coloured_graph_computer **)
477let colour_graph = Compute_colouring.colour_graph
478
479open AssocList
480
481(** val lookup_stack_cost :
482    Joint.params -> Joint.joint_program -> PreIdentifiers.identifier ->
483    Nat.nat Types.option **)
484let lookup_stack_cost p p0 id =
485  AssocList.assoc_list_lookup id
486    (Identifiers.eq_identifier PreIdentifiers.SymbolTag)
487    (Joint.stack_cost p p0)
488
489(** val back_end :
490    observe_pass -> CostLabel.costlabel -> RTLabs_syntax.rTLabs_program ->
491    ((ASM.pseudo_assembly_program, Joint.stack_cost_model) Types.prod,
492    Nat.nat) Types.prod Errors.res **)
493let back_end observe init_cost p =
494  let p0 = RTLabsToRTL.rtlabs_to_rtl init_cost p in
495  let st = lookup_stack_cost (Joint.graph_params_to_params RTL.rTL) p0 in
496  let i =
497    Obj.magic observe Rtl_separate_pass { Types.fst = p0; Types.snd = st }
498  in
499  let i0 = Obj.magic observe Rtl_uniq_pass { Types.fst = p0; Types.snd = st }
500  in
501  let p1 = RTLToERTL.rtl_to_ertl p0 in
502  let st0 = lookup_stack_cost (Joint.graph_params_to_params ERTL.eRTL) p1 in
503  let i1 = Obj.magic observe Ertl_pass { Types.fst = p1; Types.snd = st0 } in
504  let { Types.fst = eta2; Types.snd = max_stack } =
505    ERTLToLTL.ertl_to_ltl compute_fixpoint colour_graph p1
506  in
507  let { Types.fst = p2; Types.snd = stack_cost } = eta2 in
508  let st1 = lookup_stack_cost (Joint.graph_params_to_params LTL.lTL) p2 in
509  let i2 = Obj.magic observe Ltl_pass { Types.fst = p2; Types.snd = st1 } in
510  let st2 = lookup_stack_cost (Joint.graph_params_to_params LTL.lTL) p2 in
511  let p3 = LTLToLIN.ltl_to_lin p2 in
512  let st3 = lookup_stack_cost (Joint.lin_params_to_params LIN.lIN) p3 in
513  let i3 = Obj.magic observe Lin_pass { Types.fst = p3; Types.snd = st3 } in
514  Obj.magic
515    (Monad.m_bind0 (Monad.max_def Errors.res0)
516      (Obj.magic
517        (Errors.opt_to_res (Errors.msg ErrorMessages.AssemblyTooLarge)
518          (LINToASM.lin_to_asm p3))) (fun p4 ->
519      Monad.m_return0 (Monad.max_def Errors.res0) { Types.fst = { Types.fst =
520        p4; Types.snd = stack_cost }; Types.snd = max_stack }))
521
522open Assembly
523
524open Status
525
526open Fetch
527
528open PolicyFront
529
530open PolicyStep
531
532open Policy
533
534(** val assembler :
535    observe_pass -> ASM.pseudo_assembly_program -> ASM.labelled_object_code
536    Errors.res **)
537let assembler observe p =
538  Obj.magic
539    (Monad.m_bind0 (Monad.max_def Errors.res0)
540      (Obj.magic
541        (Errors.opt_to_res (Errors.msg ErrorMessages.Jump_expansion_failed)
542          (Policy.jump_expansion' p))) (fun sigma_pol ->
543      let sigma = fun ppc -> (Types.pi1 sigma_pol).Types.fst ppc in
544      let pol = fun ppc -> (Types.pi1 sigma_pol).Types.snd ppc in
545      let i =
546        Obj.magic observe Assembly_pass { Types.fst = { Types.fst = p;
547          Types.snd = sigma }; Types.snd = pol }
548      in
549      let p0 = Assembly.assembly p sigma pol in
550      let i0 = Obj.magic observe Object_code_pass (Types.pi1 p0) in
551      Obj.magic (Errors.OK (Types.pi1 p0))))
552
553open StructuredTraces
554
555open AbstractStatus
556
557open StatusProofs
558
559open Interpret
560
561open ASMCosts
562
563(** val lift_cost_map_back_to_front :
564    Csyntax.clight_program -> ASM.labelled_object_code ->
565    StructuredTraces.as_cost_map -> Label.clight_cost_map **)
566let lift_cost_map_back_to_front clight oc k asm_cost_map =
567  StructuredTraces.lift_sigma_map_id Nat.O
568    (BitVectorTrie.strong_decidable_in_codomain
569      (Identifiers.deq_identifier PreIdentifiers.CostTag) (Nat.S (Nat.S
570      (Nat.S (Nat.S (Nat.S (Nat.S (Nat.S (Nat.S (Nat.S (Nat.S (Nat.S (Nat.S
571      (Nat.S (Nat.S (Nat.S (Nat.S Nat.O))))))))))))))))
572      (Obj.magic oc.ASM.costlabels)) (Obj.magic k) (Obj.magic asm_cost_map)
573
574open UtilBranch
575
576open ASMCostsSplit
577
578type compiler_output = { c_labelled_object_code : ASM.labelled_object_code;
579                         c_stack_cost : Joint.stack_cost_model;
580                         c_max_stack : Nat.nat;
581                         c_labelled_clight : Csyntax.clight_program;
582                         c_clight_cost_map : Label.clight_cost_map }
583
584(** val compiler_output_rect_Type4 :
585    (ASM.labelled_object_code -> Joint.stack_cost_model -> Nat.nat ->
586    Csyntax.clight_program -> Label.clight_cost_map -> 'a1) ->
587    compiler_output -> 'a1 **)
588let rec compiler_output_rect_Type4 h_mk_compiler_output x_185 =
589  let { c_labelled_object_code = c_labelled_object_code0; c_stack_cost =
590    c_stack_cost0; c_max_stack = c_max_stack0; c_labelled_clight =
591    c_labelled_clight0; c_clight_cost_map = c_clight_cost_map0 } = x_185
592  in
593  h_mk_compiler_output c_labelled_object_code0 c_stack_cost0 c_max_stack0
594    c_labelled_clight0 c_clight_cost_map0
595
596(** val compiler_output_rect_Type5 :
597    (ASM.labelled_object_code -> Joint.stack_cost_model -> Nat.nat ->
598    Csyntax.clight_program -> Label.clight_cost_map -> 'a1) ->
599    compiler_output -> 'a1 **)
600let rec compiler_output_rect_Type5 h_mk_compiler_output x_187 =
601  let { c_labelled_object_code = c_labelled_object_code0; c_stack_cost =
602    c_stack_cost0; c_max_stack = c_max_stack0; c_labelled_clight =
603    c_labelled_clight0; c_clight_cost_map = c_clight_cost_map0 } = x_187
604  in
605  h_mk_compiler_output c_labelled_object_code0 c_stack_cost0 c_max_stack0
606    c_labelled_clight0 c_clight_cost_map0
607
608(** val compiler_output_rect_Type3 :
609    (ASM.labelled_object_code -> Joint.stack_cost_model -> Nat.nat ->
610    Csyntax.clight_program -> Label.clight_cost_map -> 'a1) ->
611    compiler_output -> 'a1 **)
612let rec compiler_output_rect_Type3 h_mk_compiler_output x_189 =
613  let { c_labelled_object_code = c_labelled_object_code0; c_stack_cost =
614    c_stack_cost0; c_max_stack = c_max_stack0; c_labelled_clight =
615    c_labelled_clight0; c_clight_cost_map = c_clight_cost_map0 } = x_189
616  in
617  h_mk_compiler_output c_labelled_object_code0 c_stack_cost0 c_max_stack0
618    c_labelled_clight0 c_clight_cost_map0
619
620(** val compiler_output_rect_Type2 :
621    (ASM.labelled_object_code -> Joint.stack_cost_model -> Nat.nat ->
622    Csyntax.clight_program -> Label.clight_cost_map -> 'a1) ->
623    compiler_output -> 'a1 **)
624let rec compiler_output_rect_Type2 h_mk_compiler_output x_191 =
625  let { c_labelled_object_code = c_labelled_object_code0; c_stack_cost =
626    c_stack_cost0; c_max_stack = c_max_stack0; c_labelled_clight =
627    c_labelled_clight0; c_clight_cost_map = c_clight_cost_map0 } = x_191
628  in
629  h_mk_compiler_output c_labelled_object_code0 c_stack_cost0 c_max_stack0
630    c_labelled_clight0 c_clight_cost_map0
631
632(** val compiler_output_rect_Type1 :
633    (ASM.labelled_object_code -> Joint.stack_cost_model -> Nat.nat ->
634    Csyntax.clight_program -> Label.clight_cost_map -> 'a1) ->
635    compiler_output -> 'a1 **)
636let rec compiler_output_rect_Type1 h_mk_compiler_output x_193 =
637  let { c_labelled_object_code = c_labelled_object_code0; c_stack_cost =
638    c_stack_cost0; c_max_stack = c_max_stack0; c_labelled_clight =
639    c_labelled_clight0; c_clight_cost_map = c_clight_cost_map0 } = x_193
640  in
641  h_mk_compiler_output c_labelled_object_code0 c_stack_cost0 c_max_stack0
642    c_labelled_clight0 c_clight_cost_map0
643
644(** val compiler_output_rect_Type0 :
645    (ASM.labelled_object_code -> Joint.stack_cost_model -> Nat.nat ->
646    Csyntax.clight_program -> Label.clight_cost_map -> 'a1) ->
647    compiler_output -> 'a1 **)
648let rec compiler_output_rect_Type0 h_mk_compiler_output x_195 =
649  let { c_labelled_object_code = c_labelled_object_code0; c_stack_cost =
650    c_stack_cost0; c_max_stack = c_max_stack0; c_labelled_clight =
651    c_labelled_clight0; c_clight_cost_map = c_clight_cost_map0 } = x_195
652  in
653  h_mk_compiler_output c_labelled_object_code0 c_stack_cost0 c_max_stack0
654    c_labelled_clight0 c_clight_cost_map0
655
656(** val c_labelled_object_code :
657    compiler_output -> ASM.labelled_object_code **)
658let rec c_labelled_object_code xxx =
659  xxx.c_labelled_object_code
660
661(** val c_stack_cost : compiler_output -> Joint.stack_cost_model **)
662let rec c_stack_cost xxx =
663  xxx.c_stack_cost
664
665(** val c_max_stack : compiler_output -> Nat.nat **)
666let rec c_max_stack xxx =
667  xxx.c_max_stack
668
669(** val c_labelled_clight : compiler_output -> Csyntax.clight_program **)
670let rec c_labelled_clight xxx =
671  xxx.c_labelled_clight
672
673(** val c_clight_cost_map : compiler_output -> Label.clight_cost_map **)
674let rec c_clight_cost_map xxx =
675  xxx.c_clight_cost_map
676
677(** val compiler_output_inv_rect_Type4 :
678    compiler_output -> (ASM.labelled_object_code -> Joint.stack_cost_model ->
679    Nat.nat -> Csyntax.clight_program -> Label.clight_cost_map -> __ -> 'a1)
680    -> 'a1 **)
681let compiler_output_inv_rect_Type4 hterm h1 =
682  let hcut = compiler_output_rect_Type4 h1 hterm in hcut __
683
684(** val compiler_output_inv_rect_Type3 :
685    compiler_output -> (ASM.labelled_object_code -> Joint.stack_cost_model ->
686    Nat.nat -> Csyntax.clight_program -> Label.clight_cost_map -> __ -> 'a1)
687    -> 'a1 **)
688let compiler_output_inv_rect_Type3 hterm h1 =
689  let hcut = compiler_output_rect_Type3 h1 hterm in hcut __
690
691(** val compiler_output_inv_rect_Type2 :
692    compiler_output -> (ASM.labelled_object_code -> Joint.stack_cost_model ->
693    Nat.nat -> Csyntax.clight_program -> Label.clight_cost_map -> __ -> 'a1)
694    -> 'a1 **)
695let compiler_output_inv_rect_Type2 hterm h1 =
696  let hcut = compiler_output_rect_Type2 h1 hterm in hcut __
697
698(** val compiler_output_inv_rect_Type1 :
699    compiler_output -> (ASM.labelled_object_code -> Joint.stack_cost_model ->
700    Nat.nat -> Csyntax.clight_program -> Label.clight_cost_map -> __ -> 'a1)
701    -> 'a1 **)
702let compiler_output_inv_rect_Type1 hterm h1 =
703  let hcut = compiler_output_rect_Type1 h1 hterm in hcut __
704
705(** val compiler_output_inv_rect_Type0 :
706    compiler_output -> (ASM.labelled_object_code -> Joint.stack_cost_model ->
707    Nat.nat -> Csyntax.clight_program -> Label.clight_cost_map -> __ -> 'a1)
708    -> 'a1 **)
709let compiler_output_inv_rect_Type0 hterm h1 =
710  let hcut = compiler_output_rect_Type0 h1 hterm in hcut __
711
712(** val compiler_output_discr : compiler_output -> compiler_output -> __ **)
713let compiler_output_discr x y =
714  Logic.eq_rect_Type2 x
715    (let { c_labelled_object_code = a0; c_stack_cost = a1; c_max_stack = a2;
716       c_labelled_clight = a3; c_clight_cost_map = a4 } = x
717     in
718    Obj.magic (fun _ dH -> dH __ __ __ __ __)) y
719
720(** val compiler_output_jmdiscr :
721    compiler_output -> compiler_output -> __ **)
722let compiler_output_jmdiscr x y =
723  Logic.eq_rect_Type2 x
724    (let { c_labelled_object_code = a0; c_stack_cost = a1; c_max_stack = a2;
725       c_labelled_clight = a3; c_clight_cost_map = a4 } = x
726     in
727    Obj.magic (fun _ dH -> dH __ __ __ __ __)) y
728
729(** val compile :
730    observe_pass -> Csyntax.clight_program -> compiler_output Errors.res **)
731let compile observe p =
732  Obj.magic
733    (Monad.m_bind3 (Monad.max_def Errors.res0)
734      (Obj.magic (front_end observe p)) (fun init_cost p' p0 ->
735      Monad.m_bind3 (Monad.max_def Errors.res0)
736        (Obj.magic (back_end observe init_cost p0))
737        (fun p1 stack_cost max_stack ->
738        Monad.m_bind0 (Monad.max_def Errors.res0)
739          (Obj.magic (assembler observe p1)) (fun p2 ->
740          let k = ASMCostsSplit.aSM_cost_map p2 in
741          let k' = lift_cost_map_back_to_front p' p2 k in
742          Monad.m_return0 (Monad.max_def Errors.res0)
743            { c_labelled_object_code = p2; c_stack_cost = stack_cost;
744            c_max_stack = max_stack; c_labelled_clight = p';
745            c_clight_cost_map = k' }))))
746
Note: See TracBrowser for help on using the repository browser.