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
|
/* tc-v850.c -- Assembler code for the NEC V850
Copyright (C) 1996-2018 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
GAS 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 3, or (at your option)
any later version.
GAS 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 GAS; see the file COPYING. If not, write to
the Free Software Foundation, 51 Franklin Street - Fifth Floor,
Boston, MA 02110-1301, USA. */
#include "as.h"
#include "safe-ctype.h"
#include "subsegs.h"
#include "opcode/v850.h"
#include "dwarf2dbg.h"
/* Sign-extend a 16-bit number. */
#define SEXT16(x) ((((x) & 0xffff) ^ (~0x7fff)) + 0x8000)
/* Set to TRUE if we want to be pedantic about signed overflows. */
static bfd_boolean warn_signed_overflows = FALSE;
static bfd_boolean warn_unsigned_overflows = FALSE;
/* Non-zero if floating point insns are not being used. */
static signed int soft_float = -1;
/* Indicates the target BFD machine number. */
static int machine = -1;
/* Indicates the target BFD architecture. */
enum bfd_architecture v850_target_arch = bfd_arch_v850_rh850;
const char * v850_target_format = "elf32-v850-rh850";
static flagword v850_e_flags = 0;
/* Indicates the target processor(s) for the assemble. */
static int processor_mask = 0;
/* Structure to hold information about predefined registers. */
struct reg_name
{
const char *name;
int value;
unsigned int processors;
};
/* Generic assembler global variables which must be defined by all
targets. */
/* Characters which always start a comment. */
const char comment_chars[] = "#";
/* Characters which start a comment at the beginning of a line. */
const char line_comment_chars[] = ";#";
/* Characters which may be used to separate multiple commands on a
single line. */
const char line_separator_chars[] = ";";
/* Characters which are used to indicate an exponent in a floating
point number. */
const char EXP_CHARS[] = "eE";
/* Characters which mean that a number is a floating point constant,
as in 0d1.0. */
const char FLT_CHARS[] = "dD";
const relax_typeS md_relax_table[] =
{
/* Conditional branches.(V850/V850E, max 22bit) */
#define SUBYPTE_COND_9_22 0
{0xfe, -0x100, 2, SUBYPTE_COND_9_22 + 1},
{0x1ffffe + 2, -0x200000 + 2, 6, 0},
/* Conditional branches.(V850/V850E, max 22bit) */
#define SUBYPTE_SA_9_22 2
{0xfe, -0x100, 2, SUBYPTE_SA_9_22 + 1},
{0x1ffffe + 4, -0x200000 + 4, 8, 0},
/* Unconditional branches.(V850/V850E, max 22bit) */
#define SUBYPTE_UNCOND_9_22 4
{0xfe, -0x100, 2, SUBYPTE_UNCOND_9_22 + 1},
{0x1ffffe, -0x200000, 4, 0},
/* Conditional branches.(V850E2, max 32bit) */
#define SUBYPTE_COND_9_22_32 6
{0xfe, -0x100, 2, SUBYPTE_COND_9_22_32 + 1},
{0x1fffff + 2, -0x200000 + 2, 6, SUBYPTE_COND_9_22_32 + 2},
{0x7ffffffe, -0x80000000, 8, 0},
/* Conditional branches.(V850E2, max 32bit) */
#define SUBYPTE_SA_9_22_32 9
{0xfe, -0x100, 2, SUBYPTE_SA_9_22_32 + 1},
{0x1ffffe + 4, -0x200000 + 4, 8, SUBYPTE_SA_9_22_32 + 2},
{0x7ffffffe, -0x80000000, 10, 0},
/* Unconditional branches.(V850E2, max 32bit) */
#define SUBYPTE_UNCOND_9_22_32 12
{0xfe, -0x100, 2, SUBYPTE_UNCOND_9_22_32 + 1},
{0x1ffffe, -0x200000, 4, SUBYPTE_UNCOND_9_22_32 + 2},
{0x7ffffffe, -0x80000000, 6, 0},
/* Conditional branches.(V850E2R max 22bit) */
#define SUBYPTE_COND_9_17_22 15
{0xfe, -0x100, 2, SUBYPTE_COND_9_17_22 + 1},
{0xfffe, -0x10000, 4, SUBYPTE_COND_9_17_22 + 2},
{0x1ffffe + 2, -0x200000 + 2, 6, 0},
/* Conditional branches.(V850E2R max 22bit) */
#define SUBYPTE_SA_9_17_22 18
{0xfe, -0x100, 2, SUBYPTE_SA_9_17_22 + 1},
{0xfffe, -0x10000, 4, SUBYPTE_SA_9_17_22 + 2},
{0x1ffffe + 4, -0x200000 + 4, 8, 0},
/* Conditional branches.(V850E2R max 32bit) */
#define SUBYPTE_COND_9_17_22_32 21
{0xfe, -0x100, 2, SUBYPTE_COND_9_17_22_32 + 1},
{0xfffe, -0x10000, 4, SUBYPTE_COND_9_17_22_32 + 2},
{0x1ffffe + 2, -0x200000 + 2, 6, SUBYPTE_COND_9_17_22_32 + 3},
{0x7ffffffe, -0x80000000, 8, 0},
/* Conditional branches.(V850E2R max 32bit) */
#define SUBYPTE_SA_9_17_22_32 25
{0xfe, -0x100, 2, SUBYPTE_SA_9_17_22_32 + 1},
{0xfffe, -0x10000, 4, SUBYPTE_SA_9_17_22_32 + 2},
{0x1ffffe + 4, -0x200000 + 4, 8, SUBYPTE_SA_9_17_22_32 + 3},
{0x7ffffffe, -0x80000000, 10, 0},
/* Loop. (V850E2V4_UP, max 22-bit). */
#define SUBYPTE_LOOP_16_22 29
{0x0, -0x0fffe, 4, SUBYPTE_LOOP_16_22 + 1},
{0x1ffffe + 2, -0x200000 + 2, 6, 0},
};
static int v850_relax = 0;
/* Default branch disp size 22 or 32. */
static int default_disp_size = 22;
/* Default no using bcond17. */
static int no_bcond17 = 0;
/* Default no using ld/st 23bit offset. */
static int no_stld23 = 0;
/* Fixups. */
#define MAX_INSN_FIXUPS 5
struct v850_fixup
{
expressionS exp;
int opindex;
bfd_reloc_code_real_type reloc;
};
struct v850_fixup fixups[MAX_INSN_FIXUPS];
static int fc;
struct v850_seg_entry
{
segT s;
const char *name;
flagword flags;
};
struct v850_seg_entry v850_seg_table[] =
{
{ NULL, ".sdata",
SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA | SEC_HAS_CONTENTS
| SEC_SMALL_DATA },
{ NULL, ".tdata",
SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA | SEC_HAS_CONTENTS },
{ NULL, ".zdata",
SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA | SEC_HAS_CONTENTS },
{ NULL, ".sbss",
SEC_ALLOC | SEC_SMALL_DATA },
{ NULL, ".tbss",
SEC_ALLOC },
{ NULL, ".zbss",
SEC_ALLOC},
{ NULL, ".rosdata",
SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY | SEC_DATA
| SEC_HAS_CONTENTS | SEC_SMALL_DATA },
{ NULL, ".rozdata",
SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY | SEC_DATA
| SEC_HAS_CONTENTS },
{ NULL, ".scommon",
SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA | SEC_HAS_CONTENTS
| SEC_SMALL_DATA | SEC_IS_COMMON },
{ NULL, ".tcommon",
SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA | SEC_HAS_CONTENTS
| SEC_IS_COMMON },
{ NULL, ".zcommon",
SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA | SEC_HAS_CONTENTS
| SEC_IS_COMMON },
{ NULL, ".call_table_data",
SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA | SEC_HAS_CONTENTS },
{ NULL, ".call_table_text",
SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY | SEC_CODE
| SEC_HAS_CONTENTS},
{ NULL, ".bss",
SEC_ALLOC }
};
#define SDATA_SECTION 0
#define TDATA_SECTION 1
#define ZDATA_SECTION 2
#define SBSS_SECTION 3
#define TBSS_SECTION 4
#define ZBSS_SECTION 5
#define ROSDATA_SECTION 6
#define ROZDATA_SECTION 7
#define SCOMMON_SECTION 8
#define TCOMMON_SECTION 9
#define ZCOMMON_SECTION 10
#define CALL_TABLE_DATA_SECTION 11
#define CALL_TABLE_TEXT_SECTION 12
#define BSS_SECTION 13
static void
do_v850_seg (int i, subsegT sub)
{
struct v850_seg_entry *seg = v850_seg_table + i;
obj_elf_section_change_hook ();
if (seg->s != NULL)
subseg_set (seg->s, sub);
else
{
seg->s = subseg_new (seg->name, sub);
bfd_set_section_flags (stdoutput, seg->s, seg->flags);
if ((seg->flags & SEC_LOAD) == 0)
seg_info (seg->s)->bss = 1;
}
}
static void
v850_seg (int i)
{
subsegT sub = get_absolute_expression ();
do_v850_seg (i, sub);
demand_empty_rest_of_line ();
}
static void
v850_offset (int ignore ATTRIBUTE_UNUSED)
{
char *pfrag;
int temp = get_absolute_expression ();
pfrag = frag_var (rs_org, 1, 1, (relax_substateT)0, (symbolS *)0,
(offsetT) temp, (char *) 0);
*pfrag = 0;
demand_empty_rest_of_line ();
}
/* Copied from obj_elf_common() in gas/config/obj-elf.c. */
static void
v850_comm (int area)
{
char *name;
char c;
char *p;
int temp;
unsigned int size;
symbolS *symbolP;
int have_align;
c = get_symbol_name (&name);
/* Just after name is now '\0'. */
p = input_line_pointer;
*p = c;
SKIP_WHITESPACE ();
if (*input_line_pointer != ',')
{
as_bad (_("Expected comma after symbol-name"));
ignore_rest_of_line ();
return;
}
/* Skip ','. */
input_line_pointer++;
if ((temp = get_absolute_expression ()) < 0)
{
/* xgettext:c-format */
as_bad (_(".COMMon length (%d.) < 0! Ignored."), temp);
ignore_rest_of_line ();
return;
}
size = temp;
*p = 0;
symbolP = symbol_find_or_make (name);
*p = c;
if (S_IS_DEFINED (symbolP) && ! S_IS_COMMON (symbolP))
{
as_bad (_("Ignoring attempt to re-define symbol"));
ignore_rest_of_line ();
return;
}
if (S_GET_VALUE (symbolP) != 0)
{
if (S_GET_VALUE (symbolP) != size)
/* xgettext:c-format */
as_warn (_("Length of .comm \"%s\" is already %ld. Not changed to %d."),
S_GET_NAME (symbolP), (long) S_GET_VALUE (symbolP), size);
}
know (symbol_get_frag (symbolP) == &zero_address_frag);
if (*input_line_pointer != ',')
have_align = 0;
else
{
have_align = 1;
input_line_pointer++;
SKIP_WHITESPACE ();
}
if (! have_align || *input_line_pointer != '"')
{
if (! have_align)
temp = 0;
else
{
temp = get_absolute_expression ();
if (temp < 0)
{
temp = 0;
as_warn (_("Common alignment negative; 0 assumed"));
}
}
if (symbol_get_obj (symbolP)->local)
{
segT old_sec;
int old_subsec;
char *pfrag;
int align;
flagword applicable;
old_sec = now_seg;
old_subsec = now_subseg;
applicable = bfd_applicable_section_flags (stdoutput);
applicable &= SEC_ALLOC;
switch (area)
{
case SCOMMON_SECTION:
do_v850_seg (SBSS_SECTION, 0);
break;
case ZCOMMON_SECTION:
do_v850_seg (ZBSS_SECTION, 0);
break;
case TCOMMON_SECTION:
do_v850_seg (TBSS_SECTION, 0);
break;
}
if (temp)
{
/* Convert to a power of 2 alignment. */
for (align = 0; (temp & 1) == 0; temp >>= 1, ++align)
;
if (temp != 1)
{
as_bad (_("Common alignment not a power of 2"));
ignore_rest_of_line ();
return;
}
}
else
align = 0;
record_alignment (now_seg, align);
if (align)
frag_align (align, 0, 0);
switch (area)
{
case SCOMMON_SECTION:
if (S_GET_SEGMENT (symbolP) == v850_seg_table[SBSS_SECTION].s)
symbol_get_frag (symbolP)->fr_symbol = 0;
break;
case ZCOMMON_SECTION:
if (S_GET_SEGMENT (symbolP) == v850_seg_table[ZBSS_SECTION].s)
symbol_get_frag (symbolP)->fr_symbol = 0;
break;
case TCOMMON_SECTION:
if (S_GET_SEGMENT (symbolP) == v850_seg_table[TBSS_SECTION].s)
symbol_get_frag (symbolP)->fr_symbol = 0;
break;
default:
abort ();
}
symbol_set_frag (symbolP, frag_now);
pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP,
(offsetT) size, (char *) 0);
*pfrag = 0;
S_SET_SIZE (symbolP, size);
switch (area)
{
case SCOMMON_SECTION:
S_SET_SEGMENT (symbolP, v850_seg_table[SBSS_SECTION].s);
break;
case ZCOMMON_SECTION:
S_SET_SEGMENT (symbolP, v850_seg_table[ZBSS_SECTION].s);
break;
case TCOMMON_SECTION:
S_SET_SEGMENT (symbolP, v850_seg_table[TBSS_SECTION].s);
break;
default:
abort ();
}
S_CLEAR_EXTERNAL (symbolP);
obj_elf_section_change_hook ();
subseg_set (old_sec, old_subsec);
}
else
{
segT old_sec;
int old_subsec;
allocate_common:
old_sec = now_seg;
old_subsec = now_subseg;
S_SET_VALUE (symbolP, (valueT) size);
S_SET_ALIGN (symbolP, temp);
S_SET_EXTERNAL (symbolP);
switch (area)
{
case SCOMMON_SECTION:
case ZCOMMON_SECTION:
case TCOMMON_SECTION:
do_v850_seg (area, 0);
S_SET_SEGMENT (symbolP, v850_seg_table[area].s);
break;
default:
abort ();
}
obj_elf_section_change_hook ();
subseg_set (old_sec, old_subsec);
}
}
else
{
input_line_pointer++;
/* @@ Some use the dot, some don't. Can we get some consistency?? */
if (*input_line_pointer == '.')
input_line_pointer++;
/* @@ Some say data, some say bss. */
if (strncmp (input_line_pointer, "bss\"", 4)
&& strncmp (input_line_pointer, "data\"", 5))
{
while (*--input_line_pointer != '"')
;
input_line_pointer--;
goto bad_common_segment;
}
while (*input_line_pointer++ != '"')
;
goto allocate_common;
}
symbol_get_bfdsym (symbolP)->flags |= BSF_OBJECT;
demand_empty_rest_of_line ();
return;
{
bad_common_segment:
p = input_line_pointer;
while (*p && *p != '\n')
p++;
c = *p;
*p = '\0';
as_bad (_("bad .common segment %s"), input_line_pointer + 1);
*p = c;
input_line_pointer = p;
ignore_rest_of_line ();
return;
}
}
static void
set_machine (int number)
{
machine = number;
bfd_set_arch_mach (stdoutput, v850_target_arch, machine);
switch (machine)
{
case 0: SET_PROCESSOR_MASK (processor_mask, PROCESSOR_V850); break;
case bfd_mach_v850: SET_PROCESSOR_MASK (processor_mask, PROCESSOR_V850); break;
case bfd_mach_v850e: SET_PROCESSOR_MASK (processor_mask, PROCESSOR_V850E); break;
case bfd_mach_v850e1: SET_PROCESSOR_MASK (processor_mask, PROCESSOR_V850E); break;
case bfd_mach_v850e2: SET_PROCESSOR_MASK (processor_mask, PROCESSOR_V850E2); break;
case bfd_mach_v850e2v3:SET_PROCESSOR_MASK (processor_mask, PROCESSOR_V850E2V3); break;
case bfd_mach_v850e3v5: SET_PROCESSOR_MASK (processor_mask, PROCESSOR_V850E3V5); break;
}
}
static void
v850_longcode (int type)
{
expressionS ex;
if (! v850_relax)
{
if (type == 1)
as_warn (_(".longcall pseudo-op seen when not relaxing"));
else
as_warn (_(".longjump pseudo-op seen when not relaxing"));
}
expression (&ex);
if (ex.X_op != O_symbol || ex.X_add_number != 0)
{
as_bad (_("bad .longcall format"));
ignore_rest_of_line ();
return;
}
if (type == 1)
fix_new_exp (frag_now, frag_now_fix (), 4, & ex, 1,
BFD_RELOC_V850_LONGCALL);
else
fix_new_exp (frag_now, frag_now_fix (), 4, & ex, 1,
BFD_RELOC_V850_LONGJUMP);
demand_empty_rest_of_line ();
}
/* The target specific pseudo-ops which we support. */
const pseudo_typeS md_pseudo_table[] =
{
{ "sdata", v850_seg, SDATA_SECTION },
{ "tdata", v850_seg, TDATA_SECTION },
{ "zdata", v850_seg, ZDATA_SECTION },
{ "sbss", v850_seg, SBSS_SECTION },
{ "tbss", v850_seg, TBSS_SECTION },
{ "zbss", v850_seg, ZBSS_SECTION },
{ "rosdata", v850_seg, ROSDATA_SECTION },
{ "rozdata", v850_seg, ROZDATA_SECTION },
{ "bss", v850_seg, BSS_SECTION },
{ "offset", v850_offset, 0 },
{ "word", cons, 4 },
{ "zcomm", v850_comm, ZCOMMON_SECTION },
{ "scomm", v850_comm, SCOMMON_SECTION },
{ "tcomm", v850_comm, TCOMMON_SECTION },
{ "v850", set_machine, 0 },
{ "call_table_data", v850_seg, CALL_TABLE_DATA_SECTION },
{ "call_table_text", v850_seg, CALL_TABLE_TEXT_SECTION },
{ "v850e", set_machine, bfd_mach_v850e },
{ "v850e1", set_machine, bfd_mach_v850e1 },
{ "v850e2", set_machine, bfd_mach_v850e2 },
{ "v850e2v3", set_machine, bfd_mach_v850e2v3 },
{ "v850e2v4", set_machine, bfd_mach_v850e3v5 },
{ "v850e3v5", set_machine, bfd_mach_v850e3v5 },
{ "longcall", v850_longcode, 1 },
{ "longjump", v850_longcode, 2 },
{ NULL, NULL, 0 }
};
/* Opcode hash table. */
static struct hash_control *v850_hash;
/* This table is sorted. Suitable for searching by a binary search. */
static const struct reg_name pre_defined_registers[] =
{
{ "ep", 30, PROCESSOR_ALL }, /* ep - element ptr. */
{ "gp", 4, PROCESSOR_ALL }, /* gp - global ptr. */
{ "hp", 2, PROCESSOR_ALL }, /* hp - handler stack ptr. */
{ "lp", 31, PROCESSOR_ALL }, /* lp - link ptr. */
{ "r0", 0, PROCESSOR_ALL },
{ "r1", 1, PROCESSOR_ALL },
{ "r10", 10, PROCESSOR_ALL },
{ "r11", 11, PROCESSOR_ALL },
{ "r12", 12, PROCESSOR_ALL },
{ "r13", 13, PROCESSOR_ALL },
{ "r14", 14, PROCESSOR_ALL },
{ "r15", 15, PROCESSOR_ALL },
{ "r16", 16, PROCESSOR_ALL },
{ "r17", 17, PROCESSOR_ALL },
{ "r18", 18, PROCESSOR_ALL },
{ "r19", 19, PROCESSOR_ALL },
{ "r2", 2, PROCESSOR_ALL },
{ "r20", 20, PROCESSOR_ALL },
{ "r21", 21, PROCESSOR_ALL },
{ "r22", 22, PROCESSOR_ALL },
{ "r23", 23, PROCESSOR_ALL },
{ "r24", 24, PROCESSOR_ALL },
{ "r25", 25, PROCESSOR_ALL },
{ "r26", 26, PROCESSOR_ALL },
{ "r27", 27, PROCESSOR_ALL },
{ "r28", 28, PROCESSOR_ALL },
{ "r29", 29, PROCESSOR_ALL },
{ "r3", 3, PROCESSOR_ALL },
{ "r30", 30, PROCESSOR_ALL },
{ "r31", 31, PROCESSOR_ALL },
{ "r4", 4, PROCESSOR_ALL },
{ "r5", 5, PROCESSOR_ALL },
{ "r6", 6, PROCESSOR_ALL },
{ "r7", 7, PROCESSOR_ALL },
{ "r8", 8, PROCESSOR_ALL },
{ "r9", 9, PROCESSOR_ALL },
{ "sp", 3, PROCESSOR_ALL }, /* sp - stack ptr. */
{ "tp", 5, PROCESSOR_ALL }, /* tp - text ptr. */
{ "zero", 0, PROCESSOR_ALL },
};
#define REG_NAME_CNT \
(sizeof (pre_defined_registers) / sizeof (struct reg_name))
static const struct reg_name system_registers[] =
{
{ "asid", 23, PROCESSOR_NOT_V850 },
{ "bpam", 25, PROCESSOR_NOT_V850 },
{ "bpav", 24, PROCESSOR_NOT_V850 },
{ "bpc", 22, PROCESSOR_NOT_V850 },
{ "bpdm", 27, PROCESSOR_NOT_V850 },
{ "bpdv", 26, PROCESSOR_NOT_V850 },
{ "bsel", 31, PROCESSOR_V850E2_UP },
{ "cfg", 7, PROCESSOR_V850E2V3_UP },
{ "ctbp", 20, PROCESSOR_NOT_V850 },
{ "ctpc", 16, PROCESSOR_NOT_V850 },
{ "ctpsw", 17, PROCESSOR_NOT_V850 },
{ "dbic", 15, PROCESSOR_V850E2_UP },
{ "dbpc", 18, PROCESSOR_NOT_V850 },
{ "dbpsw", 19, PROCESSOR_NOT_V850 },
{ "dbwr", 30, PROCESSOR_V850E2_UP },
{ "dir", 21, PROCESSOR_NOT_V850 },
{ "dpa0l", 16, PROCESSOR_V850E2V3_UP },
{ "dpa0u", 17, PROCESSOR_V850E2V3_UP },
{ "dpa1l", 18, PROCESSOR_V850E2V3_UP },
{ "dpa1u", 19, PROCESSOR_V850E2V3_UP },
{ "dpa2l", 20, PROCESSOR_V850E2V3_UP },
{ "dpa2u", 21, PROCESSOR_V850E2V3_UP },
{ "dpa3l", 22, PROCESSOR_V850E2V3_UP },
{ "dpa3u", 23, PROCESSOR_V850E2V3_UP },
{ "dpa4l", 24, PROCESSOR_V850E2V3_UP },
{ "dpa4u", 25, PROCESSOR_V850E2V3_UP },
{ "dpa5l", 26, PROCESSOR_V850E2V3_UP },
{ "dpa5u", 27, PROCESSOR_V850E2V3_UP },
{ "ecr", 4, PROCESSOR_ALL },
{ "eh_base", 3, PROCESSOR_V850E2V3_UP },
{ "eh_cfg", 1, PROCESSOR_V850E2V3_UP },
{ "eh_reset", 2, PROCESSOR_V850E2V3_UP },
{ "eiic", 13, PROCESSOR_V850E2_UP },
{ "eipc", 0, PROCESSOR_ALL },
{ "eipsw", 1, PROCESSOR_ALL },
{ "eiwr", 28, PROCESSOR_V850E2_UP },
{ "feic", 14, PROCESSOR_V850E2_UP },
{ "fepc", 2, PROCESSOR_ALL },
{ "fepsw", 3, PROCESSOR_ALL },
{ "fewr", 29, PROCESSOR_V850E2_UP },
{ "fpcc", 9, PROCESSOR_V850E2V3_UP },
{ "fpcfg", 10, PROCESSOR_V850E2V3_UP },
{ "fpec", 11, PROCESSOR_V850E2V3_UP },
{ "fpepc", 7, PROCESSOR_V850E2V3_UP },
{ "fpspc", 27, PROCESSOR_V850E2V3_UP },
{ "fpsr", 6, PROCESSOR_V850E2V3_UP },
{ "fpst", 8, PROCESSOR_V850E2V3_UP },
{ "ipa0l", 6, PROCESSOR_V850E2V3_UP },
{ "ipa0u", 7, PROCESSOR_V850E2V3_UP },
{ "ipa1l", 8, PROCESSOR_V850E2V3_UP },
{ "ipa1u", 9, PROCESSOR_V850E2V3_UP },
{ "ipa2l", 10, PROCESSOR_V850E2V3_UP },
{ "ipa2u", 11, PROCESSOR_V850E2V3_UP },
{ "ipa3l", 12, PROCESSOR_V850E2V3_UP },
{ "ipa3u", 13, PROCESSOR_V850E2V3_UP },
{ "ipa4l", 14, PROCESSOR_V850E2V3_UP },
{ "ipa4u", 15, PROCESSOR_V850E2V3_UP },
{ "mca", 24, PROCESSOR_V850E2V3_UP },
{ "mcc", 26, PROCESSOR_V850E2V3_UP },
{ "mcr", 27, PROCESSOR_V850E2V3_UP },
{ "mcs", 25, PROCESSOR_V850E2V3_UP },
{ "mpc", 1, PROCESSOR_V850E2V3_UP },
{ "mpm", 0, PROCESSOR_V850E2V3_UP },
{ "mpu10_dpa0l", 16, PROCESSOR_V850E2V3_UP },
{ "mpu10_dpa0u", 17, PROCESSOR_V850E2V3_UP },
{ "mpu10_dpa1l", 18, PROCESSOR_V850E2V3_UP },
{ "mpu10_dpa1u", 19, PROCESSOR_V850E2V3_UP },
{ "mpu10_dpa2l", 20, PROCESSOR_V850E2V3_UP },
{ "mpu10_dpa2u", 21, PROCESSOR_V850E2V3_UP },
{ "mpu10_dpa3l", 22, PROCESSOR_V850E2V3_UP },
{ "mpu10_dpa3u", 23, PROCESSOR_V850E2V3_UP },
{ "mpu10_dpa4l", 24, PROCESSOR_V850E2V3_UP },
{ "mpu10_dpa4u", 25, PROCESSOR_V850E2V3_UP },
{ "mpu10_dpa5l", 26, PROCESSOR_V850E2V3_UP },
{ "mpu10_dpa5u", 27, PROCESSOR_V850E2V3_UP },
{ "mpu10_ipa0l", 6, PROCESSOR_V850E2V3_UP },
{ "mpu10_ipa0u", 7, PROCESSOR_V850E2V3_UP },
{ "mpu10_ipa1l", 8, PROCESSOR_V850E2V3_UP },
{ "mpu10_ipa1u", 9, PROCESSOR_V850E2V3_UP },
{ "mpu10_ipa2l", 10, PROCESSOR_V850E2V3_UP },
{ "mpu10_ipa2u", 11, PROCESSOR_V850E2V3_UP },
{ "mpu10_ipa3l", 12, PROCESSOR_V850E2V3_UP },
{ "mpu10_ipa3u", 13, PROCESSOR_V850E2V3_UP },
{ "mpu10_ipa4l", 14, PROCESSOR_V850E2V3_UP },
{ "mpu10_ipa4u", 15, PROCESSOR_V850E2V3_UP },
{ "mpu10_mpc", 1, PROCESSOR_V850E2V3_UP },
{ "mpu10_mpm", 0, PROCESSOR_V850E2V3_UP },
{ "mpu10_tid", 2, PROCESSOR_V850E2V3_UP },
{ "mpu10_vmadr", 5, PROCESSOR_V850E2V3_UP },
{ "mpu10_vmecr", 3, PROCESSOR_V850E2V3_UP },
{ "mpu10_vmtid", 4, PROCESSOR_V850E2V3_UP },
{ "pid", 6, PROCESSOR_V850E2V3_UP },
{ "pmcr0", 4, PROCESSOR_V850E2V3_UP },
{ "pmis2", 14, PROCESSOR_V850E2V3_UP },
{ "psw", 5, PROCESSOR_ALL },
{ "scbp", 12, PROCESSOR_V850E2V3_UP },
{ "sccfg", 11, PROCESSOR_V850E2V3_UP },
{ "sr0", 0, PROCESSOR_ALL },
{ "sr1", 1, PROCESSOR_ALL },
{ "sr10", 10, PROCESSOR_ALL },
{ "sr11", 11, PROCESSOR_ALL },
{ "sr12", 12, PROCESSOR_ALL },
{ "sr13", 13, PROCESSOR_ALL },
{ "sr14", 14, PROCESSOR_ALL },
{ "sr15", 15, PROCESSOR_ALL },
{ "sr16", 16, PROCESSOR_ALL },
{ "sr17", 17, PROCESSOR_ALL },
{ "sr18", 18, PROCESSOR_ALL },
{ "sr19", 19, PROCESSOR_ALL },
{ "sr2", 2, PROCESSOR_ALL },
{ "sr20", 20, PROCESSOR_ALL },
{ "sr21", 21, PROCESSOR_ALL },
{ "sr22", 22, PROCESSOR_ALL },
{ "sr23", 23, PROCESSOR_ALL },
{ "sr24", 24, PROCESSOR_ALL },
{ "sr25", 25, PROCESSOR_ALL },
{ "sr26", 26, PROCESSOR_ALL },
{ "sr27", 27, PROCESSOR_ALL },
{ "sr28", 28, PROCESSOR_ALL },
{ "sr29", 29, PROCESSOR_ALL },
{ "sr3", 3, PROCESSOR_ALL },
{ "sr30", 30, PROCESSOR_ALL },
{ "sr31", 31, PROCESSOR_ALL },
{ "sr4", 4, PROCESSOR_ALL },
{ "sr5", 5, PROCESSOR_ALL },
{ "sr6", 6, PROCESSOR_ALL },
{ "sr7", 7, PROCESSOR_ALL },
{ "sr8", 8, PROCESSOR_ALL },
{ "sr9", 9, PROCESSOR_ALL },
{ "sw_base", 3, PROCESSOR_V850E2V3_UP },
{ "sw_cfg", 1, PROCESSOR_V850E2V3_UP },
{ "sw_ctl", 0, PROCESSOR_V850E2V3_UP },
{ "tid", 2, PROCESSOR_V850E2V3_UP },
{ "vmadr", 6, PROCESSOR_V850E2V3_UP },
{ "vmecr", 4, PROCESSOR_V850E2V3_UP },
{ "vmtid", 5, PROCESSOR_V850E2V3_UP },
{ "vsadr", 2, PROCESSOR_V850E2V3_UP },
{ "vsecr", 0, PROCESSOR_V850E2V3_UP },
{ "vstid", 1, PROCESSOR_V850E2V3_UP },
};
#define SYSREG_NAME_CNT \
(sizeof (system_registers) / sizeof (struct reg_name))
static const struct reg_name cc_names[] =
{
{ "c", 0x1, PROCESSOR_ALL },
{ "e", 0x2, PROCESSOR_ALL },
{ "ge", 0xe, PROCESSOR_ALL },
{ "gt", 0xf, PROCESSOR_ALL },
{ "h", 0xb, PROCESSOR_ALL },
{ "l", 0x1, PROCESSOR_ALL },
{ "le", 0x7, PROCESSOR_ALL },
{ "lt", 0x6, PROCESSOR_ALL },
{ "n", 0x4, PROCESSOR_ALL },
{ "nc", 0x9, PROCESSOR_ALL },
{ "ne", 0xa, PROCESSOR_ALL },
{ "nh", 0x3, PROCESSOR_ALL },
{ "nl", 0x9, PROCESSOR_ALL },
{ "ns", 0xc, PROCESSOR_ALL },
{ "nv", 0x8, PROCESSOR_ALL },
{ "nz", 0xa, PROCESSOR_ALL },
{ "p", 0xc, PROCESSOR_ALL },
{ "s", 0x4, PROCESSOR_ALL },
#define COND_SA_NUM 0xd
{ "sa", COND_SA_NUM, PROCESSOR_ALL },
{ "t", 0x5, PROCESSOR_ALL },
{ "v", 0x0, PROCESSOR_ALL },
{ "z", 0x2, PROCESSOR_ALL },
};
#define CC_NAME_CNT \
(sizeof (cc_names) / sizeof (struct reg_name))
static const struct reg_name float_cc_names[] =
{
{ "eq", 0x2, PROCESSOR_V850E2V3_UP }, /* true. */
{ "f", 0x0, PROCESSOR_V850E2V3_UP }, /* true. */
{ "ge", 0xd, PROCESSOR_V850E2V3_UP }, /* false. */
{ "gl", 0xb, PROCESSOR_V850E2V3_UP }, /* false. */
{ "gle", 0x9, PROCESSOR_V850E2V3_UP }, /* false. */
{ "gt", 0xf, PROCESSOR_V850E2V3_UP }, /* false. */
{ "le", 0xe, PROCESSOR_V850E2V3_UP }, /* true. */
{ "lt", 0xc, PROCESSOR_V850E2V3_UP }, /* true. */
{ "neq", 0x2, PROCESSOR_V850E2V3_UP }, /* false. */
{ "nge", 0xd, PROCESSOR_V850E2V3_UP }, /* true. */
{ "ngl", 0xb, PROCESSOR_V850E2V3_UP }, /* true. */
{ "ngle",0x9, PROCESSOR_V850E2V3_UP }, /* true. */
{ "ngt", 0xf, PROCESSOR_V850E2V3_UP }, /* true. */
{ "nle", 0xe, PROCESSOR_V850E2V3_UP }, /* false. */
{ "nlt", 0xc, PROCESSOR_V850E2V3_UP }, /* false. */
{ "oge", 0x5, PROCESSOR_V850E2V3_UP }, /* false. */
{ "ogl", 0x3, PROCESSOR_V850E2V3_UP }, /* false. */
{ "ogt", 0x7, PROCESSOR_V850E2V3_UP }, /* false. */
{ "ole", 0x6, PROCESSOR_V850E2V3_UP }, /* true. */
{ "olt", 0x4, PROCESSOR_V850E2V3_UP }, /* true. */
{ "or", 0x1, PROCESSOR_V850E2V3_UP }, /* false. */
{ "seq", 0xa, PROCESSOR_V850E2V3_UP }, /* true. */
{ "sf", 0x8, PROCESSOR_V850E2V3_UP }, /* true. */
{ "sne", 0xa, PROCESSOR_V850E2V3_UP }, /* false. */
{ "st", 0x8, PROCESSOR_V850E2V3_UP }, /* false. */
{ "t", 0x0, PROCESSOR_V850E2V3_UP }, /* false. */
{ "ueq", 0x3, PROCESSOR_V850E2V3_UP }, /* true. */
{ "uge", 0x4, PROCESSOR_V850E2V3_UP }, /* false. */
{ "ugt", 0x6, PROCESSOR_V850E2V3_UP }, /* false. */
{ "ule", 0x7, PROCESSOR_V850E2V3_UP }, /* true. */
{ "ult", 0x5, PROCESSOR_V850E2V3_UP }, /* true. */
{ "un", 0x1, PROCESSOR_V850E2V3_UP }, /* true. */
};
#define FLOAT_CC_NAME_CNT \
(sizeof (float_cc_names) / sizeof (struct reg_name))
static const struct reg_name cacheop_names[] =
{
{ "cfald", 0x44, PROCESSOR_V850E3V5_UP },
{ "cfali", 0x40, PROCESSOR_V850E3V5_UP },
{ "chbid", 0x04, PROCESSOR_V850E3V5_UP },
{ "chbii", 0x00, PROCESSOR_V850E3V5_UP },
{ "chbiwbd", 0x06, PROCESSOR_V850E3V5_UP },
{ "chbwbd", 0x07, PROCESSOR_V850E3V5_UP },
{ "cibid", 0x24, PROCESSOR_V850E3V5_UP },
{ "cibii", 0x20, PROCESSOR_V850E3V5_UP },
{ "cibiwbd", 0x26, PROCESSOR_V850E3V5_UP },
{ "cibwbd", 0x27, PROCESSOR_V850E3V5_UP },
{ "cildd", 0x65, PROCESSOR_V850E3V5_UP },
{ "cildi", 0x61, PROCESSOR_V850E3V5_UP },
{ "cistd", 0x64, PROCESSOR_V850E3V5_UP },
{ "cisti", 0x60, PROCESSOR_V850E3V5_UP },
};
#define CACHEOP_NAME_CNT \
(sizeof (cacheop_names) / sizeof (struct reg_name))
static const struct reg_name prefop_names[] =
{
{ "prefd", 0x04, PROCESSOR_V850E3V5_UP },
{ "prefi", 0x00, PROCESSOR_V850E3V5_UP },
};
#define PREFOP_NAME_CNT \
(sizeof (prefop_names) / sizeof (struct reg_name))
static const struct reg_name vector_registers[] =
{
{ "vr0", 0, PROCESSOR_V850E3V5_UP },
{ "vr1", 1, PROCESSOR_V850E3V5_UP },
{ "vr10", 10, PROCESSOR_V850E3V5_UP },
{ "vr11", 11, PROCESSOR_V850E3V5_UP },
{ "vr12", 12, PROCESSOR_V850E3V5_UP },
{ "vr13", 13, PROCESSOR_V850E3V5_UP },
{ "vr14", 14, PROCESSOR_V850E3V5_UP },
{ "vr15", 15, PROCESSOR_V850E3V5_UP },
{ "vr16", 16, PROCESSOR_V850E3V5_UP },
{ "vr17", 17, PROCESSOR_V850E3V5_UP },
{ "vr18", 18, PROCESSOR_V850E3V5_UP },
{ "vr19", 19, PROCESSOR_V850E3V5_UP },
{ "vr2", 2, PROCESSOR_V850E3V5_UP },
{ "vr20", 20, PROCESSOR_V850E3V5_UP },
{ "vr21", 21, PROCESSOR_V850E3V5_UP },
{ "vr22", 22, PROCESSOR_V850E3V5_UP },
{ "vr23", 23, PROCESSOR_V850E3V5_UP },
{ "vr24", 24, PROCESSOR_V850E3V5_UP },
{ "vr25", 25, PROCESSOR_V850E3V5_UP },
{ "vr26", 26, PROCESSOR_V850E3V5_UP },
{ "vr27", 27, PROCESSOR_V850E3V5_UP },
{ "vr28", 28, PROCESSOR_V850E3V5_UP },
{ "vr29", 29, PROCESSOR_V850E3V5_UP },
{ "vr3", 3, PROCESSOR_V850E3V5_UP },
{ "vr30", 30, PROCESSOR_V850E3V5_UP },
{ "vr31", 31, PROCESSOR_V850E3V5_UP },
{ "vr4", 4, PROCESSOR_V850E3V5_UP },
{ "vr5", 5, PROCESSOR_V850E3V5_UP },
{ "vr6", 6, PROCESSOR_V850E3V5_UP },
{ "vr7", 7, PROCESSOR_V850E3V5_UP },
{ "vr8", 8, PROCESSOR_V850E3V5_UP },
{ "vr9", 9, PROCESSOR_V850E3V5_UP },
};
#define VREG_NAME_CNT \
(sizeof (vector_registers) / sizeof (struct reg_name))
/* Do a binary search of the given register table to see if NAME is a
valid register name. Return the register number from the array on
success, or -1 on failure. */
static int
reg_name_search (const struct reg_name *regs,
int regcount,
const char *name,
bfd_boolean accept_numbers)
{
int middle, low, high;
int cmp;
symbolS *symbolP;
/* If the register name is a symbol, then evaluate it. */
if ((symbolP = symbol_find (name)) != NULL)
{
/* If the symbol is an alias for another name then use that.
If the symbol is an alias for a number, then return the number. */
if (symbol_equated_p (symbolP))
name
= S_GET_NAME (symbol_get_value_expression (symbolP)->X_add_symbol);
else if (accept_numbers)
{
int reg = S_GET_VALUE (symbolP);
return reg;
}
/* Otherwise drop through and try parsing name normally. */
}
low = 0;
high = regcount - 1;
do
{
middle = (low + high) / 2;
cmp = strcasecmp (name, regs[middle].name);
if (cmp < 0)
high = middle - 1;
else if (cmp > 0)
low = middle + 1;
else
return ((regs[middle].processors & processor_mask)
? regs[middle].value
: -1);
}
while (low <= high);
return -1;
}
/* Summary of register_name().
in: Input_line_pointer points to 1st char of operand.
out: An expressionS.
The operand may have been a register: in this case, X_op == O_register,
X_add_number is set to the register number, and truth is returned.
Input_line_pointer->(next non-blank) char after operand, or is in
its original state. */
static bfd_boolean
register_name (expressionS *expressionP)
{
int reg_number;
char *name;
char *start;
char c;
/* Find the spelling of the operand. */
start = input_line_pointer;
c = get_symbol_name (&name);
reg_number = reg_name_search (pre_defined_registers, REG_NAME_CNT,
name, FALSE);
/* Put back the delimiting char. */
(void) restore_line_pointer (c);
expressionP->X_add_symbol = NULL;
expressionP->X_op_symbol = NULL;
/* Look to see if it's in the register table. */
if (reg_number >= 0)
{
expressionP->X_op = O_register;
expressionP->X_add_number = reg_number;
return TRUE;
}
/* Reset the line as if we had not done anything. */
input_line_pointer = start;
expressionP->X_op = O_illegal;
return FALSE;
}
/* Summary of system_register_name().
in: INPUT_LINE_POINTER points to 1st char of operand.
EXPRESSIONP points to an expression structure to be filled in.
ACCEPT_NUMBERS is true iff numerical register names may be used.
out: An expressionS structure in expressionP.
The operand may have been a register: in this case, X_op == O_register,
X_add_number is set to the register number, and truth is returned.
Input_line_pointer->(next non-blank) char after operand, or is in
its original state. */
static bfd_boolean
system_register_name (expressionS *expressionP,
bfd_boolean accept_numbers)
{
int reg_number;
char *name;
char *start;
char c;
/* Find the spelling of the operand. */
start = input_line_pointer;
c = get_symbol_name (&name);
reg_number = reg_name_search (system_registers, SYSREG_NAME_CNT, name,
accept_numbers);
/* Put back the delimiting char. */
(void) restore_line_pointer (c);
if (reg_number < 0
&& accept_numbers)
{
/* Reset input_line pointer. */
input_line_pointer = start;
if (ISDIGIT (*input_line_pointer))
{
reg_number = strtol (input_line_pointer, &input_line_pointer, 0);
}
}
expressionP->X_add_symbol = NULL;
expressionP->X_op_symbol = NULL;
/* Look to see if it's in the register table. */
if (reg_number >= 0)
{
expressionP->X_op = O_register;
expressionP->X_add_number = reg_number;
return TRUE;
}
/* Reset the line as if we had not done anything. */
input_line_pointer = start;
expressionP->X_op = O_illegal;
return FALSE;
}
/* Summary of cc_name().
in: INPUT_LINE_POINTER points to 1st char of operand.
out: An expressionS.
The operand may have been a register: in this case, X_op == O_register,
X_add_number is set to the register number, and truth is returned.
Input_line_pointer->(next non-blank) char after operand, or is in
its original state. */
static bfd_boolean
cc_name (expressionS *expressionP,
bfd_boolean accept_numbers)
{
int reg_number;
char *name;
char *start;
char c;
/* Find the spelling of the operand. */
start = input_line_pointer;
c = get_symbol_name (&name);
reg_number = reg_name_search (cc_names, CC_NAME_CNT, name, accept_numbers);
/* Put back the delimiting char. */
(void) restore_line_pointer (c);
if (reg_number < 0
&& accept_numbers)
{
/* Reset input_line pointer. */
input_line_pointer = start;
if (ISDIGIT (*input_line_pointer))
{
reg_number = strtol (input_line_pointer, &input_line_pointer, 0);
}
}
expressionP->X_add_symbol = NULL;
expressionP->X_op_symbol = NULL;
/* Look to see if it's in the register table. */
if (reg_number >= 0)
{
expressionP->X_op = O_constant;
expressionP->X_add_number = reg_number;
return TRUE;
}
/* Reset the line as if we had not done anything. */
input_line_pointer = start;
expressionP->X_op = O_illegal;
expressionP->X_add_number = 0;
return FALSE;
}
static bfd_boolean
float_cc_name (expressionS *expressionP,
bfd_boolean accept_numbers)
{
int reg_number;
char *name;
char *start;
char c;
/* Find the spelling of the operand. */
start = input_line_pointer;
c = get_symbol_name (&name);
reg_number = reg_name_search (float_cc_names, FLOAT_CC_NAME_CNT, name, accept_numbers);
/* Put back the delimiting char. */
(void) restore_line_pointer (c);
if (reg_number < 0
&& accept_numbers)
{
/* Reset input_line pointer. */
input_line_pointer = start;
if (ISDIGIT (*input_line_pointer))
{
reg_number = strtol (input_line_pointer, &input_line_pointer, 0);
}
}
expressionP->X_add_symbol = NULL;
expressionP->X_op_symbol = NULL;
/* Look to see if it's in the register table. */
if (reg_number >= 0)
{
expressionP->X_op = O_constant;
expressionP->X_add_number = reg_number;
return TRUE;
}
/* Reset the line as if we had not done anything. */
input_line_pointer = start;
expressionP->X_op = O_illegal;
expressionP->X_add_number = 0;
return FALSE;
}
static bfd_boolean
cacheop_name (expressionS * expressionP,
bfd_boolean accept_numbers)
{
int reg_number;
char *name;
char *start;
char c;
/* Find the spelling of the operand. */
start = input_line_pointer;
c = get_symbol_name (&name);
reg_number = reg_name_search (cacheop_names, CACHEOP_NAME_CNT, name, accept_numbers);
/* Put back the delimiting char. */
(void) restore_line_pointer (c);
if (reg_number < 0
&& accept_numbers)
{
/* Reset input_line pointer. */
input_line_pointer = start;
if (ISDIGIT (*input_line_pointer))
reg_number = strtol (input_line_pointer, &input_line_pointer, 0);
}
expressionP->X_add_symbol = NULL;
expressionP->X_op_symbol = NULL;
/* Look to see if it's in the register table. */
if (reg_number >= 0)
{
expressionP->X_op = O_constant;
expressionP->X_add_number = reg_number;
return TRUE;
}
/* Reset the line as if we had not done anything. */
input_line_pointer = start;
expressionP->X_op = O_illegal;
expressionP->X_add_number = 0;
return FALSE;
}
static bfd_boolean
prefop_name (expressionS * expressionP,
bfd_boolean accept_numbers)
{
int reg_number;
char *name;
char *start;
char c;
/* Find the spelling of the operand. */
start = input_line_pointer;
c = get_symbol_name (&name);
reg_number = reg_name_search (prefop_names, PREFOP_NAME_CNT, name, accept_numbers);
/* Put back the delimiting char. */
(void) restore_line_pointer (c);
if (reg_number < 0
&& accept_numbers)
{
/* Reset input_line pointer. */
input_line_pointer = start;
if (ISDIGIT (*input_line_pointer))
reg_number = strtol (input_line_pointer, &input_line_pointer, 0);
}
expressionP->X_add_symbol = NULL;
expressionP->X_op_symbol = NULL;
/* Look to see if it's in the register table. */
if (reg_number >= 0)
{
expressionP->X_op = O_constant;
expressionP->X_add_number = reg_number;
return TRUE;
}
/* Reset the line as if we had not done anything. */
input_line_pointer = start;
expressionP->X_op = O_illegal;
expressionP->X_add_number = 0;
return FALSE;
}
static bfd_boolean
vector_register_name (expressionS *expressionP)
{
int reg_number;
char *name;
char *start;
char c;
/* Find the spelling of the operand. */
start = input_line_pointer;
c = get_symbol_name (&name);
reg_number = reg_name_search (vector_registers, VREG_NAME_CNT,
name, FALSE);
/* Put back the delimiting char. */
(void) restore_line_pointer (c);
expressionP->X_add_symbol = NULL;
expressionP->X_op_symbol = NULL;
/* Look to see if it's in the register table. */
if (reg_number >= 0)
{
expressionP->X_op = O_register;
expressionP->X_add_number = reg_number;
return TRUE;
}
/* Reset the line as if we had not done anything. */
input_line_pointer = start;
expressionP->X_op = O_illegal;
return FALSE;
}
static void
skip_white_space (void)
{
while (*input_line_pointer == ' '
|| *input_line_pointer == '\t')
++input_line_pointer;
}
/* Summary of parse_register_list ().
in: INPUT_LINE_POINTER points to 1st char of a list of registers.
INSN is the partially constructed instruction.
OPERAND is the operand being inserted.
out: NULL if the parse completed successfully, otherwise a
pointer to an error message is returned. If the parse
completes the correct bit fields in the instruction
will be filled in.
Parses register lists with the syntax:
{ rX }
{ rX, rY }
{ rX - rY }
{ rX - rY, rZ }
etc
and also parses constant expressions whose bits indicate the
registers in the lists. The LSB in the expression refers to
the lowest numbered permissible register in the register list,
and so on upwards. System registers are considered to be very
high numbers. */
static const char *
parse_register_list (unsigned long *insn,
const struct v850_operand *operand)
{
static int type1_regs[32] =
{
30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 31, 29, 28, 23, 22, 21, 20, 27, 26, 25, 24
};
int *regs;
expressionS exp;
/* Select a register array to parse. */
switch (operand->shift)
{
case 0xffe00001: regs = type1_regs; break;
default:
as_bad (_("unknown operand shift: %x\n"), operand->shift);
return _("internal failure in parse_register_list");
}
skip_white_space ();
/* If the expression starts with a curly brace it is a register list.
Otherwise it is a constant expression, whose bits indicate which
registers are to be included in the list. */
if (*input_line_pointer != '{')
{
int reg;
int i;
expression (&exp);
if (exp.X_op != O_constant)
return _("constant expression or register list expected");
if (regs == type1_regs)
{
if (exp.X_add_number & 0xFFFFF000)
return _("high bits set in register list expression");
for (reg = 20; reg < 32; reg++)
if (exp.X_add_number & (1 << (reg - 20)))
{
for (i = 0; i < 32; i++)
if (regs[i] == reg)
*insn |= (1 << i);
}
}
return NULL;
}
input_line_pointer++;
/* Parse the register list until a terminator (closing curly brace or
new-line) is found. */
for (;;)
{
skip_white_space ();
if (register_name (&exp))
{
int i;
/* Locate the given register in the list, and if it is there,
insert the corresponding bit into the instruction. */
for (i = 0; i < 32; i++)
{
if (regs[i] == exp.X_add_number)
{
*insn |= (1 << i);
break;
}
}
if (i == 32)
return _("illegal register included in list");
}
else if (system_register_name (&exp, TRUE))
{
if (regs == type1_regs)
{
return _("system registers cannot be included in list");
}
}
if (*input_line_pointer == '}')
{
input_line_pointer++;
break;
}
else if (*input_line_pointer == ',')
{
input_line_pointer++;
continue;
}
else if (*input_line_pointer == '-')
{
/* We have encountered a range of registers: rX - rY. */
int j;
expressionS exp2;
/* Skip the dash. */
++input_line_pointer;
/* Get the second register in the range. */
if (! register_name (&exp2))
{
return _("second register should follow dash in register list");
}
if (exp.X_add_number > exp2.X_add_number)
{
return _("second register should be greater than first register");
}
/* Add the rest of the registers in the range. */
for (j = exp.X_add_number + 1; j <= exp2.X_add_number; j++)
{
int i;
/* Locate the given register in the list, and if it is there,
insert the corresponding bit into the instruction. */
for (i = 0; i < 32; i++)
{
if (regs[i] == j)
{
*insn |= (1 << i);
break;
}
}
if (i == 32)
return _("illegal register included in list");
}
exp = exp2;
}
else
break;
}
return NULL;
}
const char *md_shortopts = "m:";
struct option md_longopts[] =
{
#define OPTION_DISP_SIZE_DEFAULT_22 (OPTION_MD_BASE)
{"disp-size-default-22", no_argument, NULL, OPTION_DISP_SIZE_DEFAULT_22},
#define OPTION_DISP_SIZE_DEFAULT_32 (OPTION_MD_BASE + 1)
{"disp-size-default-32", no_argument, NULL, OPTION_DISP_SIZE_DEFAULT_32},
{NULL, no_argument, NULL, 0}
};
size_t md_longopts_size = sizeof (md_longopts);
static bfd_boolean v850_data_8 = FALSE;
void
md_show_usage (FILE *stream)
{
fprintf (stream, _(" V850 options:\n"));
fprintf (stream, _(" -mwarn-signed-overflow Warn if signed immediate values overflow\n"));
fprintf (stream, _(" -mwarn-unsigned-overflow Warn if unsigned immediate values overflow\n"));
fprintf (stream, _(" -mv850 The code is targeted at the v850\n"));
fprintf (stream, _(" -mv850e The code is targeted at the v850e\n"));
fprintf (stream, _(" -mv850e1 The code is targeted at the v850e1\n"));
fprintf (stream, _(" -mv850e2 The code is targeted at the v850e2\n"));
fprintf (stream, _(" -mv850e2v3 The code is targeted at the v850e2v3\n"));
fprintf (stream, _(" -mv850e2v4 Alias for -mv850e3v5\n"));
fprintf (stream, _(" -mv850e3v5 The code is targeted at the v850e3v5\n"));
fprintf (stream, _(" -mrelax Enable relaxation\n"));
fprintf (stream, _(" --disp-size-default-22 branch displacement with unknown size is 22 bits (default)\n"));
fprintf (stream, _(" --disp-size-default-32 branch displacement with unknown size is 32 bits\n"));
fprintf (stream, _(" -mextension enable extension opcode support\n"));
fprintf (stream, _(" -mno-bcond17 disable b<cond> disp17 instruction\n"));
fprintf (stream, _(" -mno-stld23 disable st/ld offset23 instruction\n"));
fprintf (stream, _(" -mgcc-abi Mark the binary as using the old GCC ABI\n"));
fprintf (stream, _(" -mrh850-abi Mark the binary as using the RH850 ABI (default)\n"));
fprintf (stream, _(" -m8byte-align Mark the binary as using 64-bit alignment\n"));
fprintf (stream, _(" -m4byte-align Mark the binary as using 32-bit alignment (default)\n"));
fprintf (stream, _(" -msoft-float Mark the binary as not using FP insns (default for pre e2v3)\n"));
fprintf (stream, _(" -mhard-float Mark the binary as using FP insns (default for e2v3 and up)\n"));
}
int
md_parse_option (int c, const char *arg)
{
if (c != 'm')
{
switch (c)
{
case OPTION_DISP_SIZE_DEFAULT_22:
default_disp_size = 22;
return 1;
case OPTION_DISP_SIZE_DEFAULT_32:
default_disp_size = 32;
return 1;
}
return 0;
}
if (strcmp (arg, "warn-signed-overflow") == 0)
warn_signed_overflows = TRUE;
else if (strcmp (arg, "warn-unsigned-overflow") == 0)
warn_unsigned_overflows = TRUE;
else if (strcmp (arg, "v850") == 0)
{
machine = 0;
SET_PROCESSOR_MASK (processor_mask, PROCESSOR_V850);
}
else if (strcmp (arg, "v850e") == 0)
{
machine = bfd_mach_v850e;
SET_PROCESSOR_MASK (processor_mask, PROCESSOR_V850E);
}
else if (strcmp (arg, "v850e1") == 0)
{
machine = bfd_mach_v850e1;
SET_PROCESSOR_MASK (processor_mask, PROCESSOR_V850E1);
}
else if (strcmp (arg, "v850e2") == 0)
{
machine = bfd_mach_v850e2;
SET_PROCESSOR_MASK (processor_mask, PROCESSOR_V850E2);
}
else if (strcmp (arg, "v850e2v3") == 0)
{
machine = bfd_mach_v850e2v3;
SET_PROCESSOR_MASK (processor_mask, PROCESSOR_V850E2V3);
}
else if (strcmp (arg, "v850e2v4") == 0)
{
machine = bfd_mach_v850e3v5;
SET_PROCESSOR_MASK (processor_mask, PROCESSOR_V850E3V5);
}
else if (strcmp (arg, "v850e3v5") == 0)
{
machine = bfd_mach_v850e3v5;
SET_PROCESSOR_MASK (processor_mask, PROCESSOR_V850E3V5);
}
else if (strcmp (arg, "extension") == 0)
{
processor_mask |= PROCESSOR_OPTION_EXTENSION | PROCESSOR_OPTION_ALIAS;
}
else if (strcmp (arg, "no-bcond17") == 0)
{
no_bcond17 = 1;
}
else if (strcmp (arg, "no-stld23") == 0)
{
no_stld23 = 1;
}
else if (strcmp (arg, "relax") == 0)
v850_relax = 1;
else if (strcmp (arg, "gcc-abi") == 0)
{
v850_target_arch = bfd_arch_v850;
v850_target_format = "elf32-v850";
}
else if (strcmp (arg, "rh850-abi") == 0)
{
v850_target_arch = bfd_arch_v850_rh850;
v850_target_format = "elf32-v850-rh850";
}
else if (strcmp (arg, "8byte-align") == 0)
{
v850_data_8 = TRUE;
v850_e_flags |= EF_RH850_DATA_ALIGN8;
}
else if (strcmp (arg, "4byte-align") == 0)
{
v850_data_8 = FALSE;
v850_e_flags &= ~ EF_RH850_DATA_ALIGN8;
}
else if (strcmp (arg, "soft-float") == 0)
soft_float = 1;
else if (strcmp (arg, "hard-float") == 0)
soft_float = 0;
else
return 0;
return 1;
}
symbolS *
md_undefined_symbol (char *name ATTRIBUTE_UNUSED)
{
return 0;
}
const char *
md_atof (int type, char *litp, int *sizep)
{
return ieee_md_atof (type, litp, sizep, FALSE);
}
/* Very gross. */
void
md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED,
asection *sec,
fragS *fragP)
{
union u
{
bfd_reloc_code_real_type fx_r_type;
char * fr_opcode;
}
opcode_converter;
subseg_change (sec, 0);
opcode_converter.fr_opcode = fragP->fr_opcode;
subseg_change (sec, 0);
if (fragP->fr_subtype == SUBYPTE_LOOP_16_22)
{
fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol,
fragP->fr_offset, 1,
BFD_RELOC_UNUSED + opcode_converter.fx_r_type);
fragP->fr_fix += 4;
}
else if (fragP->fr_subtype == SUBYPTE_LOOP_16_22 + 1)
{
unsigned char * buffer =
(unsigned char *) (fragP->fr_fix + fragP->fr_literal);
int loop_reg = (buffer[0] & 0x1f);
/* Add -1.reg. */
md_number_to_chars ((char *) buffer, 0x025f | (loop_reg << 11), 2);
/* Now create the conditional branch + fixup to the final target. */
/* 0x000107ea = bne LBL(disp17). */
md_number_to_chars ((char *) buffer + 2, 0x000107ea, 4);
fix_new (fragP, fragP->fr_fix+2, 4, fragP->fr_symbol,
fragP->fr_offset, 1,
BFD_RELOC_V850_17_PCREL);
fragP->fr_fix += 6;
}
/* In range conditional or unconditional branch. */
else if (fragP->fr_subtype == SUBYPTE_COND_9_22
|| fragP->fr_subtype == SUBYPTE_UNCOND_9_22
|| fragP->fr_subtype == SUBYPTE_COND_9_22_32
|| fragP->fr_subtype == SUBYPTE_UNCOND_9_22_32
|| fragP->fr_subtype == SUBYPTE_COND_9_17_22
|| fragP->fr_subtype == SUBYPTE_COND_9_17_22_32
|| fragP->fr_subtype == SUBYPTE_SA_9_22
|| fragP->fr_subtype == SUBYPTE_SA_9_22_32
|| fragP->fr_subtype == SUBYPTE_SA_9_17_22
|| fragP->fr_subtype == SUBYPTE_SA_9_17_22_32)
{
fix_new (fragP, fragP->fr_fix, 2, fragP->fr_symbol,
fragP->fr_offset, 1,
BFD_RELOC_UNUSED + opcode_converter.fx_r_type);
fragP->fr_fix += 2;
}
/* V850e2r-v3 17bit conditional branch. */
else if (fragP->fr_subtype == SUBYPTE_COND_9_17_22 + 1
|| fragP->fr_subtype == SUBYPTE_COND_9_17_22_32 + 1
|| fragP->fr_subtype == SUBYPTE_SA_9_17_22 + 1
|| fragP->fr_subtype == SUBYPTE_SA_9_17_22_32 + 1)
{
unsigned char *buffer =
(unsigned char *) (fragP->fr_fix + fragP->fr_literal);
buffer[0] &= 0x0f; /* Use condition. */
buffer[0] |= 0xe0;
buffer[1] = 0x07;
/* Now create the unconditional branch + fixup to the final
target. */
md_number_to_chars ((char *) buffer + 2, 0x0001, 2);
fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol,
fragP->fr_offset, 1, BFD_RELOC_V850_17_PCREL);
fragP->fr_fix += 4;
}
/* Out of range conditional branch. Emit a branch around a 22bit jump. */
else if (fragP->fr_subtype == SUBYPTE_COND_9_22 + 1
|| fragP->fr_subtype == SUBYPTE_COND_9_22_32 + 1
|| fragP->fr_subtype == SUBYPTE_COND_9_17_22 + 2
|| fragP->fr_subtype == SUBYPTE_COND_9_17_22_32 + 2)
{
unsigned char *buffer =
(unsigned char *) (fragP->fr_fix + fragP->fr_literal);
/* Reverse the condition of the first branch. */
buffer[0] ^= 0x08;
/* Mask off all the displacement bits. */
buffer[0] &= 0x8f;
buffer[1] &= 0x07;
/* Now set the displacement bits so that we branch
around the unconditional branch. */
buffer[0] |= 0x30;
/* Now create the unconditional branch + fixup to the final
target. */
md_number_to_chars ((char *) buffer + 2, 0x00000780, 4);
fix_new (fragP, fragP->fr_fix + 2, 4, fragP->fr_symbol,
fragP->fr_offset, 1, BFD_RELOC_V850_22_PCREL);
fragP->fr_fix += 6;
}
/* Out of range conditional branch. Emit a branch around a 32bit jump. */
else if (fragP->fr_subtype == SUBYPTE_COND_9_22_32 + 2
|| fragP->fr_subtype == SUBYPTE_COND_9_17_22_32 + 3)
{
unsigned char *buffer =
(unsigned char *) (fragP->fr_fix + fragP->fr_literal);
/* Reverse the condition of the first branch. */
buffer[0] ^= 0x08;
/* Mask off all the displacement bits. */
buffer[0] &= 0x8f;
buffer[1] &= 0x07;
/* Now set the displacement bits so that we branch
around the unconditional branch. */
buffer[0] |= 0x40;
/* Now create the unconditional branch + fixup to the final
target. */
md_number_to_chars ((char *) buffer + 2, 0x02e0, 2);
fix_new (fragP, fragP->fr_fix + 4, 4, fragP->fr_symbol,
fragP->fr_offset + 2, 1, BFD_RELOC_V850_32_PCREL);
fragP->fr_fix += 8;
}
/* Out of range unconditional branch. Emit a 22bit jump. */
else if (fragP->fr_subtype == SUBYPTE_UNCOND_9_22 + 1
|| fragP->fr_subtype == SUBYPTE_UNCOND_9_22_32 + 1)
{
md_number_to_chars (fragP->fr_fix + fragP->fr_literal, 0x00000780, 4);
fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol,
fragP->fr_offset, 1, BFD_RELOC_V850_22_PCREL);
fragP->fr_fix += 4;
}
/* Out of range unconditional branch. Emit a 32bit jump. */
else if (fragP->fr_subtype == SUBYPTE_UNCOND_9_22_32 + 2)
{
md_number_to_chars (fragP->fr_fix + fragP->fr_literal, 0x02e0, 2);
fix_new (fragP, fragP->fr_fix + 4, 4, fragP->fr_symbol,
fragP->fr_offset + 2, 1, BFD_RELOC_V850_32_PCREL);
fragP->fr_fix += 6;
}
/* Out of range SA conditional branch. Emit a branch to a 22bit jump. */
else if (fragP->fr_subtype == SUBYPTE_SA_9_22 + 1
|| fragP->fr_subtype == SUBYPTE_SA_9_22_32 + 1
|| fragP->fr_subtype == SUBYPTE_SA_9_17_22 + 2
|| fragP->fr_subtype == SUBYPTE_SA_9_17_22_32 + 2)
{
unsigned char *buffer =
(unsigned char *) (fragP->fr_fix + fragP->fr_literal);
/* bsa .+4 */
buffer[0] &= 0x8f;
buffer[0] |= 0x20;
buffer[1] &= 0x07;
/* br .+6 */
md_number_to_chars ((char *) buffer + 2, 0x05b5, 2);
/* Now create the unconditional branch + fixup to the final
target. */
/* jr SYM */
md_number_to_chars ((char *) buffer + 4, 0x00000780, 4);
fix_new (fragP, fragP->fr_fix + 4, 4, fragP->fr_symbol,
fragP->fr_offset, 1,
BFD_RELOC_V850_22_PCREL);
fragP->fr_fix += 8;
}
/* Out of range SA conditional branch. Emit a branch around a 32bit jump. */
else if (fragP->fr_subtype == SUBYPTE_SA_9_22_32 + 2
|| fragP->fr_subtype == SUBYPTE_SA_9_17_22_32 + 3)
{
unsigned char *buffer =
(unsigned char *) (fragP->fr_fix + fragP->fr_literal);
/* bsa .+2 */
buffer[0] &= 0x8f;
buffer[0] |= 0x20;
buffer[1] &= 0x07;
/* br .+8 */
md_number_to_chars ((char *) buffer + 2, 0x05c5, 2);
/* Now create the unconditional branch + fixup to the final
target. */
/* jr SYM */
md_number_to_chars ((char *) buffer + 4, 0x02e0, 2);
fix_new (fragP, fragP->fr_fix + 6, 4, fragP->fr_symbol,
fragP->fr_offset + 2, 1, BFD_RELOC_V850_32_PCREL);
fragP->fr_fix += 10;
}
else
abort ();
}
valueT
md_section_align (asection *seg, valueT addr)
{
int align = bfd_get_section_alignment (stdoutput, seg);
return ((addr + (1 << align) - 1) & -(1 << align));
}
void
md_begin (void)
{
const char *prev_name = "";
const struct v850_opcode *op;
if (strncmp (TARGET_CPU, "v850e3v5", 8) == 0)
{
if (machine == -1)
machine = bfd_mach_v850e3v5;
if (!processor_mask)
SET_PROCESSOR_MASK (processor_mask, PROCESSOR_V850E3V5);
}
else if (strncmp (TARGET_CPU, "v850e2v4", 8) == 0)
{
if (machine == -1)
machine = bfd_mach_v850e3v5;
if (!processor_mask)
SET_PROCESSOR_MASK (processor_mask, PROCESSOR_V850E3V5);
}
else if (strncmp (TARGET_CPU, "v850e2v3", 8) == 0)
{
if (machine == -1)
machine = bfd_mach_v850e2v3;
if (!processor_mask)
SET_PROCESSOR_MASK (processor_mask, PROCESSOR_V850E2V3);
}
else if (strncmp (TARGET_CPU, "v850e2", 6) == 0)
{
if (machine == -1)
machine = bfd_mach_v850e2;
if (!processor_mask)
SET_PROCESSOR_MASK (processor_mask, PROCESSOR_V850E2);
}
else if (strncmp (TARGET_CPU, "v850e1", 6) == 0)
{
if (machine == -1)
machine = bfd_mach_v850e1;
if (!processor_mask)
SET_PROCESSOR_MASK (processor_mask, PROCESSOR_V850E1);
}
else if (strncmp (TARGET_CPU, "v850e", 5) == 0)
{
if (machine == -1)
machine = bfd_mach_v850e;
if (!processor_mask)
SET_PROCESSOR_MASK (processor_mask, PROCESSOR_V850E);
}
else if (strncmp (TARGET_CPU, "v850", 4) == 0)
{
if (machine == -1)
machine = 0;
if (!processor_mask)
SET_PROCESSOR_MASK (processor_mask, PROCESSOR_V850);
}
else
/* xgettext:c-format */
as_bad (_("Unable to determine default target processor from string: %s"),
TARGET_CPU);
if (soft_float == -1)
soft_float = machine < bfd_mach_v850e2v3;
v850_hash = hash_new ();
/* Insert unique names into hash table. The V850 instruction set
has many identical opcode names that have different opcodes based
on the operands. This hash table then provides a quick index to
the first opcode with a particular name in the opcode table. */
op = v850_opcodes;
while (op->name)
{
if (strcmp (prev_name, op->name))
{
prev_name = (char *) op->name;
hash_insert (v850_hash, op->name, (char *) op);
}
op++;
}
v850_seg_table[BSS_SECTION].s = bss_section;
bfd_set_arch_mach (stdoutput, v850_target_arch, machine);
bfd_set_private_flags (stdoutput, v850_e_flags);
}
static bfd_reloc_code_real_type
handle_hi016 (const struct v850_operand *operand, const char **errmsg)
{
if (operand == NULL)
return BFD_RELOC_HI16;
if (operand->default_reloc == BFD_RELOC_HI16)
return BFD_RELOC_HI16;
if (operand->default_reloc == BFD_RELOC_HI16_S)
return BFD_RELOC_HI16;
if (operand->default_reloc == BFD_RELOC_16)
return BFD_RELOC_HI16;
*errmsg = _("hi0() relocation used on an instruction which does "
"not support it");
return BFD_RELOC_64; /* Used to indicate an error condition. */
}
static bfd_reloc_code_real_type
handle_hi16 (const struct v850_operand *operand, const char **errmsg)
{
if (operand == NULL)
return BFD_RELOC_HI16_S;
if (operand->default_reloc == BFD_RELOC_HI16_S)
return BFD_RELOC_HI16_S;
if (operand->default_reloc == BFD_RELOC_HI16)
return BFD_RELOC_HI16_S;
if (operand->default_reloc == BFD_RELOC_16)
return BFD_RELOC_HI16_S;
*errmsg = _("hi() relocation used on an instruction which does "
"not support it");
return BFD_RELOC_64; /* Used to indicate an error condition. */
}
static bfd_reloc_code_real_type
handle_lo16 (const struct v850_operand *operand, const char **errmsg)
{
if (operand == NULL)
return BFD_RELOC_LO16;
if (operand->default_reloc == BFD_RELOC_LO16)
return BFD_RELOC_LO16;
if (operand->default_reloc == BFD_RELOC_V850_16_SPLIT_OFFSET)
return BFD_RELOC_V850_LO16_SPLIT_OFFSET;
if (operand->default_reloc == BFD_RELOC_V850_16_S1)
return BFD_RELOC_V850_LO16_S1;
if (operand->default_reloc == BFD_RELOC_16)
return BFD_RELOC_LO16;
*errmsg = _("lo() relocation used on an instruction which does "
"not support it");
return BFD_RELOC_64; /* Used to indicate an error condition. */
}
static bfd_reloc_code_real_type
handle_ctoff (const struct v850_operand *operand, const char **errmsg)
{
if (v850_target_arch == bfd_arch_v850_rh850)
{
*errmsg = _("ctoff() is not supported by the rh850 ABI. Use -mgcc-abi instead");
return BFD_RELOC_64; /* Used to indicate an error condition. */
}
if (operand == NULL)
return BFD_RELOC_V850_CALLT_16_16_OFFSET;
if (operand->default_reloc == BFD_RELOC_V850_CALLT_6_7_OFFSET)
return operand->default_reloc;
if (operand->default_reloc == BFD_RELOC_V850_16_S1)
return BFD_RELOC_V850_CALLT_15_16_OFFSET;
if (operand->default_reloc == BFD_RELOC_16)
return BFD_RELOC_V850_CALLT_16_16_OFFSET;
*errmsg = _("ctoff() relocation used on an instruction which does not support it");
return BFD_RELOC_64; /* Used to indicate an error condition. */
}
static bfd_reloc_code_real_type
handle_sdaoff (const struct v850_operand *operand, const char **errmsg)
{
if (operand == NULL)
return BFD_RELOC_V850_SDA_16_16_OFFSET;
if (operand->default_reloc == BFD_RELOC_V850_16_SPLIT_OFFSET)
return BFD_RELOC_V850_SDA_16_16_SPLIT_OFFSET;
if (operand->default_reloc == BFD_RELOC_16)
return BFD_RELOC_V850_SDA_16_16_OFFSET;
if (operand->default_reloc == BFD_RELOC_V850_16_S1)
return BFD_RELOC_V850_SDA_15_16_OFFSET;
*errmsg = _("sdaoff() relocation used on an instruction which does not support it");
return BFD_RELOC_64; /* Used to indicate an error condition. */
}
static bfd_reloc_code_real_type
handle_zdaoff (const struct v850_operand *operand, const char **errmsg)
{
if (operand == NULL)
return BFD_RELOC_V850_ZDA_16_16_OFFSET;
if (operand->default_reloc == BFD_RELOC_V850_16_SPLIT_OFFSET)
return BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET;
if (operand->default_reloc == BFD_RELOC_16)
return BFD_RELOC_V850_ZDA_16_16_OFFSET;
if (operand->default_reloc == BFD_RELOC_V850_16_S1)
return BFD_RELOC_V850_ZDA_15_16_OFFSET;
*errmsg = _("zdaoff() relocation used on an instruction which does not support it");
return BFD_RELOC_64; /* Used to indicate an error condition. */
}
static bfd_reloc_code_real_type
handle_tdaoff (const struct v850_operand *operand, const char **errmsg)
{
if (operand == NULL)
/* Data item, not an instruction. */
return BFD_RELOC_V850_TDA_16_16_OFFSET;
switch (operand->default_reloc)
{
/* sld.hu, operand: D5-4. */
case BFD_RELOC_V850_TDA_4_5_OFFSET:
/* sld.bu, operand: D4. */
case BFD_RELOC_V850_TDA_4_4_OFFSET:
/* sld.w/sst.w, operand: D8_6. */
case BFD_RELOC_V850_TDA_6_8_OFFSET:
/* sld.h/sst.h, operand: D8_7. */
case BFD_RELOC_V850_TDA_7_8_OFFSET:
/* sld.b/sst.b, operand: D7. */
case BFD_RELOC_V850_TDA_7_7_OFFSET:
return operand->default_reloc;
default:
break;
}
if (operand->default_reloc == BFD_RELOC_16 && operand->shift == 16)
/* set1 & chums, operands: D16. */
return BFD_RELOC_V850_TDA_16_16_OFFSET;
*errmsg = _("tdaoff() relocation used on an instruction which does not support it");
/* Used to indicate an error condition. */
return BFD_RELOC_64;
}
/* Warning: The code in this function relies upon the definitions
in the v850_operands[] array (defined in opcodes/v850-opc.c)
matching the hard coded values contained herein. */
static bfd_reloc_code_real_type
v850_reloc_prefix (const struct v850_operand *operand, const char **errmsg)
{
bfd_boolean paren_skipped = FALSE;
/* Skip leading opening parenthesis. */
if (*input_line_pointer == '(')
{
++input_line_pointer;
paren_skipped = TRUE;
}
#define CHECK_(name, reloc) \
if (strncmp (input_line_pointer, name "(", strlen (name) + 1) == 0) \
{ \
input_line_pointer += strlen (name); \
return reloc; \
}
CHECK_ ("hi0", handle_hi016(operand, errmsg) );
CHECK_ ("hi", handle_hi16(operand, errmsg) );
CHECK_ ("lo", handle_lo16 (operand, errmsg) );
CHECK_ ("sdaoff", handle_sdaoff (operand, errmsg));
CHECK_ ("zdaoff", handle_zdaoff (operand, errmsg));
CHECK_ ("tdaoff", handle_tdaoff (operand, errmsg));
CHECK_ ("hilo", BFD_RELOC_32);
CHECK_ ("lo23", BFD_RELOC_V850_23);
CHECK_ ("ctoff", handle_ctoff (operand, errmsg) );
/* Restore skipped parenthesis. */
if (paren_skipped)
--input_line_pointer;
return BFD_RELOC_NONE;
}
/* Insert an operand value into an instruction. */
static unsigned long
v850_insert_operand (unsigned long insn,
const struct v850_operand *operand,
offsetT val,
const char **errmsg)
{
if (operand->insert)
{
const char *message = NULL;
insn = operand->insert (insn, val, &message);
if (message != NULL)
{
if ((operand->flags & V850_OPERAND_SIGNED)
&& ! warn_signed_overflows
&& v850_msg_is_out_of_range (message))
{
/* Skip warning... */
}
else if ((operand->flags & V850_OPERAND_SIGNED) == 0
&& ! warn_unsigned_overflows
&& v850_msg_is_out_of_range (message))
{
/* Skip warning... */
}
else
{
if (errmsg != NULL)
*errmsg = message;
}
}
}
else if (operand->bits == -1
|| operand->flags & V850E_IMMEDIATE16
|| operand->flags & V850E_IMMEDIATE23
|| operand->flags & V850E_IMMEDIATE32)
{
abort ();
}
else
{
if (operand->bits < 32)
{
long min, max;
if ((operand->flags & V850_OPERAND_SIGNED) != 0)
{
if (! warn_signed_overflows)
max = (1 << operand->bits) - 1;
else
max = (1 << (operand->bits - 1)) - 1;
min = -(1 << (operand->bits - 1));
}
else
{
max = (1 << operand->bits) - 1;
if (! warn_unsigned_overflows)
min = -(1 << (operand->bits - 1));
else
min = 0;
}
/* Some people write constants with the sign extension done by
hand but only up to 32 bits. This shouldn't really be valid,
but, to permit this code to assemble on a 64-bit host, we
sign extend the 32-bit value to 64 bits if so doing makes the
value valid. */
if (val > max
&& (offsetT) (val - 0x80000000 - 0x80000000) >= min
&& (offsetT) (val - 0x80000000 - 0x80000000) <= max)
val = val - 0x80000000 - 0x80000000;
/* Similarly, people write expressions like ~(1<<15), and expect
this to be OK for a 32-bit unsigned value. */
else if (val < min
&& (offsetT) (val + 0x80000000 + 0x80000000) >= min
&& (offsetT) (val + 0x80000000 + 0x80000000) <= max)
val = val + 0x80000000 + 0x80000000;
else if (val < (offsetT) min || val > (offsetT) max)
{
static char buf [128];
/* Restore min and mix to expected values for decimal ranges. */
if ((operand->flags & V850_OPERAND_SIGNED)
&& ! warn_signed_overflows)
max = (1 << (operand->bits - 1)) - 1;
if (! (operand->flags & V850_OPERAND_SIGNED)
&& ! warn_unsigned_overflows)
min = 0;
sprintf (buf, _("operand out of range (%d is not between %d and %d)"),
(int) val, (int) min, (int) max);
*errmsg = buf;
}
insn |= (((long) val & ((1 << operand->bits) - 1)) << operand->shift);
}
else
{
insn |= (((long) val) << operand->shift);
}
}
return insn;
}
static char copy_of_instruction[128];
void
md_assemble (char *str)
{
char *s;
char *start_of_operands;
struct v850_opcode *opcode;
struct v850_opcode *next_opcode;
const unsigned char *opindex_ptr;
int next_opindex;
int relaxable = 0;
unsigned long insn = 0;
unsigned long insn_size;
char *f = NULL;
int i;
int match;
bfd_boolean extra_data_after_insn = FALSE;
unsigned extra_data_len = 0;
unsigned long extra_data = 0;
char *saved_input_line_pointer;
char most_match_errmsg[1024];
int most_match_count = -1;
strncpy (copy_of_instruction, str, sizeof (copy_of_instruction) - 1);
most_match_errmsg[0] = 0;
/* Get the opcode. */
for (s = str; *s != '\0' && ! ISSPACE (*s); s++)
continue;
if (*s != '\0')
*s++ = '\0';
/* Find the first opcode with the proper name. */
opcode = (struct v850_opcode *) hash_find (v850_hash, str);
if (opcode == NULL)
{
/* xgettext:c-format */
as_bad (_("Unrecognized opcode: `%s'"), str);
ignore_rest_of_line ();
return;
}
str = s;
while (ISSPACE (*str))
++str;
start_of_operands = str;
saved_input_line_pointer = input_line_pointer;
for (;;)
{
const char *errmsg = NULL;
const char *warningmsg = NULL;
match = 0;
opindex_ptr = opcode->operands;
if (no_stld23)
{
if ((strncmp (opcode->name, "st.", 3) == 0
&& v850_operands[opcode->operands[1]].bits == 23)
|| (strncmp (opcode->name, "ld.", 3) == 0
&& v850_operands[opcode->operands[0]].bits == 23))
{
errmsg = _("st/ld offset 23 instruction was disabled .");
goto error;
}
}
if ((opcode->processors & processor_mask & PROCESSOR_MASK) == 0
|| (((opcode->processors & ~PROCESSOR_MASK) != 0)
&& ((opcode->processors & processor_mask & ~PROCESSOR_MASK) == 0)))
{
errmsg = _("Target processor does not support this instruction.");
goto error;
}
relaxable = 0;
fc = 0;
next_opindex = 0;
insn = opcode->opcode;
extra_data_len = 0;
extra_data_after_insn = FALSE;
input_line_pointer = str = start_of_operands;
for (opindex_ptr = opcode->operands; *opindex_ptr != 0; opindex_ptr++)
{
const struct v850_operand *operand;
char *hold;
expressionS ex;
bfd_reloc_code_real_type reloc;
if (next_opindex == 0)
operand = &v850_operands[*opindex_ptr];
else
{
operand = &v850_operands[next_opindex];
next_opindex = 0;
}
errmsg = NULL;
while (*str == ' ')
++str;
if (operand->flags & V850_OPERAND_BANG
&& *str == '!')
++str;
else if (operand->flags & V850_OPERAND_PERCENT
&& *str == '%')
++str;
if (*str == ',' || *str == '[' || *str == ']')
++str;
while (*str == ' ')
++str;
if ( (strcmp (opcode->name, "pushsp") == 0
|| strcmp (opcode->name, "popsp") == 0
|| strcmp (opcode->name, "dbpush") == 0)
&& (*str == '-'))
++str;
if (operand->flags & V850_OPERAND_RELAX)
relaxable = 1;
/* Gather the operand. */
hold = input_line_pointer;
input_line_pointer = str;
/* lo(), hi(), hi0(), etc... */
if ((reloc = v850_reloc_prefix (operand, &errmsg)) != BFD_RELOC_NONE)
{
/* This is a fake reloc, used to indicate an error condition. */
if (reloc == BFD_RELOC_64)
{
/* match = 1; */
goto error;
}
expression (&ex);
if (ex.X_op == O_constant)
{
switch (reloc)
{
case BFD_RELOC_V850_ZDA_16_16_OFFSET:
case BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET:
case BFD_RELOC_V850_ZDA_15_16_OFFSET:
/* To cope with "not1 7, zdaoff(0xfffff006)[r0]"
and the like. */
/* Fall through. */
case BFD_RELOC_LO16:
case BFD_RELOC_V850_LO16_S1:
case BFD_RELOC_V850_LO16_SPLIT_OFFSET:
{
/* Truncate, then sign extend the value. */
ex.X_add_number = SEXT16 (ex.X_add_number);
break;
}
case BFD_RELOC_HI16:
{
/* Truncate, then sign extend the value. */
ex.X_add_number = SEXT16 (ex.X_add_number >> 16);
break;
}
case BFD_RELOC_HI16_S:
{
/* Truncate, then sign extend the value. */
int temp = (ex.X_add_number >> 16) & 0xffff;
temp += (ex.X_add_number >> 15) & 1;
ex.X_add_number = SEXT16 (temp);
break;
}
case BFD_RELOC_V850_23:
if ((operand->flags & V850E_IMMEDIATE23) == 0)
{
errmsg = _("immediate operand is too large");
goto error;
}
break;
case BFD_RELOC_32:
case BFD_RELOC_V850_32_ABS:
case BFD_RELOC_V850_32_PCREL:
if ((operand->flags & V850E_IMMEDIATE32) == 0)
{
errmsg = _("immediate operand is too large");
goto error;
}
break;
default:
as_bad (_("AAARG -> unhandled constant reloc: %d"), reloc);
break;
}
if (operand->flags & V850E_IMMEDIATE32)
{
extra_data_after_insn = TRUE;
extra_data_len = 4;
extra_data = 0;
}
else if (operand->flags & V850E_IMMEDIATE23)
{
if (reloc != BFD_RELOC_V850_23)
{
errmsg = _("immediate operand is too large");
goto error;
}
extra_data_after_insn = TRUE;
extra_data_len = 2;
extra_data = 0;
}
else if ((operand->flags & V850E_IMMEDIATE16)
|| (operand->flags & V850E_IMMEDIATE16HI))
{
if (operand->flags & V850E_IMMEDIATE16HI
&& reloc != BFD_RELOC_HI16
&& reloc != BFD_RELOC_HI16_S)
{
errmsg = _("immediate operand is too large");
goto error;
}
else if (operand->flags & V850E_IMMEDIATE16
&& reloc != BFD_RELOC_LO16)
{
errmsg = _("immediate operand is too large");
goto error;
}
extra_data_after_insn = TRUE;
extra_data_len = 2;
extra_data = 0;
}
if (fc > MAX_INSN_FIXUPS)
as_fatal (_("too many fixups"));
fixups[fc].exp = ex;
fixups[fc].opindex = *opindex_ptr;
fixups[fc].reloc = reloc;
fc++;
}
else /* ex.X_op != O_constant. */
{
if ((reloc == BFD_RELOC_32
|| reloc == BFD_RELOC_V850_32_ABS
|| reloc == BFD_RELOC_V850_32_PCREL)
&& operand->bits < 32)
{
errmsg = _("immediate operand is too large");
goto error;
}
else if (reloc == BFD_RELOC_V850_23
&& (operand->flags & V850E_IMMEDIATE23) == 0)
{
errmsg = _("immediate operand is too large");
goto error;
}
else if ((reloc == BFD_RELOC_HI16
|| reloc == BFD_RELOC_HI16_S)
&& operand->bits < 16)
{
errmsg = _("immediate operand is too large");
goto error;
}
if (operand->flags & V850E_IMMEDIATE32)
{
extra_data_after_insn = TRUE;
extra_data_len = 4;
extra_data = 0;
}
else if (operand->flags & V850E_IMMEDIATE23)
{
if (reloc != BFD_RELOC_V850_23)
{
errmsg = _("immediate operand is too large");
goto error;
}
extra_data_after_insn = TRUE;
extra_data_len = 2;
extra_data = 0;
}
else if ((operand->flags & V850E_IMMEDIATE16)
|| (operand->flags & V850E_IMMEDIATE16HI))
{
if (operand->flags & V850E_IMMEDIATE16HI
&& reloc != BFD_RELOC_HI16
&& reloc != BFD_RELOC_HI16_S)
{
errmsg = _("immediate operand is too large");
goto error;
}
else if (operand->flags & V850E_IMMEDIATE16
&& reloc != BFD_RELOC_LO16)
{
errmsg = _("immediate operand is too large");
goto error;
}
extra_data_after_insn = TRUE;
extra_data_len = 2;
extra_data = 0;
}
if (fc > MAX_INSN_FIXUPS)
as_fatal (_("too many fixups"));
fixups[fc].exp = ex;
fixups[fc].opindex = *opindex_ptr;
fixups[fc].reloc = reloc;
fc++;
}
}
else if (operand->flags & V850E_IMMEDIATE16
|| operand->flags & V850E_IMMEDIATE16HI)
{
expression (&ex);
switch (ex.X_op)
{
case O_constant:
if (operand->flags & V850E_IMMEDIATE16HI)
{
if (ex.X_add_number & 0xffff)
{
errmsg = _("constant too big to fit into instruction");
goto error;
}
ex.X_add_number >>= 16;
}
if (operand->flags & V850E_IMMEDIATE16)
{
if ((ex.X_add_number & 0xffff8000)
&& ((ex.X_add_number & 0xffff8000) != 0xffff8000))
{
errmsg = _("constant too big to fit into instruction");
goto error;
}
}
break;
case O_illegal:
errmsg = _("illegal operand");
goto error;
case O_absent:
errmsg = _("missing operand");
goto error;
default:
if (fc >= MAX_INSN_FIXUPS)
as_fatal (_("too many fixups"));
fixups[fc].exp = ex;
fixups[fc].opindex = *opindex_ptr;
fixups[fc].reloc = operand->default_reloc;
++fc;
ex.X_add_number = 0;
break;
}
extra_data_after_insn = TRUE;
extra_data_len = 2;
extra_data = ex.X_add_number;
}
else if (operand->flags & V850E_IMMEDIATE23)
{
expression (&ex);
switch (ex.X_op)
{
case O_constant:
break;
case O_illegal:
errmsg = _("illegal operand");
goto error;
case O_absent:
errmsg = _("missing operand");
goto error;
default:
break;
}
if (fc >= MAX_INSN_FIXUPS)
as_fatal (_("too many fixups"));
fixups[fc].exp = ex;
fixups[fc].opindex = *opindex_ptr;
fixups[fc].reloc = operand->default_reloc;
++fc;
extra_data_after_insn = TRUE;
extra_data_len = 2;
extra_data = 0;
}
else if (operand->flags & V850E_IMMEDIATE32)
{
expression (&ex);
switch (ex.X_op)
{
case O_constant:
if ((operand->default_reloc == BFD_RELOC_V850_32_ABS
|| operand->default_reloc == BFD_RELOC_V850_32_PCREL)
&& (ex.X_add_number & 1))
{
errmsg = _("odd number cannot be used here");
goto error;
}
break;
case O_illegal:
errmsg = _("illegal operand");
goto error;
case O_absent:
errmsg = _("missing operand");
goto error;
default:
if (fc >= MAX_INSN_FIXUPS)
as_fatal (_("too many fixups"));
fixups[fc].exp = ex;
fixups[fc].opindex = *opindex_ptr;
fixups[fc].reloc = operand->default_reloc;
++fc;
ex.X_add_number = 0;
break;
}
extra_data_after_insn = TRUE;
extra_data_len = 4;
extra_data = ex.X_add_number;
}
else if (operand->flags & V850E_OPERAND_REG_LIST)
{
errmsg = parse_register_list (&insn, operand);
if (errmsg)
goto error;
}
else
{
errmsg = NULL;
if ((operand->flags & V850_OPERAND_REG) != 0)
{
if (!register_name (&ex))
{
errmsg = _("invalid register name");
}
if ((operand->flags & V850_NOT_R0)
&& ex.X_add_number == 0)
{
errmsg = _("register r0 cannot be used here");
}
if (operand->flags & V850_REG_EVEN)
{
if (ex.X_add_number % 2)
errmsg = _("odd register cannot be used here");
ex.X_add_number = ex.X_add_number / 2;
}
}
else if ((operand->flags & V850_OPERAND_SRG) != 0)
{
if (!system_register_name (&ex, TRUE))
{
errmsg = _("invalid system register name");
}
}
else if ((operand->flags & V850_OPERAND_EP) != 0)
{
char *start = input_line_pointer;
char *name;
char c = get_symbol_name (&name);
if (strcmp (name, "ep") != 0 && strcmp (name, "r30") != 0)
{
/* Put things back the way we found them. */
(void) restore_line_pointer (c);
input_line_pointer = start;
errmsg = _("expected EP register");
goto error;
}
(void) restore_line_pointer (c);
str = input_line_pointer;
input_line_pointer = hold;
while (*str == ' ' || *str == ','
|| *str == '[' || *str == ']')
++str;
continue;
}
else if ((operand->flags & V850_OPERAND_CC) != 0)
{
if (!cc_name (&ex, TRUE))
{
errmsg = _("invalid condition code name");
}
if ((operand->flags & V850_NOT_SA)
&& ex.X_add_number == COND_SA_NUM)
{
errmsg = _("condition sa cannot be used here");
}
}
else if ((operand->flags & V850_OPERAND_FLOAT_CC) != 0)
{
if (!float_cc_name (&ex, TRUE))
{
errmsg = _("invalid condition code name");
}
}
else if ((operand->flags & V850_OPERAND_CACHEOP) != 0)
{
if (!cacheop_name (&ex, TRUE))
errmsg = _("invalid cache operation name");
}
else if ((operand->flags & V850_OPERAND_PREFOP) != 0)
{
if (!prefop_name (&ex, TRUE))
errmsg = _("invalid pref operation name");
}
else if ((operand->flags & V850_OPERAND_VREG) != 0)
{
if (!vector_register_name (&ex))
errmsg = _("invalid vector register name");
}
else if ((register_name (&ex)
&& (operand->flags & V850_OPERAND_REG) == 0))
{
char *name;
char c;
int exists = 0;
/* It is possible that an alias has been defined that
matches a register name. For example the code may
include a ".set ZERO, 0" directive, which matches
the register name "zero". Attempt to reparse the
field as an expression, and only complain if we
cannot generate a constant. */
input_line_pointer = str;
c = get_symbol_name (&name);
if (symbol_find (name) != NULL)
exists = 1;
(void) restore_line_pointer (c);
input_line_pointer = str;
expression (&ex);
if (ex.X_op != O_constant)
{
/* If this register is actually occurring too early on
the parsing of the instruction, (because another
field is missing) then report this. */
if (opindex_ptr[1] != 0
&& ((v850_operands[opindex_ptr[1]].flags
& V850_OPERAND_REG)
||(v850_operands[opindex_ptr[1]].flags
& V850_OPERAND_VREG)))
errmsg = _("syntax error: value is missing before the register name");
else
errmsg = _("syntax error: register not expected");
/* If we created a symbol in the process of this
test then delete it now, so that it will not
be output with the real symbols... */
if (exists == 0
&& ex.X_op == O_symbol)
symbol_remove (ex.X_add_symbol,
&symbol_rootP, &symbol_lastP);
}
}
else if (system_register_name (&ex, FALSE)
&& (operand->flags & V850_OPERAND_SRG) == 0)
{
errmsg = _("syntax error: system register not expected");
}
else if (cc_name (&ex, FALSE)
&& (operand->flags & V850_OPERAND_CC) == 0)
{
errmsg = _("syntax error: condition code not expected");
}
else if (float_cc_name (&ex, FALSE)
&& (operand->flags & V850_OPERAND_FLOAT_CC) == 0)
{
errmsg = _("syntax error: condition code not expected");
}
else if (vector_register_name (&ex)
&& (operand->flags & V850_OPERAND_VREG) == 0)
{
errmsg = _("syntax error: vector register not expected");
}
else
{
expression (&ex);
if ((operand->flags & V850_NOT_IMM0)
&& ex.X_op == O_constant
&& ex.X_add_number == 0)
{
errmsg = _("immediate 0 cannot be used here");
}
/* Special case:
If we are assembling a MOV/JARL/JR instruction and the immediate
value does not fit into the bits available then create a
fake error so that the next MOV/JARL/JR instruction will be
selected. This one has a 32 bit immediate field. */
if ((strcmp (opcode->name, "mov") == 0
|| strcmp (opcode->name, "jarl") == 0
|| strcmp (opcode->name, "jr") == 0)
&& ex.X_op == O_constant
&& (ex.X_add_number < (-(1 << (operand->bits - 1)))
|| ex.X_add_number > ((1 << (operand->bits - 1)) - 1)))
{
errmsg = _("immediate operand is too large");
}
if ((strcmp (opcode->name, "jarl") == 0
|| strcmp (opcode->name, "jr") == 0)
&& ex.X_op != O_constant
&& operand->bits != default_disp_size)
{
errmsg = _("immediate operand is not match");
}
/* Special case2 :
If we are assembling a ld/st instruction and the immediate
value does not fit into the bits available then create a
fake error so that the next ld/st instruction will be
selected. */
if ( ( (strncmp (opcode->name, "st.", 3) == 0)
|| (strncmp (opcode->name, "ld.", 3) == 0))
&& ex.X_op == O_constant
&& (ex.X_add_number < (-(1 << (operand->bits - 1)))
|| ex.X_add_number > ((1 << (operand->bits - 1)) - 1)))
errmsg = _("displacement is too large");
}
if (errmsg)
goto error;
switch (ex.X_op)
{
case O_illegal:
errmsg = _("illegal operand");
goto error;
case O_absent:
errmsg = _("missing operand");
goto error;
case O_register:
if ((operand->flags
& (V850_OPERAND_REG | V850_OPERAND_SRG | V850_OPERAND_VREG)) == 0)
{
errmsg = _("invalid operand");
goto error;
}
insn = v850_insert_operand (insn, operand,
ex.X_add_number,
&warningmsg);
break;
case O_constant:
insn = v850_insert_operand (insn, operand, ex.X_add_number,
&warningmsg);
break;
default:
/* We need to generate a fixup for this expression. */
if (fc >= MAX_INSN_FIXUPS)
as_fatal (_("too many fixups"));
fixups[fc].exp = ex;
fixups[fc].opindex = *opindex_ptr;
fixups[fc].reloc = BFD_RELOC_NONE;
++fc;
break;
}
}
str = input_line_pointer;
input_line_pointer = hold;
while (*str == ' ' || *str == ',' || *str == '[' || *str == ']'
|| *str == ')')
++str;
}
while (ISSPACE (*str))
++str;
if (*str == '\0')
match = 1;
error:
if (match == 0)
{
if ((opindex_ptr - opcode->operands) >= most_match_count)
{
most_match_count = opindex_ptr - opcode->operands;
if (errmsg != NULL)
strncpy (most_match_errmsg, errmsg, sizeof (most_match_errmsg)-1);
}
next_opcode = opcode + 1;
if (next_opcode->name != NULL
&& strcmp (next_opcode->name, opcode->name) == 0)
{
opcode = next_opcode;
/* Skip versions that are not supported by the target
processor. */
if ((opcode->processors & processor_mask) == 0)
goto error;
continue;
}
if (most_match_errmsg[0] == 0)
/* xgettext:c-format. */
as_bad (_("junk at end of line: `%s'"), str);
else
as_bad ("%s: %s", copy_of_instruction, most_match_errmsg);
if (*input_line_pointer == ']')
++input_line_pointer;
ignore_rest_of_line ();
input_line_pointer = saved_input_line_pointer;
return;
}
if (warningmsg != NULL)
as_warn ("%s", warningmsg);
break;
}
input_line_pointer = str;
/* Tie dwarf2 debug info to the address at the start of the insn.
We can't do this after the insn has been output as the current
frag may have been closed off. eg. by frag_var. */
dwarf2_emit_insn (0);
/* Write out the instruction. */
if (relaxable && fc > 0)
{
insn_size = 2;
fc = 0;
if (strcmp (opcode->name, "loop") == 0)
{
if (((processor_mask & PROCESSOR_V850E3V5_UP) == 0) || default_disp_size == 22)
{
insn_size = 4;
f = frag_var (rs_machine_dependent, 6, 2, SUBYPTE_LOOP_16_22,
fixups[0].exp.X_add_symbol,
fixups[0].exp.X_add_number,
(char *)(size_t) fixups[0].opindex);
md_number_to_chars (f, insn, insn_size);
md_number_to_chars (f+4, 0, 4);
}
else
{
as_bad (_("loop: 32-bit displacement not supported"));
}
}
else if (strcmp (opcode->name, "br") == 0
|| strcmp (opcode->name, "jbr") == 0)
{
if ((processor_mask & PROCESSOR_V850E2_UP) == 0 || default_disp_size == 22)
{
f = frag_var (rs_machine_dependent, 4, 2, SUBYPTE_UNCOND_9_22,
fixups[0].exp.X_add_symbol,
fixups[0].exp.X_add_number,
(char *)(size_t) fixups[0].opindex);
md_number_to_chars (f, insn, insn_size);
md_number_to_chars (f + 2, 0, 2);
}
else
{
f = frag_var (rs_machine_dependent, 6, 4, SUBYPTE_UNCOND_9_22_32,
fixups[0].exp.X_add_symbol,
fixups[0].exp.X_add_number,
(char *)(size_t) fixups[0].opindex);
md_number_to_chars (f, insn, insn_size);
md_number_to_chars (f + 2, 0, 4);
}
}
else /* b<cond>, j<cond>. */
{
if (default_disp_size == 22
|| (processor_mask & PROCESSOR_V850E2_UP) == 0)
{
if (processor_mask & PROCESSOR_V850E2V3_UP && !no_bcond17)
{
if (strcmp (opcode->name, "bsa") == 0)
{
f = frag_var (rs_machine_dependent, 8, 6, SUBYPTE_SA_9_17_22,
fixups[0].exp.X_add_symbol,
fixups[0].exp.X_add_number,
(char *)(size_t) fixups[0].opindex);
md_number_to_chars (f, insn, insn_size);
md_number_to_chars (f + 2, 0, 6);
}
else
{
f = frag_var (rs_machine_dependent, 6, 4, SUBYPTE_COND_9_17_22,
fixups[0].exp.X_add_symbol,
fixups[0].exp.X_add_number,
(char *)(size_t) fixups[0].opindex);
md_number_to_chars (f, insn, insn_size);
md_number_to_chars (f + 2, 0, 4);
}
}
else
{
if (strcmp (opcode->name, "bsa") == 0)
{
f = frag_var (rs_machine_dependent, 8, 6, SUBYPTE_SA_9_22,
fixups[0].exp.X_add_symbol,
fixups[0].exp.X_add_number,
(char *)(size_t) fixups[0].opindex);
md_number_to_chars (f, insn, insn_size);
md_number_to_chars (f + 2, 0, 6);
}
else
{
f = frag_var (rs_machine_dependent, 6, 4, SUBYPTE_COND_9_22,
fixups[0].exp.X_add_symbol,
fixups[0].exp.X_add_number,
(char *)(size_t) fixups[0].opindex);
md_number_to_chars (f, insn, insn_size);
md_number_to_chars (f + 2, 0, 4);
}
}
}
else
{
if (processor_mask & PROCESSOR_V850E2V3_UP && !no_bcond17)
{
if (strcmp (opcode->name, "bsa") == 0)
{
f = frag_var (rs_machine_dependent, 10, 8, SUBYPTE_SA_9_17_22_32,
fixups[0].exp.X_add_symbol,
fixups[0].exp.X_add_number,
(char *)(size_t) fixups[0].opindex);
md_number_to_chars (f, insn, insn_size);
md_number_to_chars (f + 2, 0, 8);
}
else
{
f = frag_var (rs_machine_dependent, 8, 6, SUBYPTE_COND_9_17_22_32,
fixups[0].exp.X_add_symbol,
fixups[0].exp.X_add_number,
(char *)(size_t) fixups[0].opindex);
md_number_to_chars (f, insn, insn_size);
md_number_to_chars (f + 2, 0, 6);
}
}
else
{
if (strcmp (opcode->name, "bsa") == 0)
{
f = frag_var (rs_machine_dependent, 10, 8, SUBYPTE_SA_9_22_32,
fixups[0].exp.X_add_symbol,
fixups[0].exp.X_add_number,
(char *)(size_t) fixups[0].opindex);
md_number_to_chars (f, insn, insn_size);
md_number_to_chars (f + 2, 0, 8);
}
else
{
f = frag_var (rs_machine_dependent, 8, 6, SUBYPTE_COND_9_22_32,
fixups[0].exp.X_add_symbol,
fixups[0].exp.X_add_number,
(char *)(size_t) fixups[0].opindex);
md_number_to_chars (f, insn, insn_size);
md_number_to_chars (f + 2, 0, 6);
}
}
}
}
}
else
{
/* Four byte insns have an opcode with the two high bits on. */
if ((insn & 0x0600) == 0x0600)
insn_size = 4;
else
insn_size = 2;
/* Special case: 32 bit MOV. */
if ((insn & 0xffe0) == 0x0620)
insn_size = 2;
/* Special case: 32 bit JARL,JMP,JR. */
if ((insn & 0x1ffe0) == 0x2e0 /* JARL. */
|| (insn & 0x1ffe0) == 0x6e0 /* JMP. */
|| (insn & 0x1ffff) == 0x2e0) /* JR. */
insn_size = 2;
if (obstack_room (& frchain_now->frch_obstack) < (insn_size + extra_data_len))
{
frag_wane (frag_now);
frag_new (0);
}
f = frag_more (insn_size);
md_number_to_chars (f, insn, insn_size);
if (extra_data_after_insn)
{
f = frag_more (extra_data_len);
md_number_to_chars (f, extra_data, extra_data_len);
extra_data_after_insn = FALSE;
}
}
/* Create any fixups. At this point we do not use a
bfd_reloc_code_real_type, but instead just use the
BFD_RELOC_UNUSED plus the operand index. This lets us easily
handle fixups for any operand type, although that is admittedly
not a very exciting feature. We pick a BFD reloc type in
md_apply_fix. */
for (i = 0; i < fc; i++)
{
const struct v850_operand *operand;
bfd_reloc_code_real_type reloc;
operand = &v850_operands[fixups[i].opindex];
reloc = fixups[i].reloc;
if (reloc != BFD_RELOC_NONE)
{
reloc_howto_type *reloc_howto =
bfd_reloc_type_lookup (stdoutput, reloc);
int size;
int address;
fixS *fixP;
if (!reloc_howto)
abort ();
size = bfd_get_reloc_size (reloc_howto);
/* XXX This will abort on an R_V850_8 reloc -
is this reloc actually used? */
if (size != 2 && size != 4)
abort ();
if (extra_data_len == 0)
{
address = (f - frag_now->fr_literal) + insn_size - size;
}
else
{
address = (f - frag_now->fr_literal) + extra_data_len - size;
}
if ((operand->flags & V850E_IMMEDIATE32) && (operand->flags & V850_PCREL))
{
fixups[i].exp.X_add_number += 2;
}
else if (operand->default_reloc == BFD_RELOC_V850_16_PCREL)
{
fixups[i].exp.X_add_number += 2;
address += 2;
}
/* fprintf (stderr, "0x%x %d %ld\n", address, size, fixups[i].exp.X_add_number); */
fixP = fix_new_exp (frag_now, address, size,
&fixups[i].exp,
reloc_howto->pc_relative,
reloc);
fixP->tc_fix_data = (void *) operand;
switch (reloc)
{
case BFD_RELOC_LO16:
case BFD_RELOC_V850_LO16_S1:
case BFD_RELOC_V850_LO16_SPLIT_OFFSET:
case BFD_RELOC_HI16:
case BFD_RELOC_HI16_S:
fixP->fx_no_overflow = 1;
break;
default:
break;
}
}
else
{
gas_assert (f != NULL);
fix_new_exp (frag_now,
f - frag_now->fr_literal, 4,
& fixups[i].exp,
(operand->flags & V850_PCREL) != 0,
(bfd_reloc_code_real_type) (fixups[i].opindex
+ (int) BFD_RELOC_UNUSED));
}
}
input_line_pointer = saved_input_line_pointer;
}
/* If while processing a fixup, a reloc really needs to be created
then it is done here. */
arelent *
tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp)
{
arelent *reloc;
reloc = XNEW (arelent);
reloc->sym_ptr_ptr = XNEW (asymbol *);
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
if ( fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY
|| fixp->fx_r_type == BFD_RELOC_VTABLE_INHERIT
|| fixp->fx_r_type == BFD_RELOC_V850_LONGCALL
|| fixp->fx_r_type == BFD_RELOC_V850_LONGJUMP
|| fixp->fx_r_type == BFD_RELOC_V850_ALIGN)
reloc->addend = fixp->fx_offset;
else
{
#if 0
if (fixp->fx_r_type == BFD_RELOC_32
&& fixp->fx_pcrel)
fixp->fx_r_type = BFD_RELOC_32_PCREL;
#endif
reloc->addend = fixp->fx_addnumber;
}
reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
if (reloc->howto == NULL)
{
as_bad_where (fixp->fx_file, fixp->fx_line,
/* xgettext:c-format */
_("reloc %d not supported by object file format"),
(int) fixp->fx_r_type);
xfree (reloc);
return NULL;
}
return reloc;
}
void
v850_handle_align (fragS * frag)
{
if (v850_relax
&& frag->fr_type == rs_align
&& frag->fr_address + frag->fr_fix > 0
&& frag->fr_offset > 1
&& now_seg != bss_section
&& now_seg != v850_seg_table[SBSS_SECTION].s
&& now_seg != v850_seg_table[TBSS_SECTION].s
&& now_seg != v850_seg_table[ZBSS_SECTION].s)
fix_new (frag, frag->fr_fix, 2, & abs_symbol, frag->fr_offset, 0,
BFD_RELOC_V850_ALIGN);
}
/* Return current size of variable part of frag. */
int
md_estimate_size_before_relax (fragS *fragp, asection *seg ATTRIBUTE_UNUSED)
{
if (fragp->fr_subtype >= sizeof (md_relax_table) / sizeof (md_relax_table[0]))
abort ();
return md_relax_table[fragp->fr_subtype].rlx_length;
}
long
v850_pcrel_from_section (fixS *fixp, segT section)
{
/* If the symbol is undefined, or in a section other than our own,
or it is weak (in which case it may well be in another section,
then let the linker figure it out. */
if (fixp->fx_addsy != (symbolS *) NULL
&& (! S_IS_DEFINED (fixp->fx_addsy)
|| S_IS_WEAK (fixp->fx_addsy)
|| (S_GET_SEGMENT (fixp->fx_addsy) != section)))
return 0;
return fixp->fx_frag->fr_address + fixp->fx_where;
}
void
md_apply_fix (fixS *fixP, valueT *valueP, segT seg ATTRIBUTE_UNUSED)
{
valueT value = * valueP;
char *where;
if (fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT
|| fixP->fx_r_type == BFD_RELOC_V850_LONGCALL
|| fixP->fx_r_type == BFD_RELOC_V850_LONGJUMP
|| fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
{
fixP->fx_done = 0;
return;
}
if (fixP->fx_addsy == (symbolS *) NULL)
fixP->fx_addnumber = value,
fixP->fx_done = 1;
else if (fixP->fx_pcrel)
fixP->fx_addnumber = fixP->fx_offset;
else
{
value = fixP->fx_offset;
if (fixP->fx_subsy != (symbolS *) NULL)
{
if (S_GET_SEGMENT (fixP->fx_subsy) == absolute_section)
value -= S_GET_VALUE (fixP->fx_subsy);
else
/* We don't actually support subtracting a symbol. */
as_bad_where (fixP->fx_file, fixP->fx_line,
_("expression too complex"));
}
fixP->fx_addnumber = value;
}
if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED)
{
int opindex;
const struct v850_operand *operand;
unsigned long insn;
const char *errmsg = NULL;
opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED;
operand = &v850_operands[opindex];
/* Fetch the instruction, insert the fully resolved operand
value, and stuff the instruction back again.
Note the instruction has been stored in little endian
format! */
where = fixP->fx_frag->fr_literal + fixP->fx_where;
if (fixP->fx_size > 2)
insn = bfd_getl32 ((unsigned char *) where);
else
insn = bfd_getl16 ((unsigned char *) where);
/* When inserting loop offsets a backwards displacement
is encoded as a positive value. */
if (operand->flags & V850_INVERSE_PCREL)
value = - value;
insn = v850_insert_operand (insn, operand, (offsetT) value,
&errmsg);
if (errmsg)
as_warn_where (fixP->fx_file, fixP->fx_line, "%s", errmsg);
if (fixP->fx_size > 2)
bfd_putl32 ((bfd_vma) insn, (unsigned char *) where);
else
bfd_putl16 ((bfd_vma) insn, (unsigned char *) where);
if (fixP->fx_done)
/* Nothing else to do here. */
return;
/* Determine a BFD reloc value based on the operand information.
We are only prepared to turn a few of the operands into relocs. */
if (operand->default_reloc == BFD_RELOC_NONE)
{
as_bad_where (fixP->fx_file, fixP->fx_line,
_("unresolved expression that must be resolved"));
fixP->fx_done = 1;
return;
}
{
fixP->fx_r_type = operand->default_reloc;
if (operand->default_reloc == BFD_RELOC_V850_16_PCREL)
{
fixP->fx_where += 2;
fixP->fx_size = 2;
fixP->fx_addnumber += 2;
}
}
}
else if (fixP->fx_done)
{
/* We still have to insert the value into memory! */
where = fixP->fx_frag->fr_literal + fixP->fx_where;
if (fixP->tc_fix_data != NULL
&& ((struct v850_operand *) fixP->tc_fix_data)->insert != NULL)
{
const char * message = NULL;
struct v850_operand * operand = (struct v850_operand *) fixP->tc_fix_data;
unsigned long insn;
/* The variable "where" currently points at the exact point inside
the insn where we need to insert the value. But we need to
extract the entire insn so we probably need to move "where"
back a few bytes. */
if (fixP->fx_size == 2)
where -= 2;
else if (fixP->fx_size == 1)
where -= 3;
insn = bfd_getl32 ((unsigned char *) where);
/* Use the operand's insertion procedure, if present, in order to
make sure that the value is correctly stored in the insn. */
insn = operand->insert (insn, (offsetT) value, & message);
/* Ignore message even if it is set. */
bfd_putl32 ((bfd_vma) insn, (unsigned char *) where);
}
else
{
switch (fixP->fx_r_type)
{
case BFD_RELOC_V850_32_ABS:
case BFD_RELOC_V850_32_PCREL:
bfd_putl32 (value & 0xfffffffe, (unsigned char *) where);
break;
case BFD_RELOC_32:
bfd_putl32 (value, (unsigned char *) where);
break;
case BFD_RELOC_V850_23:
bfd_putl32 (((value & 0x7f) << 4) | ((value & 0x7fff80) << (16-7))
| (bfd_getl32 (where) & ~((0x7f << 4) | (0xffff << 16))),
(unsigned char *) where);
break;
case BFD_RELOC_16:
case BFD_RELOC_HI16:
case BFD_RELOC_HI16_S:
case BFD_RELOC_LO16:
case BFD_RELOC_V850_ZDA_16_16_OFFSET:
case BFD_RELOC_V850_SDA_16_16_OFFSET:
case BFD_RELOC_V850_TDA_16_16_OFFSET:
case BFD_RELOC_V850_CALLT_16_16_OFFSET:
bfd_putl16 (value & 0xffff, (unsigned char *) where);
break;
case BFD_RELOC_8:
*where = value & 0xff;
break;
case BFD_RELOC_V850_9_PCREL:
bfd_putl16 (((value & 0x1f0) << 7) | ((value & 0x0e) << 3)
| (bfd_getl16 (where) & ~((0x1f0 << 7) | (0x0e << 3))), where);
break;
case BFD_RELOC_V850_17_PCREL:
bfd_putl32 (((value & 0x10000) >> (16 - 4)) | ((value & 0xfffe) << 16)
| (bfd_getl32 (where) & ~((0x10000 >> (16 - 4)) | (0xfffe << 16))), where);
break;
case BFD_RELOC_V850_16_PCREL:
bfd_putl16 ((-value & 0xfffe) | (bfd_getl16 (where + 2) & 0x0001),
(unsigned char *) (where + 2));
break;
case BFD_RELOC_V850_22_PCREL:
bfd_putl32 (((value & 0xfffe) << 16) | ((value & 0x3f0000) >> 16)
| (bfd_getl32 (where) & ~((0xfffe << 16) | (0x3f0000 >> 16))), where);
break;
case BFD_RELOC_V850_16_S1:
case BFD_RELOC_V850_LO16_S1:
case BFD_RELOC_V850_ZDA_15_16_OFFSET:
case BFD_RELOC_V850_SDA_15_16_OFFSET:
bfd_putl16 (value & 0xfffe, (unsigned char *) where);
break;
case BFD_RELOC_V850_16_SPLIT_OFFSET:
case BFD_RELOC_V850_LO16_SPLIT_OFFSET:
case BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET:
case BFD_RELOC_V850_SDA_16_16_SPLIT_OFFSET:
bfd_putl32 (((value << 16) & 0xfffe0000)
| ((value << 5) & 0x20)
| (bfd_getl32 (where) & ~0xfffe0020), where);
break;
case BFD_RELOC_V850_TDA_6_8_OFFSET:
*where = (*where & ~0x7e) | ((value >> 1) & 0x7e);
break;
case BFD_RELOC_V850_TDA_7_8_OFFSET:
*where = (*where & ~0x7f) | ((value >> 1) & 0x7f);
break;
case BFD_RELOC_V850_TDA_7_7_OFFSET:
*where = (*where & ~0x7f) | (value & 0x7f);
break;
case BFD_RELOC_V850_TDA_4_5_OFFSET:
*where = (*where & ~0xf) | ((value >> 1) & 0xf);
break;
case BFD_RELOC_V850_TDA_4_4_OFFSET:
*where = (*where & ~0xf) | (value & 0xf);
break;
case BFD_RELOC_V850_CALLT_6_7_OFFSET:
*where = (*where & ~0x3f) | (value & 0x3f);
break;
default:
abort ();
}
}
}
}
/* Parse a cons expression. We have to handle hi(), lo(), etc
on the v850. */
bfd_reloc_code_real_type
parse_cons_expression_v850 (expressionS *exp)
{
const char *errmsg;
bfd_reloc_code_real_type r;
/* See if there's a reloc prefix like hi() we have to handle. */
r = v850_reloc_prefix (NULL, &errmsg);
/* Do normal expression parsing. */
expression (exp);
return r;
}
/* Create a fixup for a cons expression. If parse_cons_expression_v850
found a reloc prefix, then we use that reloc, else we choose an
appropriate one based on the size of the expression. */
void
cons_fix_new_v850 (fragS *frag,
int where,
int size,
expressionS *exp,
bfd_reloc_code_real_type r)
{
if (r == BFD_RELOC_NONE)
{
if (size == 4)
r = BFD_RELOC_32;
if (size == 2)
r = BFD_RELOC_16;
if (size == 1)
r = BFD_RELOC_8;
}
if (exp != NULL)
fix_new_exp (frag, where, size, exp, 0, r);
else
fix_new (frag, where, size, NULL, 0, 0, r);
}
bfd_boolean
v850_fix_adjustable (fixS *fixP)
{
if (fixP->fx_addsy == NULL)
return 1;
/* Don't adjust function names. */
if (S_IS_FUNCTION (fixP->fx_addsy))
return 0;
/* We need the symbol name for the VTABLE entries. */
if (fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT
|| fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
return 0;
return 1;
}
int
v850_force_relocation (struct fix *fixP)
{
if (fixP->fx_r_type == BFD_RELOC_V850_LONGCALL
|| fixP->fx_r_type == BFD_RELOC_V850_LONGJUMP)
return 1;
if (v850_relax
&& (fixP->fx_pcrel
|| fixP->fx_r_type == BFD_RELOC_V850_ALIGN
|| fixP->fx_r_type == BFD_RELOC_V850_9_PCREL
|| fixP->fx_r_type == BFD_RELOC_V850_16_PCREL
|| fixP->fx_r_type == BFD_RELOC_V850_17_PCREL
|| fixP->fx_r_type == BFD_RELOC_V850_22_PCREL
|| fixP->fx_r_type == BFD_RELOC_V850_32_PCREL
|| fixP->fx_r_type >= BFD_RELOC_UNUSED))
return 1;
return generic_force_reloc (fixP);
}
/* Create a v850 note section. */
void
v850_md_end (void)
{
segT note_sec;
segT orig_seg = now_seg;
subsegT orig_subseg = now_subseg;
enum v850_notes id;
note_sec = subseg_new (V850_NOTE_SECNAME, 0);
bfd_set_section_flags (stdoutput, note_sec, SEC_HAS_CONTENTS | SEC_READONLY | SEC_MERGE);
bfd_set_section_alignment (stdoutput, note_sec, 2);
/* Provide default values for all of the notes. */
for (id = V850_NOTE_ALIGNMENT; id <= NUM_V850_NOTES; id++)
{
int val = 0;
char * p;
/* Follow the standard note section layout:
First write the length of the name string. */
p = frag_more (4);
md_number_to_chars (p, 4, 4);
/* Next comes the length of the "descriptor", i.e., the actual data. */
p = frag_more (4);
md_number_to_chars (p, 4, 4);
/* Write the note type. */
p = frag_more (4);
md_number_to_chars (p, (valueT) id, 4);
/* Write the name field. */
p = frag_more (4);
memcpy (p, V850_NOTE_NAME, 4);
/* Finally, write the descriptor. */
p = frag_more (4);
switch (id)
{
case V850_NOTE_ALIGNMENT:
val = v850_data_8 ? EF_RH850_DATA_ALIGN8 : EF_RH850_DATA_ALIGN4;
break;
case V850_NOTE_DATA_SIZE:
/* GCC does not currently support an option
for 32-bit doubles with the V850 backend. */
val = EF_RH850_DOUBLE64;
break;
case V850_NOTE_FPU_INFO:
if (! soft_float)
switch (machine)
{
case bfd_mach_v850e3v5: val = EF_RH850_FPU30; break;
case bfd_mach_v850e2v3: val = EF_RH850_FPU20; break;
default: break;
}
break;
default:
break;
}
md_number_to_chars (p, val, 4);
}
/* Paranoia - we probably do not need this. */
subseg_set (orig_seg, orig_subseg);
}
|