This repository has been archived by the owner on Sep 10, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
/
astUtil.ml
1892 lines (1747 loc) · 62.4 KB
/
astUtil.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(*
Machine generated. Edit at your own risk
Reproduce with the following
--line_width=74
--no_action=false
--output_directory=.
--pickler=sexp
--view=OCaml
*)
(* module AstUtil*)
let rec sexp_rd_name s_ =
begin
(SexpPkl.rd_lp s_);
(SexpPkl.rd_sym "ast_name" s_);
let tmp_ = let string1 = (StdPrimsUtil.sexp_rd_std_string s_) in
(string1) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_conv s_ =
begin
(SexpPkl.rd_lp s_);
(SexpPkl.rd_sym "ast_conv" s_);
let tmp_ = let string1 = (StdPrimsUtil.sexp_rd_std_string s_) in
(string1) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_hint s_ =
begin
(SexpPkl.rd_lp s_);
(SexpPkl.rd_sym "ast_hint" s_);
let tmp_ = let string1 = (StdPrimsUtil.sexp_rd_std_string s_) in
(string1) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_reg s_ =
begin
(SexpPkl.rd_lp s_);
(SexpPkl.rd_sym "ast_reg" s_);
let tmp_ = let string1 = (StdPrimsUtil.sexp_rd_std_string s_) in
(string1) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_target s_ =
begin
(SexpPkl.rd_lp s_);
(SexpPkl.rd_sym "ast_target" s_);
let tmp_ = let string1 = (StdPrimsUtil.sexp_rd_std_string s_) in
(string1) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_alias_set s_ =
begin
(SexpPkl.rd_lp s_);
(SexpPkl.rd_sym "ast_alias_set" s_);
let tmp_ = let string1 = (StdPrimsUtil.sexp_rd_std_string s_) in
(string1) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_size s_ =
begin
(SexpPkl.rd_lp s_);
(SexpPkl.rd_sym "ast_size" s_);
let tmp_ = let int1 = (StdPrimsUtil.sexp_rd_std_int s_) in
(int1) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_align s_ =
begin
(SexpPkl.rd_lp s_);
(SexpPkl.rd_sym "ast_align" s_);
let tmp_ = let int1 = (StdPrimsUtil.sexp_rd_std_int s_) in
(int1) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_aligned s_ =
begin
(SexpPkl.rd_lp s_);
(SexpPkl.rd_sym "ast_aligned" s_);
let tmp_ = let int1 = (StdPrimsUtil.sexp_rd_std_int s_) in
(int1) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_in_alias s_ =
begin
(SexpPkl.rd_lp s_);
(SexpPkl.rd_sym "ast_in_alias" s_);
let tmp_ = let string1 = (StdPrimsUtil.sexp_rd_std_string s_) in
(string1) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_op s_ =
begin
(SexpPkl.rd_lp s_);
(SexpPkl.rd_sym "ast_op" s_);
let tmp_ = let string1 = (StdPrimsUtil.sexp_rd_std_string s_) in
(string1) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_region s_ =
begin
(SexpPkl.rd_lp s_);
(SexpPkl.rd_sym "ast_region" s_);
let tmp_ = let int1 = (StdPrimsUtil.sexp_rd_std_int s_) in
let int2 = (StdPrimsUtil.sexp_rd_std_int s_) in
(int1, int2) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_ty s_ =
begin
(SexpPkl.rd_lp s_);
let tmp_ = let t = (SexpPkl.get_sym s_) in
(match (t) with
"ast_TyAt" -> let ty1 = (sexp_rd_ty s_) in
let region1 = (sexp_rd_region s_) in
Ast.TyAt(ty1, region1)
| "ast_BitsTy" -> let size1 = (sexp_rd_size s_) in
Ast.BitsTy(size1)
| "ast_TypeSynonym" -> let name1 = (sexp_rd_name s_) in
Ast.TypeSynonym(name1)
| _ -> (SexpPkl.die ()))
(* end match *) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_name_or_mem s_ =
begin
(SexpPkl.rd_lp s_);
let tmp_ = let t = (SexpPkl.get_sym s_) in
(match (t) with
"ast_NameOrMemAt" -> let name_or_mem1 = (sexp_rd_name_or_mem s_) in
let region1 = (sexp_rd_region s_) in
Ast.NameOrMemAt(name_or_mem1, region1)
| "ast_Name" -> let hint_opt1 = (SexpPkl.rd_option sexp_rd_hint s_) in
let name1 = (sexp_rd_name s_) in
let aligned_opt1 = (SexpPkl.rd_option sexp_rd_aligned s_) in
Ast.Name(hint_opt1, name1, aligned_opt1)
| "ast_Mem" -> let ty1 = (sexp_rd_ty s_) in
let expr1 = (sexp_rd_expr s_) in
let aligned_opt1 = (SexpPkl.rd_option sexp_rd_aligned s_) in
let in_alias_list1 = (SexpPkl.rd_list sexp_rd_in_alias s_) in
Ast.Mem(ty1, expr1, aligned_opt1, in_alias_list1)
| _ -> (SexpPkl.die ()))
(* end match *) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_actual s_ =
begin
(SexpPkl.rd_lp s_);
(SexpPkl.rd_sym "ast_actual" s_);
let tmp_ = let hint_opt1 = (SexpPkl.rd_option sexp_rd_hint s_) in
let expr1 = (sexp_rd_expr s_) in
let aligned_opt1 = (SexpPkl.rd_option sexp_rd_aligned s_) in
(hint_opt1, expr1, aligned_opt1) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_expr s_ =
begin
(SexpPkl.rd_lp s_);
let tmp_ = let t = (SexpPkl.get_sym s_) in
(match (t) with
"ast_ExprAt" -> let expr1 = (sexp_rd_expr s_) in
let region1 = (sexp_rd_region s_) in
Ast.ExprAt(expr1, region1)
| "ast_Sint" -> let string1 = (StdPrimsUtil.sexp_rd_std_string s_) in
let ty_opt1 = (SexpPkl.rd_option sexp_rd_ty s_) in
Ast.Sint(string1, ty_opt1)
| "ast_Uint" -> let string1 = (StdPrimsUtil.sexp_rd_std_string s_) in
let ty_opt1 = (SexpPkl.rd_option sexp_rd_ty s_) in
Ast.Uint(string1, ty_opt1)
| "ast_Float" -> let string1 = (StdPrimsUtil.sexp_rd_std_string s_) in
let ty_opt1 = (SexpPkl.rd_option sexp_rd_ty s_) in
Ast.Float(string1, ty_opt1)
| "ast_Char" -> let int1 = (StdPrimsUtil.sexp_rd_std_int s_) in
let ty_opt1 = (SexpPkl.rd_option sexp_rd_ty s_) in
Ast.Char(int1, ty_opt1)
| "ast_Fetch" -> let name_or_mem1 = (sexp_rd_name_or_mem s_) in
Ast.Fetch(name_or_mem1)
| "ast_BinOp" -> let expr1 = (sexp_rd_expr s_) in
let op1 = (sexp_rd_op s_) in
let expr2 = (sexp_rd_expr s_) in
Ast.BinOp(expr1, op1, expr2)
| "ast_UnOp" -> let op1 = (sexp_rd_op s_) in
let expr1 = (sexp_rd_expr s_) in
Ast.UnOp(op1, expr1)
| "ast_PrimOp" -> let name1 = (sexp_rd_name s_) in
let actual_list1 = (SexpPkl.rd_list sexp_rd_actual s_) in
Ast.PrimOp(name1, actual_list1)
| _ -> (SexpPkl.die ()))
(* end match *) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_import s_ =
begin
(SexpPkl.rd_lp s_);
(SexpPkl.rd_sym "ast_import" s_);
let tmp_ = let string_opt1 = (SexpPkl.rd_option
StdPrimsUtil.sexp_rd_std_string
s_) in
let name1 = (sexp_rd_name s_) in
(string_opt1, name1) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_export s_ =
begin
(SexpPkl.rd_lp s_);
(SexpPkl.rd_sym "ast_export" s_);
let tmp_ = let name1 = (sexp_rd_name s_) in
let string_opt1 = (SexpPkl.rd_option StdPrimsUtil.sexp_rd_std_string s_) in
(name1, string_opt1) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_variance s_ =
begin
(SexpPkl.rd_lp s_);
let tmp_ = let t = (SexpPkl.get_sym s_) in
(match (t) with
"ast_Invariant" -> Ast.Invariant
| "ast_Invisible" -> Ast.Invisible
| "ast_Variant" -> Ast.Variant
| _ -> (SexpPkl.die ()))
(* end match *) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_register s_ =
begin
(SexpPkl.rd_lp s_);
(SexpPkl.rd_sym "ast_register" s_);
let tmp_ = let variance1 = (sexp_rd_variance s_) in
let hint_opt1 = (SexpPkl.rd_option sexp_rd_hint s_) in
let ty1 = (sexp_rd_ty s_) in
let name1 = (sexp_rd_name s_) in
let reg_opt1 = (SexpPkl.rd_option sexp_rd_reg s_) in
(variance1, hint_opt1, ty1, name1, reg_opt1) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_arch s_ =
begin
(SexpPkl.rd_lp s_);
let tmp_ = let t = (SexpPkl.get_sym s_) in
(match (t) with
"ast_Memsize" -> let int1 = (StdPrimsUtil.sexp_rd_std_int s_) in
Ast.Memsize(int1)
| "ast_ByteorderBig" -> Ast.ByteorderBig
| "ast_ByteorderLittle" -> Ast.ByteorderLittle
| "ast_FloatRepr" -> let string1 = (StdPrimsUtil.sexp_rd_std_string s_) in
Ast.FloatRepr(string1)
| "ast_Charset" -> let string1 = (StdPrimsUtil.sexp_rd_std_string s_) in
Ast.Charset(string1)
| "ast_WordSize" -> let int1 = (StdPrimsUtil.sexp_rd_std_int s_) in
Ast.WordSize(int1)
| "ast_PointerSize" -> let int1 = (StdPrimsUtil.sexp_rd_std_int s_) in
Ast.PointerSize(int1)
| _ -> (SexpPkl.die ()))
(* end match *) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_decl s_ =
begin
(SexpPkl.rd_lp s_);
let tmp_ = let t = (SexpPkl.get_sym s_) in
(match (t) with
"ast_DeclAt" -> let decl1 = (sexp_rd_decl s_) in
let region1 = (sexp_rd_region s_) in
Ast.DeclAt(decl1, region1)
| "ast_Import" -> let ty_opt1 = (SexpPkl.rd_option sexp_rd_ty s_) in
let import_list1 = (SexpPkl.rd_list sexp_rd_import s_) in
Ast.Import(ty_opt1, import_list1)
| "ast_Export" -> let ty_opt1 = (SexpPkl.rd_option sexp_rd_ty s_) in
let export_list1 = (SexpPkl.rd_list sexp_rd_export s_) in
Ast.Export(ty_opt1, export_list1)
| "ast_Const" -> let ty_opt1 = (SexpPkl.rd_option sexp_rd_ty s_) in
let name1 = (sexp_rd_name s_) in
let expr1 = (sexp_rd_expr s_) in
Ast.Const(ty_opt1, name1, expr1)
| "ast_Typedef" -> let ty1 = (sexp_rd_ty s_) in
let name_list1 = (SexpPkl.rd_list sexp_rd_name s_) in
Ast.Typedef(ty1, name_list1)
| "ast_Registers" -> let register_list1 = (SexpPkl.rd_list sexp_rd_register s_) in
Ast.Registers(register_list1)
| "ast_Pragma" -> Ast.Pragma
| "ast_Target" -> let arch_list1 = (SexpPkl.rd_list sexp_rd_arch s_) in
Ast.Target(arch_list1)
| _ -> (SexpPkl.die ()))
(* end match *) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_bare_formal s_ =
begin
(SexpPkl.rd_lp s_);
(SexpPkl.rd_sym "ast_bare_formal" s_);
let tmp_ = let hint_opt1 = (SexpPkl.rd_option sexp_rd_hint s_) in
let variance1 = (sexp_rd_variance s_) in
let ty1 = (sexp_rd_ty s_) in
let name1 = (sexp_rd_name s_) in
let aligned_opt1 = (SexpPkl.rd_option sexp_rd_aligned s_) in
(hint_opt1, variance1, ty1, name1, aligned_opt1) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_formal s_ =
begin
(SexpPkl.rd_lp s_);
(SexpPkl.rd_sym "ast_formal" s_);
let tmp_ = let region1 = (sexp_rd_region s_) in
let bare_formal1 = (sexp_rd_bare_formal s_) in
(region1, bare_formal1) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_memsize s_ =
begin
(SexpPkl.rd_lp s_);
let tmp_ = let t = (SexpPkl.get_sym s_) in
(match (t) with
"ast_NoSize" -> Ast.NoSize
| "ast_DynSize" -> Ast.DynSize
| "ast_FixSize" -> let expr1 = (sexp_rd_expr s_) in
Ast.FixSize(expr1)
| _ -> (SexpPkl.die ()))
(* end match *) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_init s_ =
begin
(SexpPkl.rd_lp s_);
let tmp_ = let t = (SexpPkl.get_sym s_) in
(match (t) with
"ast_InitAt" -> let init1 = (sexp_rd_init s_) in
let region1 = (sexp_rd_region s_) in
Ast.InitAt(init1, region1)
| "ast_InitExprs" -> let expr_list1 = (SexpPkl.rd_list sexp_rd_expr s_) in
Ast.InitExprs(expr_list1)
| "ast_InitStr" -> let string1 = (StdPrimsUtil.sexp_rd_std_string s_) in
Ast.InitStr(string1)
| "ast_InitUStr" -> let string1 = (StdPrimsUtil.sexp_rd_std_string s_) in
Ast.InitUStr(string1)
| _ -> (SexpPkl.die ()))
(* end match *) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_datum s_ =
begin
(SexpPkl.rd_lp s_);
let tmp_ = let t = (SexpPkl.get_sym s_) in
(match (t) with
"ast_DatumAt" -> let datum1 = (sexp_rd_datum s_) in
let region1 = (sexp_rd_region s_) in
Ast.DatumAt(datum1, region1)
| "ast_Label" -> let name1 = (sexp_rd_name s_) in
Ast.Label(name1)
| "ast_Align" -> let align1 = (sexp_rd_align s_) in
Ast.Align(align1)
| "ast_MemDecl" -> let ty1 = (sexp_rd_ty s_) in
let memsize1 = (sexp_rd_memsize s_) in
let init_opt1 = (SexpPkl.rd_option sexp_rd_init s_) in
Ast.MemDecl(ty1, memsize1, init_opt1)
| _ -> (SexpPkl.die ()))
(* end match *) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_cformal s_ =
begin
(SexpPkl.rd_lp s_);
(SexpPkl.rd_sym "ast_cformal" s_);
let tmp_ = let region1 = (sexp_rd_region s_) in
let hint_opt1 = (SexpPkl.rd_option sexp_rd_hint s_) in
let name1 = (sexp_rd_name s_) in
let aligned_opt1 = (SexpPkl.rd_option sexp_rd_aligned s_) in
(region1, hint_opt1, name1, aligned_opt1) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_flow s_ =
begin
(SexpPkl.rd_lp s_);
let tmp_ = let t = (SexpPkl.get_sym s_) in
(match (t) with
"ast_FlowAt" -> let flow1 = (sexp_rd_flow s_) in
let region1 = (sexp_rd_region s_) in
Ast.FlowAt(flow1, region1)
| "ast_CutsTo" -> let name_list1 = (SexpPkl.rd_list sexp_rd_name s_) in
Ast.CutsTo(name_list1)
| "ast_UnwindsTo" -> let name_list1 = (SexpPkl.rd_list sexp_rd_name s_) in
Ast.UnwindsTo(name_list1)
| "ast_ReturnsTo" -> let name_list1 = (SexpPkl.rd_list sexp_rd_name s_) in
Ast.ReturnsTo(name_list1)
| "ast_NeverReturns" -> Ast.NeverReturns
| "ast_Aborts" -> Ast.Aborts
| _ -> (SexpPkl.die ()))
(* end match *) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_mem s_ =
begin
(SexpPkl.rd_lp s_);
let tmp_ = let t = (SexpPkl.get_sym s_) in
(match (t) with
"ast_AliasAt" -> let mem1 = (sexp_rd_mem s_) in
let region1 = (sexp_rd_region s_) in
Ast.AliasAt(mem1, region1)
| "ast_Reads" -> let name_list1 = (SexpPkl.rd_list sexp_rd_name s_) in
Ast.Reads(name_list1)
| "ast_Writes" -> let name_list1 = (SexpPkl.rd_list sexp_rd_name s_) in
Ast.Writes(name_list1)
| _ -> (SexpPkl.die ()))
(* end match *) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_procann s_ =
begin
(SexpPkl.rd_lp s_);
let tmp_ = let t = (SexpPkl.get_sym s_) in
(match (t) with
"ast_Flow" -> let flow1 = (sexp_rd_flow s_) in
Ast.Flow(flow1)
| "ast_Alias" -> let mem1 = (sexp_rd_mem s_) in
Ast.Alias(mem1)
| _ -> (SexpPkl.die ()))
(* end match *) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_altcont s_ =
begin
(SexpPkl.rd_lp s_);
(SexpPkl.rd_sym "ast_altcont" s_);
let tmp_ = let expr1 = (sexp_rd_expr s_) in
let expr2 = (sexp_rd_expr s_) in
(expr1, expr2) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_range s_ =
begin
(SexpPkl.rd_lp s_);
let tmp_ = let t = (SexpPkl.get_sym s_) in
(match (t) with
"ast_Point" -> let expr1 = (sexp_rd_expr s_) in
Ast.Point(expr1)
| "ast_Range" -> let expr1 = (sexp_rd_expr s_) in
let expr2 = (sexp_rd_expr s_) in
Ast.Range(expr1, expr2)
| _ -> (SexpPkl.die ()))
(* end match *) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_guarded s_ =
begin
(SexpPkl.rd_lp s_);
(SexpPkl.rd_sym "ast_guarded" s_);
let tmp_ = let guard = (SexpPkl.rd_option sexp_rd_expr s_) in
let value = (sexp_rd_expr s_) in
(guard, value) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_arm s_ =
begin
(SexpPkl.rd_lp s_);
let tmp_ = let t = (SexpPkl.get_sym s_) in
(match (t) with
"ast_ArmAt" -> let arm1 = (sexp_rd_arm s_) in
let region1 = (sexp_rd_region s_) in
Ast.ArmAt(arm1, region1)
| "ast_Case" -> let range_list1 = (SexpPkl.rd_list sexp_rd_range s_) in
let body_list1 = (SexpPkl.rd_list sexp_rd_body s_) in
Ast.Case(range_list1, body_list1)
| _ -> (SexpPkl.die ()))
(* end match *) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_stmt s_ =
begin
(SexpPkl.rd_lp s_);
let tmp_ = let t = (SexpPkl.get_sym s_) in
(match (t) with
"ast_StmtAt" -> let stmt1 = (sexp_rd_stmt s_) in
let region1 = (sexp_rd_region s_) in
Ast.StmtAt(stmt1, region1)
| "ast_IfStmt" -> let expr1 = (sexp_rd_expr s_) in
let body_list1 = (SexpPkl.rd_list sexp_rd_body s_) in
let body_list2 = (SexpPkl.rd_list sexp_rd_body s_) in
Ast.IfStmt(expr1, body_list1, body_list2)
| "ast_SwitchStmt" -> let range_opt1 = (SexpPkl.rd_option sexp_rd_range s_) in
let expr1 = (sexp_rd_expr s_) in
let arm_list1 = (SexpPkl.rd_list sexp_rd_arm s_) in
Ast.SwitchStmt(range_opt1, expr1, arm_list1)
| "ast_LabelStmt" -> let name1 = (sexp_rd_name s_) in
Ast.LabelStmt(name1)
| "ast_ContStmt" -> let name1 = (sexp_rd_name s_) in
let cformal_list1 = (SexpPkl.rd_list sexp_rd_cformal s_) in
Ast.ContStmt(name1, cformal_list1)
| "ast_SpanStmt" -> let key = (sexp_rd_expr s_) in
let value = (sexp_rd_expr s_) in
let body_list1 = (SexpPkl.rd_list sexp_rd_body s_) in
Ast.SpanStmt(key, value, body_list1)
| "ast_AssignStmt" -> let name_or_mem_list1 = (SexpPkl.rd_list sexp_rd_name_or_mem s_) in
let guarded_list1 = (SexpPkl.rd_list sexp_rd_guarded s_) in
Ast.AssignStmt(name_or_mem_list1, guarded_list1)
| "ast_CallStmt" -> let name_or_mem_list1 = (SexpPkl.rd_list sexp_rd_name_or_mem s_) in
let conv_opt1 = (SexpPkl.rd_option sexp_rd_conv s_) in
let expr1 = (sexp_rd_expr s_) in
let actual_list1 = (SexpPkl.rd_list sexp_rd_actual s_) in
let target_list1 = (SexpPkl.rd_list sexp_rd_target s_) in
let procann_list1 = (SexpPkl.rd_list sexp_rd_procann s_) in
Ast.CallStmt(name_or_mem_list1, conv_opt1, expr1, actual_list1, target_list1, procann_list1)
| "ast_PrimStmt" -> let name_or_mem_list1 = (SexpPkl.rd_list sexp_rd_name_or_mem s_) in
let conv_opt1 = (SexpPkl.rd_option sexp_rd_conv s_) in
let name1 = (sexp_rd_name s_) in
let actual_list1 = (SexpPkl.rd_list sexp_rd_actual s_) in
let flow_list1 = (SexpPkl.rd_list sexp_rd_flow s_) in
Ast.PrimStmt(name_or_mem_list1, conv_opt1, name1, actual_list1, flow_list1)
| "ast_GotoStmt" -> let expr1 = (sexp_rd_expr s_) in
let target_list1 = (SexpPkl.rd_list sexp_rd_target s_) in
Ast.GotoStmt(expr1, target_list1)
| "ast_JumpStmt" -> let conv_opt1 = (SexpPkl.rd_option sexp_rd_conv s_) in
let expr1 = (sexp_rd_expr s_) in
let actual_list1 = (SexpPkl.rd_list sexp_rd_actual s_) in
let target_list1 = (SexpPkl.rd_list sexp_rd_target s_) in
Ast.JumpStmt(conv_opt1, expr1, actual_list1, target_list1)
| "ast_CutStmt" -> let expr1 = (sexp_rd_expr s_) in
let actual_list1 = (SexpPkl.rd_list sexp_rd_actual s_) in
let flow_list1 = (SexpPkl.rd_list sexp_rd_flow s_) in
Ast.CutStmt(expr1, actual_list1, flow_list1)
| "ast_ReturnStmt" -> let conv_opt1 = (SexpPkl.rd_option sexp_rd_conv s_) in
let altcont_opt1 = (SexpPkl.rd_option sexp_rd_altcont s_) in
let actual_list1 = (SexpPkl.rd_list sexp_rd_actual s_) in
Ast.ReturnStmt(conv_opt1, altcont_opt1, actual_list1)
| "ast_EmptyStmt" -> Ast.EmptyStmt
| "ast_CommentStmt" -> let string1 = (StdPrimsUtil.sexp_rd_std_string s_) in
Ast.CommentStmt(string1)
| "ast_LimitcheckStmt" -> let expr1 = (sexp_rd_expr s_) in
let expr_opt1 = (SexpPkl.rd_option sexp_rd_expr s_) in
Ast.LimitcheckStmt(expr1, expr_opt1)
| _ -> (SexpPkl.die ()))
(* end match *) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_body s_ =
begin
(SexpPkl.rd_lp s_);
let tmp_ = let t = (SexpPkl.get_sym s_) in
(match (t) with
"ast_BodyAt" -> let body1 = (sexp_rd_body s_) in
let region1 = (sexp_rd_region s_) in
Ast.BodyAt(body1, region1)
| "ast_DeclBody" -> let decl1 = (sexp_rd_decl s_) in
Ast.DeclBody(decl1)
| "ast_StmtBody" -> let stmt1 = (sexp_rd_stmt s_) in
Ast.StmtBody(stmt1)
| "ast_DataBody" -> let datum_list1 = (SexpPkl.rd_list sexp_rd_datum s_) in
Ast.DataBody(datum_list1)
| _ -> (SexpPkl.die ()))
(* end match *) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_proc s_ =
begin
(SexpPkl.rd_lp s_);
(SexpPkl.rd_sym "ast_proc" s_);
let tmp_ = let conv_opt1 = (SexpPkl.rd_option sexp_rd_conv s_) in
let name1 = (sexp_rd_name s_) in
let formal_list1 = (SexpPkl.rd_list sexp_rd_formal s_) in
let body_list1 = (SexpPkl.rd_list sexp_rd_body s_) in
let region1 = (sexp_rd_region s_) in
(conv_opt1, name1, formal_list1, body_list1, region1) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_section s_ =
begin
(SexpPkl.rd_lp s_);
let tmp_ = let t = (SexpPkl.get_sym s_) in
(match (t) with
"ast_SectionAt" -> let section1 = (sexp_rd_section s_) in
let region1 = (sexp_rd_region s_) in
Ast.SectionAt(section1, region1)
| "ast_Decl" -> let decl1 = (sexp_rd_decl s_) in
Ast.Decl(decl1)
| "ast_Procedure" -> let proc1 = (sexp_rd_proc s_) in
Ast.Procedure(proc1)
| "ast_Datum" -> let datum1 = (sexp_rd_datum s_) in
Ast.Datum(datum1)
| "ast_SSpan" -> let key = (sexp_rd_expr s_) in
let value = (sexp_rd_expr s_) in
let section_list1 = (SexpPkl.rd_list sexp_rd_section s_) in
Ast.SSpan(key, value, section_list1)
| _ -> (SexpPkl.die ()))
(* end match *) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_toplevel s_ =
begin
(SexpPkl.rd_lp s_);
let tmp_ = let t = (SexpPkl.get_sym s_) in
(match (t) with
"ast_ToplevelAt" -> let toplevel1 = (sexp_rd_toplevel s_) in
let region1 = (sexp_rd_region s_) in
Ast.ToplevelAt(toplevel1, region1)
| "ast_Section" -> let name1 = (sexp_rd_name s_) in
let section_list1 = (SexpPkl.rd_list sexp_rd_section s_) in
Ast.Section(name1, section_list1)
| "ast_TopDecl" -> let decl1 = (sexp_rd_decl s_) in
Ast.TopDecl(decl1)
| "ast_TopProcedure" -> let proc1 = (sexp_rd_proc s_) in
Ast.TopProcedure(proc1)
| _ -> (SexpPkl.die ()))
(* end match *) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_program s_ =
begin
(SexpPkl.rd_lp s_);
(SexpPkl.rd_sym "ast_program" s_);
let tmp_ = let toplevel_list1 = (SexpPkl.rd_list
sexp_rd_toplevel
s_) in
(toplevel_list1) in
begin
(SexpPkl.rd_rp s_);
tmp_
end
end
and sexp_rd_guarded_list s_ =
(SexpPkl.rd_list sexp_rd_guarded s_)
and sexp_rd_arm_list s_ =
(SexpPkl.rd_list sexp_rd_arm s_)
and sexp_rd_range_list s_ =
(SexpPkl.rd_list sexp_rd_range s_)
and sexp_rd_range_option s_ =
(SexpPkl.rd_option sexp_rd_range s_)
and sexp_rd_altcont_option s_ =
(SexpPkl.rd_option sexp_rd_altcont s_)
and sexp_rd_name_or_mem_list s_ =
(SexpPkl.rd_list sexp_rd_name_or_mem s_)
and sexp_rd_procann_list s_ =
(SexpPkl.rd_list sexp_rd_procann s_)
and sexp_rd_flow_list s_ =
(SexpPkl.rd_list sexp_rd_flow s_)
and sexp_rd_cformal_list s_ =
(SexpPkl.rd_list sexp_rd_cformal s_)
and sexp_rd_actual_list s_ =
(SexpPkl.rd_list sexp_rd_actual s_)
and sexp_rd_init_option s_ =
(SexpPkl.rd_option sexp_rd_init s_)
and sexp_rd_body_list s_ =
(SexpPkl.rd_list sexp_rd_body s_)
and sexp_rd_formal_list s_ =
(SexpPkl.rd_list sexp_rd_formal s_)
and sexp_rd_arch_list s_ =
(SexpPkl.rd_list sexp_rd_arch s_)
and sexp_rd_register_list s_ =
(SexpPkl.rd_list sexp_rd_register s_)
and sexp_rd_export_list s_ =
(SexpPkl.rd_list sexp_rd_export s_)
and sexp_rd_import_list s_ =
(SexpPkl.rd_list sexp_rd_import s_)
and sexp_rd_ty_option s_ =
(SexpPkl.rd_option sexp_rd_ty s_)
and sexp_rd_expr_list s_ =
(SexpPkl.rd_list sexp_rd_expr s_)
and sexp_rd_expr_option s_ =
(SexpPkl.rd_option sexp_rd_expr s_)
and sexp_rd_datum_list s_ =
(SexpPkl.rd_list sexp_rd_datum s_)
and sexp_rd_section_list s_ =
(SexpPkl.rd_list sexp_rd_section s_)
and sexp_rd_toplevel_list s_ =
(SexpPkl.rd_list sexp_rd_toplevel s_)
and sexp_rd_in_alias_list s_ =
(SexpPkl.rd_list sexp_rd_in_alias s_)
and sexp_rd_aligned_option s_ =
(SexpPkl.rd_option sexp_rd_aligned s_)
and sexp_rd_target_list s_ =
(SexpPkl.rd_list sexp_rd_target s_)
and sexp_rd_reg_option s_ =
(SexpPkl.rd_option sexp_rd_reg s_)
and sexp_rd_hint_option s_ =
(SexpPkl.rd_option sexp_rd_hint s_)
and sexp_rd_conv_option s_ =
(SexpPkl.rd_option sexp_rd_conv s_)
and sexp_rd_name_list s_ =
(SexpPkl.rd_list sexp_rd_name s_)
and sexp_wr_name x_ s_ =
(match (x_) with
((string1) : Ast.name) -> begin
(SexpPkl.wr_lp s_);
(SexpPkl.wr_sym "ast_name" s_);
(StdPrimsUtil.sexp_wr_std_string string1 s_);
(SexpPkl.wr_rp s_)
end)
(* end match *)
and sexp_wr_conv x_ s_ =
(match (x_) with
((string1) : Ast.conv) -> begin
(SexpPkl.wr_lp s_);
(SexpPkl.wr_sym "ast_conv" s_);
(StdPrimsUtil.sexp_wr_std_string string1 s_);
(SexpPkl.wr_rp s_)
end)
(* end match *)
and sexp_wr_hint x_ s_ =
(match (x_) with
((string1) : Ast.hint) -> begin
(SexpPkl.wr_lp s_);
(SexpPkl.wr_sym "ast_hint" s_);
(StdPrimsUtil.sexp_wr_std_string string1 s_);
(SexpPkl.wr_rp s_)
end)
(* end match *)
and sexp_wr_reg x_ s_ =
(match (x_) with
((string1) : Ast.reg) -> begin
(SexpPkl.wr_lp s_);
(SexpPkl.wr_sym "ast_reg" s_);
(StdPrimsUtil.sexp_wr_std_string string1 s_);
(SexpPkl.wr_rp s_)
end)
(* end match *)
and sexp_wr_target x_ s_ =
(match (x_) with
((string1) : Ast.target) -> begin
(SexpPkl.wr_lp s_);
(SexpPkl.wr_sym "ast_target" s_);
(StdPrimsUtil.sexp_wr_std_string string1 s_);
(SexpPkl.wr_rp s_)
end)
(* end match *)
and sexp_wr_alias_set x_ s_ =
(match (x_) with
((string1) : Ast.alias_set) -> begin
(SexpPkl.wr_lp s_);
(SexpPkl.wr_sym "ast_alias_set" s_);
(StdPrimsUtil.sexp_wr_std_string string1 s_);
(SexpPkl.wr_rp s_)
end)
(* end match *)
and sexp_wr_size x_ s_ =
(match (x_) with
((int1) : Ast.size) -> begin
(SexpPkl.wr_lp s_);
(SexpPkl.wr_sym "ast_size" s_);
(StdPrimsUtil.sexp_wr_std_int int1 s_);
(SexpPkl.wr_rp s_)
end)
(* end match *)
and sexp_wr_align x_ s_ =
(match (x_) with
((int1) : Ast.align) -> begin
(SexpPkl.wr_lp s_);
(SexpPkl.wr_sym "ast_align" s_);
(StdPrimsUtil.sexp_wr_std_int int1 s_);
(SexpPkl.wr_rp s_)
end)
(* end match *)
and sexp_wr_aligned x_ s_ =
(match (x_) with
((int1) : Ast.aligned) -> begin
(SexpPkl.wr_lp s_);
(SexpPkl.wr_sym "ast_aligned" s_);
(StdPrimsUtil.sexp_wr_std_int int1 s_);
(SexpPkl.wr_rp s_)
end)
(* end match *)
and sexp_wr_in_alias x_ s_ =
(match (x_) with
((string1) : Ast.in_alias) -> begin
(SexpPkl.wr_lp s_);
(SexpPkl.wr_sym "ast_in_alias" s_);
(StdPrimsUtil.sexp_wr_std_string string1 s_);
(SexpPkl.wr_rp s_)
end)
(* end match *)
and sexp_wr_op x_ s_ =
(match (x_) with
((string1) : Ast.op) -> begin
(SexpPkl.wr_lp s_);
(SexpPkl.wr_sym "ast_op" s_);
(StdPrimsUtil.sexp_wr_std_string string1 s_);
(SexpPkl.wr_rp s_)
end)
(* end match *)
and sexp_wr_region x_ s_ =
(match (x_) with
((int1, int2) : Ast.region) -> begin
(SexpPkl.wr_lp s_);
(SexpPkl.wr_sym "ast_region" s_);
(StdPrimsUtil.sexp_wr_std_int int1 s_);
(StdPrimsUtil.sexp_wr_std_int int2 s_);
(SexpPkl.wr_rp s_)
end)
(* end match *)
and sexp_wr_ty x_ s_ =
(match (x_) with
(Ast.TyAt(ty1, region1)) -> begin
(SexpPkl.wr_lp s_);
(SexpPkl.wr_sym "ast_TyAt" s_);
(sexp_wr_ty ty1 s_);
(sexp_wr_region region1 s_);
(SexpPkl.wr_rp s_)
end
| (Ast.BitsTy(size1)) -> begin
(SexpPkl.wr_lp s_);
(SexpPkl.wr_sym "ast_BitsTy" s_);