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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
|
/* A Bison parser, made by GNU Bison 1.875c. */
/* Skeleton parser for Yacc-like parsing with Bison,
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* As a special exception, when this file is copied by Bison into a
Bison output file, you may use that output file without restriction.
This special exception was added by the Free Software Foundation
in version 1.24 of Bison. */
/* Written by Richard Stallman by simplifying the original so called
``semantic'' parser. */
/* All symbols defined below should begin with yy or YY, to avoid
infringing on user name space. This should be done even for local
variables, as they might otherwise be expanded by user macros.
There are some unavoidable exceptions within include files to
define necessary library symbols; they are noted "INFRINGES ON
USER NAME SPACE" below. */
/* Identify Bison output. */
#define YYBISON 1
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
/* Pure parsers. */
#define YYPURE 0
/* Using locations. */
#define YYLSP_NEEDED 0
/* If NAME_PREFIX is specified substitute the variables and functions
names. */
#define yyparse Upgradeparse
#define yylex Upgradelex
#define yyerror Upgradeerror
#define yylval Upgradelval
#define yychar Upgradechar
#define yydebug Upgradedebug
#define yynerrs Upgradenerrs
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
ESINT64VAL = 258,
EUINT64VAL = 259,
SINTVAL = 260,
UINTVAL = 261,
FPVAL = 262,
VOID = 263,
BOOL = 264,
SBYTE = 265,
UBYTE = 266,
SHORT = 267,
USHORT = 268,
INT = 269,
UINT = 270,
LONG = 271,
ULONG = 272,
FLOAT = 273,
DOUBLE = 274,
TYPE = 275,
LABEL = 276,
VAR_ID = 277,
LABELSTR = 278,
STRINGCONSTANT = 279,
IMPLEMENTATION = 280,
ZEROINITIALIZER = 281,
TRUETOK = 282,
FALSETOK = 283,
BEGINTOK = 284,
ENDTOK = 285,
DECLARE = 286,
GLOBAL = 287,
CONSTANT = 288,
SECTION = 289,
VOLATILE = 290,
TO = 291,
DOTDOTDOT = 292,
NULL_TOK = 293,
UNDEF = 294,
CONST = 295,
INTERNAL = 296,
LINKONCE = 297,
WEAK = 298,
APPENDING = 299,
DLLIMPORT = 300,
DLLEXPORT = 301,
EXTERN_WEAK = 302,
OPAQUE = 303,
NOT = 304,
EXTERNAL = 305,
TARGET = 306,
TRIPLE = 307,
ENDIAN = 308,
POINTERSIZE = 309,
LITTLE = 310,
BIG = 311,
ALIGN = 312,
DEPLIBS = 313,
CALL = 314,
TAIL = 315,
ASM_TOK = 316,
MODULE = 317,
SIDEEFFECT = 318,
CC_TOK = 319,
CCC_TOK = 320,
CSRETCC_TOK = 321,
FASTCC_TOK = 322,
COLDCC_TOK = 323,
X86_STDCALLCC_TOK = 324,
X86_FASTCALLCC_TOK = 325,
DATALAYOUT = 326,
RET = 327,
BR = 328,
SWITCH = 329,
INVOKE = 330,
UNREACHABLE = 331,
UNWIND = 332,
EXCEPT = 333,
ADD = 334,
SUB = 335,
MUL = 336,
DIV = 337,
UDIV = 338,
SDIV = 339,
FDIV = 340,
REM = 341,
UREM = 342,
SREM = 343,
FREM = 344,
AND = 345,
OR = 346,
XOR = 347,
SHL = 348,
SHR = 349,
ASHR = 350,
LSHR = 351,
SETLE = 352,
SETGE = 353,
SETLT = 354,
SETGT = 355,
SETEQ = 356,
SETNE = 357,
ICMP = 358,
FCMP = 359,
MALLOC = 360,
ALLOCA = 361,
FREE = 362,
LOAD = 363,
STORE = 364,
GETELEMENTPTR = 365,
PHI_TOK = 366,
SELECT = 367,
VAARG = 368,
EXTRACTELEMENT = 369,
INSERTELEMENT = 370,
SHUFFLEVECTOR = 371,
VAARG_old = 372,
VANEXT_old = 373,
EQ = 374,
NE = 375,
SLT = 376,
SGT = 377,
SLE = 378,
SGE = 379,
ULT = 380,
UGT = 381,
ULE = 382,
UGE = 383,
OEQ = 384,
ONE = 385,
OLT = 386,
OGT = 387,
OLE = 388,
OGE = 389,
ORD = 390,
UNO = 391,
UEQ = 392,
UNE = 393,
CAST = 394,
TRUNC = 395,
ZEXT = 396,
SEXT = 397,
FPTRUNC = 398,
FPEXT = 399,
FPTOUI = 400,
FPTOSI = 401,
UITOFP = 402,
SITOFP = 403,
PTRTOINT = 404,
INTTOPTR = 405,
BITCAST = 406
};
#endif
#define ESINT64VAL 258
#define EUINT64VAL 259
#define SINTVAL 260
#define UINTVAL 261
#define FPVAL 262
#define VOID 263
#define BOOL 264
#define SBYTE 265
#define UBYTE 266
#define SHORT 267
#define USHORT 268
#define INT 269
#define UINT 270
#define LONG 271
#define ULONG 272
#define FLOAT 273
#define DOUBLE 274
#define TYPE 275
#define LABEL 276
#define VAR_ID 277
#define LABELSTR 278
#define STRINGCONSTANT 279
#define IMPLEMENTATION 280
#define ZEROINITIALIZER 281
#define TRUETOK 282
#define FALSETOK 283
#define BEGINTOK 284
#define ENDTOK 285
#define DECLARE 286
#define GLOBAL 287
#define CONSTANT 288
#define SECTION 289
#define VOLATILE 290
#define TO 291
#define DOTDOTDOT 292
#define NULL_TOK 293
#define UNDEF 294
#define CONST 295
#define INTERNAL 296
#define LINKONCE 297
#define WEAK 298
#define APPENDING 299
#define DLLIMPORT 300
#define DLLEXPORT 301
#define EXTERN_WEAK 302
#define OPAQUE 303
#define NOT 304
#define EXTERNAL 305
#define TARGET 306
#define TRIPLE 307
#define ENDIAN 308
#define POINTERSIZE 309
#define LITTLE 310
#define BIG 311
#define ALIGN 312
#define DEPLIBS 313
#define CALL 314
#define TAIL 315
#define ASM_TOK 316
#define MODULE 317
#define SIDEEFFECT 318
#define CC_TOK 319
#define CCC_TOK 320
#define CSRETCC_TOK 321
#define FASTCC_TOK 322
#define COLDCC_TOK 323
#define X86_STDCALLCC_TOK 324
#define X86_FASTCALLCC_TOK 325
#define DATALAYOUT 326
#define RET 327
#define BR 328
#define SWITCH 329
#define INVOKE 330
#define UNREACHABLE 331
#define UNWIND 332
#define EXCEPT 333
#define ADD 334
#define SUB 335
#define MUL 336
#define DIV 337
#define UDIV 338
#define SDIV 339
#define FDIV 340
#define REM 341
#define UREM 342
#define SREM 343
#define FREM 344
#define AND 345
#define OR 346
#define XOR 347
#define SHL 348
#define SHR 349
#define ASHR 350
#define LSHR 351
#define SETLE 352
#define SETGE 353
#define SETLT 354
#define SETGT 355
#define SETEQ 356
#define SETNE 357
#define ICMP 358
#define FCMP 359
#define MALLOC 360
#define ALLOCA 361
#define FREE 362
#define LOAD 363
#define STORE 364
#define GETELEMENTPTR 365
#define PHI_TOK 366
#define SELECT 367
#define VAARG 368
#define EXTRACTELEMENT 369
#define INSERTELEMENT 370
#define SHUFFLEVECTOR 371
#define VAARG_old 372
#define VANEXT_old 373
#define EQ 374
#define NE 375
#define SLT 376
#define SGT 377
#define SLE 378
#define SGE 379
#define ULT 380
#define UGT 381
#define ULE 382
#define UGE 383
#define OEQ 384
#define ONE 385
#define OLT 386
#define OGT 387
#define OLE 388
#define OGE 389
#define ORD 390
#define UNO 391
#define UEQ 392
#define UNE 393
#define CAST 394
#define TRUNC 395
#define ZEXT 396
#define SEXT 397
#define FPTRUNC 398
#define FPEXT 399
#define FPTOUI 400
#define FPTOSI 401
#define UITOFP 402
#define SITOFP 403
#define PTRTOINT 404
#define INTTOPTR 405
#define BITCAST 406
/* Copy the first part of user declarations. */
#line 14 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
#include "UpgradeInternals.h"
#include "llvm/CallingConv.h"
#include "llvm/InlineAsm.h"
#include "llvm/Instructions.h"
#include "llvm/Module.h"
#include "llvm/ParameterAttributes.h"
#include "llvm/ValueSymbolTable.h"
#include "llvm/Support/GetElementPtrTypeIterator.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/MathExtras.h"
#include <algorithm>
#include <iostream>
#include <map>
#include <list>
#include <utility>
// DEBUG_UPREFS - Define this symbol if you want to enable debugging output
// relating to upreferences in the input stream.
//
//#define DEBUG_UPREFS 1
#ifdef DEBUG_UPREFS
#define UR_OUT(X) std::cerr << X
#else
#define UR_OUT(X)
#endif
#define YYERROR_VERBOSE 1
#define YYINCLUDED_STDLIB_H
#define YYDEBUG 1
int yylex();
int yyparse();
int yyerror(const char*);
static void warning(const std::string& WarningMsg);
namespace llvm {
std::istream* LexInput;
static std::string CurFilename;
// This bool controls whether attributes are ever added to function declarations
// definitions and calls.
static bool AddAttributes = false;
static Module *ParserResult;
static bool ObsoleteVarArgs;
static bool NewVarArgs;
static BasicBlock *CurBB;
static GlobalVariable *CurGV;
static unsigned lastCallingConv;
// This contains info used when building the body of a function. It is
// destroyed when the function is completed.
//
typedef std::vector<Value *> ValueList; // Numbered defs
typedef std::pair<std::string,TypeInfo> RenameMapKey;
typedef std::map<RenameMapKey,std::string> RenameMapType;
static void
ResolveDefinitions(std::map<const Type *,ValueList> &LateResolvers,
std::map<const Type *,ValueList> *FutureLateResolvers = 0);
static struct PerModuleInfo {
Module *CurrentModule;
std::map<const Type *, ValueList> Values; // Module level numbered definitions
std::map<const Type *,ValueList> LateResolveValues;
std::vector<PATypeHolder> Types;
std::vector<Signedness> TypeSigns;
std::map<std::string,Signedness> NamedTypeSigns;
std::map<std::string,Signedness> NamedValueSigns;
std::map<ValID, PATypeHolder> LateResolveTypes;
static Module::Endianness Endian;
static Module::PointerSize PointerSize;
RenameMapType RenameMap;
/// PlaceHolderInfo - When temporary placeholder objects are created, remember
/// how they were referenced and on which line of the input they came from so
/// that we can resolve them later and print error messages as appropriate.
std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
// GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
// references to global values. Global values may be referenced before they
// are defined, and if so, the temporary object that they represent is held
// here. This is used for forward references of GlobalValues.
//
typedef std::map<std::pair<const PointerType *, ValID>, GlobalValue*>
GlobalRefsType;
GlobalRefsType GlobalRefs;
void ModuleDone() {
// If we could not resolve some functions at function compilation time
// (calls to functions before they are defined), resolve them now... Types
// are resolved when the constant pool has been completely parsed.
//
ResolveDefinitions(LateResolveValues);
// Check to make sure that all global value forward references have been
// resolved!
//
if (!GlobalRefs.empty()) {
std::string UndefinedReferences = "Unresolved global references exist:\n";
for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
I != E; ++I) {
UndefinedReferences += " " + I->first.first->getDescription() + " " +
I->first.second.getName() + "\n";
}
error(UndefinedReferences);
return;
}
if (CurrentModule->getDataLayout().empty()) {
std::string dataLayout;
if (Endian != Module::AnyEndianness)
dataLayout.append(Endian == Module::BigEndian ? "E" : "e");
if (PointerSize != Module::AnyPointerSize) {
if (!dataLayout.empty())
dataLayout += "-";
dataLayout.append(PointerSize == Module::Pointer64 ?
"p:64:64" : "p:32:32");
}
CurrentModule->setDataLayout(dataLayout);
}
Values.clear(); // Clear out function local definitions
Types.clear();
TypeSigns.clear();
NamedTypeSigns.clear();
NamedValueSigns.clear();
CurrentModule = 0;
}
// GetForwardRefForGlobal - Check to see if there is a forward reference
// for this global. If so, remove it from the GlobalRefs map and return it.
// If not, just return null.
GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
// Check to see if there is a forward reference to this global variable...
// if there is, eliminate it and patch the reference to use the new def'n.
GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
GlobalValue *Ret = 0;
if (I != GlobalRefs.end()) {
Ret = I->second;
GlobalRefs.erase(I);
}
return Ret;
}
void setEndianness(Module::Endianness E) { Endian = E; }
void setPointerSize(Module::PointerSize sz) { PointerSize = sz; }
} CurModule;
Module::Endianness PerModuleInfo::Endian = Module::AnyEndianness;
Module::PointerSize PerModuleInfo::PointerSize = Module::AnyPointerSize;
static struct PerFunctionInfo {
Function *CurrentFunction; // Pointer to current function being created
std::map<const Type*, ValueList> Values; // Keep track of #'d definitions
std::map<const Type*, ValueList> LateResolveValues;
bool isDeclare; // Is this function a forward declararation?
GlobalValue::LinkageTypes Linkage;// Linkage for forward declaration.
/// BBForwardRefs - When we see forward references to basic blocks, keep
/// track of them here.
std::map<BasicBlock*, std::pair<ValID, int> > BBForwardRefs;
std::vector<BasicBlock*> NumberedBlocks;
RenameMapType RenameMap;
unsigned NextBBNum;
inline PerFunctionInfo() {
CurrentFunction = 0;
isDeclare = false;
Linkage = GlobalValue::ExternalLinkage;
}
inline void FunctionStart(Function *M) {
CurrentFunction = M;
NextBBNum = 0;
}
void FunctionDone() {
NumberedBlocks.clear();
// Any forward referenced blocks left?
if (!BBForwardRefs.empty()) {
error("Undefined reference to label " +
BBForwardRefs.begin()->first->getName());
return;
}
// Resolve all forward references now.
ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
Values.clear(); // Clear out function local definitions
RenameMap.clear();
CurrentFunction = 0;
isDeclare = false;
Linkage = GlobalValue::ExternalLinkage;
}
} CurFun; // Info for the current function...
static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
/// This function is just a utility to make a Key value for the rename map.
/// The Key is a combination of the name, type, Signedness of the original
/// value (global/function). This just constructs the key and ensures that
/// named Signedness values are resolved to the actual Signedness.
/// @brief Make a key for the RenameMaps
static RenameMapKey makeRenameMapKey(const std::string &Name, const Type* Ty,
const Signedness &Sign) {
TypeInfo TI;
TI.T = Ty;
if (Sign.isNamed())
// Don't allow Named Signedness nodes because they won't match. The actual
// Signedness must be looked up in the NamedTypeSigns map.
TI.S.copy(CurModule.NamedTypeSigns[Sign.getName()]);
else
TI.S.copy(Sign);
return std::make_pair(Name, TI);
}
//===----------------------------------------------------------------------===//
// Code to handle definitions of all the types
//===----------------------------------------------------------------------===//
static int InsertValue(Value *V,
std::map<const Type*,ValueList> &ValueTab = CurFun.Values) {
if (V->hasName()) return -1; // Is this a numbered definition?
// Yes, insert the value into the value table...
ValueList &List = ValueTab[V->getType()];
List.push_back(V);
return List.size()-1;
}
static const Type *getType(const ValID &D, bool DoNotImprovise = false) {
switch (D.Type) {
case ValID::NumberVal: // Is it a numbered definition?
// Module constants occupy the lowest numbered slots...
if ((unsigned)D.Num < CurModule.Types.size()) {
return CurModule.Types[(unsigned)D.Num];
}
break;
case ValID::NameVal: // Is it a named definition?
if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) {
return N;
}
break;
default:
error("Internal parser error: Invalid symbol type reference");
return 0;
}
// If we reached here, we referenced either a symbol that we don't know about
// or an id number that hasn't been read yet. We may be referencing something
// forward, so just create an entry to be resolved later and get to it...
//
if (DoNotImprovise) return 0; // Do we just want a null to be returned?
if (inFunctionScope()) {
if (D.Type == ValID::NameVal) {
error("Reference to an undefined type: '" + D.getName() + "'");
return 0;
} else {
error("Reference to an undefined type: #" + itostr(D.Num));
return 0;
}
}
std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
if (I != CurModule.LateResolveTypes.end())
return I->second;
Type *Typ = OpaqueType::get();
CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
return Typ;
}
/// This is like the getType method except that instead of looking up the type
/// for a given ID, it looks up that type's sign.
/// @brief Get the signedness of a referenced type
static Signedness getTypeSign(const ValID &D) {
switch (D.Type) {
case ValID::NumberVal: // Is it a numbered definition?
// Module constants occupy the lowest numbered slots...
if ((unsigned)D.Num < CurModule.TypeSigns.size()) {
return CurModule.TypeSigns[(unsigned)D.Num];
}
break;
case ValID::NameVal: { // Is it a named definition?
std::map<std::string,Signedness>::const_iterator I =
CurModule.NamedTypeSigns.find(D.Name);
if (I != CurModule.NamedTypeSigns.end())
return I->second;
// Perhaps its a named forward .. just cache the name
Signedness S;
S.makeNamed(D.Name);
return S;
}
default:
break;
}
// If we don't find it, its signless
Signedness S;
S.makeSignless();
return S;
}
/// This function is analagous to getElementType in LLVM. It provides the same
/// function except that it looks up the Signedness instead of the type. This is
/// used when processing GEP instructions that need to extract the type of an
/// indexed struct/array/ptr member.
/// @brief Look up an element's sign.
static Signedness getElementSign(const ValueInfo& VI,
const std::vector<Value*> &Indices) {
const Type *Ptr = VI.V->getType();
assert(isa<PointerType>(Ptr) && "Need pointer type");
unsigned CurIdx = 0;
Signedness S(VI.S);
while (const CompositeType *CT = dyn_cast<CompositeType>(Ptr)) {
if (CurIdx == Indices.size())
break;
Value *Index = Indices[CurIdx++];
assert(!isa<PointerType>(CT) || CurIdx == 1 && "Invalid type");
Ptr = CT->getTypeAtIndex(Index);
if (const Type* Ty = Ptr->getForwardedType())
Ptr = Ty;
assert(S.isComposite() && "Bad Signedness type");
if (isa<StructType>(CT)) {
S = S.get(cast<ConstantInt>(Index)->getZExtValue());
} else {
S = S.get(0UL);
}
if (S.isNamed())
S = CurModule.NamedTypeSigns[S.getName()];
}
Signedness Result;
Result.makeComposite(S);
return Result;
}
/// This function just translates a ConstantInfo into a ValueInfo and calls
/// getElementSign(ValueInfo,...). Its just a convenience.
/// @brief ConstantInfo version of getElementSign.
static Signedness getElementSign(const ConstInfo& CI,
const std::vector<Constant*> &Indices) {
ValueInfo VI;
VI.V = CI.C;
VI.S.copy(CI.S);
std::vector<Value*> Idx;
for (unsigned i = 0; i < Indices.size(); ++i)
Idx.push_back(Indices[i]);
Signedness result = getElementSign(VI, Idx);
VI.destroy();
return result;
}
/// This function determines if two function types differ only in their use of
/// the sret parameter attribute in the first argument. If they are identical
/// in all other respects, it returns true. Otherwise, it returns false.
static bool FuncTysDifferOnlyBySRet(const FunctionType *F1,
const FunctionType *F2) {
if (F1->getReturnType() != F2->getReturnType() ||
F1->getNumParams() != F2->getNumParams())
return false;
const ParamAttrsList *PAL1 = F1->getParamAttrs();
const ParamAttrsList *PAL2 = F2->getParamAttrs();
if (PAL1 && !PAL2 || PAL2 && !PAL1)
return false;
if (PAL1 && PAL2 && ((PAL1->size() != PAL2->size()) ||
(PAL1->getParamAttrs(0) != PAL2->getParamAttrs(0))))
return false;
unsigned SRetMask = ~unsigned(ParamAttr::StructRet);
for (unsigned i = 0; i < F1->getNumParams(); ++i) {
if (F1->getParamType(i) != F2->getParamType(i) || (PAL1 && PAL2 &&
(unsigned(PAL1->getParamAttrs(i+1)) & SRetMask !=
unsigned(PAL2->getParamAttrs(i+1)) & SRetMask)))
return false;
}
return true;
}
/// This function determines if the type of V and Ty differ only by the SRet
/// parameter attribute. This is a more generalized case of
/// FuncTysDIfferOnlyBySRet since it doesn't require FunctionType arguments.
static bool TypesDifferOnlyBySRet(Value *V, const Type* Ty) {
if (V->getType() == Ty)
return true;
const PointerType *PF1 = dyn_cast<PointerType>(Ty);
const PointerType *PF2 = dyn_cast<PointerType>(V->getType());
if (PF1 && PF2) {
const FunctionType* FT1 = dyn_cast<FunctionType>(PF1->getElementType());
const FunctionType* FT2 = dyn_cast<FunctionType>(PF2->getElementType());
if (FT1 && FT2)
return FuncTysDifferOnlyBySRet(FT1, FT2);
}
return false;
}
// The upgrade of csretcc to sret param attribute may have caused a function
// to not be found because the param attribute changed the type of the called
// function. This helper function, used in getExistingValue, detects that
// situation and bitcasts the function to the correct type.
static Value* handleSRetFuncTypeMerge(Value *V, const Type* Ty) {
// Handle degenerate cases
if (!V)
return 0;
if (V->getType() == Ty)
return V;
const PointerType *PF1 = dyn_cast<PointerType>(Ty);
const PointerType *PF2 = dyn_cast<PointerType>(V->getType());
if (PF1 && PF2) {
const FunctionType *FT1 = dyn_cast<FunctionType>(PF1->getElementType());
const FunctionType *FT2 = dyn_cast<FunctionType>(PF2->getElementType());
if (FT1 && FT2 && FuncTysDifferOnlyBySRet(FT1, FT2)) {
const ParamAttrsList *PAL2 = FT2->getParamAttrs();
if (PAL2 && PAL2->paramHasAttr(1, ParamAttr::StructRet))
return V;
else if (Constant *C = dyn_cast<Constant>(V))
return ConstantExpr::getBitCast(C, PF1);
else
return new BitCastInst(V, PF1, "upgrd.cast", CurBB);
}
}
return 0;
}
// getExistingValue - Look up the value specified by the provided type and
// the provided ValID. If the value exists and has already been defined, return
// it. Otherwise return null.
//
static Value *getExistingValue(const Type *Ty, const ValID &D) {
if (isa<FunctionType>(Ty)) {
error("Functions are not values and must be referenced as pointers");
}
switch (D.Type) {
case ValID::NumberVal: { // Is it a numbered definition?
unsigned Num = (unsigned)D.Num;
// Module constants occupy the lowest numbered slots...
std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty);
if (VI != CurModule.Values.end()) {
if (Num < VI->second.size())
return VI->second[Num];
Num -= VI->second.size();
}
// Make sure that our type is within bounds
VI = CurFun.Values.find(Ty);
if (VI == CurFun.Values.end()) return 0;
// Check that the number is within bounds...
if (VI->second.size() <= Num) return 0;
return VI->second[Num];
}
case ValID::NameVal: { // Is it a named definition?
// Get the name out of the ID
RenameMapKey Key = makeRenameMapKey(D.Name, Ty, D.S);
Value *V = 0;
if (inFunctionScope()) {
// See if the name was renamed
RenameMapType::const_iterator I = CurFun.RenameMap.find(Key);
std::string LookupName;
if (I != CurFun.RenameMap.end())
LookupName = I->second;
else
LookupName = D.Name;
ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
V = SymTab.lookup(LookupName);
if (V && V->getType() != Ty)
V = handleSRetFuncTypeMerge(V, Ty);
assert((!V || TypesDifferOnlyBySRet(V, Ty)) && "Found wrong type");
}
if (!V) {
RenameMapType::const_iterator I = CurModule.RenameMap.find(Key);
std::string LookupName;
if (I != CurModule.RenameMap.end())
LookupName = I->second;
else
LookupName = D.Name;
V = CurModule.CurrentModule->getValueSymbolTable().lookup(LookupName);
if (V && V->getType() != Ty)
V = handleSRetFuncTypeMerge(V, Ty);
assert((!V || TypesDifferOnlyBySRet(V, Ty)) && "Found wrong type");
}
if (!V)
return 0;
D.destroy(); // Free old strdup'd memory...
return V;
}
// Check to make sure that "Ty" is an integral type, and that our
// value will fit into the specified type...
case ValID::ConstSIntVal: // Is it a constant pool reference??
if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
error("Signed integral constant '" + itostr(D.ConstPool64) +
"' is invalid for type '" + Ty->getDescription() + "'");
}
return ConstantInt::get(Ty, D.ConstPool64);
case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64))
error("Integral constant '" + utostr(D.UConstPool64) +
"' is invalid or out of range");
else // This is really a signed reference. Transmogrify.
return ConstantInt::get(Ty, D.ConstPool64);
} else
return ConstantInt::get(Ty, D.UConstPool64);
case ValID::ConstFPVal: // Is it a floating point const pool reference?
if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP))
error("FP constant invalid for type");
return ConstantFP::get(Ty, D.ConstPoolFP);
case ValID::ConstNullVal: // Is it a null value?
if (!isa<PointerType>(Ty))
error("Cannot create a a non pointer null");
return ConstantPointerNull::get(cast<PointerType>(Ty));
case ValID::ConstUndefVal: // Is it an undef value?
return UndefValue::get(Ty);
case ValID::ConstZeroVal: // Is it a zero value?
return Constant::getNullValue(Ty);
case ValID::ConstantVal: // Fully resolved constant?
if (D.ConstantValue->getType() != Ty)
error("Constant expression type different from required type");
return D.ConstantValue;
case ValID::InlineAsmVal: { // Inline asm expression
const PointerType *PTy = dyn_cast<PointerType>(Ty);
const FunctionType *FTy =
PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints))
error("Invalid type for asm constraint string");
InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
D.IAD->HasSideEffects);
D.destroy(); // Free InlineAsmDescriptor.
return IA;
}
default:
assert(0 && "Unhandled case");
return 0;
} // End of switch
assert(0 && "Unhandled case");
return 0;
}
// getVal - This function is identical to getExistingValue, except that if a
// value is not already defined, it "improvises" by creating a placeholder var
// that looks and acts just like the requested variable. When the value is
// defined later, all uses of the placeholder variable are replaced with the
// real thing.
//
static Value *getVal(const Type *Ty, const ValID &ID) {
if (Ty == Type::LabelTy)
error("Cannot use a basic block here");
// See if the value has already been defined.
Value *V = getExistingValue(Ty, ID);
if (V) return V;
if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty))
error("Invalid use of a composite type");
// If we reached here, we referenced either a symbol that we don't know about
// or an id number that hasn't been read yet. We may be referencing something
// forward, so just create an entry to be resolved later and get to it...
V = new Argument(Ty);
// Remember where this forward reference came from. FIXME, shouldn't we try
// to recycle these things??
CurModule.PlaceHolderInfo.insert(
std::make_pair(V, std::make_pair(ID, Upgradelineno)));
if (inFunctionScope())
InsertValue(V, CurFun.LateResolveValues);
else
InsertValue(V, CurModule.LateResolveValues);
return V;
}
/// @brief This just makes any name given to it unique, up to MAX_UINT times.
static std::string makeNameUnique(const std::string& Name) {
static unsigned UniqueNameCounter = 1;
std::string Result(Name);
Result += ".upgrd." + llvm::utostr(UniqueNameCounter++);
return Result;
}
/// getBBVal - This is used for two purposes:
/// * If isDefinition is true, a new basic block with the specified ID is being
/// defined.
/// * If isDefinition is true, this is a reference to a basic block, which may
/// or may not be a forward reference.
///
static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) {
assert(inFunctionScope() && "Can't get basic block at global scope");
std::string Name;
BasicBlock *BB = 0;
switch (ID.Type) {
default:
error("Illegal label reference " + ID.getName());
break;
case ValID::NumberVal: // Is it a numbered definition?
if (unsigned(ID.Num) >= CurFun.NumberedBlocks.size())
CurFun.NumberedBlocks.resize(ID.Num+1);
BB = CurFun.NumberedBlocks[ID.Num];
break;
case ValID::NameVal: // Is it a named definition?
Name = ID.Name;
if (Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name)) {
if (N->getType() != Type::LabelTy) {
// Register names didn't use to conflict with basic block names
// because of type planes. Now they all have to be unique. So, we just
// rename the register and treat this name as if no basic block
// had been found.
RenameMapKey Key = makeRenameMapKey(ID.Name, N->getType(), ID.S);
N->setName(makeNameUnique(N->getName()));
CurModule.RenameMap[Key] = N->getName();
BB = 0;
} else {
BB = cast<BasicBlock>(N);
}
}
break;
}
// See if the block has already been defined.
if (BB) {
// If this is the definition of the block, make sure the existing value was
// just a forward reference. If it was a forward reference, there will be
// an entry for it in the PlaceHolderInfo map.
if (isDefinition && !CurFun.BBForwardRefs.erase(BB))
// The existing value was a definition, not a forward reference.
error("Redefinition of label " + ID.getName());
ID.destroy(); // Free strdup'd memory.
return BB;
}
// Otherwise this block has not been seen before.
BB = new BasicBlock("", CurFun.CurrentFunction);
if (ID.Type == ValID::NameVal) {
BB->setName(ID.Name);
} else {
CurFun.NumberedBlocks[ID.Num] = BB;
}
// If this is not a definition, keep track of it so we can use it as a forward
// reference.
if (!isDefinition) {
// Remember where this forward reference came from.
CurFun.BBForwardRefs[BB] = std::make_pair(ID, Upgradelineno);
} else {
// The forward declaration could have been inserted anywhere in the
// function: insert it into the correct place now.
CurFun.CurrentFunction->getBasicBlockList().remove(BB);
CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
}
ID.destroy();
return BB;
}
//===----------------------------------------------------------------------===//
// Code to handle forward references in instructions
//===----------------------------------------------------------------------===//
//
// This code handles the late binding needed with statements that reference
// values not defined yet... for example, a forward branch, or the PHI node for
// a loop body.
//
// This keeps a table (CurFun.LateResolveValues) of all such forward references
// and back patchs after we are done.
//
// ResolveDefinitions - If we could not resolve some defs at parsing
// time (forward branches, phi functions for loops, etc...) resolve the
// defs now...
//
static void
ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers,
std::map<const Type*,ValueList> *FutureLateResolvers) {
// Loop over LateResolveDefs fixing up stuff that couldn't be resolved
for (std::map<const Type*,ValueList>::iterator LRI = LateResolvers.begin(),
E = LateResolvers.end(); LRI != E; ++LRI) {
const Type* Ty = LRI->first;
ValueList &List = LRI->second;
while (!List.empty()) {
Value *V = List.back();
List.pop_back();
std::map<Value*, std::pair<ValID, int> >::iterator PHI =
CurModule.PlaceHolderInfo.find(V);
assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error");
ValID &DID = PHI->second.first;
Value *TheRealValue = getExistingValue(Ty, DID);
if (TheRealValue) {
V->replaceAllUsesWith(TheRealValue);
delete V;
CurModule.PlaceHolderInfo.erase(PHI);
} else if (FutureLateResolvers) {
// Functions have their unresolved items forwarded to the module late
// resolver table
InsertValue(V, *FutureLateResolvers);
} else {
if (DID.Type == ValID::NameVal) {
error("Reference to an invalid definition: '" + DID.getName() +
"' of type '" + V->getType()->getDescription() + "'",
PHI->second.second);
return;
} else {
error("Reference to an invalid definition: #" +
itostr(DID.Num) + " of type '" +
V->getType()->getDescription() + "'", PHI->second.second);
return;
}
}
}
}
LateResolvers.clear();
}
/// This function is used for type resolution and upref handling. When a type
/// becomes concrete, this function is called to adjust the signedness for the
/// concrete type.
static void ResolveTypeSign(const Type* oldTy, const Signedness &Sign) {
std::string TyName = CurModule.CurrentModule->getTypeName(oldTy);
if (!TyName.empty())
CurModule.NamedTypeSigns[TyName] = Sign;
}
/// ResolveTypeTo - A brand new type was just declared. This means that (if
/// name is not null) things referencing Name can be resolved. Otherwise,
/// things refering to the number can be resolved. Do this now.
static void ResolveTypeTo(char *Name, const Type *ToTy, const Signedness& Sign){
ValID D;
if (Name)
D = ValID::create(Name);
else
D = ValID::create((int)CurModule.Types.size());
D.S.copy(Sign);
if (Name)
CurModule.NamedTypeSigns[Name] = Sign;
std::map<ValID, PATypeHolder>::iterator I =
CurModule.LateResolveTypes.find(D);
if (I != CurModule.LateResolveTypes.end()) {
const Type *OldTy = I->second.get();
((DerivedType*)OldTy)->refineAbstractTypeTo(ToTy);
CurModule.LateResolveTypes.erase(I);
}
}
/// This is the implementation portion of TypeHasInteger. It traverses the
/// type given, avoiding recursive types, and returns true as soon as it finds
/// an integer type. If no integer type is found, it returns false.
static bool TypeHasIntegerI(const Type *Ty, std::vector<const Type*> Stack) {
// Handle some easy cases
if (Ty->isPrimitiveType() || (Ty->getTypeID() == Type::OpaqueTyID))
return false;
if (Ty->isInteger())
return true;
if (const SequentialType *STy = dyn_cast<SequentialType>(Ty))
return STy->getElementType()->isInteger();
// Avoid type structure recursion
for (std::vector<const Type*>::iterator I = Stack.begin(), E = Stack.end();
I != E; ++I)
if (Ty == *I)
return false;
// Push us on the type stack
Stack.push_back(Ty);
if (const FunctionType *FTy = dyn_cast<FunctionType>(Ty)) {
if (TypeHasIntegerI(FTy->getReturnType(), Stack))
return true;
FunctionType::param_iterator I = FTy->param_begin();
FunctionType::param_iterator E = FTy->param_end();
for (; I != E; ++I)
if (TypeHasIntegerI(*I, Stack))
return true;
return false;
} else if (const StructType *STy = dyn_cast<StructType>(Ty)) {
StructType::element_iterator I = STy->element_begin();
StructType::element_iterator E = STy->element_end();
for (; I != E; ++I) {
if (TypeHasIntegerI(*I, Stack))
return true;
}
return false;
}
// There shouldn't be anything else, but its definitely not integer
assert(0 && "What type is this?");
return false;
}
/// This is the interface to TypeHasIntegerI. It just provides the type stack,
/// to avoid recursion, and then calls TypeHasIntegerI.
static inline bool TypeHasInteger(const Type *Ty) {
std::vector<const Type*> TyStack;
return TypeHasIntegerI(Ty, TyStack);
}
// setValueName - Set the specified value to the name given. The name may be
// null potentially, in which case this is a noop. The string passed in is
// assumed to be a malloc'd string buffer, and is free'd by this function.
//
static void setValueName(const ValueInfo &V, char *NameStr) {
if (NameStr) {
std::string Name(NameStr); // Copy string
free(NameStr); // Free old string
if (V.V->getType() == Type::VoidTy) {
error("Can't assign name '" + Name + "' to value with void type");
return;
}
assert(inFunctionScope() && "Must be in function scope");
// Search the function's symbol table for an existing value of this name
ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
Value* Existing = ST.lookup(Name);
if (Existing) {
// An existing value of the same name was found. This might have happened
// because of the integer type planes collapsing in LLVM 2.0.
if (Existing->getType() == V.V->getType() &&
!TypeHasInteger(Existing->getType())) {
// If the type does not contain any integers in them then this can't be
// a type plane collapsing issue. It truly is a redefinition and we
// should error out as the assembly is invalid.
error("Redefinition of value named '" + Name + "' of type '" +
V.V->getType()->getDescription() + "'");
return;
}
// In LLVM 2.0 we don't allow names to be re-used for any values in a
// function, regardless of Type. Previously re-use of names was okay as
// long as they were distinct types. With type planes collapsing because
// of the signedness change and because of PR411, this can no longer be
// supported. We must search the entire symbol table for a conflicting
// name and make the name unique. No warning is needed as this can't
// cause a problem.
std::string NewName = makeNameUnique(Name);
// We're changing the name but it will probably be used by other
// instructions as operands later on. Consequently we have to retain
// a mapping of the renaming that we're doing.
RenameMapKey Key = makeRenameMapKey(Name, V.V->getType(), V.S);
CurFun.RenameMap[Key] = NewName;
Name = NewName;
}
// Set the name.
V.V->setName(Name);
}
}
/// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
/// this is a declaration, otherwise it is a definition.
static GlobalVariable *
ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage,
bool isConstantGlobal, const Type *Ty,
Constant *Initializer,
const Signedness &Sign) {
if (isa<FunctionType>(Ty))
error("Cannot declare global vars of function type");
const PointerType *PTy = PointerType::get(Ty);
std::string Name;
if (NameStr) {
Name = NameStr; // Copy string
free(NameStr); // Free old string
}
// See if this global value was forward referenced. If so, recycle the
// object.
ValID ID;
if (!Name.empty()) {
ID = ValID::create((char*)Name.c_str());
} else {
ID = ValID::create((int)CurModule.Values[PTy].size());
}
ID.S.makeComposite(Sign);
if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
// Move the global to the end of the list, from whereever it was
// previously inserted.
GlobalVariable *GV = cast<GlobalVariable>(FWGV);
CurModule.CurrentModule->getGlobalList().remove(GV);
CurModule.CurrentModule->getGlobalList().push_back(GV);
GV->setInitializer(Initializer);
GV->setLinkage(Linkage);
GV->setConstant(isConstantGlobal);
InsertValue(GV, CurModule.Values);
return GV;
}
// If this global has a name, check to see if there is already a definition
// of this global in the module and emit warnings if there are conflicts.
if (!Name.empty()) {
// The global has a name. See if there's an existing one of the same name.
if (CurModule.CurrentModule->getNamedGlobal(Name) ||
CurModule.CurrentModule->getFunction(Name)) {
// We found an existing global of the same name. This isn't allowed
// in LLVM 2.0. Consequently, we must alter the name of the global so it
// can at least compile. This can happen because of type planes
// There is alread a global of the same name which means there is a
// conflict. Let's see what we can do about it.
std::string NewName(makeNameUnique(Name));
if (Linkage != GlobalValue::InternalLinkage) {
// The linkage of this gval is external so we can't reliably rename
// it because it could potentially create a linking problem.
// However, we can't leave the name conflict in the output either or
// it won't assemble with LLVM 2.0. So, all we can do is rename
// this one to something unique and emit a warning about the problem.
warning("Renaming global variable '" + Name + "' to '" + NewName +
"' may cause linkage errors");
}
// Put the renaming in the global rename map
RenameMapKey Key = makeRenameMapKey(Name, PointerType::get(Ty), ID.S);
CurModule.RenameMap[Key] = NewName;
// Rename it
Name = NewName;
}
}
// Otherwise there is no existing GV to use, create one now.
GlobalVariable *GV =
new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
CurModule.CurrentModule);
InsertValue(GV, CurModule.Values);
// Remember the sign of this global.
CurModule.NamedValueSigns[Name] = ID.S;
return GV;
}
// setTypeName - Set the specified type to the name given. The name may be
// null potentially, in which case this is a noop. The string passed in is
// assumed to be a malloc'd string buffer, and is freed by this function.
//
// This function returns true if the type has already been defined, but is
// allowed to be redefined in the specified context. If the name is a new name
// for the type plane, it is inserted and false is returned.
static bool setTypeName(const PATypeInfo& TI, char *NameStr) {
assert(!inFunctionScope() && "Can't give types function-local names");
if (NameStr == 0) return false;
std::string Name(NameStr); // Copy string
free(NameStr); // Free old string
const Type* Ty = TI.PAT->get();
// We don't allow assigning names to void type
if (Ty == Type::VoidTy) {
error("Can't assign name '" + Name + "' to the void type");
return false;
}
// Set the type name, checking for conflicts as we do so.
bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, Ty);
// Save the sign information for later use
CurModule.NamedTypeSigns[Name] = TI.S;
if (AlreadyExists) { // Inserting a name that is already defined???
const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
assert(Existing && "Conflict but no matching type?");
// There is only one case where this is allowed: when we are refining an
// opaque type. In this case, Existing will be an opaque type.
if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
// We ARE replacing an opaque type!
const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(Ty);
return true;
}
// Otherwise, this is an attempt to redefine a type. That's okay if
// the redefinition is identical to the original. This will be so if
// Existing and T point to the same Type object. In this one case we
// allow the equivalent redefinition.
if (Existing == Ty) return true; // Yes, it's equal.
// Any other kind of (non-equivalent) redefinition is an error.
error("Redefinition of type named '" + Name + "' in the '" +
Ty->getDescription() + "' type plane");
}
return false;
}
//===----------------------------------------------------------------------===//
// Code for handling upreferences in type names...
//
// TypeContains - Returns true if Ty directly contains E in it.
//
static bool TypeContains(const Type *Ty, const Type *E) {
return std::find(Ty->subtype_begin(), Ty->subtype_end(),
E) != Ty->subtype_end();
}
namespace {
struct UpRefRecord {
// NestingLevel - The number of nesting levels that need to be popped before
// this type is resolved.
unsigned NestingLevel;
// LastContainedTy - This is the type at the current binding level for the
// type. Every time we reduce the nesting level, this gets updated.
const Type *LastContainedTy;
// UpRefTy - This is the actual opaque type that the upreference is
// represented with.
OpaqueType *UpRefTy;
UpRefRecord(unsigned NL, OpaqueType *URTy)
: NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) { }
};
}
// UpRefs - A list of the outstanding upreferences that need to be resolved.
static std::vector<UpRefRecord> UpRefs;
/// HandleUpRefs - Every time we finish a new layer of types, this function is
/// called. It loops through the UpRefs vector, which is a list of the
/// currently active types. For each type, if the up reference is contained in
/// the newly completed type, we decrement the level count. When the level
/// count reaches zero, the upreferenced type is the type that is passed in:
/// thus we can complete the cycle.
///
static PATypeHolder HandleUpRefs(const Type *ty, const Signedness& Sign) {
// If Ty isn't abstract, or if there are no up-references in it, then there is
// nothing to resolve here.
if (!ty->isAbstract() || UpRefs.empty()) return ty;
PATypeHolder Ty(ty);
UR_OUT("Type '" << Ty->getDescription() <<
"' newly formed. Resolving upreferences.\n" <<
UpRefs.size() << " upreferences active!\n");
// If we find any resolvable upreferences (i.e., those whose NestingLevel goes
// to zero), we resolve them all together before we resolve them to Ty. At
// the end of the loop, if there is anything to resolve to Ty, it will be in
// this variable.
OpaqueType *TypeToResolve = 0;
unsigned i = 0;
for (; i != UpRefs.size(); ++i) {
UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
<< UpRefs[i].UpRefTy->getDescription() << ") = "
<< (TypeContains(Ty, UpRefs[i].UpRefTy) ? "true" : "false") << "\n");
if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
// Decrement level of upreference
unsigned Level = --UpRefs[i].NestingLevel;
UpRefs[i].LastContainedTy = Ty;
UR_OUT(" Uplevel Ref Level = " << Level << "\n");
if (Level == 0) { // Upreference should be resolved!
if (!TypeToResolve) {
TypeToResolve = UpRefs[i].UpRefTy;
} else {
UR_OUT(" * Resolving upreference for "
<< UpRefs[i].UpRefTy->getDescription() << "\n";
std::string OldName = UpRefs[i].UpRefTy->getDescription());
ResolveTypeSign(UpRefs[i].UpRefTy, Sign);
UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
UR_OUT(" * Type '" << OldName << "' refined upreference to: "
<< (const void*)Ty << ", " << Ty->getDescription() << "\n");
}
UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
--i; // Do not skip the next element...
}
}
}
if (TypeToResolve) {
UR_OUT(" * Resolving upreference for "
<< UpRefs[i].UpRefTy->getDescription() << "\n";
std::string OldName = TypeToResolve->getDescription());
ResolveTypeSign(TypeToResolve, Sign);
TypeToResolve->refineAbstractTypeTo(Ty);
}
return Ty;
}
bool Signedness::operator<(const Signedness &that) const {
if (isNamed()) {
if (that.isNamed())
return *(this->name) < *(that.name);
else
return CurModule.NamedTypeSigns[*name] < that;
} else if (that.isNamed()) {
return *this < CurModule.NamedTypeSigns[*that.name];
}
if (isComposite() && that.isComposite()) {
if (sv->size() == that.sv->size()) {
SignVector::const_iterator thisI = sv->begin(), thisE = sv->end();
SignVector::const_iterator thatI = that.sv->begin(),
thatE = that.sv->end();
for (; thisI != thisE; ++thisI, ++thatI) {
if (*thisI < *thatI)
return true;
else if (!(*thisI == *thatI))
return false;
}
return false;
}
return sv->size() < that.sv->size();
}
return kind < that.kind;
}
bool Signedness::operator==(const Signedness &that) const {
if (isNamed())
if (that.isNamed())
return *(this->name) == *(that.name);
else
return CurModule.NamedTypeSigns[*(this->name)] == that;
else if (that.isNamed())
return *this == CurModule.NamedTypeSigns[*(that.name)];
if (isComposite() && that.isComposite()) {
if (sv->size() == that.sv->size()) {
SignVector::const_iterator thisI = sv->begin(), thisE = sv->end();
SignVector::const_iterator thatI = that.sv->begin(),
thatE = that.sv->end();
for (; thisI != thisE; ++thisI, ++thatI) {
if (!(*thisI == *thatI))
return false;
}
return true;
}
return false;
}
return kind == that.kind;
}
void Signedness::copy(const Signedness &that) {
if (that.isNamed()) {
kind = Named;
name = new std::string(*that.name);
} else if (that.isComposite()) {
kind = Composite;
sv = new SignVector();
*sv = *that.sv;
} else {
kind = that.kind;
sv = 0;
}
}
void Signedness::destroy() {
if (isNamed()) {
delete name;
} else if (isComposite()) {
delete sv;
}
}
#ifndef NDEBUG
void Signedness::dump() const {
if (isComposite()) {
if (sv->size() == 1) {
(*sv)[0].dump();
std::cerr << "*";
} else {
std::cerr << "{ " ;
for (unsigned i = 0; i < sv->size(); ++i) {
if (i != 0)
std::cerr << ", ";
(*sv)[i].dump();
}
std::cerr << "} " ;
}
} else if (isNamed()) {
std::cerr << *name;
} else if (isSigned()) {
std::cerr << "S";
} else if (isUnsigned()) {
std::cerr << "U";
} else
std::cerr << ".";
}
#endif
static inline Instruction::TermOps
getTermOp(TermOps op) {
switch (op) {
default : assert(0 && "Invalid OldTermOp");
case RetOp : return Instruction::Ret;
case BrOp : return Instruction::Br;
case SwitchOp : return Instruction::Switch;
case InvokeOp : return Instruction::Invoke;
case UnwindOp : return Instruction::Unwind;
case UnreachableOp: return Instruction::Unreachable;
}
}
static inline Instruction::BinaryOps
getBinaryOp(BinaryOps op, const Type *Ty, const Signedness& Sign) {
switch (op) {
default : assert(0 && "Invalid OldBinaryOps");
case SetEQ :
case SetNE :
case SetLE :
case SetGE :
case SetLT :
case SetGT : assert(0 && "Should use getCompareOp");
case AddOp : return Instruction::Add;
case SubOp : return Instruction::Sub;
case MulOp : return Instruction::Mul;
case DivOp : {
// This is an obsolete instruction so we must upgrade it based on the
// types of its operands.
bool isFP = Ty->isFloatingPoint();
if (const VectorType* PTy = dyn_cast<VectorType>(Ty))
// If its a vector type we want to use the element type
isFP = PTy->getElementType()->isFloatingPoint();
if (isFP)
return Instruction::FDiv;
else if (Sign.isSigned())
return Instruction::SDiv;
return Instruction::UDiv;
}
case UDivOp : return Instruction::UDiv;
case SDivOp : return Instruction::SDiv;
case FDivOp : return Instruction::FDiv;
case RemOp : {
// This is an obsolete instruction so we must upgrade it based on the
// types of its operands.
bool isFP = Ty->isFloatingPoint();
if (const VectorType* PTy = dyn_cast<VectorType>(Ty))
// If its a vector type we want to use the element type
isFP = PTy->getElementType()->isFloatingPoint();
// Select correct opcode
if (isFP)
return Instruction::FRem;
else if (Sign.isSigned())
return Instruction::SRem;
return Instruction::URem;
}
case URemOp : return Instruction::URem;
case SRemOp : return Instruction::SRem;
case FRemOp : return Instruction::FRem;
case LShrOp : return Instruction::LShr;
case AShrOp : return Instruction::AShr;
case ShlOp : return Instruction::Shl;
case ShrOp :
if (Sign.isSigned())
return Instruction::AShr;
return Instruction::LShr;
case AndOp : return Instruction::And;
case OrOp : return Instruction::Or;
case XorOp : return Instruction::Xor;
}
}
static inline Instruction::OtherOps
getCompareOp(BinaryOps op, unsigned short &predicate, const Type* &Ty,
const Signedness &Sign) {
bool isSigned = Sign.isSigned();
bool isFP = Ty->isFloatingPoint();
switch (op) {
default : assert(0 && "Invalid OldSetCC");
case SetEQ :
if (isFP) {
predicate = FCmpInst::FCMP_OEQ;
return Instruction::FCmp;
} else {
predicate = ICmpInst::ICMP_EQ;
return Instruction::ICmp;
}
case SetNE :
if (isFP) {
predicate = FCmpInst::FCMP_UNE;
return Instruction::FCmp;
} else {
predicate = ICmpInst::ICMP_NE;
return Instruction::ICmp;
}
case SetLE :
if (isFP) {
predicate = FCmpInst::FCMP_OLE;
return Instruction::FCmp;
} else {
if (isSigned)
predicate = ICmpInst::ICMP_SLE;
else
predicate = ICmpInst::ICMP_ULE;
return Instruction::ICmp;
}
case SetGE :
if (isFP) {
predicate = FCmpInst::FCMP_OGE;
return Instruction::FCmp;
} else {
if (isSigned)
predicate = ICmpInst::ICMP_SGE;
else
predicate = ICmpInst::ICMP_UGE;
return Instruction::ICmp;
}
case SetLT :
if (isFP) {
predicate = FCmpInst::FCMP_OLT;
return Instruction::FCmp;
} else {
if (isSigned)
predicate = ICmpInst::ICMP_SLT;
else
predicate = ICmpInst::ICMP_ULT;
return Instruction::ICmp;
}
case SetGT :
if (isFP) {
predicate = FCmpInst::FCMP_OGT;
return Instruction::FCmp;
} else {
if (isSigned)
predicate = ICmpInst::ICMP_SGT;
else
predicate = ICmpInst::ICMP_UGT;
return Instruction::ICmp;
}
}
}
static inline Instruction::MemoryOps getMemoryOp(MemoryOps op) {
switch (op) {
default : assert(0 && "Invalid OldMemoryOps");
case MallocOp : return Instruction::Malloc;
case FreeOp : return Instruction::Free;
case AllocaOp : return Instruction::Alloca;
case LoadOp : return Instruction::Load;
case StoreOp : return Instruction::Store;
case GetElementPtrOp : return Instruction::GetElementPtr;
}
}
static inline Instruction::OtherOps
getOtherOp(OtherOps op, const Signedness &Sign) {
switch (op) {
default : assert(0 && "Invalid OldOtherOps");
case PHIOp : return Instruction::PHI;
case CallOp : return Instruction::Call;
case SelectOp : return Instruction::Select;
case UserOp1 : return Instruction::UserOp1;
case UserOp2 : return Instruction::UserOp2;
case VAArg : return Instruction::VAArg;
case ExtractElementOp : return Instruction::ExtractElement;
case InsertElementOp : return Instruction::InsertElement;
case ShuffleVectorOp : return Instruction::ShuffleVector;
case ICmpOp : return Instruction::ICmp;
case FCmpOp : return Instruction::FCmp;
};
}
static inline Value*
getCast(CastOps op, Value *Src, const Signedness &SrcSign, const Type *DstTy,
const Signedness &DstSign, bool ForceInstruction = false) {
Instruction::CastOps Opcode;
const Type* SrcTy = Src->getType();
if (op == CastOp) {
if (SrcTy->isFloatingPoint() && isa<PointerType>(DstTy)) {
// fp -> ptr cast is no longer supported but we must upgrade this
// by doing a double cast: fp -> int -> ptr
SrcTy = Type::Int64Ty;
Opcode = Instruction::IntToPtr;
if (isa<Constant>(Src)) {
Src = ConstantExpr::getCast(Instruction::FPToUI,
cast<Constant>(Src), SrcTy);
} else {
std::string NewName(makeNameUnique(Src->getName()));
Src = new FPToUIInst(Src, SrcTy, NewName, CurBB);
}
} else if (isa<IntegerType>(DstTy) &&
cast<IntegerType>(DstTy)->getBitWidth() == 1) {
// cast type %x to bool was previously defined as setne type %x, null
// The cast semantic is now to truncate, not compare so we must retain
// the original intent by replacing the cast with a setne
Constant* Null = Constant::getNullValue(SrcTy);
Instruction::OtherOps Opcode = Instruction::ICmp;
unsigned short predicate = ICmpInst::ICMP_NE;
if (SrcTy->isFloatingPoint()) {
Opcode = Instruction::FCmp;
predicate = FCmpInst::FCMP_ONE;
} else if (!SrcTy->isInteger() && !isa<PointerType>(SrcTy)) {
error("Invalid cast to bool");
}
if (isa<Constant>(Src) && !ForceInstruction)
return ConstantExpr::getCompare(predicate, cast<Constant>(Src), Null);
else
return CmpInst::create(Opcode, predicate, Src, Null);
}
// Determine the opcode to use by calling CastInst::getCastOpcode
Opcode =
CastInst::getCastOpcode(Src, SrcSign.isSigned(), DstTy,
DstSign.isSigned());
} else switch (op) {
default: assert(0 && "Invalid cast token");
case TruncOp: Opcode = Instruction::Trunc; break;
case ZExtOp: Opcode = Instruction::ZExt; break;
case SExtOp: Opcode = Instruction::SExt; break;
case FPTruncOp: Opcode = Instruction::FPTrunc; break;
case FPExtOp: Opcode = Instruction::FPExt; break;
case FPToUIOp: Opcode = Instruction::FPToUI; break;
case FPToSIOp: Opcode = Instruction::FPToSI; break;
case UIToFPOp: Opcode = Instruction::UIToFP; break;
case SIToFPOp: Opcode = Instruction::SIToFP; break;
case PtrToIntOp: Opcode = Instruction::PtrToInt; break;
case IntToPtrOp: Opcode = Instruction::IntToPtr; break;
case BitCastOp: Opcode = Instruction::BitCast; break;
}
if (isa<Constant>(Src) && !ForceInstruction)
return ConstantExpr::getCast(Opcode, cast<Constant>(Src), DstTy);
return CastInst::create(Opcode, Src, DstTy);
}
static Instruction *
upgradeIntrinsicCall(const Type* RetTy, const ValID &ID,
std::vector<Value*>& Args) {
std::string Name = ID.Type == ValID::NameVal ? ID.Name : "";
if (Name.length() <= 5 || Name[0] != 'l' || Name[1] != 'l' ||
Name[2] != 'v' || Name[3] != 'm' || Name[4] != '.')
return 0;
switch (Name[5]) {
case 'i':
if (Name == "llvm.isunordered.f32" || Name == "llvm.isunordered.f64") {
if (Args.size() != 2)
error("Invalid prototype for " + Name);
return new FCmpInst(FCmpInst::FCMP_UNO, Args[0], Args[1]);
}
break;
case 'v' : {
const Type* PtrTy = PointerType::get(Type::Int8Ty);
std::vector<const Type*> Params;
if (Name == "llvm.va_start" || Name == "llvm.va_end") {
if (Args.size() != 1)
error("Invalid prototype for " + Name + " prototype");
Params.push_back(PtrTy);
const FunctionType *FTy =
FunctionType::get(Type::VoidTy, Params, false);
const PointerType *PFTy = PointerType::get(FTy);
Value* Func = getVal(PFTy, ID);
Args[0] = new BitCastInst(Args[0], PtrTy, makeNameUnique("va"), CurBB);
return new CallInst(Func, Args.begin(), Args.end());
} else if (Name == "llvm.va_copy") {
if (Args.size() != 2)
error("Invalid prototype for " + Name + " prototype");
Params.push_back(PtrTy);
Params.push_back(PtrTy);
const FunctionType *FTy =
FunctionType::get(Type::VoidTy, Params, false);
const PointerType *PFTy = PointerType::get(FTy);
Value* Func = getVal(PFTy, ID);
std::string InstName0(makeNameUnique("va0"));
std::string InstName1(makeNameUnique("va1"));
Args[0] = new BitCastInst(Args[0], PtrTy, InstName0, CurBB);
Args[1] = new BitCastInst(Args[1], PtrTy, InstName1, CurBB);
return new CallInst(Func, Args.begin(), Args.end());
}
}
}
return 0;
}
const Type* upgradeGEPCEIndices(const Type* PTy,
std::vector<ValueInfo> *Indices,
std::vector<Constant*> &Result) {
const Type *Ty = PTy;
Result.clear();
for (unsigned i = 0, e = Indices->size(); i != e ; ++i) {
Constant *Index = cast<Constant>((*Indices)[i].V);
if (ConstantInt *CI = dyn_cast<ConstantInt>(Index)) {
// LLVM 1.2 and earlier used ubyte struct indices. Convert any ubyte
// struct indices to i32 struct indices with ZExt for compatibility.
if (CI->getBitWidth() < 32)
Index = ConstantExpr::getCast(Instruction::ZExt, CI, Type::Int32Ty);
}
if (isa<SequentialType>(Ty)) {
// Make sure that unsigned SequentialType indices are zext'd to
// 64-bits if they were smaller than that because LLVM 2.0 will sext
// all indices for SequentialType elements. We must retain the same
// semantic (zext) for unsigned types.
if (const IntegerType *Ity = dyn_cast<IntegerType>(Index->getType())) {
if (Ity->getBitWidth() < 64 && (*Indices)[i].S.isUnsigned()) {
Index = ConstantExpr::getCast(Instruction::ZExt, Index,Type::Int64Ty);
}
}
}
Result.push_back(Index);
Ty = GetElementPtrInst::getIndexedType(PTy, Result.begin(),
Result.end(),true);
if (!Ty)
error("Index list invalid for constant getelementptr");
}
return Ty;
}
const Type* upgradeGEPInstIndices(const Type* PTy,
std::vector<ValueInfo> *Indices,
std::vector<Value*> &Result) {
const Type *Ty = PTy;
Result.clear();
for (unsigned i = 0, e = Indices->size(); i != e ; ++i) {
Value *Index = (*Indices)[i].V;
if (ConstantInt *CI = dyn_cast<ConstantInt>(Index)) {
// LLVM 1.2 and earlier used ubyte struct indices. Convert any ubyte
// struct indices to i32 struct indices with ZExt for compatibility.
if (CI->getBitWidth() < 32)
Index = ConstantExpr::getCast(Instruction::ZExt, CI, Type::Int32Ty);
}
if (isa<StructType>(Ty)) { // Only change struct indices
if (!isa<Constant>(Index)) {
error("Invalid non-constant structure index");
return 0;
}
} else {
// Make sure that unsigned SequentialType indices are zext'd to
// 64-bits if they were smaller than that because LLVM 2.0 will sext
// all indices for SequentialType elements. We must retain the same
// semantic (zext) for unsigned types.
if (const IntegerType *Ity = dyn_cast<IntegerType>(Index->getType())) {
if (Ity->getBitWidth() < 64 && (*Indices)[i].S.isUnsigned()) {
if (isa<Constant>(Index))
Index = ConstantExpr::getCast(Instruction::ZExt,
cast<Constant>(Index), Type::Int64Ty);
else
Index = CastInst::create(Instruction::ZExt, Index, Type::Int64Ty,
makeNameUnique("gep"), CurBB);
}
}
}
Result.push_back(Index);
Ty = GetElementPtrInst::getIndexedType(PTy, Result.begin(),
Result.end(),true);
if (!Ty)
error("Index list invalid for constant getelementptr");
}
return Ty;
}
unsigned upgradeCallingConv(unsigned CC) {
switch (CC) {
case OldCallingConv::C : return CallingConv::C;
case OldCallingConv::CSRet : return CallingConv::C;
case OldCallingConv::Fast : return CallingConv::Fast;
case OldCallingConv::Cold : return CallingConv::Cold;
case OldCallingConv::X86_StdCall : return CallingConv::X86_StdCall;
case OldCallingConv::X86_FastCall: return CallingConv::X86_FastCall;
default:
return CC;
}
}
Module* UpgradeAssembly(const std::string &infile, std::istream& in,
bool debug, bool addAttrs)
{
Upgradelineno = 1;
CurFilename = infile;
LexInput = ∈
yydebug = debug;
AddAttributes = addAttrs;
ObsoleteVarArgs = false;
NewVarArgs = false;
CurModule.CurrentModule = new Module(CurFilename);
// Check to make sure the parser succeeded
if (yyparse()) {
if (ParserResult)
delete ParserResult;
std::cerr << "llvm-upgrade: parse failed.\n";
return 0;
}
// Check to make sure that parsing produced a result
if (!ParserResult) {
std::cerr << "llvm-upgrade: no parse result.\n";
return 0;
}
// Reset ParserResult variable while saving its value for the result.
Module *Result = ParserResult;
ParserResult = 0;
//Not all functions use vaarg, so make a second check for ObsoleteVarArgs
{
Function* F;
if ((F = Result->getFunction("llvm.va_start"))
&& F->getFunctionType()->getNumParams() == 0)
ObsoleteVarArgs = true;
if((F = Result->getFunction("llvm.va_copy"))
&& F->getFunctionType()->getNumParams() == 1)
ObsoleteVarArgs = true;
}
if (ObsoleteVarArgs && NewVarArgs) {
error("This file is corrupt: it uses both new and old style varargs");
return 0;
}
if(ObsoleteVarArgs) {
if(Function* F = Result->getFunction("llvm.va_start")) {
if (F->arg_size() != 0) {
error("Obsolete va_start takes 0 argument");
return 0;
}
//foo = va_start()
// ->
//bar = alloca typeof(foo)
//va_start(bar)
//foo = load bar
const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
const Type* ArgTy = F->getFunctionType()->getReturnType();
const Type* ArgTyPtr = PointerType::get(ArgTy);
Function* NF = cast<Function>(Result->getOrInsertFunction(
"llvm.va_start", RetTy, ArgTyPtr, (Type *)0));
while (!F->use_empty()) {
CallInst* CI = cast<CallInst>(F->use_back());
AllocaInst* bar = new AllocaInst(ArgTy, 0, "vastart.fix.1", CI);
new CallInst(NF, bar, "", CI);
Value* foo = new LoadInst(bar, "vastart.fix.2", CI);
CI->replaceAllUsesWith(foo);
CI->getParent()->getInstList().erase(CI);
}
Result->getFunctionList().erase(F);
}
if(Function* F = Result->getFunction("llvm.va_end")) {
if(F->arg_size() != 1) {
error("Obsolete va_end takes 1 argument");
return 0;
}
//vaend foo
// ->
//bar = alloca 1 of typeof(foo)
//vaend bar
const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
const Type* ArgTy = F->getFunctionType()->getParamType(0);
const Type* ArgTyPtr = PointerType::get(ArgTy);
Function* NF = cast<Function>(Result->getOrInsertFunction(
"llvm.va_end", RetTy, ArgTyPtr, (Type *)0));
while (!F->use_empty()) {
CallInst* CI = cast<CallInst>(F->use_back());
AllocaInst* bar = new AllocaInst(ArgTy, 0, "vaend.fix.1", CI);
new StoreInst(CI->getOperand(1), bar, CI);
new CallInst(NF, bar, "", CI);
CI->getParent()->getInstList().erase(CI);
}
Result->getFunctionList().erase(F);
}
if(Function* F = Result->getFunction("llvm.va_copy")) {
if(F->arg_size() != 1) {
error("Obsolete va_copy takes 1 argument");
return 0;
}
//foo = vacopy(bar)
// ->
//a = alloca 1 of typeof(foo)
//b = alloca 1 of typeof(foo)
//store bar -> b
//vacopy(a, b)
//foo = load a
const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
const Type* ArgTy = F->getFunctionType()->getReturnType();
const Type* ArgTyPtr = PointerType::get(ArgTy);
Function* NF = cast<Function>(Result->getOrInsertFunction(
"llvm.va_copy", RetTy, ArgTyPtr, ArgTyPtr, (Type *)0));
while (!F->use_empty()) {
CallInst* CI = cast<CallInst>(F->use_back());
Value *Args[2] = {
new AllocaInst(ArgTy, 0, "vacopy.fix.1", CI),
new AllocaInst(ArgTy, 0, "vacopy.fix.2", CI)
};
new StoreInst(CI->getOperand(1), Args[1], CI);
new CallInst(NF, Args, Args + 2, "", CI);
Value* foo = new LoadInst(Args[0], "vacopy.fix.3", CI);
CI->replaceAllUsesWith(foo);
CI->getParent()->getInstList().erase(CI);
}
Result->getFunctionList().erase(F);
}
}
return Result;
}
} // end llvm namespace
using namespace llvm;
/* Enabling traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
/* Enabling verbose error messages. */
#ifdef YYERROR_VERBOSE
# undef YYERROR_VERBOSE
# define YYERROR_VERBOSE 1
#else
# define YYERROR_VERBOSE 0
#endif
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
#line 1750 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
typedef union YYSTYPE {
llvm::Module *ModuleVal;
llvm::Function *FunctionVal;
std::pair<llvm::PATypeInfo, char*> *ArgVal;
llvm::BasicBlock *BasicBlockVal;
llvm::TermInstInfo TermInstVal;
llvm::InstrInfo InstVal;
llvm::ConstInfo ConstVal;
llvm::ValueInfo ValueVal;
llvm::PATypeInfo TypeVal;
llvm::TypeInfo PrimType;
llvm::PHIListInfo PHIList;
std::list<llvm::PATypeInfo> *TypeList;
std::vector<llvm::ValueInfo> *ValueList;
std::vector<llvm::ConstInfo> *ConstVector;
std::vector<std::pair<llvm::PATypeInfo,char*> > *ArgList;
// Represent the RHS of PHI node
std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
llvm::GlobalValue::LinkageTypes Linkage;
int64_t SInt64Val;
uint64_t UInt64Val;
int SIntVal;
unsigned UIntVal;
double FPVal;
bool BoolVal;
char *StrVal; // This memory is strdup'd!
llvm::ValID ValIDVal; // strdup'd memory maybe!
llvm::BinaryOps BinaryOpVal;
llvm::TermOps TermOpVal;
llvm::MemoryOps MemOpVal;
llvm::OtherOps OtherOpVal;
llvm::CastOps CastOpVal;
llvm::ICmpInst::Predicate IPred;
llvm::FCmpInst::Predicate FPred;
llvm::Module::Endianness Endianness;
} YYSTYPE;
/* Line 191 of yacc.c. */
#line 2165 "UpgradeParser.tab.c"
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif
/* Copy the second part of user declarations. */
/* Line 214 of yacc.c. */
#line 2177 "UpgradeParser.tab.c"
#if ! defined (yyoverflow) || YYERROR_VERBOSE
/* The parser invokes alloca or malloc; define the necessary symbols. */
# ifdef YYSTACK_USE_ALLOCA
# if YYSTACK_USE_ALLOCA
# define YYSTACK_ALLOC alloca
# endif
# else
# if defined (alloca) || defined (_ALLOCA_H)
# define YYSTACK_ALLOC alloca
# else
# ifdef __GNUC__
# define YYSTACK_ALLOC __builtin_alloca
# endif
# endif
# endif
# ifdef YYSTACK_ALLOC
/* Pacify GCC's `empty if-body' warning. */
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
# else
# if defined (__STDC__) || defined (__cplusplus)
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
# define YYSIZE_T size_t
# endif
# define YYSTACK_ALLOC malloc
# define YYSTACK_FREE free
# endif
#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
#if (! defined (yyoverflow) \
&& (! defined (__cplusplus) \
|| (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */
union yyalloc
{
short yyss;
YYSTYPE yyvs;
};
/* The size of the maximum gap between one aligned stack and the next. */
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
/* The size of an array large to enough to hold all stacks, each with
N elements. */
# define YYSTACK_BYTES(N) \
((N) * (sizeof (short) + sizeof (YYSTYPE)) \
+ YYSTACK_GAP_MAXIMUM)
/* Copy COUNT objects from FROM to TO. The source and destination do
not overlap. */
# ifndef YYCOPY
# if defined (__GNUC__) && 1 < __GNUC__
# define YYCOPY(To, From, Count) \
__builtin_memcpy (To, From, (Count) * sizeof (*(From)))
# else
# define YYCOPY(To, From, Count) \
do \
{ \
register YYSIZE_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) \
(To)[yyi] = (From)[yyi]; \
} \
while (0)
# endif
# endif
/* Relocate STACK from its old location to the new one. The
local variables YYSIZE and YYSTACKSIZE give the old and new number of
elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next
stack. */
# define YYSTACK_RELOCATE(Stack) \
do \
{ \
YYSIZE_T yynewbytes; \
YYCOPY (&yyptr->Stack, Stack, yysize); \
Stack = &yyptr->Stack; \
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
yyptr += yynewbytes / sizeof (*yyptr); \
} \
while (0)
#endif
#if defined (__STDC__) || defined (__cplusplus)
typedef signed char yysigned_char;
#else
typedef short yysigned_char;
#endif
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 4
/* YYLAST -- Last index in YYTABLE. */
#define YYLAST 1630
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 166
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 81
/* YYNRULES -- Number of rules. */
#define YYNRULES 310
/* YYNRULES -- Number of states. */
#define YYNSTATES 606
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
#define YYMAXUTOK 406
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
static const unsigned char yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
155, 156, 164, 2, 153, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
160, 152, 161, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 157, 154, 159, 2, 2, 2, 2, 2, 165,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
158, 2, 2, 162, 2, 163, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 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
};
#if YYDEBUG
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
YYRHS. */
static const unsigned short yyprhs[] =
{
0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
119, 121, 123, 125, 127, 129, 131, 133, 135, 137,
139, 141, 143, 145, 147, 149, 151, 153, 155, 157,
159, 161, 164, 165, 167, 169, 171, 173, 175, 177,
179, 180, 181, 183, 185, 187, 189, 191, 193, 196,
197, 200, 201, 205, 208, 209, 211, 212, 216, 218,
221, 223, 225, 227, 229, 231, 233, 235, 237, 239,
241, 243, 245, 247, 249, 251, 253, 255, 257, 259,
261, 264, 269, 275, 281, 285, 288, 294, 299, 302,
304, 308, 310, 314, 316, 317, 322, 326, 330, 335,
340, 344, 351, 357, 360, 363, 366, 369, 372, 375,
378, 381, 384, 387, 394, 400, 409, 416, 423, 430,
438, 446, 453, 460, 469, 478, 482, 484, 486, 488,
490, 493, 496, 501, 504, 506, 511, 514, 519, 520,
528, 529, 537, 538, 546, 547, 555, 559, 564, 565,
567, 569, 571, 575, 579, 583, 587, 591, 595, 597,
598, 600, 602, 604, 605, 608, 612, 614, 616, 620,
622, 623, 632, 634, 636, 637, 642, 644, 646, 649,
650, 652, 654, 655, 656, 662, 663, 665, 667, 669,
671, 673, 675, 677, 679, 681, 685, 687, 693, 695,
697, 699, 701, 704, 707, 710, 714, 717, 718, 720,
722, 724, 727, 730, 734, 744, 754, 763, 777, 779,
781, 788, 794, 797, 804, 812, 814, 818, 820, 821,
824, 826, 832, 838, 844, 851, 858, 861, 866, 871,
878, 883, 888, 893, 898, 905, 912, 915, 923, 925,
928, 929, 931, 932, 936, 943, 947, 954, 957, 962,
969
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const short yyrhs[] =
{
200, 0, -1, 5, -1, 6, -1, 3, -1, 4,
-1, 79, -1, 80, -1, 81, -1, 82, -1, 83,
-1, 84, -1, 85, -1, 86, -1, 87, -1, 88,
-1, 89, -1, 90, -1, 91, -1, 92, -1, 97,
-1, 98, -1, 99, -1, 100, -1, 101, -1, 102,
-1, 119, -1, 120, -1, 121, -1, 122, -1, 123,
-1, 124, -1, 125, -1, 126, -1, 127, -1, 128,
-1, 129, -1, 130, -1, 131, -1, 132, -1, 133,
-1, 134, -1, 135, -1, 136, -1, 137, -1, 138,
-1, 125, -1, 126, -1, 127, -1, 128, -1, 27,
-1, 28, -1, 93, -1, 94, -1, 95, -1, 96,
-1, 140, -1, 141, -1, 142, -1, 143, -1, 144,
-1, 145, -1, 146, -1, 147, -1, 148, -1, 149,
-1, 150, -1, 151, -1, 139, -1, 16, -1, 14,
-1, 12, -1, 10, -1, 17, -1, 15, -1, 13,
-1, 11, -1, 176, -1, 177, -1, 18, -1, 19,
-1, 212, 152, -1, -1, 41, -1, 42, -1, 43,
-1, 44, -1, 45, -1, 46, -1, 47, -1, -1,
-1, 65, -1, 66, -1, 67, -1, 68, -1, 69,
-1, 70, -1, 64, 4, -1, -1, 57, 4, -1,
-1, 153, 57, 4, -1, 34, 24, -1, -1, 185,
-1, -1, 153, 188, 187, -1, 185, -1, 57, 4,
-1, 191, -1, 8, -1, 193, -1, 8, -1, 193,
-1, 9, -1, 10, -1, 11, -1, 12, -1, 13,
-1, 14, -1, 15, -1, 16, -1, 17, -1, 18,
-1, 19, -1, 21, -1, 192, -1, 48, -1, 229,
-1, 154, 4, -1, 190, 155, 195, 156, -1, 157,
4, 158, 193, 159, -1, 160, 4, 158, 193, 161,
-1, 162, 194, 163, -1, 162, 163, -1, 160, 162,
194, 163, 161, -1, 160, 162, 163, 161, -1, 193,
164, -1, 193, -1, 194, 153, 193, -1, 194, -1,
194, 153, 37, -1, 37, -1, -1, 191, 157, 198,
159, -1, 191, 157, 159, -1, 191, 165, 24, -1,
191, 160, 198, 161, -1, 191, 162, 198, 163, -1,
191, 162, 163, -1, 191, 160, 162, 198, 163, 161,
-1, 191, 160, 162, 163, 161, -1, 191, 38, -1,
191, 39, -1, 191, 229, -1, 191, 197, -1, 191,
26, -1, 176, 168, -1, 177, 4, -1, 9, 27,
-1, 9, 28, -1, 179, 7, -1, 175, 155, 196,
36, 191, 156, -1, 110, 155, 196, 244, 156, -1,
112, 155, 196, 153, 196, 153, 196, 156, -1, 169,
155, 196, 153, 196, 156, -1, 170, 155, 196, 153,
196, 156, -1, 171, 155, 196, 153, 196, 156, -1,
103, 172, 155, 196, 153, 196, 156, -1, 104, 173,
155, 196, 153, 196, 156, -1, 174, 155, 196, 153,
196, 156, -1, 114, 155, 196, 153, 196, 156, -1,
115, 155, 196, 153, 196, 153, 196, 156, -1, 116,
155, 196, 153, 196, 153, 196, 156, -1, 198, 153,
196, -1, 196, -1, 32, -1, 33, -1, 201, -1,
201, 222, -1, 201, 224, -1, 201, 62, 61, 207,
-1, 201, 25, -1, 202, -1, 202, 180, 20, 189,
-1, 202, 224, -1, 202, 62, 61, 207, -1, -1,
202, 180, 181, 199, 196, 203, 187, -1, -1, 202,
180, 50, 199, 191, 204, 187, -1, -1, 202, 180,
45, 199, 191, 205, 187, -1, -1, 202, 180, 47,
199, 191, 206, 187, -1, 202, 51, 209, -1, 202,
58, 152, 210, -1, -1, 24, -1, 56, -1, 55,
-1, 53, 152, 208, -1, 54, 152, 4, -1, 52,
152, 24, -1, 71, 152, 24, -1, 157, 211, 159,
-1, 211, 153, 24, -1, 24, -1, -1, 22, -1,
24, -1, 212, -1, -1, 191, 213, -1, 215, 153,
214, -1, 214, -1, 215, -1, 215, 153, 37, -1,
37, -1, -1, 182, 189, 212, 155, 216, 156, 186,
183, -1, 29, -1, 162, -1, -1, 181, 220, 217,
218, -1, 30, -1, 163, -1, 232, 221, -1, -1,
45, -1, 47, -1, -1, -1, 31, 225, 223, 226,
217, -1, -1, 63, -1, 3, -1, 4, -1, 7,
-1, 27, -1, 28, -1, 38, -1, 39, -1, 26,
-1, 160, 198, 161, -1, 197, -1, 61, 227, 24,
153, 24, -1, 167, -1, 212, -1, 229, -1, 228,
-1, 191, 230, -1, 232, 233, -1, 219, 233, -1,
234, 180, 236, -1, 234, 238, -1, -1, 23, -1,
77, -1, 78, -1, 72, 231, -1, 72, 8, -1,
73, 21, 230, -1, 73, 9, 230, 153, 21, 230,
153, 21, 230, -1, 74, 178, 230, 153, 21, 230,
157, 237, 159, -1, 74, 178, 230, 153, 21, 230,
157, 159, -1, 75, 182, 189, 230, 155, 241, 156,
36, 21, 230, 235, 21, 230, -1, 235, -1, 76,
-1, 237, 178, 228, 153, 21, 230, -1, 178, 228,
153, 21, 230, -1, 180, 243, -1, 191, 157, 230,
153, 230, 159, -1, 239, 153, 157, 230, 153, 230,
159, -1, 231, -1, 240, 153, 231, -1, 240, -1,
-1, 60, 59, -1, 59, -1, 169, 191, 230, 153,
230, -1, 170, 191, 230, 153, 230, -1, 171, 191,
230, 153, 230, -1, 103, 172, 191, 230, 153, 230,
-1, 104, 173, 191, 230, 153, 230, -1, 49, 231,
-1, 174, 231, 153, 231, -1, 175, 231, 36, 191,
-1, 112, 231, 153, 231, 153, 231, -1, 113, 231,
153, 191, -1, 117, 231, 153, 191, -1, 118, 231,
153, 191, -1, 114, 231, 153, 231, -1, 115, 231,
153, 231, 153, 231, -1, 116, 231, 153, 231, 153,
231, -1, 111, 239, -1, 242, 182, 189, 230, 155,
241, 156, -1, 246, -1, 153, 240, -1, -1, 35,
-1, -1, 105, 191, 184, -1, 105, 191, 153, 15,
230, 184, -1, 106, 191, 184, -1, 106, 191, 153,
15, 230, 184, -1, 107, 231, -1, 245, 108, 191,
230, -1, 245, 109, 231, 153, 191, 230, -1, 110,
191, 230, 244, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const unsigned short yyrline[] =
{
0, 1890, 1890, 1891, 1899, 1900, 1910, 1910, 1910, 1910,
1910, 1910, 1910, 1910, 1910, 1910, 1910, 1914, 1914, 1914,
1918, 1918, 1918, 1918, 1918, 1918, 1922, 1922, 1923, 1923,
1924, 1924, 1925, 1925, 1926, 1926, 1930, 1930, 1931, 1931,
1932, 1932, 1933, 1933, 1934, 1934, 1935, 1935, 1936, 1936,
1937, 1938, 1941, 1941, 1941, 1941, 1945, 1945, 1945, 1945,
1945, 1945, 1945, 1946, 1946, 1946, 1946, 1946, 1946, 1952,
1952, 1952, 1952, 1956, 1956, 1956, 1956, 1960, 1960, 1964,
1964, 1969, 1972, 1977, 1978, 1979, 1980, 1981, 1982, 1983,
1984, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 2005,
2006, 2014, 2015, 2023, 2032, 2033, 2040, 2041, 2045, 2049,
2065, 2066, 2073, 2074, 2081, 2089, 2089, 2089, 2089, 2089,
2089, 2089, 2090, 2090, 2090, 2090, 2090, 2095, 2099, 2103,
2108, 2117, 2144, 2150, 2163, 2174, 2178, 2191, 2195, 2209,
2213, 2220, 2221, 2227, 2234, 2246, 2276, 2289, 2312, 2340,
2362, 2373, 2395, 2406, 2415, 2420, 2479, 2486, 2494, 2501,
2508, 2512, 2516, 2525, 2540, 2552, 2561, 2589, 2602, 2611,
2617, 2623, 2634, 2640, 2646, 2657, 2658, 2667, 2668, 2680,
2689, 2690, 2691, 2692, 2693, 2709, 2729, 2731, 2733, 2733,
2740, 2740, 2748, 2748, 2756, 2756, 2765, 2767, 2769, 2774,
2788, 2789, 2793, 2796, 2804, 2808, 2815, 2819, 2823, 2827,
2835, 2835, 2839, 2840, 2844, 2852, 2857, 2865, 2866, 2873,
2880, 2884, 3074, 3074, 3078, 3078, 3088, 3088, 3092, 3097,
3098, 3099, 3103, 3104, 3103, 3116, 3117, 3122, 3123, 3124,
3125, 3129, 3133, 3134, 3135, 3136, 3157, 3161, 3175, 3176,
3181, 3181, 3189, 3199, 3202, 3211, 3222, 3227, 3236, 3247,
3247, 3250, 3254, 3258, 3263, 3273, 3291, 3300, 3374, 3378,
3385, 3397, 3412, 3442, 3452, 3462, 3466, 3473, 3474, 3478,
3481, 3487, 3506, 3524, 3540, 3554, 3568, 3579, 3597, 3606,
3615, 3622, 3643, 3667, 3673, 3679, 3685, 3701, 3794, 3802,
3803, 3807, 3808, 3812, 3818, 3825, 3831, 3838, 3845, 3858,
3884
};
#endif
#if YYDEBUG || YYERROR_VERBOSE
/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
"$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "SINTVAL",
"UINTVAL", "FPVAL", "VOID", "BOOL", "SBYTE", "UBYTE", "SHORT", "USHORT",
"INT", "UINT", "LONG", "ULONG", "FLOAT", "DOUBLE", "TYPE", "LABEL",
"VAR_ID", "LABELSTR", "STRINGCONSTANT", "IMPLEMENTATION",
"ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK",
"DECLARE", "GLOBAL", "CONSTANT", "SECTION", "VOLATILE", "TO",
"DOTDOTDOT", "NULL_TOK", "UNDEF", "CONST", "INTERNAL", "LINKONCE",
"WEAK", "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE",
"NOT", "EXTERNAL", "TARGET", "TRIPLE", "ENDIAN", "POINTERSIZE", "LITTLE",
"BIG", "ALIGN", "DEPLIBS", "CALL", "TAIL", "ASM_TOK", "MODULE",
"SIDEEFFECT", "CC_TOK", "CCC_TOK", "CSRETCC_TOK", "FASTCC_TOK",
"COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT",
"RET", "BR", "SWITCH", "INVOKE", "UNREACHABLE", "UNWIND", "EXCEPT",
"ADD", "SUB", "MUL", "DIV", "UDIV", "SDIV", "FDIV", "REM", "UREM",
"SREM", "FREM", "AND", "OR", "XOR", "SHL", "SHR", "ASHR", "LSHR",
"SETLE", "SETGE", "SETLT", "SETGT", "SETEQ", "SETNE", "ICMP", "FCMP",
"MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR", "PHI_TOK",
"SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR",
"VAARG_old", "VANEXT_old", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT",
"UGT", "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD",
"UNO", "UEQ", "UNE", "CAST", "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT",
"FPTOUI", "FPTOSI", "UITOFP", "SITOFP", "PTRTOINT", "INTTOPTR",
"BITCAST", "'='", "','", "'\\\\'", "'('", "')'", "'['", "'x'", "']'",
"'<'", "'>'", "'{'", "'}'", "'*'", "'c'", "$accept", "INTVAL",
"EINT64VAL", "ArithmeticOps", "LogicalOps", "SetCondOps", "IPredicates",
"FPredicates", "ShiftOps", "CastOps", "SIntType", "UIntType", "IntType",
"FPType", "OptAssign", "OptLinkage", "OptCallingConv", "OptAlign",
"OptCAlign", "SectionString", "OptSection", "GlobalVarAttributes",
"GlobalVarAttribute", "TypesV", "UpRTypesV", "Types", "PrimType",
"UpRTypes", "TypeListI", "ArgTypeListI", "ConstVal", "ConstExpr",
"ConstVector", "GlobalType", "Module", "FunctionList", "ConstPool", "@1",
"@2", "@3", "@4", "AsmBlock", "BigOrLittle", "TargetDefinition",
"LibrariesDefinition", "LibList", "Name", "OptName", "ArgVal",
"ArgListH", "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader",
"@5", "END", "Function", "FnDeclareLinkage", "FunctionProto", "@6", "@7",
"OptSideEffect", "ConstValueRef", "SymbolicValueRef", "ValueRef",
"ResolvedVal", "BasicBlockList", "BasicBlock", "InstructionList",
"Unwind", "BBTerminatorInst", "JumpTable", "Inst", "PHIList",
"ValueRefList", "ValueRefListE", "OptTailCall", "InstVal", "IndexList",
"OptVolatile", "MemoryInst", 0
};
#endif
# ifdef YYPRINT
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
token YYLEX-NUM. */
static const unsigned short yytoknum[] =
{
0, 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, 61, 44, 92, 40, 41, 91, 120, 93,
60, 62, 123, 125, 42, 99
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const unsigned char yyr1[] =
{
0, 166, 167, 167, 168, 168, 169, 169, 169, 169,
169, 169, 169, 169, 169, 169, 169, 170, 170, 170,
171, 171, 171, 171, 171, 171, 172, 172, 172, 172,
172, 172, 172, 172, 172, 172, 173, 173, 173, 173,
173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
173, 173, 174, 174, 174, 174, 175, 175, 175, 175,
175, 175, 175, 175, 175, 175, 175, 175, 175, 176,
176, 176, 176, 177, 177, 177, 177, 178, 178, 179,
179, 180, 180, 181, 181, 181, 181, 181, 181, 181,
181, 182, 182, 182, 182, 182, 182, 182, 182, 183,
183, 184, 184, 185, 186, 186, 187, 187, 188, 188,
189, 189, 190, 190, 191, 192, 192, 192, 192, 192,
192, 192, 192, 192, 192, 192, 192, 193, 193, 193,
193, 193, 193, 193, 193, 193, 193, 193, 193, 194,
194, 195, 195, 195, 195, 196, 196, 196, 196, 196,
196, 196, 196, 196, 196, 196, 196, 196, 196, 196,
196, 196, 196, 197, 197, 197, 197, 197, 197, 197,
197, 197, 197, 197, 197, 198, 198, 199, 199, 200,
201, 201, 201, 201, 201, 202, 202, 202, 203, 202,
204, 202, 205, 202, 206, 202, 202, 202, 202, 207,
208, 208, 209, 209, 209, 209, 210, 211, 211, 211,
212, 212, 213, 213, 214, 215, 215, 216, 216, 216,
216, 217, 218, 218, 220, 219, 221, 221, 222, 223,
223, 223, 225, 226, 224, 227, 227, 228, 228, 228,
228, 228, 228, 228, 228, 228, 228, 228, 229, 229,
230, 230, 231, 232, 232, 233, 234, 234, 234, 235,
235, 236, 236, 236, 236, 236, 236, 236, 236, 236,
237, 237, 238, 239, 239, 240, 240, 241, 241, 242,
242, 243, 243, 243, 243, 243, 243, 243, 243, 243,
243, 243, 243, 243, 243, 243, 243, 243, 243, 244,
244, 245, 245, 246, 246, 246, 246, 246, 246, 246,
246
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const unsigned char yyr2[] =
{
0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 2, 0, 1, 1, 1, 1, 1, 1, 1,
0, 0, 1, 1, 1, 1, 1, 1, 2, 0,
2, 0, 3, 2, 0, 1, 0, 3, 1, 2,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2, 4, 5, 5, 3, 2, 5, 4, 2, 1,
3, 1, 3, 1, 0, 4, 3, 3, 4, 4,
3, 6, 5, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 6, 5, 8, 6, 6, 6, 7,
7, 6, 6, 8, 8, 3, 1, 1, 1, 1,
2, 2, 4, 2, 1, 4, 2, 4, 0, 7,
0, 7, 0, 7, 0, 7, 3, 4, 0, 1,
1, 1, 3, 3, 3, 3, 3, 3, 1, 0,
1, 1, 1, 0, 2, 3, 1, 1, 3, 1,
0, 8, 1, 1, 0, 4, 1, 1, 2, 0,
1, 1, 0, 0, 5, 0, 1, 1, 1, 1,
1, 1, 1, 1, 1, 3, 1, 5, 1, 1,
1, 1, 2, 2, 2, 3, 2, 0, 1, 1,
1, 2, 2, 3, 9, 9, 8, 13, 1, 1,
6, 5, 2, 6, 7, 1, 3, 1, 0, 2,
1, 5, 5, 5, 6, 6, 2, 4, 4, 6,
4, 4, 4, 4, 6, 6, 2, 7, 1, 2,
0, 1, 0, 3, 6, 3, 6, 2, 4, 6,
4
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
STATE-NUM when YYTABLE doesn't specify something else to do. Zero
means the default is an error. */
static const unsigned short yydefact[] =
{
198, 0, 90, 184, 1, 183, 232, 83, 84, 85,
86, 87, 88, 89, 0, 224, 257, 180, 181, 257,
210, 211, 0, 0, 0, 90, 0, 186, 229, 0,
91, 258, 254, 82, 226, 227, 228, 253, 0, 0,
0, 0, 196, 0, 0, 0, 0, 0, 0, 0,
81, 230, 231, 233, 199, 182, 0, 92, 93, 94,
95, 96, 97, 0, 0, 302, 256, 0, 0, 0,
0, 209, 197, 187, 2, 3, 111, 115, 116, 117,
118, 119, 120, 121, 122, 123, 124, 125, 126, 128,
0, 0, 0, 0, 248, 185, 0, 110, 127, 114,
249, 129, 177, 178, 0, 0, 0, 0, 91, 98,
0, 222, 223, 225, 301, 0, 280, 0, 0, 0,
0, 91, 269, 259, 260, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 52,
53, 54, 55, 20, 21, 22, 23, 24, 25, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 68, 56, 57, 58, 59, 60, 61,
62, 63, 64, 65, 66, 67, 0, 0, 0, 0,
0, 268, 255, 91, 272, 0, 298, 204, 201, 200,
202, 203, 205, 208, 0, 130, 0, 0, 0, 113,
135, 139, 0, 144, 138, 192, 194, 190, 115, 116,
117, 118, 119, 120, 121, 122, 123, 124, 125, 0,
0, 0, 0, 188, 234, 0, 0, 286, 279, 262,
261, 0, 0, 72, 76, 71, 75, 70, 74, 69,
73, 77, 78, 0, 0, 26, 27, 28, 29, 30,
31, 32, 33, 34, 35, 0, 50, 51, 46, 47,
48, 49, 36, 37, 38, 39, 40, 41, 42, 43,
44, 45, 0, 101, 101, 307, 0, 0, 296, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 206, 0, 0, 0, 0,
0, 134, 143, 141, 0, 106, 106, 106, 160, 161,
4, 5, 158, 159, 162, 157, 153, 154, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 156, 155, 106, 220, 237, 238,
239, 244, 240, 241, 242, 243, 235, 0, 246, 251,
250, 252, 0, 263, 0, 0, 0, 0, 0, 303,
0, 305, 300, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
207, 112, 112, 137, 0, 140, 0, 131, 0, 193,
195, 191, 0, 0, 0, 0, 0, 0, 0, 146,
176, 0, 0, 0, 150, 0, 147, 0, 0, 0,
0, 0, 189, 219, 213, 216, 217, 0, 236, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
310, 0, 0, 0, 290, 293, 0, 0, 291, 292,
0, 0, 0, 287, 288, 0, 308, 0, 132, 133,
136, 142, 0, 0, 108, 106, 0, 0, 300, 0,
0, 0, 0, 0, 145, 135, 114, 0, 148, 149,
0, 0, 0, 0, 0, 212, 214, 0, 104, 0,
245, 0, 0, 278, 0, 0, 101, 102, 101, 275,
299, 0, 0, 0, 0, 0, 281, 282, 283, 278,
0, 103, 109, 107, 0, 0, 0, 0, 0, 0,
0, 175, 152, 0, 0, 0, 0, 0, 0, 218,
215, 105, 99, 0, 0, 0, 277, 0, 284, 285,
0, 304, 306, 0, 0, 0, 289, 294, 295, 0,
309, 0, 0, 164, 0, 0, 0, 0, 151, 0,
0, 0, 0, 0, 0, 221, 247, 0, 0, 0,
276, 273, 0, 297, 0, 0, 0, 172, 0, 0,
166, 167, 168, 171, 163, 100, 0, 266, 0, 0,
0, 274, 169, 170, 0, 0, 0, 264, 0, 265,
0, 0, 165, 173, 174, 0, 0, 0, 0, 0,
0, 271, 0, 0, 270, 267
};
/* YYDEFGOTO[NTERM-NUM]. */
static const short yydefgoto[] =
{
-1, 94, 312, 329, 330, 331, 255, 272, 332, 333,
219, 220, 243, 221, 25, 15, 63, 555, 359, 454,
522, 389, 455, 95, 96, 222, 98, 99, 202, 304,
400, 348, 401, 104, 1, 2, 3, 336, 307, 305,
306, 55, 190, 42, 72, 194, 100, 476, 415, 416,
417, 64, 113, 16, 30, 36, 17, 53, 18, 28,
108, 419, 349, 101, 351, 489, 19, 32, 33, 181,
182, 579, 66, 278, 526, 527, 183, 184, 430, 185,
186
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
#define YYPACT_NINF -542
static const short yypact[] =
{
-542, 13, 162, 567, -542, -542, -542, -542, -542, -542,
-542, -542, -542, -542, 83, -542, 19, -542, -542, -14,
-542, -542, 50, -87, 87, 233, 27, -542, 123, 141,
175, -542, -542, 98, -542, -542, -542, -542, 33, 40,
66, 68, -542, 14, 141, 1265, 156, 156, 156, 156,
-542, -542, -542, -542, -542, -542, 221, -542, -542, -542,
-542, -542, -542, 1265, -19, 1479, -542, 204, 135, 226,
227, 235, -542, -542, -542, -542, 81, -542, -542, -542,
-542, -542, -542, -542, -542, -542, -542, -542, -542, -542,
256, 257, 4, 15, -542, -542, 108, -542, -542, 12,
-542, -542, -542, -542, 1306, 1306, 1306, 1326, 175, -542,
98, -542, -542, -542, -542, 1306, -542, 205, 1367, 116,
479, 175, -542, -542, -542, -542, -542, -542, -542, -542,
-542, -542, -542, -542, -542, -542, -542, -542, -542, -542,
-542, -542, -542, -542, -542, -542, -542, -542, -542, 355,
429, 1306, 1306, 1306, 1306, 1306, 1306, 1306, 1306, 1306,
1306, 1306, 1306, -542, -542, -542, -542, -542, -542, -542,
-542, -542, -542, -542, -542, -542, 1306, 1306, 1306, 1306,
1306, -542, -542, 175, -542, 86, -542, -542, -542, -542,
-542, -542, -542, -542, -13, -542, 110, 111, 75, -542,
-542, 12, -81, 1046, -542, -542, -542, -542, 174, 208,
266, 210, 267, 212, 268, 230, 277, 275, 278, 246,
280, 279, 566, -542, -542, 136, 766, -542, -542, 81,
-542, 766, 766, -542, -542, -542, -542, -542, -542, -542,
-542, -542, -542, 766, 1265, -542, -542, -542, -542, -542,
-542, -542, -542, -542, -542, 1306, -542, -542, -542, -542,
-542, -542, -542, -542, -542, -542, -542, -542, -542, -542,
-542, -542, 1306, 137, 145, -542, 766, 132, 146, 147,
148, 149, 151, 152, 158, 160, 766, 766, 766, 161,
281, 1265, 1306, 1306, 291, -542, 1306, 1306, 155, -27,
1306, -542, -542, 165, 163, 176, 176, 176, -542, -542,
-542, -542, -542, -542, -542, -542, -542, -542, 355, 429,
172, 177, 178, 179, 182, 1087, 1387, 529, 311, 184,
185, 186, 188, 189, -542, -542, 176, 1107, -542, -542,
-542, -542, -542, -542, -542, -542, 282, 1326, -542, -542,
-542, -542, 193, -542, 194, 766, 766, 766, 7, -542,
20, -542, 195, 766, 192, 1306, 1306, 1306, 1306, 1306,
1306, 1306, 200, 201, 206, 1306, 1306, 766, 766, 207,
-542, -59, -149, -542, 196, 12, 1148, -542, 44, -542,
-542, -542, 203, 211, 1326, 1326, 1326, 1326, 1326, -542,
-542, -8, 741, -82, -542, 10, -542, 1326, 1326, 1326,
1326, 1326, -542, -542, 98, -542, 214, 209, -542, 337,
-34, 342, 348, 215, 218, 219, 766, 371, 766, 1306,
-542, 223, 766, 224, -542, -542, 225, 234, -542, -542,
766, 766, 766, -542, -542, 228, -542, 1306, -542, -542,
-542, -542, 362, 375, -542, 176, 1326, 1326, 195, 236,
237, 240, 243, 1326, -542, 238, -25, 11, -542, -542,
244, 245, 247, 250, 352, -542, -542, 1205, 370, 252,
-542, 766, 766, 1306, 766, 766, 258, -542, 258, -542,
259, 766, 264, 1306, 1306, 1306, -542, -542, -542, 1306,
766, -542, -542, -542, 270, 271, 263, 1326, 1326, 1326,
1326, -542, -542, 260, 1326, 1326, 1326, 1326, 1306, -542,
-542, -542, 368, 402, 274, 276, 259, 287, -542, -542,
374, -542, -542, 1306, 285, 766, -542, -542, -542, 290,
-542, 1326, 1326, -542, 283, 295, 284, 294, -542, 296,
297, 299, 302, 303, 430, -542, -542, 414, 41, 425,
-542, -542, 305, -542, 306, 310, 1326, -542, 1326, 1326,
-542, -542, -542, -542, -542, -542, 766, -542, 893, 144,
448, -542, -542, -542, 314, 315, 316, -542, 331, -542,
893, 766, -542, -542, -542, 464, 334, 180, 766, 481,
482, -542, 766, 766, -542, -542
};
/* YYPGOTO[NTERM-NUM]. */
static const short yypgoto[] =
{
-542, -542, -542, 435, 439, 441, 191, 197, 442, 445,
-119, -116, -541, -542, 478, 489, -107, -542, -267, 37,
-542, -238, -542, -60, -542, -45, -542, -74, -51, -542,
-101, 300, -252, 134, -542, -542, -542, -542, -542, -542,
-542, 473, -542, -542, -542, -542, 8, -542, 46, -542,
-542, 410, -542, -542, -542, -542, -542, -542, 518, -542,
-542, -542, -528, 142, -90, -113, -542, 505, -542, -72,
-542, -542, -542, -542, 97, 28, -542, -542, 70, -542,
-542
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule which
number is the opposite. If zero, do what YYDEFACT says.
If YYTABLE_NINF, syntax error. */
#define YYTABLE_NINF -180
static const short yytable[] =
{
97, 241, 227, 110, 242, 230, 223, 361, 197, 31,
111, 26, 449, 4, 244, 204, 34, 578, 97, 201,
74, 75, 426, 199, 77, 78, 79, 80, 81, 82,
83, 84, 85, 86, 87, 428, 88, 20, 590, 21,
275, 26, 31, 279, 280, 281, 282, 283, 284, 285,
588, 233, 234, 235, 236, 237, 238, 239, 240, 205,
206, 207, 596, 89, 427, 43, 289, 290, 390, 391,
226, 463, 300, 226, 403, 405, 291, 427, 452, 468,
74, 75, 301, 199, 77, 78, 79, 80, 81, 82,
83, 84, 85, 86, 87, 420, 88, 20, 412, 21,
448, 453, 38, 39, 40, 204, 273, 274, 226, 276,
277, 226, 226, 226, 226, 226, 226, 226, 225, 463,
20, 41, 21, 89, 201, 231, 300, 480, -139, 201,
-112, 286, 287, 288, 226, 226, 384, 232, -139, 204,
294, 352, 353, 112, 29, 463, 295, 299, 44, 35,
467, 464, 303, 354, 233, 234, 235, 236, 237, 238,
239, 240, -179, 463, 463, 54, 198, -112, 51, 90,
52, 71, 91, 469, 513, 92, 204, 93, 200, 50,
379, 105, 106, 107, 355, 67, 362, 5, 102, 103,
188, 189, 68, 6, 292, 293, 372, 373, 374, 97,
577, 308, 309, 7, 8, 9, 10, 11, 12, 13,
356, -72, -72, -71, -71, -70, -70, 503, 69, 531,
70, 532, 381, 382, 14, 109, 385, 357, 187, 90,
191, 377, 91, -69, -69, 92, -113, 93, 298, 56,
57, 58, 59, 60, 61, 62, 97, 378, 226, 310,
311, 192, 433, 45, 435, 436, 437, 123, 124, 193,
195, 196, 443, 203, 228, 423, 424, 425, 296, 297,
-76, -75, -74, 431, 7, 8, 9, 10, 46, 12,
47, -73, -79, 48, 313, -80, 314, 445, 446, 363,
358, 337, 414, 458, 459, 460, 461, 462, 360, 364,
365, 366, 367, 589, 368, 369, 470, 471, 472, 473,
474, 370, 385, 371, 375, 380, 383, 376, 386, 387,
226, 434, 226, 226, 226, 438, 439, 394, 466, 388,
226, 444, 395, 396, 397, 406, 486, 398, 488, 407,
408, 409, 492, 410, 411, 418, 421, 422, 429, 432,
496, 497, 498, 440, 441, 504, 505, 450, 456, 442,
447, 479, 511, 481, 335, 478, 457, 477, 350, 482,
483, 484, 485, 350, 350, 487, 491, 493, 494, 502,
536, 537, 538, 499, 226, 350, 501, 495, 518, 507,
508, 524, 525, 509, 528, 529, 510, 514, 515, 512,
516, 534, 500, 517, 452, 523, 544, 545, 546, 547,
540, 530, 533, 549, 550, 551, 552, 535, 350, 543,
560, 548, 475, 541, 542, 554, 556, 557, 350, 350,
350, 427, 414, 558, 575, 576, 566, 568, 226, 241,
564, 565, 242, 559, 561, 562, 563, 569, 226, 226,
226, 567, 570, 571, 226, 572, 256, 257, 573, 574,
241, 580, 582, 242, 581, 584, 583, 585, 586, 591,
592, 593, 594, 553, 245, 246, 247, 248, 249, 250,
251, 252, 253, 254, 595, 598, 587, 599, 226, 233,
234, 235, 236, 237, 238, 239, 240, 350, 350, 350,
176, 597, 602, 603, 177, 350, 178, 179, 601, 392,
180, 65, 604, 605, 49, 521, 393, 73, 224, 350,
350, 27, 334, 520, 37, 600, 490, 539, 506, 0,
0, 0, 0, 0, 74, 75, 0, 199, 208, 209,
210, 211, 212, 213, 214, 215, 216, 217, 218, 0,
88, 20, 0, 21, 258, 259, 260, 261, 262, 263,
264, 265, 266, 267, 268, 269, 270, 271, 350, 0,
350, 74, 75, 0, 350, 0, 0, 89, 0, 0,
0, 0, 350, 350, 350, 0, 0, -82, 20, 20,
21, 21, 315, 0, 0, 0, 0, 0, 6, -82,
-82, 0, 0, 0, 316, 317, 0, 0, -82, -82,
-82, -82, -82, -82, -82, 0, 0, -82, 22, 0,
0, 0, 0, 350, 350, 23, 350, 350, 0, 24,
0, 0, 0, 350, 0, 0, 0, 0, 0, 0,
0, 0, 350, 0, 0, 125, 126, 127, 128, 129,
130, 131, 132, 133, 134, 135, 136, 137, 138, 139,
140, 141, 142, 143, 144, 145, 146, 147, 148, 318,
319, 0, 0, 0, 0, 0, 320, 350, 321, 0,
322, 323, 324, 90, 0, 0, 91, 0, 0, 92,
0, 93, 404, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 163, 164, 165, 166, 167,
168, 169, 170, 171, 172, 173, 174, 175, 350, 0,
0, 0, 0, 325, 0, 0, 326, 0, 327, 0,
0, 328, 0, 350, 0, 0, 0, 0, 0, 0,
350, 0, 0, 0, 350, 350, 74, 75, 0, 199,
208, 209, 210, 211, 212, 213, 214, 215, 216, 217,
218, 0, 88, 20, 0, 21, 0, 0, 0, 338,
339, 74, 75, 340, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 20, 89,
21, 0, 341, 342, 343, 0, 0, 0, 0, 0,
0, 0, 0, 0, 344, 345, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 346, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 125, 126, 127, 128, 129,
130, 131, 132, 133, 134, 135, 136, 137, 138, 139,
140, 141, 142, 143, 144, 145, 146, 147, 148, 318,
319, 0, 0, 0, 0, 0, 320, 0, 321, 0,
322, 323, 324, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 90, 338, 339, 91, 0,
340, 92, 0, 93, 465, 163, 164, 165, 166, 167,
168, 169, 170, 171, 172, 173, 174, 175, 0, 341,
342, 343, 0, 0, 0, 0, 347, 0, 0, 0,
0, 344, 345, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 346, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 125, 126, 127, 128, 129, 130, 131, 132,
133, 134, 135, 136, 137, 138, 139, 140, 141, 142,
143, 144, 145, 146, 147, 148, 318, 319, 0, 0,
0, 0, 0, 320, 0, 321, 0, 322, 323, 324,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 163, 164, 165, 166, 167, 168, 169, 170,
171, 172, 173, 174, 175, 0, 0, 0, 0, 0,
0, 74, 75, 347, 199, 77, 78, 79, 80, 81,
82, 83, 84, 85, 86, 87, 0, 88, 20, 0,
21, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 302, 0, 0, 0, 0, 0, 0,
0, 0, 74, 75, 89, 199, 208, 209, 210, 211,
212, 213, 214, 215, 216, 217, 218, 0, 88, 20,
0, 21, 74, 75, 0, 199, 77, 78, 79, 80,
81, 82, 83, 84, 85, 86, 87, 0, 88, 20,
0, 21, 0, 0, 0, 89, 0, 0, 0, 0,
0, 0, 0, 0, 413, 0, 0, 0, 0, 0,
0, 0, 0, 74, 75, 89, 199, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87, 0, 88,
20, 0, 21, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 451, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 89, 0, 0, 0,
90, 0, 0, 91, 0, 0, 92, 0, 93, 0,
74, 75, 0, 199, 77, 78, 79, 80, 81, 82,
83, 84, 85, 86, 87, 0, 88, 20, 0, 21,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 90, 519, 0, 91, 0, 399, 92, 0, 93,
0, 0, 0, 89, 0, 0, 0, 0, 0, 0,
0, 90, 0, 0, 91, 0, 0, 92, 0, 93,
74, 75, 0, 76, 77, 78, 79, 80, 81, 82,
83, 84, 85, 86, 87, 0, 88, 20, 0, 21,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 90, 0, 0, 91, 0, 0, 92, 0,
93, 74, 75, 89, 199, 77, 78, 79, 80, 81,
82, 83, 84, 85, 86, 87, 0, 88, 20, 0,
21, 74, 75, 0, 199, 208, 209, 210, 211, 212,
213, 214, 215, 216, 217, 218, 0, 88, 20, 0,
21, 0, 0, 0, 89, 0, 0, 0, 0, 90,
0, 0, 91, 0, 0, 92, 0, 93, 0, 0,
0, 0, 74, 75, 89, 229, 77, 78, 79, 80,
81, 82, 83, 84, 85, 86, 87, 0, 88, 20,
0, 21, 74, 75, 0, 199, 208, 209, 210, 211,
212, 213, 214, 215, 216, 217, 218, 0, 88, 20,
0, 21, 0, 0, 0, 89, 0, 0, 0, 90,
0, 0, 91, 0, 0, 92, 0, 93, 0, 0,
0, 0, 0, 0, 0, 89, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
90, 0, 0, 91, 0, 0, 92, 0, 93, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
90, 0, 0, 91, 0, 0, 92, 0, 93, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 114, 0, 0, 0, 0, 0,
0, 90, 0, 0, 91, 0, 0, 92, 115, 93,
0, 0, 0, 0, 0, 0, 0, 0, 116, 117,
0, 90, 0, 0, 91, 0, 0, 92, 0, 402,
0, 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, 0, 0, 154,
155, 156, 157, 158, 159, 160, 161, 162, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 163, 164,
165, 166, 167, 168, 169, 170, 171, 172, 173, 174,
175
};
static const short yycheck[] =
{
45, 120, 115, 63, 120, 118, 107, 274, 4, 23,
29, 3, 161, 0, 121, 164, 30, 558, 63, 93,
5, 6, 15, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 15, 21, 22, 579, 24,
153, 33, 23, 156, 157, 158, 159, 160, 161, 162,
578, 10, 11, 12, 13, 14, 15, 16, 17, 104,
105, 106, 590, 48, 57, 152, 179, 180, 306, 307,
115, 153, 153, 118, 326, 327, 183, 57, 34, 161,
5, 6, 163, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 347, 21, 22, 336, 24,
159, 57, 52, 53, 54, 164, 151, 152, 153, 154,
155, 156, 157, 158, 159, 160, 161, 162, 110, 153,
22, 71, 24, 48, 198, 9, 153, 161, 153, 203,
155, 176, 177, 178, 179, 180, 163, 21, 163, 164,
153, 231, 232, 162, 61, 153, 159, 198, 61, 163,
402, 159, 203, 243, 10, 11, 12, 13, 14, 15,
16, 17, 0, 153, 153, 24, 162, 155, 45, 154,
47, 157, 157, 163, 163, 160, 164, 162, 163, 152,
293, 47, 48, 49, 244, 152, 276, 25, 32, 33,
55, 56, 152, 31, 108, 109, 286, 287, 288, 244,
159, 27, 28, 41, 42, 43, 44, 45, 46, 47,
255, 3, 4, 3, 4, 3, 4, 455, 152, 486,
152, 488, 296, 297, 62, 4, 300, 272, 24, 154,
4, 291, 157, 3, 4, 160, 155, 162, 163, 64,
65, 66, 67, 68, 69, 70, 291, 292, 293, 3,
4, 24, 365, 20, 367, 368, 369, 77, 78, 24,
4, 4, 375, 155, 59, 355, 356, 357, 158, 158,
4, 4, 4, 363, 41, 42, 43, 44, 45, 46,
47, 4, 7, 50, 4, 7, 7, 377, 378, 157,
153, 155, 337, 394, 395, 396, 397, 398, 153, 153,
153, 153, 153, 159, 153, 153, 407, 408, 409, 410,
411, 153, 386, 153, 153, 24, 161, 36, 153, 156,
365, 366, 367, 368, 369, 370, 371, 155, 402, 153,
375, 376, 155, 155, 155, 24, 426, 155, 428, 155,
155, 155, 432, 155, 155, 63, 153, 153, 153, 157,
440, 441, 442, 153, 153, 456, 457, 161, 155, 153,
153, 24, 463, 21, 222, 156, 155, 153, 226, 21,
155, 153, 153, 231, 232, 4, 153, 153, 153, 4,
493, 494, 495, 155, 429, 243, 24, 153, 36, 153,
153, 481, 482, 153, 484, 485, 153, 153, 153, 161,
153, 491, 447, 153, 34, 153, 507, 508, 509, 510,
500, 153, 153, 514, 515, 516, 517, 153, 276, 156,
533, 161, 414, 153, 153, 57, 24, 153, 286, 287,
288, 57, 477, 157, 4, 21, 153, 153, 483, 558,
541, 542, 558, 156, 159, 535, 156, 153, 493, 494,
495, 156, 156, 156, 499, 156, 27, 28, 156, 156,
579, 36, 156, 579, 159, 566, 156, 568, 569, 21,
156, 156, 156, 518, 119, 120, 121, 122, 123, 124,
125, 126, 127, 128, 153, 21, 576, 153, 533, 10,
11, 12, 13, 14, 15, 16, 17, 355, 356, 357,
65, 591, 21, 21, 65, 363, 65, 65, 598, 318,
65, 33, 602, 603, 25, 478, 319, 44, 108, 377,
378, 3, 222, 477, 19, 597, 429, 499, 458, -1,
-1, -1, -1, -1, 5, 6, -1, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, -1,
21, 22, -1, 24, 125, 126, 127, 128, 129, 130,
131, 132, 133, 134, 135, 136, 137, 138, 426, -1,
428, 5, 6, -1, 432, -1, -1, 48, -1, -1,
-1, -1, 440, 441, 442, -1, -1, 20, 22, 22,
24, 24, 26, -1, -1, -1, -1, -1, 31, 32,
33, -1, -1, -1, 38, 39, -1, -1, 41, 42,
43, 44, 45, 46, 47, -1, -1, 50, 51, -1,
-1, -1, -1, 481, 482, 58, 484, 485, -1, 62,
-1, -1, -1, 491, -1, -1, -1, -1, -1, -1,
-1, -1, 500, -1, -1, 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, -1, -1, -1, -1, -1, 110, 535, 112, -1,
114, 115, 116, 154, -1, -1, 157, -1, -1, 160,
-1, 162, 163, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 139, 140, 141, 142, 143,
144, 145, 146, 147, 148, 149, 150, 151, 576, -1,
-1, -1, -1, 157, -1, -1, 160, -1, 162, -1,
-1, 165, -1, 591, -1, -1, -1, -1, -1, -1,
598, -1, -1, -1, 602, 603, 5, 6, -1, 8,
9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
19, -1, 21, 22, -1, 24, -1, -1, -1, 3,
4, 5, 6, 7, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 22, 48,
24, -1, 26, 27, 28, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 38, 39, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 61, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 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, -1, -1, -1, -1, -1, 110, -1, 112, -1,
114, 115, 116, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 154, 3, 4, 157, -1,
7, 160, -1, 162, 163, 139, 140, 141, 142, 143,
144, 145, 146, 147, 148, 149, 150, 151, -1, 26,
27, 28, -1, -1, -1, -1, 160, -1, -1, -1,
-1, 38, 39, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 61, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 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, -1, -1,
-1, -1, -1, 110, -1, 112, -1, 114, 115, 116,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 139, 140, 141, 142, 143, 144, 145, 146,
147, 148, 149, 150, 151, -1, -1, -1, -1, -1,
-1, 5, 6, 160, 8, 9, 10, 11, 12, 13,
14, 15, 16, 17, 18, 19, -1, 21, 22, -1,
24, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 37, -1, -1, -1, -1, -1, -1,
-1, -1, 5, 6, 48, 8, 9, 10, 11, 12,
13, 14, 15, 16, 17, 18, 19, -1, 21, 22,
-1, 24, 5, 6, -1, 8, 9, 10, 11, 12,
13, 14, 15, 16, 17, 18, 19, -1, 21, 22,
-1, 24, -1, -1, -1, 48, -1, -1, -1, -1,
-1, -1, -1, -1, 37, -1, -1, -1, -1, -1,
-1, -1, -1, 5, 6, 48, 8, 9, 10, 11,
12, 13, 14, 15, 16, 17, 18, 19, -1, 21,
22, -1, 24, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 37, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 48, -1, -1, -1,
154, -1, -1, 157, -1, -1, 160, -1, 162, -1,
5, 6, -1, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, -1, 21, 22, -1, 24,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 154, 37, -1, 157, -1, 159, 160, -1, 162,
-1, -1, -1, 48, -1, -1, -1, -1, -1, -1,
-1, 154, -1, -1, 157, -1, -1, 160, -1, 162,
5, 6, -1, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, -1, 21, 22, -1, 24,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 154, -1, -1, 157, -1, -1, 160, -1,
162, 5, 6, 48, 8, 9, 10, 11, 12, 13,
14, 15, 16, 17, 18, 19, -1, 21, 22, -1,
24, 5, 6, -1, 8, 9, 10, 11, 12, 13,
14, 15, 16, 17, 18, 19, -1, 21, 22, -1,
24, -1, -1, -1, 48, -1, -1, -1, -1, 154,
-1, -1, 157, -1, -1, 160, -1, 162, -1, -1,
-1, -1, 5, 6, 48, 8, 9, 10, 11, 12,
13, 14, 15, 16, 17, 18, 19, -1, 21, 22,
-1, 24, 5, 6, -1, 8, 9, 10, 11, 12,
13, 14, 15, 16, 17, 18, 19, -1, 21, 22,
-1, 24, -1, -1, -1, 48, -1, -1, -1, 154,
-1, -1, 157, -1, -1, 160, -1, 162, -1, -1,
-1, -1, -1, -1, -1, 48, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
154, -1, -1, 157, -1, -1, 160, -1, 162, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
154, -1, -1, 157, -1, -1, 160, -1, 162, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 35, -1, -1, -1, -1, -1,
-1, 154, -1, -1, 157, -1, -1, 160, 49, 162,
-1, -1, -1, -1, -1, -1, -1, -1, 59, 60,
-1, 154, -1, -1, 157, -1, -1, 160, -1, 162,
-1, 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, -1, -1, 110,
111, 112, 113, 114, 115, 116, 117, 118, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 139, 140,
141, 142, 143, 144, 145, 146, 147, 148, 149, 150,
151
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const unsigned char yystos[] =
{
0, 200, 201, 202, 0, 25, 31, 41, 42, 43,
44, 45, 46, 47, 62, 181, 219, 222, 224, 232,
22, 24, 51, 58, 62, 180, 212, 224, 225, 61,
220, 23, 233, 234, 30, 163, 221, 233, 52, 53,
54, 71, 209, 152, 61, 20, 45, 47, 50, 181,
152, 45, 47, 223, 24, 207, 64, 65, 66, 67,
68, 69, 70, 182, 217, 180, 238, 152, 152, 152,
152, 157, 210, 207, 5, 6, 8, 9, 10, 11,
12, 13, 14, 15, 16, 17, 18, 19, 21, 48,
154, 157, 160, 162, 167, 189, 190, 191, 192, 193,
212, 229, 32, 33, 199, 199, 199, 199, 226, 4,
189, 29, 162, 218, 35, 49, 59, 60, 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, 110, 111, 112, 113, 114, 115,
116, 117, 118, 139, 140, 141, 142, 143, 144, 145,
146, 147, 148, 149, 150, 151, 169, 170, 171, 174,
175, 235, 236, 242, 243, 245, 246, 24, 55, 56,
208, 4, 24, 24, 211, 4, 4, 4, 162, 8,
163, 193, 194, 155, 164, 191, 191, 191, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 176,
177, 179, 191, 196, 217, 212, 191, 231, 59, 8,
231, 9, 21, 10, 11, 12, 13, 14, 15, 16,
17, 176, 177, 178, 182, 119, 120, 121, 122, 123,
124, 125, 126, 127, 128, 172, 27, 28, 125, 126,
127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
137, 138, 173, 191, 191, 231, 191, 191, 239, 231,
231, 231, 231, 231, 231, 231, 191, 191, 191, 231,
231, 182, 108, 109, 153, 159, 158, 158, 163, 194,
153, 163, 37, 194, 195, 205, 206, 204, 27, 28,
3, 4, 168, 4, 7, 26, 38, 39, 103, 104,
110, 112, 114, 115, 116, 157, 160, 162, 165, 169,
170, 171, 174, 175, 197, 229, 203, 155, 3, 4,
7, 26, 27, 28, 38, 39, 61, 160, 197, 228,
229, 230, 230, 230, 230, 189, 191, 191, 153, 184,
153, 184, 230, 157, 153, 153, 153, 153, 153, 153,
153, 153, 230, 230, 230, 153, 36, 189, 191, 231,
24, 193, 193, 161, 163, 193, 153, 156, 153, 187,
187, 187, 172, 173, 155, 155, 155, 155, 155, 159,
196, 198, 162, 198, 163, 198, 24, 155, 155, 155,
155, 155, 187, 37, 191, 214, 215, 216, 63, 227,
198, 153, 153, 230, 230, 230, 15, 57, 15, 153,
244, 230, 157, 231, 191, 231, 231, 231, 191, 191,
153, 153, 153, 231, 191, 230, 230, 153, 159, 161,
161, 37, 34, 57, 185, 188, 155, 155, 196, 196,
196, 196, 196, 153, 159, 163, 193, 198, 161, 163,
196, 196, 196, 196, 196, 212, 213, 153, 156, 24,
161, 21, 21, 155, 153, 153, 230, 4, 230, 231,
240, 153, 230, 153, 153, 153, 230, 230, 230, 155,
191, 24, 4, 187, 196, 196, 244, 153, 153, 153,
153, 196, 161, 163, 153, 153, 153, 153, 36, 37,
214, 185, 186, 153, 230, 230, 240, 241, 230, 230,
153, 184, 184, 153, 230, 153, 231, 231, 231, 241,
230, 153, 153, 156, 196, 196, 196, 196, 161, 196,
196, 196, 196, 191, 57, 183, 24, 153, 157, 156,
231, 159, 230, 156, 196, 196, 153, 156, 153, 153,
156, 156, 156, 156, 156, 4, 21, 159, 178, 237,
36, 159, 156, 156, 196, 196, 196, 230, 228, 159,
178, 21, 156, 156, 156, 153, 228, 230, 21, 153,
235, 230, 21, 21, 230, 230
};
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
# define YYSIZE_T __SIZE_TYPE__
#endif
#if ! defined (YYSIZE_T) && defined (size_t)
# define YYSIZE_T size_t
#endif
#if ! defined (YYSIZE_T)
# if defined (__STDC__) || defined (__cplusplus)
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
# define YYSIZE_T size_t
# endif
#endif
#if ! defined (YYSIZE_T)
# define YYSIZE_T unsigned int
#endif
#define yyerrok (yyerrstatus = 0)
#define yyclearin (yychar = YYEMPTY)
#define YYEMPTY (-2)
#define YYEOF 0
#define YYACCEPT goto yyacceptlab
#define YYABORT goto yyabortlab
#define YYERROR goto yyerrorlab
/* Like YYERROR except do call yyerror. This remains here temporarily
to ease the transition to the new meaning of YYERROR, for GCC.
Once GCC version 2 has supplanted version 1, this can go. */
#define YYFAIL goto yyerrlab
#define YYRECOVERING() (!!yyerrstatus)
#define YYBACKUP(Token, Value) \
do \
if (yychar == YYEMPTY && yylen == 1) \
{ \
yychar = (Token); \
yylval = (Value); \
yytoken = YYTRANSLATE (yychar); \
YYPOPSTACK; \
goto yybackup; \
} \
else \
{ \
yyerror ("syntax error: cannot back up");\
YYERROR; \
} \
while (0)
#define YYTERROR 1
#define YYERRCODE 256
/* YYLLOC_DEFAULT -- Compute the default location (before the actions
are run). */
#ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N) \
((Current).first_line = (Rhs)[1].first_line, \
(Current).first_column = (Rhs)[1].first_column, \
(Current).last_line = (Rhs)[N].last_line, \
(Current).last_column = (Rhs)[N].last_column)
#endif
/* YYLEX -- calling `yylex' with the right arguments. */
#ifdef YYLEX_PARAM
# define YYLEX yylex (YYLEX_PARAM)
#else
# define YYLEX yylex ()
#endif
/* Enable debugging if requested. */
#if YYDEBUG
# ifndef YYFPRINTF
# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
# define YYFPRINTF fprintf
# endif
# define YYDPRINTF(Args) \
do { \
if (yydebug) \
YYFPRINTF Args; \
} while (0)
# define YYDSYMPRINT(Args) \
do { \
if (yydebug) \
yysymprint Args; \
} while (0)
# define YYDSYMPRINTF(Title, Token, Value, Location) \
do { \
if (yydebug) \
{ \
YYFPRINTF (stderr, "%s ", Title); \
yysymprint (stderr, \
Token, Value); \
YYFPRINTF (stderr, "\n"); \
} \
} while (0)
/*------------------------------------------------------------------.
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
| TOP (included). |
`------------------------------------------------------------------*/
#if defined (__STDC__) || defined (__cplusplus)
static void
yy_stack_print (short *bottom, short *top)
#else
static void
yy_stack_print (bottom, top)
short *bottom;
short *top;
#endif
{
YYFPRINTF (stderr, "Stack now");
for (/* Nothing. */; bottom <= top; ++bottom)
YYFPRINTF (stderr, " %d", *bottom);
YYFPRINTF (stderr, "\n");
}
# define YY_STACK_PRINT(Bottom, Top) \
do { \
if (yydebug) \
yy_stack_print ((Bottom), (Top)); \
} while (0)
/*------------------------------------------------.
| Report that the YYRULE is going to be reduced. |
`------------------------------------------------*/
#if defined (__STDC__) || defined (__cplusplus)
static void
yy_reduce_print (int yyrule)
#else
static void
yy_reduce_print (yyrule)
int yyrule;
#endif
{
int yyi;
unsigned int yylno = yyrline[yyrule];
YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
yyrule - 1, yylno);
/* Print the symbols being reduced, and their result. */
for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
}
# define YY_REDUCE_PRINT(Rule) \
do { \
if (yydebug) \
yy_reduce_print (Rule); \
} while (0)
/* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */
int yydebug;
#else /* !YYDEBUG */
# define YYDPRINTF(Args)
# define YYDSYMPRINT(Args)
# define YYDSYMPRINTF(Title, Token, Value, Location)
# define YY_STACK_PRINT(Bottom, Top)
# define YY_REDUCE_PRINT(Rule)
#endif /* !YYDEBUG */
/* YYINITDEPTH -- initial size of the parser's stacks. */
#ifndef YYINITDEPTH
# define YYINITDEPTH 200
#endif
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
if the built-in stack extension method is used).
Do not make this value too large; the results are undefined if
SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
evaluated with infinite-precision integer arithmetic. */
#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
# undef YYMAXDEPTH
#endif
#ifndef YYMAXDEPTH
# define YYMAXDEPTH 10000
#endif
#if YYERROR_VERBOSE
# ifndef yystrlen
# if defined (__GLIBC__) && defined (_STRING_H)
# define yystrlen strlen
# else
/* Return the length of YYSTR. */
static YYSIZE_T
# if defined (__STDC__) || defined (__cplusplus)
yystrlen (const char *yystr)
# else
yystrlen (yystr)
const char *yystr;
# endif
{
register const char *yys = yystr;
while (*yys++ != '\0')
continue;
return yys - yystr - 1;
}
# endif
# endif
# ifndef yystpcpy
# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
# define yystpcpy stpcpy
# else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
YYDEST. */
static char *
# if defined (__STDC__) || defined (__cplusplus)
yystpcpy (char *yydest, const char *yysrc)
# else
yystpcpy (yydest, yysrc)
char *yydest;
const char *yysrc;
# endif
{
register char *yyd = yydest;
register const char *yys = yysrc;
while ((*yyd++ = *yys++) != '\0')
continue;
return yyd - 1;
}
# endif
# endif
#endif /* !YYERROR_VERBOSE */
#if YYDEBUG
/*--------------------------------.
| Print this symbol on YYOUTPUT. |
`--------------------------------*/
#if defined (__STDC__) || defined (__cplusplus)
static void
yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
#else
static void
yysymprint (yyoutput, yytype, yyvaluep)
FILE *yyoutput;
int yytype;
YYSTYPE *yyvaluep;
#endif
{
/* Pacify ``unused variable'' warnings. */
(void) yyvaluep;
if (yytype < YYNTOKENS)
{
YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
# ifdef YYPRINT
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
# endif
}
else
YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
switch (yytype)
{
default:
break;
}
YYFPRINTF (yyoutput, ")");
}
#endif /* ! YYDEBUG */
/*-----------------------------------------------.
| Release the memory associated to this symbol. |
`-----------------------------------------------*/
#if defined (__STDC__) || defined (__cplusplus)
static void
yydestruct (int yytype, YYSTYPE *yyvaluep)
#else
static void
yydestruct (yytype, yyvaluep)
int yytype;
YYSTYPE *yyvaluep;
#endif
{
/* Pacify ``unused variable'' warnings. */
(void) yyvaluep;
switch (yytype)
{
default:
break;
}
}
/* Prevent warnings from -Wmissing-prototypes. */
#ifdef YYPARSE_PARAM
# if defined (__STDC__) || defined (__cplusplus)
int yyparse (void *YYPARSE_PARAM);
# else
int yyparse ();
# endif
#else /* ! YYPARSE_PARAM */
#if defined (__STDC__) || defined (__cplusplus)
int yyparse (void);
#else
int yyparse ();
#endif
#endif /* ! YYPARSE_PARAM */
/* The lookahead symbol. */
int yychar;
/* The semantic value of the lookahead symbol. */
YYSTYPE yylval;
/* Number of syntax errors so far. */
int yynerrs;
/*----------.
| yyparse. |
`----------*/
#ifdef YYPARSE_PARAM
# if defined (__STDC__) || defined (__cplusplus)
int yyparse (void *YYPARSE_PARAM)
# else
int yyparse (YYPARSE_PARAM)
void *YYPARSE_PARAM;
# endif
#else /* ! YYPARSE_PARAM */
#if defined (__STDC__) || defined (__cplusplus)
int
yyparse (void)
#else
int
yyparse ()
#endif
#endif
{
register int yystate;
register int yyn;
int yyresult;
/* Number of tokens to shift before error messages enabled. */
int yyerrstatus;
/* Lookahead token as an internal (translated) token number. */
int yytoken = 0;
/* Three stacks and their tools:
`yyss': related to states,
`yyvs': related to semantic values,
`yyls': related to locations.
Refer to the stacks thru separate pointers, to allow yyoverflow
to reallocate them elsewhere. */
/* The state stack. */
short yyssa[YYINITDEPTH];
short *yyss = yyssa;
register short *yyssp;
/* The semantic value stack. */
YYSTYPE yyvsa[YYINITDEPTH];
YYSTYPE *yyvs = yyvsa;
register YYSTYPE *yyvsp;
#define YYPOPSTACK (yyvsp--, yyssp--)
YYSIZE_T yystacksize = YYINITDEPTH;
/* The variables used to return semantic value and location from the
action routines. */
YYSTYPE yyval;
/* When reducing, the number of symbols on the RHS of the reduced
rule. */
int yylen;
YYDPRINTF ((stderr, "Starting parse\n"));
yystate = 0;
yyerrstatus = 0;
yynerrs = 0;
yychar = YYEMPTY; /* Cause a token to be read. */
/* Initialize stack pointers.
Waste one element of value and location stack
so that they stay on the same level as the state stack.
The wasted elements are never initialized. */
yyssp = yyss;
yyvsp = yyvs;
goto yysetstate;
/*------------------------------------------------------------.
| yynewstate -- Push a new state, which is found in yystate. |
`------------------------------------------------------------*/
yynewstate:
/* In all cases, when you get here, the value and location stacks
have just been pushed. so pushing a state here evens the stacks.
*/
yyssp++;
yysetstate:
*yyssp = yystate;
if (yyss + yystacksize - 1 <= yyssp)
{
/* Get the current used size of the three stacks, in elements. */
YYSIZE_T yysize = yyssp - yyss + 1;
#ifdef yyoverflow
{
/* Give user a chance to reallocate the stack. Use copies of
these so that the &'s don't force the real ones into
memory. */
YYSTYPE *yyvs1 = yyvs;
short *yyss1 = yyss;
/* Each stack pointer address is followed by the size of the
data in use in that stack, in bytes. This used to be a
conditional around just the two extra args, but that might
be undefined if yyoverflow is a macro. */
yyoverflow ("parser stack overflow",
&yyss1, yysize * sizeof (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp),
&yystacksize);
yyss = yyss1;
yyvs = yyvs1;
}
#else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE
goto yyoverflowlab;
# else
/* Extend the stack our own way. */
if (YYMAXDEPTH <= yystacksize)
goto yyoverflowlab;
yystacksize *= 2;
if (YYMAXDEPTH < yystacksize)
yystacksize = YYMAXDEPTH;
{
short *yyss1 = yyss;
union yyalloc *yyptr =
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
if (! yyptr)
goto yyoverflowlab;
YYSTACK_RELOCATE (yyss);
YYSTACK_RELOCATE (yyvs);
# undef YYSTACK_RELOCATE
if (yyss1 != yyssa)
YYSTACK_FREE (yyss1);
}
# endif
#endif /* no yyoverflow */
yyssp = yyss + yysize - 1;
yyvsp = yyvs + yysize - 1;
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
(unsigned long int) yystacksize));
if (yyss + yystacksize - 1 <= yyssp)
YYABORT;
}
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
goto yybackup;
/*-----------.
| yybackup. |
`-----------*/
yybackup:
/* Do appropriate processing given the current state. */
/* Read a lookahead token if we need one and don't already have one. */
/* yyresume: */
/* First try to decide what to do without reference to lookahead token. */
yyn = yypact[yystate];
if (yyn == YYPACT_NINF)
goto yydefault;
/* Not known => get a lookahead token if don't already have one. */
/* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
if (yychar == YYEMPTY)
{
YYDPRINTF ((stderr, "Reading a token: "));
yychar = YYLEX;
}
if (yychar <= YYEOF)
{
yychar = yytoken = YYEOF;
YYDPRINTF ((stderr, "Now at end of input.\n"));
}
else
{
yytoken = YYTRANSLATE (yychar);
YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
}
/* If the proper action on seeing token YYTOKEN is to reduce or to
detect an error, take that action. */
yyn += yytoken;
if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
goto yydefault;
yyn = yytable[yyn];
if (yyn <= 0)
{
if (yyn == 0 || yyn == YYTABLE_NINF)
goto yyerrlab;
yyn = -yyn;
goto yyreduce;
}
if (yyn == YYFINAL)
YYACCEPT;
/* Shift the lookahead token. */
YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
/* Discard the token being shifted unless it is eof. */
if (yychar != YYEOF)
yychar = YYEMPTY;
*++yyvsp = yylval;
/* Count tokens shifted since error; after three, turn off error
status. */
if (yyerrstatus)
yyerrstatus--;
yystate = yyn;
goto yynewstate;
/*-----------------------------------------------------------.
| yydefault -- do the default action for the current state. |
`-----------------------------------------------------------*/
yydefault:
yyn = yydefact[yystate];
if (yyn == 0)
goto yyerrlab;
goto yyreduce;
/*-----------------------------.
| yyreduce -- Do a reduction. |
`-----------------------------*/
yyreduce:
/* yyn is the number of a rule to reduce with. */
yylen = yyr2[yyn];
/* If YYLEN is nonzero, implement the default value of the action:
`$$ = $1'.
Otherwise, the following line sets YYVAL to garbage.
This behavior is undocumented and Bison
users should not rely upon it. Assigning to YYVAL
unconditionally makes the parser a bit smaller, and it avoids a
GCC warning that YYVAL may be used uninitialized. */
yyval = yyvsp[1-yylen];
YY_REDUCE_PRINT (yyn);
switch (yyn)
{
case 3:
#line 1891 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
if (yyvsp[0].UIntVal > (uint32_t)INT32_MAX) // Outside of my range!
error("Value too large for type");
yyval.SIntVal = (int32_t)yyvsp[0].UIntVal;
;}
break;
case 5:
#line 1900 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
if (yyvsp[0].UInt64Val > (uint64_t)INT64_MAX) // Outside of my range!
error("Value too large for type");
yyval.SInt64Val = (int64_t)yyvsp[0].UInt64Val;
;}
break;
case 26:
#line 1922 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.IPred = ICmpInst::ICMP_EQ; ;}
break;
case 27:
#line 1922 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.IPred = ICmpInst::ICMP_NE; ;}
break;
case 28:
#line 1923 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.IPred = ICmpInst::ICMP_SLT; ;}
break;
case 29:
#line 1923 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.IPred = ICmpInst::ICMP_SGT; ;}
break;
case 30:
#line 1924 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.IPred = ICmpInst::ICMP_SLE; ;}
break;
case 31:
#line 1924 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.IPred = ICmpInst::ICMP_SGE; ;}
break;
case 32:
#line 1925 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.IPred = ICmpInst::ICMP_ULT; ;}
break;
case 33:
#line 1925 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.IPred = ICmpInst::ICMP_UGT; ;}
break;
case 34:
#line 1926 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.IPred = ICmpInst::ICMP_ULE; ;}
break;
case 35:
#line 1926 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.IPred = ICmpInst::ICMP_UGE; ;}
break;
case 36:
#line 1930 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.FPred = FCmpInst::FCMP_OEQ; ;}
break;
case 37:
#line 1930 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.FPred = FCmpInst::FCMP_ONE; ;}
break;
case 38:
#line 1931 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.FPred = FCmpInst::FCMP_OLT; ;}
break;
case 39:
#line 1931 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.FPred = FCmpInst::FCMP_OGT; ;}
break;
case 40:
#line 1932 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.FPred = FCmpInst::FCMP_OLE; ;}
break;
case 41:
#line 1932 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.FPred = FCmpInst::FCMP_OGE; ;}
break;
case 42:
#line 1933 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.FPred = FCmpInst::FCMP_ORD; ;}
break;
case 43:
#line 1933 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.FPred = FCmpInst::FCMP_UNO; ;}
break;
case 44:
#line 1934 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.FPred = FCmpInst::FCMP_UEQ; ;}
break;
case 45:
#line 1934 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.FPred = FCmpInst::FCMP_UNE; ;}
break;
case 46:
#line 1935 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.FPred = FCmpInst::FCMP_ULT; ;}
break;
case 47:
#line 1935 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.FPred = FCmpInst::FCMP_UGT; ;}
break;
case 48:
#line 1936 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.FPred = FCmpInst::FCMP_ULE; ;}
break;
case 49:
#line 1936 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.FPred = FCmpInst::FCMP_UGE; ;}
break;
case 50:
#line 1937 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.FPred = FCmpInst::FCMP_TRUE; ;}
break;
case 51:
#line 1938 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.FPred = FCmpInst::FCMP_FALSE; ;}
break;
case 81:
#line 1969 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyval.StrVal = yyvsp[-1].StrVal;
;}
break;
case 82:
#line 1972 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyval.StrVal = 0;
;}
break;
case 83:
#line 1977 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.Linkage = GlobalValue::InternalLinkage; ;}
break;
case 84:
#line 1978 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.Linkage = GlobalValue::LinkOnceLinkage; ;}
break;
case 85:
#line 1979 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.Linkage = GlobalValue::WeakLinkage; ;}
break;
case 86:
#line 1980 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.Linkage = GlobalValue::AppendingLinkage; ;}
break;
case 87:
#line 1981 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.Linkage = GlobalValue::DLLImportLinkage; ;}
break;
case 88:
#line 1982 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.Linkage = GlobalValue::DLLExportLinkage; ;}
break;
case 89:
#line 1983 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.Linkage = GlobalValue::ExternalWeakLinkage; ;}
break;
case 90:
#line 1984 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.Linkage = GlobalValue::ExternalLinkage; ;}
break;
case 91:
#line 1988 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.UIntVal = lastCallingConv = OldCallingConv::C; ;}
break;
case 92:
#line 1989 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.UIntVal = lastCallingConv = OldCallingConv::C; ;}
break;
case 93:
#line 1990 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.UIntVal = lastCallingConv = OldCallingConv::CSRet; ;}
break;
case 94:
#line 1991 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.UIntVal = lastCallingConv = OldCallingConv::Fast; ;}
break;
case 95:
#line 1992 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.UIntVal = lastCallingConv = OldCallingConv::Cold; ;}
break;
case 96:
#line 1993 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.UIntVal = lastCallingConv = OldCallingConv::X86_StdCall; ;}
break;
case 97:
#line 1994 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.UIntVal = lastCallingConv = OldCallingConv::X86_FastCall; ;}
break;
case 98:
#line 1995 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
if ((unsigned)yyvsp[0].UInt64Val != yyvsp[0].UInt64Val)
error("Calling conv too large");
yyval.UIntVal = lastCallingConv = yyvsp[0].UInt64Val;
;}
break;
case 99:
#line 2005 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.UIntVal = 0; ;}
break;
case 100:
#line 2006 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyval.UIntVal = yyvsp[0].UInt64Val;
if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
error("Alignment must be a power of two");
;}
break;
case 101:
#line 2014 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.UIntVal = 0; ;}
break;
case 102:
#line 2015 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyval.UIntVal = yyvsp[0].UInt64Val;
if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
error("Alignment must be a power of two");
;}
break;
case 103:
#line 2023 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
for (unsigned i = 0, e = strlen(yyvsp[0].StrVal); i != e; ++i)
if (yyvsp[0].StrVal[i] == '"' || yyvsp[0].StrVal[i] == '\\')
error("Invalid character in section name");
yyval.StrVal = yyvsp[0].StrVal;
;}
break;
case 104:
#line 2032 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.StrVal = 0; ;}
break;
case 105:
#line 2033 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.StrVal = yyvsp[0].StrVal; ;}
break;
case 106:
#line 2040 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{;}
break;
case 107:
#line 2041 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{;}
break;
case 108:
#line 2045 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
CurGV->setSection(yyvsp[0].StrVal);
free(yyvsp[0].StrVal);
;}
break;
case 109:
#line 2049 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
if (yyvsp[0].UInt64Val != 0 && !isPowerOf2_32(yyvsp[0].UInt64Val))
error("Alignment must be a power of two");
CurGV->setAlignment(yyvsp[0].UInt64Val);
;}
break;
case 111:
#line 2066 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyval.TypeVal.PAT = new PATypeHolder(yyvsp[0].PrimType.T);
yyval.TypeVal.S.makeSignless();
;}
break;
case 113:
#line 2074 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyval.TypeVal.PAT = new PATypeHolder(yyvsp[0].PrimType.T);
yyval.TypeVal.S.makeSignless();
;}
break;
case 114:
#line 2081 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
if (!UpRefs.empty())
error("Invalid upreference in type: " + (*yyvsp[0].TypeVal.PAT)->getDescription());
yyval.TypeVal = yyvsp[0].TypeVal;
;}
break;
case 127:
#line 2095 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyval.TypeVal.PAT = new PATypeHolder(yyvsp[0].PrimType.T);
yyval.TypeVal.S.copy(yyvsp[0].PrimType.S);
;}
break;
case 128:
#line 2099 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyval.TypeVal.PAT = new PATypeHolder(OpaqueType::get());
yyval.TypeVal.S.makeSignless();
;}
break;
case 129:
#line 2103 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ // Named types are also simple types...
yyval.TypeVal.S.copy(getTypeSign(yyvsp[0].ValIDVal));
const Type* tmp = getType(yyvsp[0].ValIDVal);
yyval.TypeVal.PAT = new PATypeHolder(tmp);
;}
break;
case 130:
#line 2108 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ // Type UpReference
if (yyvsp[0].UInt64Val > (uint64_t)~0U)
error("Value out of range");
OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
UpRefs.push_back(UpRefRecord((unsigned)yyvsp[0].UInt64Val, OT)); // Add to vector...
yyval.TypeVal.PAT = new PATypeHolder(OT);
yyval.TypeVal.S.makeSignless();
UR_OUT("New Upreference!\n");
;}
break;
case 131:
#line 2117 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ // Function derived type?
yyval.TypeVal.S.makeComposite(yyvsp[-3].TypeVal.S);
std::vector<const Type*> Params;
for (std::list<llvm::PATypeInfo>::iterator I = yyvsp[-1].TypeList->begin(),
E = yyvsp[-1].TypeList->end(); I != E; ++I) {
Params.push_back(I->PAT->get());
yyval.TypeVal.S.add(I->S);
}
bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
if (isVarArg) Params.pop_back();
ParamAttrsList *PAL = 0;
if (lastCallingConv == OldCallingConv::CSRet) {
ParamAttrsVector Attrs;
ParamAttrsWithIndex PAWI;
PAWI.index = 1; PAWI.attrs = ParamAttr::StructRet; // first arg
Attrs.push_back(PAWI);
PAL = ParamAttrsList::get(Attrs);
}
const FunctionType *FTy =
FunctionType::get(yyvsp[-3].TypeVal.PAT->get(), Params, isVarArg, PAL);
yyval.TypeVal.PAT = new PATypeHolder( HandleUpRefs(FTy, yyval.TypeVal.S) );
delete yyvsp[-3].TypeVal.PAT; // Delete the return type handle
delete yyvsp[-1].TypeList; // Delete the argument list
;}
break;
case 132:
#line 2144 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ // Sized array type?
yyval.TypeVal.S.makeComposite(yyvsp[-1].TypeVal.S);
yyval.TypeVal.PAT = new PATypeHolder(HandleUpRefs(ArrayType::get(yyvsp[-1].TypeVal.PAT->get(),
(unsigned)yyvsp[-3].UInt64Val), yyval.TypeVal.S));
delete yyvsp[-1].TypeVal.PAT;
;}
break;
case 133:
#line 2150 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ // Vector type?
const llvm::Type* ElemTy = yyvsp[-1].TypeVal.PAT->get();
if ((unsigned)yyvsp[-3].UInt64Val != yyvsp[-3].UInt64Val)
error("Unsigned result not equal to signed result");
if (!(ElemTy->isInteger() || ElemTy->isFloatingPoint()))
error("Elements of a VectorType must be integer or floating point");
if (!isPowerOf2_32(yyvsp[-3].UInt64Val))
error("VectorType length should be a power of 2");
yyval.TypeVal.S.makeComposite(yyvsp[-1].TypeVal.S);
yyval.TypeVal.PAT = new PATypeHolder(HandleUpRefs(VectorType::get(ElemTy,
(unsigned)yyvsp[-3].UInt64Val), yyval.TypeVal.S));
delete yyvsp[-1].TypeVal.PAT;
;}
break;
case 134:
#line 2163 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ // Structure type?
std::vector<const Type*> Elements;
yyval.TypeVal.S.makeComposite();
for (std::list<llvm::PATypeInfo>::iterator I = yyvsp[-1].TypeList->begin(),
E = yyvsp[-1].TypeList->end(); I != E; ++I) {
Elements.push_back(I->PAT->get());
yyval.TypeVal.S.add(I->S);
}
yyval.TypeVal.PAT = new PATypeHolder(HandleUpRefs(StructType::get(Elements), yyval.TypeVal.S));
delete yyvsp[-1].TypeList;
;}
break;
case 135:
#line 2174 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ // Empty structure type?
yyval.TypeVal.PAT = new PATypeHolder(StructType::get(std::vector<const Type*>()));
yyval.TypeVal.S.makeComposite();
;}
break;
case 136:
#line 2178 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ // Packed Structure type?
yyval.TypeVal.S.makeComposite();
std::vector<const Type*> Elements;
for (std::list<llvm::PATypeInfo>::iterator I = yyvsp[-2].TypeList->begin(),
E = yyvsp[-2].TypeList->end(); I != E; ++I) {
Elements.push_back(I->PAT->get());
yyval.TypeVal.S.add(I->S);
delete I->PAT;
}
yyval.TypeVal.PAT = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true),
yyval.TypeVal.S));
delete yyvsp[-2].TypeList;
;}
break;
case 137:
#line 2191 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ // Empty packed structure type?
yyval.TypeVal.PAT = new PATypeHolder(StructType::get(std::vector<const Type*>(),true));
yyval.TypeVal.S.makeComposite();
;}
break;
case 138:
#line 2195 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ // Pointer type?
if (yyvsp[-1].TypeVal.PAT->get() == Type::LabelTy)
error("Cannot form a pointer to a basic block");
yyval.TypeVal.S.makeComposite(yyvsp[-1].TypeVal.S);
yyval.TypeVal.PAT = new PATypeHolder(HandleUpRefs(PointerType::get(yyvsp[-1].TypeVal.PAT->get()),
yyval.TypeVal.S));
delete yyvsp[-1].TypeVal.PAT;
;}
break;
case 139:
#line 2209 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyval.TypeList = new std::list<PATypeInfo>();
yyval.TypeList->push_back(yyvsp[0].TypeVal);
;}
break;
case 140:
#line 2213 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.TypeList=yyvsp[-2].TypeList)->push_back(yyvsp[0].TypeVal);
;}
break;
case 142:
#line 2221 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
PATypeInfo VoidTI;
VoidTI.PAT = new PATypeHolder(Type::VoidTy);
VoidTI.S.makeSignless();
(yyval.TypeList=yyvsp[-2].TypeList)->push_back(VoidTI);
;}
break;
case 143:
#line 2227 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyval.TypeList = new std::list<PATypeInfo>();
PATypeInfo VoidTI;
VoidTI.PAT = new PATypeHolder(Type::VoidTy);
VoidTI.S.makeSignless();
yyval.TypeList->push_back(VoidTI);
;}
break;
case 144:
#line 2234 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyval.TypeList = new std::list<PATypeInfo>();
;}
break;
case 145:
#line 2246 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ // Nonempty unsized arr
const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-3].TypeVal.PAT->get());
if (ATy == 0)
error("Cannot make array constant with type: '" +
yyvsp[-3].TypeVal.PAT->get()->getDescription() + "'");
const Type *ETy = ATy->getElementType();
int NumElements = ATy->getNumElements();
// Verify that we have the correct size...
if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
error("Type mismatch: constant sized array initialized with " +
utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " +
itostr(NumElements) + "");
// Verify all elements are correct type!
std::vector<Constant*> Elems;
for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
Constant *C = (*yyvsp[-1].ConstVector)[i].C;
const Type* ValTy = C->getType();
if (ETy != ValTy)
error("Element #" + utostr(i) + " is not of type '" +
ETy->getDescription() +"' as required!\nIt is of type '"+
ValTy->getDescription() + "'");
Elems.push_back(C);
}
yyval.ConstVal.C = ConstantArray::get(ATy, Elems);
yyval.ConstVal.S.copy(yyvsp[-3].TypeVal.S);
delete yyvsp[-3].TypeVal.PAT;
delete yyvsp[-1].ConstVector;
;}
break;
case 146:
#line 2276 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal.PAT->get());
if (ATy == 0)
error("Cannot make array constant with type: '" +
yyvsp[-2].TypeVal.PAT->get()->getDescription() + "'");
int NumElements = ATy->getNumElements();
if (NumElements != -1 && NumElements != 0)
error("Type mismatch: constant sized array initialized with 0"
" arguments, but has size of " + itostr(NumElements) +"");
yyval.ConstVal.C = ConstantArray::get(ATy, std::vector<Constant*>());
yyval.ConstVal.S.copy(yyvsp[-2].TypeVal.S);
delete yyvsp[-2].TypeVal.PAT;
;}
break;
case 147:
#line 2289 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal.PAT->get());
if (ATy == 0)
error("Cannot make array constant with type: '" +
yyvsp[-2].TypeVal.PAT->get()->getDescription() + "'");
int NumElements = ATy->getNumElements();
const Type *ETy = dyn_cast<IntegerType>(ATy->getElementType());
if (!ETy || cast<IntegerType>(ETy)->getBitWidth() != 8)
error("String arrays require type i8, not '" + ETy->getDescription() +
"'");
char *EndStr = UnEscapeLexed(yyvsp[0].StrVal, true);
if (NumElements != -1 && NumElements != (EndStr-yyvsp[0].StrVal))
error("Can't build string constant of size " +
itostr((int)(EndStr-yyvsp[0].StrVal)) + " when array has size " +
itostr(NumElements) + "");
std::vector<Constant*> Vals;
for (char *C = (char *)yyvsp[0].StrVal; C != (char *)EndStr; ++C)
Vals.push_back(ConstantInt::get(ETy, *C));
free(yyvsp[0].StrVal);
yyval.ConstVal.C = ConstantArray::get(ATy, Vals);
yyval.ConstVal.S.copy(yyvsp[-2].TypeVal.S);
delete yyvsp[-2].TypeVal.PAT;
;}
break;
case 148:
#line 2312 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ // Nonempty unsized arr
const VectorType *PTy = dyn_cast<VectorType>(yyvsp[-3].TypeVal.PAT->get());
if (PTy == 0)
error("Cannot make packed constant with type: '" +
yyvsp[-3].TypeVal.PAT->get()->getDescription() + "'");
const Type *ETy = PTy->getElementType();
int NumElements = PTy->getNumElements();
// Verify that we have the correct size...
if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
error("Type mismatch: constant sized packed initialized with " +
utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " +
itostr(NumElements) + "");
// Verify all elements are correct type!
std::vector<Constant*> Elems;
for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
Constant *C = (*yyvsp[-1].ConstVector)[i].C;
const Type* ValTy = C->getType();
if (ETy != ValTy)
error("Element #" + utostr(i) + " is not of type '" +
ETy->getDescription() +"' as required!\nIt is of type '"+
ValTy->getDescription() + "'");
Elems.push_back(C);
}
yyval.ConstVal.C = ConstantVector::get(PTy, Elems);
yyval.ConstVal.S.copy(yyvsp[-3].TypeVal.S);
delete yyvsp[-3].TypeVal.PAT;
delete yyvsp[-1].ConstVector;
;}
break;
case 149:
#line 2340 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
const StructType *STy = dyn_cast<StructType>(yyvsp[-3].TypeVal.PAT->get());
if (STy == 0)
error("Cannot make struct constant with type: '" +
yyvsp[-3].TypeVal.PAT->get()->getDescription() + "'");
if (yyvsp[-1].ConstVector->size() != STy->getNumContainedTypes())
error("Illegal number of initializers for structure type");
// Check to ensure that constants are compatible with the type initializer!
std::vector<Constant*> Fields;
for (unsigned i = 0, e = yyvsp[-1].ConstVector->size(); i != e; ++i) {
Constant *C = (*yyvsp[-1].ConstVector)[i].C;
if (C->getType() != STy->getElementType(i))
error("Expected type '" + STy->getElementType(i)->getDescription() +
"' for element #" + utostr(i) + " of structure initializer");
Fields.push_back(C);
}
yyval.ConstVal.C = ConstantStruct::get(STy, Fields);
yyval.ConstVal.S.copy(yyvsp[-3].TypeVal.S);
delete yyvsp[-3].TypeVal.PAT;
delete yyvsp[-1].ConstVector;
;}
break;
case 150:
#line 2362 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
const StructType *STy = dyn_cast<StructType>(yyvsp[-2].TypeVal.PAT->get());
if (STy == 0)
error("Cannot make struct constant with type: '" +
yyvsp[-2].TypeVal.PAT->get()->getDescription() + "'");
if (STy->getNumContainedTypes() != 0)
error("Illegal number of initializers for structure type");
yyval.ConstVal.C = ConstantStruct::get(STy, std::vector<Constant*>());
yyval.ConstVal.S.copy(yyvsp[-2].TypeVal.S);
delete yyvsp[-2].TypeVal.PAT;
;}
break;
case 151:
#line 2373 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
const StructType *STy = dyn_cast<StructType>(yyvsp[-5].TypeVal.PAT->get());
if (STy == 0)
error("Cannot make packed struct constant with type: '" +
yyvsp[-5].TypeVal.PAT->get()->getDescription() + "'");
if (yyvsp[-2].ConstVector->size() != STy->getNumContainedTypes())
error("Illegal number of initializers for packed structure type");
// Check to ensure that constants are compatible with the type initializer!
std::vector<Constant*> Fields;
for (unsigned i = 0, e = yyvsp[-2].ConstVector->size(); i != e; ++i) {
Constant *C = (*yyvsp[-2].ConstVector)[i].C;
if (C->getType() != STy->getElementType(i))
error("Expected type '" + STy->getElementType(i)->getDescription() +
"' for element #" + utostr(i) + " of packed struct initializer");
Fields.push_back(C);
}
yyval.ConstVal.C = ConstantStruct::get(STy, Fields);
yyval.ConstVal.S.copy(yyvsp[-5].TypeVal.S);
delete yyvsp[-5].TypeVal.PAT;
delete yyvsp[-2].ConstVector;
;}
break;
case 152:
#line 2395 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
const StructType *STy = dyn_cast<StructType>(yyvsp[-4].TypeVal.PAT->get());
if (STy == 0)
error("Cannot make packed struct constant with type: '" +
yyvsp[-4].TypeVal.PAT->get()->getDescription() + "'");
if (STy->getNumContainedTypes() != 0)
error("Illegal number of initializers for packed structure type");
yyval.ConstVal.C = ConstantStruct::get(STy, std::vector<Constant*>());
yyval.ConstVal.S.copy(yyvsp[-4].TypeVal.S);
delete yyvsp[-4].TypeVal.PAT;
;}
break;
case 153:
#line 2406 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
const PointerType *PTy = dyn_cast<PointerType>(yyvsp[-1].TypeVal.PAT->get());
if (PTy == 0)
error("Cannot make null pointer constant with type: '" +
yyvsp[-1].TypeVal.PAT->get()->getDescription() + "'");
yyval.ConstVal.C = ConstantPointerNull::get(PTy);
yyval.ConstVal.S.copy(yyvsp[-1].TypeVal.S);
delete yyvsp[-1].TypeVal.PAT;
;}
break;
case 154:
#line 2415 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyval.ConstVal.C = UndefValue::get(yyvsp[-1].TypeVal.PAT->get());
yyval.ConstVal.S.copy(yyvsp[-1].TypeVal.S);
delete yyvsp[-1].TypeVal.PAT;
;}
break;
case 155:
#line 2420 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
const PointerType *Ty = dyn_cast<PointerType>(yyvsp[-1].TypeVal.PAT->get());
if (Ty == 0)
error("Global const reference must be a pointer type, not" +
yyvsp[-1].TypeVal.PAT->get()->getDescription());
// ConstExprs can exist in the body of a function, thus creating
// GlobalValues whenever they refer to a variable. Because we are in
// the context of a function, getExistingValue will search the functions
// symbol table instead of the module symbol table for the global symbol,
// which throws things all off. To get around this, we just tell
// getExistingValue that we are at global scope here.
//
Function *SavedCurFn = CurFun.CurrentFunction;
CurFun.CurrentFunction = 0;
yyvsp[0].ValIDVal.S.copy(yyvsp[-1].TypeVal.S);
Value *V = getExistingValue(Ty, yyvsp[0].ValIDVal);
CurFun.CurrentFunction = SavedCurFn;
// If this is an initializer for a constant pointer, which is referencing a
// (currently) undefined variable, create a stub now that shall be replaced
// in the future with the right type of variable.
//
if (V == 0) {
assert(isa<PointerType>(Ty) && "Globals may only be used as pointers");
const PointerType *PT = cast<PointerType>(Ty);
// First check to see if the forward references value is already created!
PerModuleInfo::GlobalRefsType::iterator I =
CurModule.GlobalRefs.find(std::make_pair(PT, yyvsp[0].ValIDVal));
if (I != CurModule.GlobalRefs.end()) {
V = I->second; // Placeholder already exists, use it...
yyvsp[0].ValIDVal.destroy();
} else {
std::string Name;
if (yyvsp[0].ValIDVal.Type == ValID::NameVal) Name = yyvsp[0].ValIDVal.Name;
// Create the forward referenced global.
GlobalValue *GV;
if (const FunctionType *FTy =
dyn_cast<FunctionType>(PT->getElementType())) {
GV = new Function(FTy, GlobalValue::ExternalLinkage, Name,
CurModule.CurrentModule);
} else {
GV = new GlobalVariable(PT->getElementType(), false,
GlobalValue::ExternalLinkage, 0,
Name, CurModule.CurrentModule);
}
// Keep track of the fact that we have a forward ref to recycle it
CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, yyvsp[0].ValIDVal), GV));
V = GV;
}
}
yyval.ConstVal.C = cast<GlobalValue>(V);
yyval.ConstVal.S.copy(yyvsp[-1].TypeVal.S);
delete yyvsp[-1].TypeVal.PAT; // Free the type handle
;}
break;
case 156:
#line 2479 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
if (yyvsp[-1].TypeVal.PAT->get() != yyvsp[0].ConstVal.C->getType())
error("Mismatched types for constant expression");
yyval.ConstVal = yyvsp[0].ConstVal;
yyval.ConstVal.S.copy(yyvsp[-1].TypeVal.S);
delete yyvsp[-1].TypeVal.PAT;
;}
break;
case 157:
#line 2486 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
const Type *Ty = yyvsp[-1].TypeVal.PAT->get();
if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
error("Cannot create a null initialized value of this type");
yyval.ConstVal.C = Constant::getNullValue(Ty);
yyval.ConstVal.S.copy(yyvsp[-1].TypeVal.S);
delete yyvsp[-1].TypeVal.PAT;
;}
break;
case 158:
#line 2494 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ // integral constants
const Type *Ty = yyvsp[-1].PrimType.T;
if (!ConstantInt::isValueValidForType(Ty, yyvsp[0].SInt64Val))
error("Constant value doesn't fit in type");
yyval.ConstVal.C = ConstantInt::get(Ty, yyvsp[0].SInt64Val);
yyval.ConstVal.S.makeSigned();
;}
break;
case 159:
#line 2501 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ // integral constants
const Type *Ty = yyvsp[-1].PrimType.T;
if (!ConstantInt::isValueValidForType(Ty, yyvsp[0].UInt64Val))
error("Constant value doesn't fit in type");
yyval.ConstVal.C = ConstantInt::get(Ty, yyvsp[0].UInt64Val);
yyval.ConstVal.S.makeUnsigned();
;}
break;
case 160:
#line 2508 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ // Boolean constants
yyval.ConstVal.C = ConstantInt::get(Type::Int1Ty, true);
yyval.ConstVal.S.makeUnsigned();
;}
break;
case 161:
#line 2512 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ // Boolean constants
yyval.ConstVal.C = ConstantInt::get(Type::Int1Ty, false);
yyval.ConstVal.S.makeUnsigned();
;}
break;
case 162:
#line 2516 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ // Float & Double constants
if (!ConstantFP::isValueValidForType(yyvsp[-1].PrimType.T, yyvsp[0].FPVal))
error("Floating point constant invalid for type");
yyval.ConstVal.C = ConstantFP::get(yyvsp[-1].PrimType.T, yyvsp[0].FPVal);
yyval.ConstVal.S.makeSignless();
;}
break;
case 163:
#line 2525 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
const Type* SrcTy = yyvsp[-3].ConstVal.C->getType();
const Type* DstTy = yyvsp[-1].TypeVal.PAT->get();
Signedness SrcSign(yyvsp[-3].ConstVal.S);
Signedness DstSign(yyvsp[-1].TypeVal.S);
if (!SrcTy->isFirstClassType())
error("cast constant expression from a non-primitive type: '" +
SrcTy->getDescription() + "'");
if (!DstTy->isFirstClassType())
error("cast constant expression to a non-primitive type: '" +
DstTy->getDescription() + "'");
yyval.ConstVal.C = cast<Constant>(getCast(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal.C, SrcSign, DstTy, DstSign));
yyval.ConstVal.S.copy(DstSign);
delete yyvsp[-1].TypeVal.PAT;
;}
break;
case 164:
#line 2540 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
const Type *Ty = yyvsp[-2].ConstVal.C->getType();
if (!isa<PointerType>(Ty))
error("GetElementPtr requires a pointer operand");
std::vector<Constant*> CIndices;
upgradeGEPCEIndices(yyvsp[-2].ConstVal.C->getType(), yyvsp[-1].ValueList, CIndices);
delete yyvsp[-1].ValueList;
yyval.ConstVal.C = ConstantExpr::getGetElementPtr(yyvsp[-2].ConstVal.C, &CIndices[0], CIndices.size());
yyval.ConstVal.S.copy(getElementSign(yyvsp[-2].ConstVal, CIndices));
;}
break;
case 165:
#line 2552 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
if (!yyvsp[-5].ConstVal.C->getType()->isInteger() ||
cast<IntegerType>(yyvsp[-5].ConstVal.C->getType())->getBitWidth() != 1)
error("Select condition must be bool type");
if (yyvsp[-3].ConstVal.C->getType() != yyvsp[-1].ConstVal.C->getType())
error("Select operand types must match");
yyval.ConstVal.C = ConstantExpr::getSelect(yyvsp[-5].ConstVal.C, yyvsp[-3].ConstVal.C, yyvsp[-1].ConstVal.C);
yyval.ConstVal.S.copy(yyvsp[-3].ConstVal.S);
;}
break;
case 166:
#line 2561 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
const Type *Ty = yyvsp[-3].ConstVal.C->getType();
if (Ty != yyvsp[-1].ConstVal.C->getType())
error("Binary operator types must match");
// First, make sure we're dealing with the right opcode by upgrading from
// obsolete versions.
Instruction::BinaryOps Opcode = getBinaryOp(yyvsp[-5].BinaryOpVal, Ty, yyvsp[-3].ConstVal.S);
// HACK: llvm 1.3 and earlier used to emit invalid pointer constant exprs.
// To retain backward compatibility with these early compilers, we emit a
// cast to the appropriate integer type automatically if we are in the
// broken case. See PR424 for more information.
if (!isa<PointerType>(Ty)) {
yyval.ConstVal.C = ConstantExpr::get(Opcode, yyvsp[-3].ConstVal.C, yyvsp[-1].ConstVal.C);
} else {
const Type *IntPtrTy = 0;
switch (CurModule.CurrentModule->getPointerSize()) {
case Module::Pointer32: IntPtrTy = Type::Int32Ty; break;
case Module::Pointer64: IntPtrTy = Type::Int64Ty; break;
default: error("invalid pointer binary constant expr");
}
yyval.ConstVal.C = ConstantExpr::get(Opcode,
ConstantExpr::getCast(Instruction::PtrToInt, yyvsp[-3].ConstVal.C, IntPtrTy),
ConstantExpr::getCast(Instruction::PtrToInt, yyvsp[-1].ConstVal.C, IntPtrTy));
yyval.ConstVal.C = ConstantExpr::getCast(Instruction::IntToPtr, yyval.ConstVal.C, Ty);
}
yyval.ConstVal.S.copy(yyvsp[-3].ConstVal.S);
;}
break;
case 167:
#line 2589 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
const Type* Ty = yyvsp[-3].ConstVal.C->getType();
if (Ty != yyvsp[-1].ConstVal.C->getType())
error("Logical operator types must match");
if (!Ty->isInteger()) {
if (!isa<VectorType>(Ty) ||
!cast<VectorType>(Ty)->getElementType()->isInteger())
error("Logical operator requires integer operands");
}
Instruction::BinaryOps Opcode = getBinaryOp(yyvsp[-5].BinaryOpVal, Ty, yyvsp[-3].ConstVal.S);
yyval.ConstVal.C = ConstantExpr::get(Opcode, yyvsp[-3].ConstVal.C, yyvsp[-1].ConstVal.C);
yyval.ConstVal.S.copy(yyvsp[-3].ConstVal.S);
;}
break;
case 168:
#line 2602 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
const Type* Ty = yyvsp[-3].ConstVal.C->getType();
if (Ty != yyvsp[-1].ConstVal.C->getType())
error("setcc operand types must match");
unsigned short pred;
Instruction::OtherOps Opcode = getCompareOp(yyvsp[-5].BinaryOpVal, pred, Ty, yyvsp[-3].ConstVal.S);
yyval.ConstVal.C = ConstantExpr::getCompare(Opcode, yyvsp[-3].ConstVal.C, yyvsp[-1].ConstVal.C);
yyval.ConstVal.S.makeUnsigned();
;}
break;
case 169:
#line 2611 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
if (yyvsp[-3].ConstVal.C->getType() != yyvsp[-1].ConstVal.C->getType())
error("icmp operand types must match");
yyval.ConstVal.C = ConstantExpr::getCompare(yyvsp[-5].IPred, yyvsp[-3].ConstVal.C, yyvsp[-1].ConstVal.C);
yyval.ConstVal.S.makeUnsigned();
;}
break;
case 170:
#line 2617 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
if (yyvsp[-3].ConstVal.C->getType() != yyvsp[-1].ConstVal.C->getType())
error("fcmp operand types must match");
yyval.ConstVal.C = ConstantExpr::getCompare(yyvsp[-5].FPred, yyvsp[-3].ConstVal.C, yyvsp[-1].ConstVal.C);
yyval.ConstVal.S.makeUnsigned();
;}
break;
case 171:
#line 2623 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
if (!yyvsp[-1].ConstVal.C->getType()->isInteger() ||
cast<IntegerType>(yyvsp[-1].ConstVal.C->getType())->getBitWidth() != 8)
error("Shift count for shift constant must be unsigned byte");
const Type* Ty = yyvsp[-3].ConstVal.C->getType();
if (!yyvsp[-3].ConstVal.C->getType()->isInteger())
error("Shift constant expression requires integer operand");
Constant *ShiftAmt = ConstantExpr::getZExt(yyvsp[-1].ConstVal.C, Ty);
yyval.ConstVal.C = ConstantExpr::get(getBinaryOp(yyvsp[-5].BinaryOpVal, Ty, yyvsp[-3].ConstVal.S), yyvsp[-3].ConstVal.C, ShiftAmt);
yyval.ConstVal.S.copy(yyvsp[-3].ConstVal.S);
;}
break;
case 172:
#line 2634 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
if (!ExtractElementInst::isValidOperands(yyvsp[-3].ConstVal.C, yyvsp[-1].ConstVal.C))
error("Invalid extractelement operands");
yyval.ConstVal.C = ConstantExpr::getExtractElement(yyvsp[-3].ConstVal.C, yyvsp[-1].ConstVal.C);
yyval.ConstVal.S.copy(yyvsp[-3].ConstVal.S.get(0));
;}
break;
case 173:
#line 2640 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
if (!InsertElementInst::isValidOperands(yyvsp[-5].ConstVal.C, yyvsp[-3].ConstVal.C, yyvsp[-1].ConstVal.C))
error("Invalid insertelement operands");
yyval.ConstVal.C = ConstantExpr::getInsertElement(yyvsp[-5].ConstVal.C, yyvsp[-3].ConstVal.C, yyvsp[-1].ConstVal.C);
yyval.ConstVal.S.copy(yyvsp[-5].ConstVal.S);
;}
break;
case 174:
#line 2646 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
if (!ShuffleVectorInst::isValidOperands(yyvsp[-5].ConstVal.C, yyvsp[-3].ConstVal.C, yyvsp[-1].ConstVal.C))
error("Invalid shufflevector operands");
yyval.ConstVal.C = ConstantExpr::getShuffleVector(yyvsp[-5].ConstVal.C, yyvsp[-3].ConstVal.C, yyvsp[-1].ConstVal.C);
yyval.ConstVal.S.copy(yyvsp[-5].ConstVal.S);
;}
break;
case 175:
#line 2657 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(yyvsp[0].ConstVal); ;}
break;
case 176:
#line 2658 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyval.ConstVector = new std::vector<ConstInfo>();
yyval.ConstVector->push_back(yyvsp[0].ConstVal);
;}
break;
case 177:
#line 2667 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.BoolVal = false; ;}
break;
case 178:
#line 2668 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.BoolVal = true; ;}
break;
case 179:
#line 2680 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyval.ModuleVal = ParserResult = yyvsp[0].ModuleVal;
CurModule.ModuleDone();
;}
break;
case 180:
#line 2689 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.ModuleVal = yyvsp[-1].ModuleVal; CurFun.FunctionDone(); ;}
break;
case 181:
#line 2690 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.ModuleVal = yyvsp[-1].ModuleVal; ;}
break;
case 182:
#line 2691 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.ModuleVal = yyvsp[-3].ModuleVal; ;}
break;
case 183:
#line 2692 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.ModuleVal = yyvsp[-1].ModuleVal; ;}
break;
case 184:
#line 2693 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyval.ModuleVal = CurModule.CurrentModule;
// Emit an error if there are any unresolved types left.
if (!CurModule.LateResolveTypes.empty()) {
const ValID &DID = CurModule.LateResolveTypes.begin()->first;
if (DID.Type == ValID::NameVal) {
error("Reference to an undefined type: '"+DID.getName() + "'");
} else {
error("Reference to an undefined type: #" + itostr(DID.Num));
}
}
;}
break;
case 185:
#line 2709 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
// Eagerly resolve types. This is not an optimization, this is a
// requirement that is due to the fact that we could have this:
//
// %list = type { %list * }
// %list = type { %list * } ; repeated type decl
//
// If types are not resolved eagerly, then the two types will not be
// determined to be the same type!
//
ResolveTypeTo(yyvsp[-2].StrVal, yyvsp[0].TypeVal.PAT->get(), yyvsp[0].TypeVal.S);
if (!setTypeName(yyvsp[0].TypeVal, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) {
// If this is a numbered type that is not a redefinition, add it to the
// slot table.
CurModule.Types.push_back(yyvsp[0].TypeVal.PAT->get());
CurModule.TypeSigns.push_back(yyvsp[0].TypeVal.S);
}
delete yyvsp[0].TypeVal.PAT;
;}
break;
case 186:
#line 2729 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ // Function prototypes can be in const pool
;}
break;
case 187:
#line 2731 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ // Asm blocks can be in the const pool
;}
break;
case 188:
#line 2733 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
if (yyvsp[0].ConstVal.C == 0)
error("Global value initializer is not a constant");
CurGV = ParseGlobalVariable(yyvsp[-3].StrVal, yyvsp[-2].Linkage, yyvsp[-1].BoolVal, yyvsp[0].ConstVal.C->getType(), yyvsp[0].ConstVal.C, yyvsp[0].ConstVal.S);
;}
break;
case 189:
#line 2737 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
CurGV = 0;
;}
break;
case 190:
#line 2740 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
const Type *Ty = yyvsp[0].TypeVal.PAT->get();
CurGV = ParseGlobalVariable(yyvsp[-3].StrVal, GlobalValue::ExternalLinkage, yyvsp[-1].BoolVal, Ty, 0,
yyvsp[0].TypeVal.S);
delete yyvsp[0].TypeVal.PAT;
;}
break;
case 191:
#line 2745 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
CurGV = 0;
;}
break;
case 192:
#line 2748 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
const Type *Ty = yyvsp[0].TypeVal.PAT->get();
CurGV = ParseGlobalVariable(yyvsp[-3].StrVal, GlobalValue::DLLImportLinkage, yyvsp[-1].BoolVal, Ty, 0,
yyvsp[0].TypeVal.S);
delete yyvsp[0].TypeVal.PAT;
;}
break;
case 193:
#line 2753 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
CurGV = 0;
;}
break;
case 194:
#line 2756 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
const Type *Ty = yyvsp[0].TypeVal.PAT->get();
CurGV =
ParseGlobalVariable(yyvsp[-3].StrVal, GlobalValue::ExternalWeakLinkage, yyvsp[-1].BoolVal, Ty, 0,
yyvsp[0].TypeVal.S);
delete yyvsp[0].TypeVal.PAT;
;}
break;
case 195:
#line 2762 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
CurGV = 0;
;}
break;
case 196:
#line 2765 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
;}
break;
case 197:
#line 2767 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
;}
break;
case 198:
#line 2769 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
;}
break;
case 199:
#line 2774 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
char *EndStr = UnEscapeLexed(yyvsp[0].StrVal, true);
std::string NewAsm(yyvsp[0].StrVal, EndStr);
free(yyvsp[0].StrVal);
if (AsmSoFar.empty())
CurModule.CurrentModule->setModuleInlineAsm(NewAsm);
else
CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm);
;}
break;
case 200:
#line 2788 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.Endianness = Module::BigEndian; ;}
break;
case 201:
#line 2789 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.Endianness = Module::LittleEndian; ;}
break;
case 202:
#line 2793 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
CurModule.setEndianness(yyvsp[0].Endianness);
;}
break;
case 203:
#line 2796 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
if (yyvsp[0].UInt64Val == 32)
CurModule.setPointerSize(Module::Pointer32);
else if (yyvsp[0].UInt64Val == 64)
CurModule.setPointerSize(Module::Pointer64);
else
error("Invalid pointer size: '" + utostr(yyvsp[0].UInt64Val) + "'");
;}
break;
case 204:
#line 2804 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
CurModule.CurrentModule->setTargetTriple(yyvsp[0].StrVal);
free(yyvsp[0].StrVal);
;}
break;
case 205:
#line 2808 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
CurModule.CurrentModule->setDataLayout(yyvsp[0].StrVal);
free(yyvsp[0].StrVal);
;}
break;
case 207:
#line 2819 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
CurModule.CurrentModule->addLibrary(yyvsp[0].StrVal);
free(yyvsp[0].StrVal);
;}
break;
case 208:
#line 2823 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
CurModule.CurrentModule->addLibrary(yyvsp[0].StrVal);
free(yyvsp[0].StrVal);
;}
break;
case 209:
#line 2827 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ ;}
break;
case 213:
#line 2840 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.StrVal = 0; ;}
break;
case 214:
#line 2844 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
if (yyvsp[-1].TypeVal.PAT->get() == Type::VoidTy)
error("void typed arguments are invalid");
yyval.ArgVal = new std::pair<PATypeInfo, char*>(yyvsp[-1].TypeVal, yyvsp[0].StrVal);
;}
break;
case 215:
#line 2852 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyval.ArgList = yyvsp[-2].ArgList;
yyval.ArgList->push_back(*yyvsp[0].ArgVal);
delete yyvsp[0].ArgVal;
;}
break;
case 216:
#line 2857 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyval.ArgList = new std::vector<std::pair<PATypeInfo,char*> >();
yyval.ArgList->push_back(*yyvsp[0].ArgVal);
delete yyvsp[0].ArgVal;
;}
break;
case 217:
#line 2865 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.ArgList = yyvsp[0].ArgList; ;}
break;
case 218:
#line 2866 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyval.ArgList = yyvsp[-2].ArgList;
PATypeInfo VoidTI;
VoidTI.PAT = new PATypeHolder(Type::VoidTy);
VoidTI.S.makeSignless();
yyval.ArgList->push_back(std::pair<PATypeInfo, char*>(VoidTI, 0));
;}
break;
case 219:
#line 2873 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyval.ArgList = new std::vector<std::pair<PATypeInfo,char*> >();
PATypeInfo VoidTI;
VoidTI.PAT = new PATypeHolder(Type::VoidTy);
VoidTI.S.makeSignless();
yyval.ArgList->push_back(std::pair<PATypeInfo, char*>(VoidTI, 0));
;}
break;
case 220:
#line 2880 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.ArgList = 0; ;}
break;
case 221:
#line 2884 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
UnEscapeLexed(yyvsp[-5].StrVal);
std::string FunctionName(yyvsp[-5].StrVal);
free(yyvsp[-5].StrVal); // Free strdup'd memory!
const Type* RetTy = yyvsp[-6].TypeVal.PAT->get();
if (!RetTy->isFirstClassType() && RetTy != Type::VoidTy)
error("LLVM functions cannot return aggregate types");
Signedness FTySign;
FTySign.makeComposite(yyvsp[-6].TypeVal.S);
std::vector<const Type*> ParamTyList;
// In LLVM 2.0 the signatures of three varargs intrinsics changed to take
// i8*. We check here for those names and override the parameter list
// types to ensure the prototype is correct.
if (FunctionName == "llvm.va_start" || FunctionName == "llvm.va_end") {
ParamTyList.push_back(PointerType::get(Type::Int8Ty));
} else if (FunctionName == "llvm.va_copy") {
ParamTyList.push_back(PointerType::get(Type::Int8Ty));
ParamTyList.push_back(PointerType::get(Type::Int8Ty));
} else if (yyvsp[-3].ArgList) { // If there are arguments...
for (std::vector<std::pair<PATypeInfo,char*> >::iterator
I = yyvsp[-3].ArgList->begin(), E = yyvsp[-3].ArgList->end(); I != E; ++I) {
const Type *Ty = I->first.PAT->get();
ParamTyList.push_back(Ty);
FTySign.add(I->first.S);
}
}
bool isVarArg = ParamTyList.size() && ParamTyList.back() == Type::VoidTy;
if (isVarArg)
ParamTyList.pop_back();
// Convert the CSRet calling convention into the corresponding parameter
// attribute.
ParamAttrsList *PAL = 0;
if (yyvsp[-7].UIntVal == OldCallingConv::CSRet) {
ParamAttrsVector Attrs;
ParamAttrsWithIndex PAWI;
PAWI.index = 1; PAWI.attrs = ParamAttr::StructRet; // first arg
Attrs.push_back(PAWI);
PAL = ParamAttrsList::get(Attrs);
}
const FunctionType *FT =
FunctionType::get(RetTy, ParamTyList, isVarArg, PAL);
const PointerType *PFT = PointerType::get(FT);
delete yyvsp[-6].TypeVal.PAT;
ValID ID;
if (!FunctionName.empty()) {
ID = ValID::create((char*)FunctionName.c_str());
} else {
ID = ValID::create((int)CurModule.Values[PFT].size());
}
ID.S.makeComposite(FTySign);
Function *Fn = 0;
Module* M = CurModule.CurrentModule;
// See if this function was forward referenced. If so, recycle the object.
if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
// Move the function to the end of the list, from whereever it was
// previously inserted.
Fn = cast<Function>(FWRef);
M->getFunctionList().remove(Fn);
M->getFunctionList().push_back(Fn);
} else if (!FunctionName.empty()) {
GlobalValue *Conflict = M->getFunction(FunctionName);
if (!Conflict)
Conflict = M->getNamedGlobal(FunctionName);
if (Conflict && PFT == Conflict->getType()) {
if (!CurFun.isDeclare && !Conflict->isDeclaration()) {
// We have two function definitions that conflict, same type, same
// name. We should really check to make sure that this is the result
// of integer type planes collapsing and generate an error if it is
// not, but we'll just rename on the assumption that it is. However,
// let's do it intelligently and rename the internal linkage one
// if there is one.
std::string NewName(makeNameUnique(FunctionName));
if (Conflict->hasInternalLinkage()) {
Conflict->setName(NewName);
RenameMapKey Key =
makeRenameMapKey(FunctionName, Conflict->getType(), ID.S);
CurModule.RenameMap[Key] = NewName;
Fn = new Function(FT, CurFun.Linkage, FunctionName, M);
InsertValue(Fn, CurModule.Values);
} else {
Fn = new Function(FT, CurFun.Linkage, NewName, M);
InsertValue(Fn, CurModule.Values);
RenameMapKey Key =
makeRenameMapKey(FunctionName, PFT, ID.S);
CurModule.RenameMap[Key] = NewName;
}
} else {
// If they are not both definitions, then just use the function we
// found since the types are the same.
Fn = cast<Function>(Conflict);
// Make sure to strip off any argument names so we can't get
// conflicts.
if (Fn->isDeclaration())
for (Function::arg_iterator AI = Fn->arg_begin(),
AE = Fn->arg_end(); AI != AE; ++AI)
AI->setName("");
}
} else if (Conflict) {
// We have two globals with the same name and different types.
// Previously, this was permitted because the symbol table had
// "type planes" and names only needed to be distinct within a
// type plane. After PR411 was fixed, this is no loner the case.
// To resolve this we must rename one of the two.
if (Conflict->hasInternalLinkage()) {
// We can safely rename the Conflict.
RenameMapKey Key =
makeRenameMapKey(Conflict->getName(), Conflict->getType(),
CurModule.NamedValueSigns[Conflict->getName()]);
Conflict->setName(makeNameUnique(Conflict->getName()));
CurModule.RenameMap[Key] = Conflict->getName();
Fn = new Function(FT, CurFun.Linkage, FunctionName, M);
InsertValue(Fn, CurModule.Values);
} else {
// We can't quietly rename either of these things, but we must
// rename one of them. Only if the function's linkage is internal can
// we forgo a warning message about the renamed function.
std::string NewName = makeNameUnique(FunctionName);
if (CurFun.Linkage != GlobalValue::InternalLinkage) {
warning("Renaming function '" + FunctionName + "' as '" + NewName +
"' may cause linkage errors");
}
// Elect to rename the thing we're now defining.
Fn = new Function(FT, CurFun.Linkage, NewName, M);
InsertValue(Fn, CurModule.Values);
RenameMapKey Key = makeRenameMapKey(FunctionName, PFT, ID.S);
CurModule.RenameMap[Key] = NewName;
}
} else {
// There's no conflict, just define the function
Fn = new Function(FT, CurFun.Linkage, FunctionName, M);
InsertValue(Fn, CurModule.Values);
}
} else {
// There's no conflict, just define the function
Fn = new Function(FT, CurFun.Linkage, FunctionName, M);
InsertValue(Fn, CurModule.Values);
}
CurFun.FunctionStart(Fn);
if (CurFun.isDeclare) {
// If we have declaration, always overwrite linkage. This will allow us
// to correctly handle cases, when pointer to function is passed as
// argument to another function.
Fn->setLinkage(CurFun.Linkage);
}
Fn->setCallingConv(upgradeCallingConv(yyvsp[-7].UIntVal));
Fn->setAlignment(yyvsp[0].UIntVal);
if (yyvsp[-1].StrVal) {
Fn->setSection(yyvsp[-1].StrVal);
free(yyvsp[-1].StrVal);
}
// Add all of the arguments we parsed to the function...
if (yyvsp[-3].ArgList) { // Is null if empty...
if (isVarArg) { // Nuke the last entry
assert(yyvsp[-3].ArgList->back().first.PAT->get() == Type::VoidTy &&
yyvsp[-3].ArgList->back().second == 0 && "Not a varargs marker");
delete yyvsp[-3].ArgList->back().first.PAT;
yyvsp[-3].ArgList->pop_back(); // Delete the last entry
}
Function::arg_iterator ArgIt = Fn->arg_begin();
Function::arg_iterator ArgEnd = Fn->arg_end();
std::vector<std::pair<PATypeInfo,char*> >::iterator I = yyvsp[-3].ArgList->begin();
std::vector<std::pair<PATypeInfo,char*> >::iterator E = yyvsp[-3].ArgList->end();
for ( ; I != E && ArgIt != ArgEnd; ++I, ++ArgIt) {
delete I->first.PAT; // Delete the typeholder...
ValueInfo VI; VI.V = ArgIt; VI.S.copy(I->first.S);
setValueName(VI, I->second); // Insert arg into symtab...
InsertValue(ArgIt);
}
delete yyvsp[-3].ArgList; // We're now done with the argument list
}
lastCallingConv = OldCallingConv::C;
;}
break;
case 224:
#line 3078 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ CurFun.Linkage = yyvsp[0].Linkage; ;}
break;
case 225:
#line 3078 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyval.FunctionVal = CurFun.CurrentFunction;
// Make sure that we keep track of the linkage type even if there was a
// previous "declare".
yyval.FunctionVal->setLinkage(yyvsp[-3].Linkage);
;}
break;
case 228:
#line 3092 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyval.FunctionVal = yyvsp[-1].FunctionVal;
;}
break;
case 229:
#line 3097 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.Linkage = GlobalValue::ExternalLinkage; ;}
break;
case 230:
#line 3098 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.Linkage = GlobalValue::DLLImportLinkage; ;}
break;
case 231:
#line 3099 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.Linkage = GlobalValue::ExternalWeakLinkage; ;}
break;
case 232:
#line 3103 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ CurFun.isDeclare = true; ;}
break;
case 233:
#line 3104 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ CurFun.Linkage = yyvsp[0].Linkage; ;}
break;
case 234:
#line 3104 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyval.FunctionVal = CurFun.CurrentFunction;
CurFun.FunctionDone();
;}
break;
case 235:
#line 3116 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.BoolVal = false; ;}
break;
case 236:
#line 3117 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.BoolVal = true; ;}
break;
case 237:
#line 3122 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val); ;}
break;
case 238:
#line 3123 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val); ;}
break;
case 239:
#line 3124 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.ValIDVal = ValID::create(yyvsp[0].FPVal); ;}
break;
case 240:
#line 3125 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyval.ValIDVal = ValID::create(ConstantInt::get(Type::Int1Ty, true));
yyval.ValIDVal.S.makeUnsigned();
;}
break;
case 241:
#line 3129 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyval.ValIDVal = ValID::create(ConstantInt::get(Type::Int1Ty, false));
yyval.ValIDVal.S.makeUnsigned();
;}
break;
case 242:
#line 3133 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.ValIDVal = ValID::createNull(); ;}
break;
case 243:
#line 3134 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.ValIDVal = ValID::createUndef(); ;}
break;
case 244:
#line 3135 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.ValIDVal = ValID::createZeroInit(); ;}
break;
case 245:
#line 3136 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ // Nonempty unsized packed vector
const Type *ETy = (*yyvsp[-1].ConstVector)[0].C->getType();
int NumElements = yyvsp[-1].ConstVector->size();
VectorType* pt = VectorType::get(ETy, NumElements);
yyval.ValIDVal.S.makeComposite((*yyvsp[-1].ConstVector)[0].S);
PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(pt, yyval.ValIDVal.S));
// Verify all elements are correct type!
std::vector<Constant*> Elems;
for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
Constant *C = (*yyvsp[-1].ConstVector)[i].C;
const Type *CTy = C->getType();
if (ETy != CTy)
error("Element #" + utostr(i) + " is not of type '" +
ETy->getDescription() +"' as required!\nIt is of type '" +
CTy->getDescription() + "'");
Elems.push_back(C);
}
yyval.ValIDVal = ValID::create(ConstantVector::get(pt, Elems));
delete PTy; delete yyvsp[-1].ConstVector;
;}
break;
case 246:
#line 3157 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyval.ValIDVal = ValID::create(yyvsp[0].ConstVal.C);
yyval.ValIDVal.S.copy(yyvsp[0].ConstVal.S);
;}
break;
case 247:
#line 3161 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
char *End = UnEscapeLexed(yyvsp[-2].StrVal, true);
std::string AsmStr = std::string(yyvsp[-2].StrVal, End);
End = UnEscapeLexed(yyvsp[0].StrVal, true);
std::string Constraints = std::string(yyvsp[0].StrVal, End);
yyval.ValIDVal = ValID::createInlineAsm(AsmStr, Constraints, yyvsp[-3].BoolVal);
free(yyvsp[-2].StrVal);
free(yyvsp[0].StrVal);
;}
break;
case 248:
#line 3175 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.ValIDVal = ValID::create(yyvsp[0].SIntVal); yyval.ValIDVal.S.makeSignless(); ;}
break;
case 249:
#line 3176 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.ValIDVal = ValID::create(yyvsp[0].StrVal); yyval.ValIDVal.S.makeSignless(); ;}
break;
case 252:
#line 3189 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
const Type *Ty = yyvsp[-1].TypeVal.PAT->get();
yyvsp[0].ValIDVal.S.copy(yyvsp[-1].TypeVal.S);
yyval.ValueVal.V = getVal(Ty, yyvsp[0].ValIDVal);
yyval.ValueVal.S.copy(yyvsp[-1].TypeVal.S);
delete yyvsp[-1].TypeVal.PAT;
;}
break;
case 253:
#line 3199 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyval.FunctionVal = yyvsp[-1].FunctionVal;
;}
break;
case 254:
#line 3202 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ // Do not allow functions with 0 basic blocks
yyval.FunctionVal = yyvsp[-1].FunctionVal;
;}
break;
case 255:
#line 3211 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
ValueInfo VI; VI.V = yyvsp[0].TermInstVal.TI; VI.S.copy(yyvsp[0].TermInstVal.S);
setValueName(VI, yyvsp[-1].StrVal);
InsertValue(yyvsp[0].TermInstVal.TI);
yyvsp[-2].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal.TI);
InsertValue(yyvsp[-2].BasicBlockVal);
yyval.BasicBlockVal = yyvsp[-2].BasicBlockVal;
;}
break;
case 256:
#line 3222 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
if (yyvsp[0].InstVal.I)
yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].InstVal.I);
yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal;
;}
break;
case 257:
#line 3227 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyval.BasicBlockVal = CurBB = getBBVal(ValID::create((int)CurFun.NextBBNum++),true);
// Make sure to move the basic block to the correct location in the
// function, instead of leaving it inserted wherever it was first
// referenced.
Function::BasicBlockListType &BBL =
CurFun.CurrentFunction->getBasicBlockList();
BBL.splice(BBL.end(), BBL, yyval.BasicBlockVal);
;}
break;
case 258:
#line 3236 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyval.BasicBlockVal = CurBB = getBBVal(ValID::create(yyvsp[0].StrVal), true);
// Make sure to move the basic block to the correct location in the
// function, instead of leaving it inserted wherever it was first
// referenced.
Function::BasicBlockListType &BBL =
CurFun.CurrentFunction->getBasicBlockList();
BBL.splice(BBL.end(), BBL, yyval.BasicBlockVal);
;}
break;
case 261:
#line 3250 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ // Return with a result...
yyval.TermInstVal.TI = new ReturnInst(yyvsp[0].ValueVal.V);
yyval.TermInstVal.S.makeSignless();
;}
break;
case 262:
#line 3254 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ // Return with no result...
yyval.TermInstVal.TI = new ReturnInst();
yyval.TermInstVal.S.makeSignless();
;}
break;
case 263:
#line 3258 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ // Unconditional Branch...
BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
yyval.TermInstVal.TI = new BranchInst(tmpBB);
yyval.TermInstVal.S.makeSignless();
;}
break;
case 264:
#line 3263 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyvsp[-3].ValIDVal.S.makeSignless();
yyvsp[0].ValIDVal.S.makeSignless();
BasicBlock* tmpBBA = getBBVal(yyvsp[-3].ValIDVal);
BasicBlock* tmpBBB = getBBVal(yyvsp[0].ValIDVal);
yyvsp[-6].ValIDVal.S.makeUnsigned();
Value* tmpVal = getVal(Type::Int1Ty, yyvsp[-6].ValIDVal);
yyval.TermInstVal.TI = new BranchInst(tmpBBA, tmpBBB, tmpVal);
yyval.TermInstVal.S.makeSignless();
;}
break;
case 265:
#line 3273 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyvsp[-6].ValIDVal.S.copy(yyvsp[-7].PrimType.S);
Value* tmpVal = getVal(yyvsp[-7].PrimType.T, yyvsp[-6].ValIDVal);
yyvsp[-3].ValIDVal.S.makeSignless();
BasicBlock* tmpBB = getBBVal(yyvsp[-3].ValIDVal);
SwitchInst *S = new SwitchInst(tmpVal, tmpBB, yyvsp[-1].JumpTable->size());
yyval.TermInstVal.TI = S;
yyval.TermInstVal.S.makeSignless();
std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = yyvsp[-1].JumpTable->begin(),
E = yyvsp[-1].JumpTable->end();
for (; I != E; ++I) {
if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
S->addCase(CI, I->second);
else
error("Switch case is constant, but not a simple integer");
}
delete yyvsp[-1].JumpTable;
;}
break;
case 266:
#line 3291 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyvsp[-5].ValIDVal.S.copy(yyvsp[-6].PrimType.S);
Value* tmpVal = getVal(yyvsp[-6].PrimType.T, yyvsp[-5].ValIDVal);
yyvsp[-2].ValIDVal.S.makeSignless();
BasicBlock* tmpBB = getBBVal(yyvsp[-2].ValIDVal);
SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
yyval.TermInstVal.TI = S;
yyval.TermInstVal.S.makeSignless();
;}
break;
case 267:
#line 3301 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
const PointerType *PFTy;
const FunctionType *Ty;
Signedness FTySign;
if (!(PFTy = dyn_cast<PointerType>(yyvsp[-10].TypeVal.PAT->get())) ||
!(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
// Pull out the types of all of the arguments...
std::vector<const Type*> ParamTypes;
FTySign.makeComposite(yyvsp[-10].TypeVal.S);
if (yyvsp[-7].ValueList) {
for (std::vector<ValueInfo>::iterator I = yyvsp[-7].ValueList->begin(), E = yyvsp[-7].ValueList->end();
I != E; ++I) {
ParamTypes.push_back((*I).V->getType());
FTySign.add(I->S);
}
}
ParamAttrsList *PAL = 0;
if (yyvsp[-11].UIntVal == OldCallingConv::CSRet) {
ParamAttrsVector Attrs;
ParamAttrsWithIndex PAWI;
PAWI.index = 1; PAWI.attrs = ParamAttr::StructRet; // first arg
Attrs.push_back(PAWI);
PAL = ParamAttrsList::get(Attrs);
}
bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
if (isVarArg) ParamTypes.pop_back();
Ty = FunctionType::get(yyvsp[-10].TypeVal.PAT->get(), ParamTypes, isVarArg, PAL);
PFTy = PointerType::get(Ty);
yyval.TermInstVal.S.copy(yyvsp[-10].TypeVal.S);
} else {
FTySign = yyvsp[-10].TypeVal.S;
// Get the signedness of the result type. $3 is the pointer to the
// function type so we get the 0th element to extract the function type,
// and then the 0th element again to get the result type.
yyval.TermInstVal.S.copy(yyvsp[-10].TypeVal.S.get(0).get(0));
}
yyvsp[-9].ValIDVal.S.makeComposite(FTySign);
Value *V = getVal(PFTy, yyvsp[-9].ValIDVal); // Get the function we're calling...
BasicBlock *Normal = getBBVal(yyvsp[-3].ValIDVal);
BasicBlock *Except = getBBVal(yyvsp[0].ValIDVal);
// Create the call node...
if (!yyvsp[-7].ValueList) { // Has no arguments?
std::vector<Value*> Args;
yyval.TermInstVal.TI = new InvokeInst(V, Normal, Except, Args.begin(), Args.end());
} else { // Has arguments?
// Loop through FunctionType's arguments and ensure they are specified
// correctly!
//
FunctionType::param_iterator I = Ty->param_begin();
FunctionType::param_iterator E = Ty->param_end();
std::vector<ValueInfo>::iterator ArgI = yyvsp[-7].ValueList->begin(), ArgE = yyvsp[-7].ValueList->end();
std::vector<Value*> Args;
for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
if ((*ArgI).V->getType() != *I)
error("Parameter " +(*ArgI).V->getName()+ " is not of type '" +
(*I)->getDescription() + "'");
Args.push_back((*ArgI).V);
}
if (I != E || (ArgI != ArgE && !Ty->isVarArg()))
error("Invalid number of parameters detected");
yyval.TermInstVal.TI = new InvokeInst(V, Normal, Except, Args.begin(), Args.end());
}
cast<InvokeInst>(yyval.TermInstVal.TI)->setCallingConv(upgradeCallingConv(yyvsp[-11].UIntVal));
delete yyvsp[-10].TypeVal.PAT;
delete yyvsp[-7].ValueList;
lastCallingConv = OldCallingConv::C;
;}
break;
case 268:
#line 3374 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyval.TermInstVal.TI = new UnwindInst();
yyval.TermInstVal.S.makeSignless();
;}
break;
case 269:
#line 3378 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyval.TermInstVal.TI = new UnreachableInst();
yyval.TermInstVal.S.makeSignless();
;}
break;
case 270:
#line 3385 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyval.JumpTable = yyvsp[-5].JumpTable;
yyvsp[-3].ValIDVal.S.copy(yyvsp[-4].PrimType.S);
Constant *V = cast<Constant>(getExistingValue(yyvsp[-4].PrimType.T, yyvsp[-3].ValIDVal));
if (V == 0)
error("May only switch on a constant pool value");
yyvsp[0].ValIDVal.S.makeSignless();
BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
yyval.JumpTable->push_back(std::make_pair(V, tmpBB));
;}
break;
case 271:
#line 3397 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyval.JumpTable = new std::vector<std::pair<Constant*, BasicBlock*> >();
yyvsp[-3].ValIDVal.S.copy(yyvsp[-4].PrimType.S);
Constant *V = cast<Constant>(getExistingValue(yyvsp[-4].PrimType.T, yyvsp[-3].ValIDVal));
if (V == 0)
error("May only switch on a constant pool value");
yyvsp[0].ValIDVal.S.makeSignless();
BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
yyval.JumpTable->push_back(std::make_pair(V, tmpBB));
;}
break;
case 272:
#line 3412 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
bool omit = false;
if (yyvsp[-1].StrVal)
if (BitCastInst *BCI = dyn_cast<BitCastInst>(yyvsp[0].InstVal.I))
if (BCI->getSrcTy() == BCI->getDestTy() &&
BCI->getOperand(0)->getName() == yyvsp[-1].StrVal)
// This is a useless bit cast causing a name redefinition. It is
// a bit cast from a type to the same type of an operand with the
// same name as the name we would give this instruction. Since this
// instruction results in no code generation, it is safe to omit
// the instruction. This situation can occur because of collapsed
// type planes. For example:
// %X = add int %Y, %Z
// %X = cast int %Y to uint
// After upgrade, this looks like:
// %X = add i32 %Y, %Z
// %X = bitcast i32 to i32
// The bitcast is clearly useless so we omit it.
omit = true;
if (omit) {
yyval.InstVal.I = 0;
yyval.InstVal.S.makeSignless();
} else {
ValueInfo VI; VI.V = yyvsp[0].InstVal.I; VI.S.copy(yyvsp[0].InstVal.S);
setValueName(VI, yyvsp[-1].StrVal);
InsertValue(yyvsp[0].InstVal.I);
yyval.InstVal = yyvsp[0].InstVal;
}
;}
break;
case 273:
#line 3442 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ // Used for PHI nodes
yyval.PHIList.P = new std::list<std::pair<Value*, BasicBlock*> >();
yyval.PHIList.S.copy(yyvsp[-5].TypeVal.S);
yyvsp[-3].ValIDVal.S.copy(yyvsp[-5].TypeVal.S);
Value* tmpVal = getVal(yyvsp[-5].TypeVal.PAT->get(), yyvsp[-3].ValIDVal);
yyvsp[-1].ValIDVal.S.makeSignless();
BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal);
yyval.PHIList.P->push_back(std::make_pair(tmpVal, tmpBB));
delete yyvsp[-5].TypeVal.PAT;
;}
break;
case 274:
#line 3452 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyval.PHIList = yyvsp[-6].PHIList;
yyvsp[-3].ValIDVal.S.copy(yyvsp[-6].PHIList.S);
Value* tmpVal = getVal(yyvsp[-6].PHIList.P->front().first->getType(), yyvsp[-3].ValIDVal);
yyvsp[-1].ValIDVal.S.makeSignless();
BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal);
yyvsp[-6].PHIList.P->push_back(std::make_pair(tmpVal, tmpBB));
;}
break;
case 275:
#line 3462 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ // Used for call statements, and memory insts...
yyval.ValueList = new std::vector<ValueInfo>();
yyval.ValueList->push_back(yyvsp[0].ValueVal);
;}
break;
case 276:
#line 3466 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyval.ValueList = yyvsp[-2].ValueList;
yyvsp[-2].ValueList->push_back(yyvsp[0].ValueVal);
;}
break;
case 278:
#line 3474 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.ValueList = 0; ;}
break;
case 279:
#line 3478 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyval.BoolVal = true;
;}
break;
case 280:
#line 3481 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyval.BoolVal = false;
;}
break;
case 281:
#line 3487 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyvsp[-2].ValIDVal.S.copy(yyvsp[-3].TypeVal.S);
yyvsp[0].ValIDVal.S.copy(yyvsp[-3].TypeVal.S);
const Type* Ty = yyvsp[-3].TypeVal.PAT->get();
if (!Ty->isInteger() && !Ty->isFloatingPoint() && !isa<VectorType>(Ty))
error("Arithmetic operator requires integer, FP, or packed operands");
if (isa<VectorType>(Ty) &&
(yyvsp[-4].BinaryOpVal == URemOp || yyvsp[-4].BinaryOpVal == SRemOp || yyvsp[-4].BinaryOpVal == FRemOp || yyvsp[-4].BinaryOpVal == RemOp))
error("Remainder not supported on vector types");
// Upgrade the opcode from obsolete versions before we do anything with it.
Instruction::BinaryOps Opcode = getBinaryOp(yyvsp[-4].BinaryOpVal, Ty, yyvsp[-3].TypeVal.S);
Value* val1 = getVal(Ty, yyvsp[-2].ValIDVal);
Value* val2 = getVal(Ty, yyvsp[0].ValIDVal);
yyval.InstVal.I = BinaryOperator::create(Opcode, val1, val2);
if (yyval.InstVal.I == 0)
error("binary operator returned null");
yyval.InstVal.S.copy(yyvsp[-3].TypeVal.S);
delete yyvsp[-3].TypeVal.PAT;
;}
break;
case 282:
#line 3506 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyvsp[-2].ValIDVal.S.copy(yyvsp[-3].TypeVal.S);
yyvsp[0].ValIDVal.S.copy(yyvsp[-3].TypeVal.S);
const Type *Ty = yyvsp[-3].TypeVal.PAT->get();
if (!Ty->isInteger()) {
if (!isa<VectorType>(Ty) ||
!cast<VectorType>(Ty)->getElementType()->isInteger())
error("Logical operator requires integral operands");
}
Instruction::BinaryOps Opcode = getBinaryOp(yyvsp[-4].BinaryOpVal, Ty, yyvsp[-3].TypeVal.S);
Value* tmpVal1 = getVal(Ty, yyvsp[-2].ValIDVal);
Value* tmpVal2 = getVal(Ty, yyvsp[0].ValIDVal);
yyval.InstVal.I = BinaryOperator::create(Opcode, tmpVal1, tmpVal2);
if (yyval.InstVal.I == 0)
error("binary operator returned null");
yyval.InstVal.S.copy(yyvsp[-3].TypeVal.S);
delete yyvsp[-3].TypeVal.PAT;
;}
break;
case 283:
#line 3524 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyvsp[-2].ValIDVal.S.copy(yyvsp[-3].TypeVal.S);
yyvsp[0].ValIDVal.S.copy(yyvsp[-3].TypeVal.S);
const Type* Ty = yyvsp[-3].TypeVal.PAT->get();
if(isa<VectorType>(Ty))
error("VectorTypes currently not supported in setcc instructions");
unsigned short pred;
Instruction::OtherOps Opcode = getCompareOp(yyvsp[-4].BinaryOpVal, pred, Ty, yyvsp[-3].TypeVal.S);
Value* tmpVal1 = getVal(Ty, yyvsp[-2].ValIDVal);
Value* tmpVal2 = getVal(Ty, yyvsp[0].ValIDVal);
yyval.InstVal.I = CmpInst::create(Opcode, pred, tmpVal1, tmpVal2);
if (yyval.InstVal.I == 0)
error("binary operator returned null");
yyval.InstVal.S.makeUnsigned();
delete yyvsp[-3].TypeVal.PAT;
;}
break;
case 284:
#line 3540 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyvsp[-2].ValIDVal.S.copy(yyvsp[-3].TypeVal.S);
yyvsp[0].ValIDVal.S.copy(yyvsp[-3].TypeVal.S);
const Type *Ty = yyvsp[-3].TypeVal.PAT->get();
if (isa<VectorType>(Ty))
error("VectorTypes currently not supported in icmp instructions");
else if (!Ty->isInteger() && !isa<PointerType>(Ty))
error("icmp requires integer or pointer typed operands");
Value* tmpVal1 = getVal(Ty, yyvsp[-2].ValIDVal);
Value* tmpVal2 = getVal(Ty, yyvsp[0].ValIDVal);
yyval.InstVal.I = new ICmpInst(yyvsp[-4].IPred, tmpVal1, tmpVal2);
yyval.InstVal.S.makeUnsigned();
delete yyvsp[-3].TypeVal.PAT;
;}
break;
case 285:
#line 3554 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyvsp[-2].ValIDVal.S.copy(yyvsp[-3].TypeVal.S);
yyvsp[0].ValIDVal.S.copy(yyvsp[-3].TypeVal.S);
const Type *Ty = yyvsp[-3].TypeVal.PAT->get();
if (isa<VectorType>(Ty))
error("VectorTypes currently not supported in fcmp instructions");
else if (!Ty->isFloatingPoint())
error("fcmp instruction requires floating point operands");
Value* tmpVal1 = getVal(Ty, yyvsp[-2].ValIDVal);
Value* tmpVal2 = getVal(Ty, yyvsp[0].ValIDVal);
yyval.InstVal.I = new FCmpInst(yyvsp[-4].FPred, tmpVal1, tmpVal2);
yyval.InstVal.S.makeUnsigned();
delete yyvsp[-3].TypeVal.PAT;
;}
break;
case 286:
#line 3568 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
warning("Use of obsolete 'not' instruction: Replacing with 'xor");
const Type *Ty = yyvsp[0].ValueVal.V->getType();
Value *Ones = ConstantInt::getAllOnesValue(Ty);
if (Ones == 0)
error("Expected integral type for not instruction");
yyval.InstVal.I = BinaryOperator::create(Instruction::Xor, yyvsp[0].ValueVal.V, Ones);
if (yyval.InstVal.I == 0)
error("Could not create a xor instruction");
yyval.InstVal.S.copy(yyvsp[0].ValueVal.S);
;}
break;
case 287:
#line 3579 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
if (!yyvsp[0].ValueVal.V->getType()->isInteger() ||
cast<IntegerType>(yyvsp[0].ValueVal.V->getType())->getBitWidth() != 8)
error("Shift amount must be int8");
const Type* Ty = yyvsp[-2].ValueVal.V->getType();
if (!Ty->isInteger())
error("Shift constant expression requires integer operand");
Value* ShiftAmt = 0;
if (cast<IntegerType>(Ty)->getBitWidth() > Type::Int8Ty->getBitWidth())
if (Constant *C = dyn_cast<Constant>(yyvsp[0].ValueVal.V))
ShiftAmt = ConstantExpr::getZExt(C, Ty);
else
ShiftAmt = new ZExtInst(yyvsp[0].ValueVal.V, Ty, makeNameUnique("shift"), CurBB);
else
ShiftAmt = yyvsp[0].ValueVal.V;
yyval.InstVal.I = BinaryOperator::create(getBinaryOp(yyvsp[-3].BinaryOpVal, Ty, yyvsp[-2].ValueVal.S), yyvsp[-2].ValueVal.V, ShiftAmt);
yyval.InstVal.S.copy(yyvsp[-2].ValueVal.S);
;}
break;
case 288:
#line 3597 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
const Type *DstTy = yyvsp[0].TypeVal.PAT->get();
if (!DstTy->isFirstClassType())
error("cast instruction to a non-primitive type: '" +
DstTy->getDescription() + "'");
yyval.InstVal.I = cast<Instruction>(getCast(yyvsp[-3].CastOpVal, yyvsp[-2].ValueVal.V, yyvsp[-2].ValueVal.S, DstTy, yyvsp[0].TypeVal.S, true));
yyval.InstVal.S.copy(yyvsp[0].TypeVal.S);
delete yyvsp[0].TypeVal.PAT;
;}
break;
case 289:
#line 3606 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
if (!yyvsp[-4].ValueVal.V->getType()->isInteger() ||
cast<IntegerType>(yyvsp[-4].ValueVal.V->getType())->getBitWidth() != 1)
error("select condition must be bool");
if (yyvsp[-2].ValueVal.V->getType() != yyvsp[0].ValueVal.V->getType())
error("select value types should match");
yyval.InstVal.I = new SelectInst(yyvsp[-4].ValueVal.V, yyvsp[-2].ValueVal.V, yyvsp[0].ValueVal.V);
yyval.InstVal.S.copy(yyvsp[-2].ValueVal.S);
;}
break;
case 290:
#line 3615 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
const Type *Ty = yyvsp[0].TypeVal.PAT->get();
NewVarArgs = true;
yyval.InstVal.I = new VAArgInst(yyvsp[-2].ValueVal.V, Ty);
yyval.InstVal.S.copy(yyvsp[0].TypeVal.S);
delete yyvsp[0].TypeVal.PAT;
;}
break;
case 291:
#line 3622 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
const Type* ArgTy = yyvsp[-2].ValueVal.V->getType();
const Type* DstTy = yyvsp[0].TypeVal.PAT->get();
ObsoleteVarArgs = true;
Function* NF = cast<Function>(CurModule.CurrentModule->
getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0));
//b = vaarg a, t ->
//foo = alloca 1 of t
//bar = vacopy a
//store bar -> foo
//b = vaarg foo, t
AllocaInst* foo = new AllocaInst(ArgTy, 0, "vaarg.fix");
CurBB->getInstList().push_back(foo);
CallInst* bar = new CallInst(NF, yyvsp[-2].ValueVal.V);
CurBB->getInstList().push_back(bar);
CurBB->getInstList().push_back(new StoreInst(bar, foo));
yyval.InstVal.I = new VAArgInst(foo, DstTy);
yyval.InstVal.S.copy(yyvsp[0].TypeVal.S);
delete yyvsp[0].TypeVal.PAT;
;}
break;
case 292:
#line 3643 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
const Type* ArgTy = yyvsp[-2].ValueVal.V->getType();
const Type* DstTy = yyvsp[0].TypeVal.PAT->get();
ObsoleteVarArgs = true;
Function* NF = cast<Function>(CurModule.CurrentModule->
getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0));
//b = vanext a, t ->
//foo = alloca 1 of t
//bar = vacopy a
//store bar -> foo
//tmp = vaarg foo, t
//b = load foo
AllocaInst* foo = new AllocaInst(ArgTy, 0, "vanext.fix");
CurBB->getInstList().push_back(foo);
CallInst* bar = new CallInst(NF, yyvsp[-2].ValueVal.V);
CurBB->getInstList().push_back(bar);
CurBB->getInstList().push_back(new StoreInst(bar, foo));
Instruction* tmp = new VAArgInst(foo, DstTy);
CurBB->getInstList().push_back(tmp);
yyval.InstVal.I = new LoadInst(foo);
yyval.InstVal.S.copy(yyvsp[0].TypeVal.S);
delete yyvsp[0].TypeVal.PAT;
;}
break;
case 293:
#line 3667 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
if (!ExtractElementInst::isValidOperands(yyvsp[-2].ValueVal.V, yyvsp[0].ValueVal.V))
error("Invalid extractelement operands");
yyval.InstVal.I = new ExtractElementInst(yyvsp[-2].ValueVal.V, yyvsp[0].ValueVal.V);
yyval.InstVal.S.copy(yyvsp[-2].ValueVal.S.get(0));
;}
break;
case 294:
#line 3673 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
if (!InsertElementInst::isValidOperands(yyvsp[-4].ValueVal.V, yyvsp[-2].ValueVal.V, yyvsp[0].ValueVal.V))
error("Invalid insertelement operands");
yyval.InstVal.I = new InsertElementInst(yyvsp[-4].ValueVal.V, yyvsp[-2].ValueVal.V, yyvsp[0].ValueVal.V);
yyval.InstVal.S.copy(yyvsp[-4].ValueVal.S);
;}
break;
case 295:
#line 3679 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
if (!ShuffleVectorInst::isValidOperands(yyvsp[-4].ValueVal.V, yyvsp[-2].ValueVal.V, yyvsp[0].ValueVal.V))
error("Invalid shufflevector operands");
yyval.InstVal.I = new ShuffleVectorInst(yyvsp[-4].ValueVal.V, yyvsp[-2].ValueVal.V, yyvsp[0].ValueVal.V);
yyval.InstVal.S.copy(yyvsp[-4].ValueVal.S);
;}
break;
case 296:
#line 3685 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
const Type *Ty = yyvsp[0].PHIList.P->front().first->getType();
if (!Ty->isFirstClassType())
error("PHI node operands must be of first class type");
PHINode *PHI = new PHINode(Ty);
PHI->reserveOperandSpace(yyvsp[0].PHIList.P->size());
while (yyvsp[0].PHIList.P->begin() != yyvsp[0].PHIList.P->end()) {
if (yyvsp[0].PHIList.P->front().first->getType() != Ty)
error("All elements of a PHI node must be of the same type");
PHI->addIncoming(yyvsp[0].PHIList.P->front().first, yyvsp[0].PHIList.P->front().second);
yyvsp[0].PHIList.P->pop_front();
}
yyval.InstVal.I = PHI;
yyval.InstVal.S.copy(yyvsp[0].PHIList.S);
delete yyvsp[0].PHIList.P; // Free the list...
;}
break;
case 297:
#line 3701 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
// Handle the short call syntax
const PointerType *PFTy;
const FunctionType *FTy;
Signedness FTySign;
if (!(PFTy = dyn_cast<PointerType>(yyvsp[-4].TypeVal.PAT->get())) ||
!(FTy = dyn_cast<FunctionType>(PFTy->getElementType()))) {
// Pull out the types of all of the arguments...
std::vector<const Type*> ParamTypes;
FTySign.makeComposite(yyvsp[-4].TypeVal.S);
if (yyvsp[-1].ValueList) {
for (std::vector<ValueInfo>::iterator I = yyvsp[-1].ValueList->begin(), E = yyvsp[-1].ValueList->end();
I != E; ++I) {
ParamTypes.push_back((*I).V->getType());
FTySign.add(I->S);
}
}
bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
if (isVarArg) ParamTypes.pop_back();
const Type *RetTy = yyvsp[-4].TypeVal.PAT->get();
if (!RetTy->isFirstClassType() && RetTy != Type::VoidTy)
error("Functions cannot return aggregate types");
// Deal with CSRetCC
ParamAttrsList *PAL = 0;
if (yyvsp[-5].UIntVal == OldCallingConv::CSRet) {
ParamAttrsVector Attrs;
ParamAttrsWithIndex PAWI;
PAWI.index = 1; PAWI.attrs = ParamAttr::StructRet; // first arg
Attrs.push_back(PAWI);
PAL = ParamAttrsList::get(Attrs);
}
FTy = FunctionType::get(RetTy, ParamTypes, isVarArg, PAL);
PFTy = PointerType::get(FTy);
yyval.InstVal.S.copy(yyvsp[-4].TypeVal.S);
} else {
FTySign = yyvsp[-4].TypeVal.S;
// Get the signedness of the result type. $3 is the pointer to the
// function type so we get the 0th element to extract the function type,
// and then the 0th element again to get the result type.
yyval.InstVal.S.copy(yyvsp[-4].TypeVal.S.get(0).get(0));
}
yyvsp[-3].ValIDVal.S.makeComposite(FTySign);
// First upgrade any intrinsic calls.
std::vector<Value*> Args;
if (yyvsp[-1].ValueList)
for (unsigned i = 0, e = yyvsp[-1].ValueList->size(); i < e; ++i)
Args.push_back((*yyvsp[-1].ValueList)[i].V);
Instruction *Inst = upgradeIntrinsicCall(FTy->getReturnType(), yyvsp[-3].ValIDVal, Args);
// If we got an upgraded intrinsic
if (Inst) {
yyval.InstVal.I = Inst;
} else {
// Get the function we're calling
Value *V = getVal(PFTy, yyvsp[-3].ValIDVal);
// Check the argument values match
if (!yyvsp[-1].ValueList) { // Has no arguments?
// Make sure no arguments is a good thing!
if (FTy->getNumParams() != 0)
error("No arguments passed to a function that expects arguments");
} else { // Has arguments?
// Loop through FunctionType's arguments and ensure they are specified
// correctly!
//
FunctionType::param_iterator I = FTy->param_begin();
FunctionType::param_iterator E = FTy->param_end();
std::vector<ValueInfo>::iterator ArgI = yyvsp[-1].ValueList->begin(), ArgE = yyvsp[-1].ValueList->end();
for (; ArgI != ArgE && I != E; ++ArgI, ++I)
if ((*ArgI).V->getType() != *I)
error("Parameter " +(*ArgI).V->getName()+ " is not of type '" +
(*I)->getDescription() + "'");
if (I != E || (ArgI != ArgE && !FTy->isVarArg()))
error("Invalid number of parameters detected");
}
// Create the call instruction
CallInst *CI = new CallInst(V, Args.begin(), Args.end());
CI->setTailCall(yyvsp[-6].BoolVal);
CI->setCallingConv(upgradeCallingConv(yyvsp[-5].UIntVal));
yyval.InstVal.I = CI;
}
delete yyvsp[-4].TypeVal.PAT;
delete yyvsp[-1].ValueList;
lastCallingConv = OldCallingConv::C;
;}
break;
case 298:
#line 3794 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyval.InstVal = yyvsp[0].InstVal;
;}
break;
case 299:
#line 3802 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.ValueList = yyvsp[0].ValueList; ;}
break;
case 300:
#line 3803 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.ValueList = new std::vector<ValueInfo>(); ;}
break;
case 301:
#line 3807 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.BoolVal = true; ;}
break;
case 302:
#line 3808 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{ yyval.BoolVal = false; ;}
break;
case 303:
#line 3812 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
const Type *Ty = yyvsp[-1].TypeVal.PAT->get();
yyval.InstVal.S.makeComposite(yyvsp[-1].TypeVal.S);
yyval.InstVal.I = new MallocInst(Ty, 0, yyvsp[0].UIntVal);
delete yyvsp[-1].TypeVal.PAT;
;}
break;
case 304:
#line 3818 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
const Type *Ty = yyvsp[-4].TypeVal.PAT->get();
yyvsp[-1].ValIDVal.S.makeUnsigned();
yyval.InstVal.S.makeComposite(yyvsp[-4].TypeVal.S);
yyval.InstVal.I = new MallocInst(Ty, getVal(yyvsp[-2].PrimType.T, yyvsp[-1].ValIDVal), yyvsp[0].UIntVal);
delete yyvsp[-4].TypeVal.PAT;
;}
break;
case 305:
#line 3825 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
const Type *Ty = yyvsp[-1].TypeVal.PAT->get();
yyval.InstVal.S.makeComposite(yyvsp[-1].TypeVal.S);
yyval.InstVal.I = new AllocaInst(Ty, 0, yyvsp[0].UIntVal);
delete yyvsp[-1].TypeVal.PAT;
;}
break;
case 306:
#line 3831 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
const Type *Ty = yyvsp[-4].TypeVal.PAT->get();
yyvsp[-1].ValIDVal.S.makeUnsigned();
yyval.InstVal.S.makeComposite(yyvsp[-2].PrimType.S);
yyval.InstVal.I = new AllocaInst(Ty, getVal(yyvsp[-2].PrimType.T, yyvsp[-1].ValIDVal), yyvsp[0].UIntVal);
delete yyvsp[-4].TypeVal.PAT;
;}
break;
case 307:
#line 3838 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
const Type *PTy = yyvsp[0].ValueVal.V->getType();
if (!isa<PointerType>(PTy))
error("Trying to free nonpointer type '" + PTy->getDescription() + "'");
yyval.InstVal.I = new FreeInst(yyvsp[0].ValueVal.V);
yyval.InstVal.S.makeSignless();
;}
break;
case 308:
#line 3845 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
const Type* Ty = yyvsp[-1].TypeVal.PAT->get();
yyvsp[0].ValIDVal.S.copy(yyvsp[-1].TypeVal.S);
if (!isa<PointerType>(Ty))
error("Can't load from nonpointer type: " + Ty->getDescription());
if (!cast<PointerType>(Ty)->getElementType()->isFirstClassType())
error("Can't load from pointer of non-first-class type: " +
Ty->getDescription());
Value* tmpVal = getVal(Ty, yyvsp[0].ValIDVal);
yyval.InstVal.I = new LoadInst(tmpVal, "", yyvsp[-3].BoolVal);
yyval.InstVal.S.copy(yyvsp[-1].TypeVal.S.get(0));
delete yyvsp[-1].TypeVal.PAT;
;}
break;
case 309:
#line 3858 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyvsp[0].ValIDVal.S.copy(yyvsp[-1].TypeVal.S);
const PointerType *PTy = dyn_cast<PointerType>(yyvsp[-1].TypeVal.PAT->get());
if (!PTy)
error("Can't store to a nonpointer type: " +
yyvsp[-1].TypeVal.PAT->get()->getDescription());
const Type *ElTy = PTy->getElementType();
Value *StoreVal = yyvsp[-3].ValueVal.V;
Value* tmpVal = getVal(PTy, yyvsp[0].ValIDVal);
if (ElTy != yyvsp[-3].ValueVal.V->getType()) {
StoreVal = handleSRetFuncTypeMerge(yyvsp[-3].ValueVal.V, ElTy);
if (!StoreVal)
error("Can't store '" + yyvsp[-3].ValueVal.V->getType()->getDescription() +
"' into space of type '" + ElTy->getDescription() + "'");
else {
PTy = PointerType::get(StoreVal->getType());
if (Constant *C = dyn_cast<Constant>(tmpVal))
tmpVal = ConstantExpr::getBitCast(C, PTy);
else
tmpVal = new BitCastInst(tmpVal, PTy, "upgrd.cast", CurBB);
}
}
yyval.InstVal.I = new StoreInst(StoreVal, tmpVal, yyvsp[-5].BoolVal);
yyval.InstVal.S.makeSignless();
delete yyvsp[-1].TypeVal.PAT;
;}
break;
case 310:
#line 3884 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
{
yyvsp[-1].ValIDVal.S.copy(yyvsp[-2].TypeVal.S);
const Type* Ty = yyvsp[-2].TypeVal.PAT->get();
if (!isa<PointerType>(Ty))
error("getelementptr insn requires pointer operand");
std::vector<Value*> VIndices;
upgradeGEPInstIndices(Ty, yyvsp[0].ValueList, VIndices);
Value* tmpVal = getVal(Ty, yyvsp[-1].ValIDVal);
yyval.InstVal.I = new GetElementPtrInst(tmpVal, VIndices.begin(), VIndices.end());
ValueInfo VI; VI.V = tmpVal; VI.S.copy(yyvsp[-2].TypeVal.S);
yyval.InstVal.S.copy(getElementSign(VI, VIndices));
delete yyvsp[-2].TypeVal.PAT;
delete yyvsp[0].ValueList;
;}
break;
}
/* Line 993 of yacc.c. */
#line 6500 "UpgradeParser.tab.c"
yyvsp -= yylen;
yyssp -= yylen;
YY_STACK_PRINT (yyss, yyssp);
*++yyvsp = yyval;
/* Now `shift' the result of the reduction. Determine what state
that goes to, based on the state we popped back to and the rule
number reduced by. */
yyn = yyr1[yyn];
yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
yystate = yytable[yystate];
else
yystate = yydefgoto[yyn - YYNTOKENS];
goto yynewstate;
/*------------------------------------.
| yyerrlab -- here on detecting error |
`------------------------------------*/
yyerrlab:
/* If not already recovering from an error, report this error. */
if (!yyerrstatus)
{
++yynerrs;
#if YYERROR_VERBOSE
yyn = yypact[yystate];
if (YYPACT_NINF < yyn && yyn < YYLAST)
{
YYSIZE_T yysize = 0;
int yytype = YYTRANSLATE (yychar);
const char* yyprefix;
char *yymsg;
int yyx;
/* Start YYX at -YYN if negative to avoid negative indexes in
YYCHECK. */
int yyxbegin = yyn < 0 ? -yyn : 0;
/* Stay within bounds of both yycheck and yytname. */
int yychecklim = YYLAST - yyn;
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
int yycount = 0;
yyprefix = ", expecting ";
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
{
yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
yycount += 1;
if (yycount == 5)
{
yysize = 0;
break;
}
}
yysize += (sizeof ("syntax error, unexpected ")
+ yystrlen (yytname[yytype]));
yymsg = (char *) YYSTACK_ALLOC (yysize);
if (yymsg != 0)
{
char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
yyp = yystpcpy (yyp, yytname[yytype]);
if (yycount < 5)
{
yyprefix = ", expecting ";
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
{
yyp = yystpcpy (yyp, yyprefix);
yyp = yystpcpy (yyp, yytname[yyx]);
yyprefix = " or ";
}
}
yyerror (yymsg);
YYSTACK_FREE (yymsg);
}
else
yyerror ("syntax error; also virtual memory exhausted");
}
else
#endif /* YYERROR_VERBOSE */
yyerror ("syntax error");
}
if (yyerrstatus == 3)
{
/* If just tried and failed to reuse lookahead token after an
error, discard it. */
if (yychar <= YYEOF)
{
/* If at end of input, pop the error token,
then the rest of the stack, then return failure. */
if (yychar == YYEOF)
for (;;)
{
YYPOPSTACK;
if (yyssp == yyss)
YYABORT;
YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
yydestruct (yystos[*yyssp], yyvsp);
}
}
else
{
YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
yydestruct (yytoken, &yylval);
yychar = YYEMPTY;
}
}
/* Else will try to reuse lookahead token after shifting the error
token. */
goto yyerrlab1;
/*---------------------------------------------------.
| yyerrorlab -- error raised explicitly by YYERROR. |
`---------------------------------------------------*/
yyerrorlab:
#ifdef __GNUC__
/* Pacify GCC when the user code never invokes YYERROR and the label
yyerrorlab therefore never appears in user code. */
if (0)
goto yyerrorlab;
#endif
yyvsp -= yylen;
yyssp -= yylen;
yystate = *yyssp;
goto yyerrlab1;
/*-------------------------------------------------------------.
| yyerrlab1 -- common code for both syntax error and YYERROR. |
`-------------------------------------------------------------*/
yyerrlab1:
yyerrstatus = 3; /* Each real token shifted decrements this. */
for (;;)
{
yyn = yypact[yystate];
if (yyn != YYPACT_NINF)
{
yyn += YYTERROR;
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
{
yyn = yytable[yyn];
if (0 < yyn)
break;
}
}
/* Pop the current state because it cannot handle the error token. */
if (yyssp == yyss)
YYABORT;
YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
yydestruct (yystos[yystate], yyvsp);
YYPOPSTACK;
yystate = *yyssp;
YY_STACK_PRINT (yyss, yyssp);
}
if (yyn == YYFINAL)
YYACCEPT;
YYDPRINTF ((stderr, "Shifting error token, "));
*++yyvsp = yylval;
yystate = yyn;
goto yynewstate;
/*-------------------------------------.
| yyacceptlab -- YYACCEPT comes here. |
`-------------------------------------*/
yyacceptlab:
yyresult = 0;
goto yyreturn;
/*-----------------------------------.
| yyabortlab -- YYABORT comes here. |
`-----------------------------------*/
yyabortlab:
yyresult = 1;
goto yyreturn;
#ifndef yyoverflow
/*----------------------------------------------.
| yyoverflowlab -- parser overflow comes here. |
`----------------------------------------------*/
yyoverflowlab:
yyerror ("parser stack overflow");
yyresult = 2;
/* Fall through. */
#endif
yyreturn:
#ifndef yyoverflow
if (yyss != yyssa)
YYSTACK_FREE (yyss);
#endif
return yyresult;
}
#line 3902 "/users/dag/projects/cascade/llvm.modified/tools/llvm-upgrade/UpgradeParser.y"
int yyerror(const char *ErrorMsg) {
std::string where
= std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
+ ":" + llvm::utostr((unsigned) Upgradelineno) + ": ";
std::string errMsg = where + "error: " + std::string(ErrorMsg);
if (yychar != YYEMPTY && yychar != 0)
errMsg += " while reading token '" + std::string(Upgradetext, Upgradeleng) +
"'.";
std::cerr << "llvm-upgrade: " << errMsg << '\n';
std::cout << "llvm-upgrade: parse failed.\n";
exit(1);
}
void warning(const std::string& ErrorMsg) {
std::string where
= std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
+ ":" + llvm::utostr((unsigned) Upgradelineno) + ": ";
std::string errMsg = where + "warning: " + std::string(ErrorMsg);
if (yychar != YYEMPTY && yychar != 0)
errMsg += " while reading token '" + std::string(Upgradetext, Upgradeleng) +
"'.";
std::cerr << "llvm-upgrade: " << errMsg << '\n';
}
void error(const std::string& ErrorMsg, int LineNo) {
if (LineNo == -1) LineNo = Upgradelineno;
Upgradelineno = LineNo;
yyerror(ErrorMsg.c_str());
}
|