1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
8645
8646
8647
8648
8649
8650
8651
8652
8653
8654
8655
8656
8657
8658
8659
8660
8661
8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688
8689
8690
8691
8692
8693
8694
8695
8696
8697
8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
8770
8771
8772
8773
8774
8775
8776
8777
8778
8779
8780
8781
8782
8783
8784
8785
8786
8787
8788
8789
8790
8791
8792
8793
8794
8795
8796
8797
8798
8799
8800
8801
8802
8803
8804
8805
8806
8807
8808
8809
8810
8811
8812
8813
8814
8815
8816
8817
8818
8819
8820
8821
8822
8823
8824
8825
8826
8827
8828
8829
8830
8831
8832
8833
8834
8835
8836
8837
8838
8839
8840
8841
8842
8843
8844
8845
8846
8847
8848
8849
8850
8851
8852
8853
8854
8855
8856
8857
8858
8859
8860
8861
8862
8863
8864
8865
8866
8867
8868
8869
8870
8871
8872
8873
8874
8875
8876
8877
8878
8879
8880
8881
8882
8883
8884
8885
8886
8887
8888
8889
8890
8891
8892
8893
8894
8895
8896
8897
8898
8899
8900
8901
8902
8903
8904
8905
8906
8907
8908
8909
8910
8911
8912
8913
8914
8915
8916
8917
8918
8919
8920
8921
8922
8923
8924
8925
8926
8927
8928
8929
8930
8931
8932
8933
8934
8935
8936
8937
8938
8939
8940
8941
8942
8943
8944
8945
8946
8947
8948
8949
8950
8951
8952
8953
8954
8955
8956
8957
8958
8959
8960
8961
8962
8963
8964
8965
8966
8967
8968
8969
8970
8971
8972
8973
8974
8975
8976
8977
8978
8979
8980
8981
8982
8983
8984
8985
8986
8987
8988
8989
8990
8991
8992
8993
8994
8995
8996
8997
8998
8999
9000
9001
9002
9003
9004
9005
9006
9007
9008
9009
9010
9011
9012
9013
9014
9015
9016
9017
9018
9019
9020
9021
9022
9023
9024
9025
9026
9027
9028
9029
9030
9031
9032
9033
9034
9035
9036
9037
9038
9039
9040
9041
9042
9043
9044
9045
9046
9047
9048
9049
9050
9051
9052
9053
9054
9055
9056
9057
9058
9059
9060
9061
9062
9063
9064
9065
9066
9067
9068
9069
9070
9071
9072
9073
9074
9075
9076
9077
9078
9079
9080
9081
9082
9083
9084
9085
9086
9087
9088
9089
9090
9091
9092
9093
9094
9095
9096
9097
9098
9099
9100
9101
9102
9103
9104
9105
9106
9107
9108
9109
9110
9111
9112
9113
9114
9115
9116
9117
9118
9119
9120
9121
9122
9123
9124
9125
9126
9127
9128
9129
9130
9131
9132
9133
9134
9135
9136
9137
9138
9139
9140
9141
9142
9143
9144
9145
9146
9147
9148
9149
9150
9151
9152
9153
9154
9155
9156
9157
9158
9159
9160
9161
9162
9163
9164
9165
9166
9167
9168
9169
9170
9171
9172
9173
9174
9175
9176
9177
9178
9179
9180
|
@c Copyright (C) 1988,1989,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,
@c 2002, 2003 Free Software Foundation, Inc.
@c This is part of the GCC manual.
@c For copying conditions, see the file gcc.texi.
@node Target Macros
@chapter Target Description Macros and Functions
@cindex machine description macros
@cindex target description macros
@cindex macros, target description
@cindex @file{tm.h} macros
In addition to the file @file{@var{machine}.md}, a machine description
includes a C header file conventionally given the name
@file{@var{machine}.h} and a C source file named @file{@var{machine}.c}.
The header file defines numerous macros that convey the information
about the target machine that does not fit into the scheme of the
@file{.md} file. The file @file{tm.h} should be a link to
@file{@var{machine}.h}. The header file @file{config.h} includes
@file{tm.h} and most compiler source files include @file{config.h}. The
source file defines a variable @code{targetm}, which is a structure
containing pointers to functions and data relating to the target
machine. @file{@var{machine}.c} should also contain their definitions,
if they are not defined elsewhere in GCC, and other functions called
through the macros defined in the @file{.h} file.
@menu
* Target Structure:: The @code{targetm} variable.
* Driver:: Controlling how the driver runs the compilation passes.
* Run-time Target:: Defining @samp{-m} options like @option{-m68000} and @option{-m68020}.
* Per-Function Data:: Defining data structures for per-function information.
* Storage Layout:: Defining sizes and alignments of data.
* Type Layout:: Defining sizes and properties of basic user data types.
* Escape Sequences:: Defining the value of target character escape sequences
* Registers:: Naming and describing the hardware registers.
* Register Classes:: Defining the classes of hardware registers.
* Stack and Calling:: Defining which way the stack grows and by how much.
* Varargs:: Defining the varargs macros.
* Trampolines:: Code set up at run time to enter a nested function.
* Library Calls:: Controlling how library routines are implicitly called.
* Addressing Modes:: Defining addressing modes valid for memory operands.
* Condition Code:: Defining how insns update the condition code.
* Costs:: Defining relative costs of different operations.
* Scheduling:: Adjusting the behavior of the instruction scheduler.
* Sections:: Dividing storage into text, data, and other sections.
* PIC:: Macros for position independent code.
* Assembler Format:: Defining how to write insns and pseudo-ops to output.
* Debugging Info:: Defining the format of debugging output.
* Floating Point:: Handling floating point for cross-compilers.
* Mode Switching:: Insertion of mode-switching instructions.
* Target Attributes:: Defining target-specific uses of @code{__attribute__}.
* MIPS Coprocessors:: MIPS coprocessor support and how to customize it.
* PCH Target:: Validity checking for precompiled headers.
* Misc:: Everything else.
@end menu
@node Target Structure
@section The Global @code{targetm} Variable
@cindex target hooks
@cindex target functions
@deftypevar {struct gcc_target} targetm
The target @file{.c} file must define the global @code{targetm} variable
which contains pointers to functions and data relating to the target
machine. The variable is declared in @file{target.h};
@file{target-def.h} defines the macro @code{TARGET_INITIALIZER} which is
used to initialize the variable, and macros for the default initializers
for elements of the structure. The @file{.c} file should override those
macros for which the default definition is inappropriate. For example:
@smallexample
#include "target.h"
#include "target-def.h"
/* @r{Initialize the GCC target structure.} */
#undef TARGET_COMP_TYPE_ATTRIBUTES
#define TARGET_COMP_TYPE_ATTRIBUTES @var{machine}_comp_type_attributes
struct gcc_target targetm = TARGET_INITIALIZER;
@end smallexample
@end deftypevar
Where a macro should be defined in the @file{.c} file in this manner to
form part of the @code{targetm} structure, it is documented below as a
``Target Hook'' with a prototype. Many macros will change in future
from being defined in the @file{.h} file to being part of the
@code{targetm} structure.
@node Driver
@section Controlling the Compilation Driver, @file{gcc}
@cindex driver
@cindex controlling the compilation driver
@c prevent bad page break with this line
You can control the compilation driver.
@defmac SWITCH_TAKES_ARG (@var{char})
A C expression which determines whether the option @option{-@var{char}}
takes arguments. The value should be the number of arguments that
option takes--zero, for many options.
By default, this macro is defined as
@code{DEFAULT_SWITCH_TAKES_ARG}, which handles the standard options
properly. You need not define @code{SWITCH_TAKES_ARG} unless you
wish to add additional options which take arguments. Any redefinition
should call @code{DEFAULT_SWITCH_TAKES_ARG} and then check for
additional options.
@end defmac
@defmac WORD_SWITCH_TAKES_ARG (@var{name})
A C expression which determines whether the option @option{-@var{name}}
takes arguments. The value should be the number of arguments that
option takes--zero, for many options. This macro rather than
@code{SWITCH_TAKES_ARG} is used for multi-character option names.
By default, this macro is defined as
@code{DEFAULT_WORD_SWITCH_TAKES_ARG}, which handles the standard options
properly. You need not define @code{WORD_SWITCH_TAKES_ARG} unless you
wish to add additional options which take arguments. Any redefinition
should call @code{DEFAULT_WORD_SWITCH_TAKES_ARG} and then check for
additional options.
@end defmac
@defmac SWITCH_CURTAILS_COMPILATION (@var{char})
A C expression which determines whether the option @option{-@var{char}}
stops compilation before the generation of an executable. The value is
boolean, nonzero if the option does stop an executable from being
generated, zero otherwise.
By default, this macro is defined as
@code{DEFAULT_SWITCH_CURTAILS_COMPILATION}, which handles the standard
options properly. You need not define
@code{SWITCH_CURTAILS_COMPILATION} unless you wish to add additional
options which affect the generation of an executable. Any redefinition
should call @code{DEFAULT_SWITCH_CURTAILS_COMPILATION} and then check
for additional options.
@end defmac
@defmac SWITCHES_NEED_SPACES
A string-valued C expression which enumerates the options for which
the linker needs a space between the option and its argument.
If this macro is not defined, the default value is @code{""}.
@end defmac
@defmac TARGET_OPTION_TRANSLATE_TABLE
If defined, a list of pairs of strings, the first of which is a
potential command line target to the @file{gcc} driver program, and the
second of which is a space-separated (tabs and other whitespace are not
supported) list of options with which to replace the first option. The
target defining this list is responsible for assuring that the results
are valid. Replacement options may not be the @code{--opt} style, they
must be the @code{-opt} style. It is the intention of this macro to
provide a mechanism for substitution that affects the multilibs chosen,
such as one option that enables many options, some of which select
multilibs. Example nonsensical definition, where @code{-malt-abi},
@code{-EB}, and @code{-mspoo} cause different multilibs to be chosen:
@smallexample
#define TARGET_OPTION_TRANSLATE_TABLE \
@{ "-fast", "-march=fast-foo -malt-abi -I/usr/fast-foo" @}, \
@{ "-compat", "-EB -malign=4 -mspoo" @}
@end smallexample
@end defmac
@defmac DRIVER_SELF_SPECS
A list of specs for the driver itself. It should be a suitable
initializer for an array of strings, with no surrounding braces.
The driver applies these specs to its own command line between loading
default @file{specs} files (but not command-line specified ones) and
choosing the multilib directory or running any subcommands. It
applies them in the order given, so each spec can depend on the
options added by earlier ones. It is also possible to remove options
using @samp{%<@var{option}} in the usual way.
This macro can be useful when a port has several interdependent target
options. It provides a way of standardizing the command line so
that the other specs are easier to write.
Do not define this macro if it does not need to do anything.
@end defmac
@defmac OPTION_DEFAULT_SPECS
A list of specs used to support configure-time default options (i.e.@:
@option{--with} options) in the driver. It should be a suitable initializer
for an array of structures, each containing two strings, without the
outermost pair of surrounding braces.
The first item in the pair is the name of the default. This must match
the code in @file{config.gcc} for the target. The second item is a spec
to apply if a default with this name was specified. The string
@samp{%(VALUE)} in the spec will be replaced by the value of the default
everywhere it occurs.
The driver will apply these specs to its own command line between loading
default @file{specs} files and processing @code{DRIVER_SELF_SPECS}, using
the same mechanism as @code{DRIVER_SELF_SPECS}.
Do not define this macro if it does not need to do anything.
@end defmac
@defmac CPP_SPEC
A C string constant that tells the GCC driver program options to
pass to CPP@. It can also specify how to translate options you
give to GCC into options for GCC to pass to the CPP@.
Do not define this macro if it does not need to do anything.
@end defmac
@defmac CPLUSPLUS_CPP_SPEC
This macro is just like @code{CPP_SPEC}, but is used for C++, rather
than C@. If you do not define this macro, then the value of
@code{CPP_SPEC} (if any) will be used instead.
@end defmac
@defmac CC1_SPEC
A C string constant that tells the GCC driver program options to
pass to @code{cc1}, @code{cc1plus}, @code{f771}, and the other language
front ends.
It can also specify how to translate options you give to GCC into options
for GCC to pass to front ends.
Do not define this macro if it does not need to do anything.
@end defmac
@defmac CC1PLUS_SPEC
A C string constant that tells the GCC driver program options to
pass to @code{cc1plus}. It can also specify how to translate options you
give to GCC into options for GCC to pass to the @code{cc1plus}.
Do not define this macro if it does not need to do anything.
Note that everything defined in CC1_SPEC is already passed to
@code{cc1plus} so there is no need to duplicate the contents of
CC1_SPEC in CC1PLUS_SPEC@.
@end defmac
@defmac ASM_SPEC
A C string constant that tells the GCC driver program options to
pass to the assembler. It can also specify how to translate options
you give to GCC into options for GCC to pass to the assembler.
See the file @file{sun3.h} for an example of this.
Do not define this macro if it does not need to do anything.
@end defmac
@defmac ASM_FINAL_SPEC
A C string constant that tells the GCC driver program how to
run any programs which cleanup after the normal assembler.
Normally, this is not needed. See the file @file{mips.h} for
an example of this.
Do not define this macro if it does not need to do anything.
@end defmac
@defmac AS_NEEDS_DASH_FOR_PIPED_INPUT
Define this macro, with no value, if the driver should give the assembler
an argument consisting of a single dash, @option{-}, to instruct it to
read from its standard input (which will be a pipe connected to the
output of the compiler proper). This argument is given after any
@option{-o} option specifying the name of the output file.
If you do not define this macro, the assembler is assumed to read its
standard input if given no non-option arguments. If your assembler
cannot read standard input at all, use a @samp{%@{pipe:%e@}} construct;
see @file{mips.h} for instance.
@end defmac
@defmac LINK_SPEC
A C string constant that tells the GCC driver program options to
pass to the linker. It can also specify how to translate options you
give to GCC into options for GCC to pass to the linker.
Do not define this macro if it does not need to do anything.
@end defmac
@defmac LIB_SPEC
Another C string constant used much like @code{LINK_SPEC}. The difference
between the two is that @code{LIB_SPEC} is used at the end of the
command given to the linker.
If this macro is not defined, a default is provided that
loads the standard C library from the usual place. See @file{gcc.c}.
@end defmac
@defmac LIBGCC_SPEC
Another C string constant that tells the GCC driver program
how and when to place a reference to @file{libgcc.a} into the
linker command line. This constant is placed both before and after
the value of @code{LIB_SPEC}.
If this macro is not defined, the GCC driver provides a default that
passes the string @option{-lgcc} to the linker.
@end defmac
@defmac STARTFILE_SPEC
Another C string constant used much like @code{LINK_SPEC}. The
difference between the two is that @code{STARTFILE_SPEC} is used at
the very beginning of the command given to the linker.
If this macro is not defined, a default is provided that loads the
standard C startup file from the usual place. See @file{gcc.c}.
@end defmac
@defmac ENDFILE_SPEC
Another C string constant used much like @code{LINK_SPEC}. The
difference between the two is that @code{ENDFILE_SPEC} is used at
the very end of the command given to the linker.
Do not define this macro if it does not need to do anything.
@end defmac
@defmac THREAD_MODEL_SPEC
GCC @code{-v} will print the thread model GCC was configured to use.
However, this doesn't work on platforms that are multilibbed on thread
models, such as AIX 4.3. On such platforms, define
@code{THREAD_MODEL_SPEC} such that it evaluates to a string without
blanks that names one of the recognized thread models. @code{%*}, the
default value of this macro, will expand to the value of
@code{thread_file} set in @file{config.gcc}.
@end defmac
@defmac SYSROOT_SUFFIX_SPEC
Define this macro to add a suffix to the target sysroot when GCC is
configured with a sysroot. This will cause GCC to search for usr/lib,
et al, within sysroot+suffix.
@end defmac
@defmac SYSROOT_HEADERS_SUFFIX_SPEC
Define this macro to add a headers_suffix to the target sysroot when
GCC is configured with a sysroot. This will cause GCC to pass the
updated sysroot+headers_suffix to CPP, causing it to search for
usr/include, et al, within sysroot+headers_suffix.
@end defmac
@defmac EXTRA_SPECS
Define this macro to provide additional specifications to put in the
@file{specs} file that can be used in various specifications like
@code{CC1_SPEC}.
The definition should be an initializer for an array of structures,
containing a string constant, that defines the specification name, and a
string constant that provides the specification.
Do not define this macro if it does not need to do anything.
@code{EXTRA_SPECS} is useful when an architecture contains several
related targets, which have various @code{@dots{}_SPECS} which are similar
to each other, and the maintainer would like one central place to keep
these definitions.
For example, the PowerPC System V.4 targets use @code{EXTRA_SPECS} to
define either @code{_CALL_SYSV} when the System V calling sequence is
used or @code{_CALL_AIX} when the older AIX-based calling sequence is
used.
The @file{config/rs6000/rs6000.h} target file defines:
@example
#define EXTRA_SPECS \
@{ "cpp_sysv_default", CPP_SYSV_DEFAULT @},
#define CPP_SYS_DEFAULT ""
@end example
The @file{config/rs6000/sysv.h} target file defines:
@smallexample
#undef CPP_SPEC
#define CPP_SPEC \
"%@{posix: -D_POSIX_SOURCE @} \
%@{mcall-sysv: -D_CALL_SYSV @} \
%@{!mcall-sysv: %(cpp_sysv_default) @} \
%@{msoft-float: -D_SOFT_FLOAT@} %@{mcpu=403: -D_SOFT_FLOAT@}"
#undef CPP_SYSV_DEFAULT
#define CPP_SYSV_DEFAULT "-D_CALL_SYSV"
@end smallexample
while the @file{config/rs6000/eabiaix.h} target file defines
@code{CPP_SYSV_DEFAULT} as:
@smallexample
#undef CPP_SYSV_DEFAULT
#define CPP_SYSV_DEFAULT "-D_CALL_AIX"
@end smallexample
@end defmac
@defmac LINK_LIBGCC_SPECIAL
Define this macro if the driver program should find the library
@file{libgcc.a} itself and should not pass @option{-L} options to the
linker. If you do not define this macro, the driver program will pass
the argument @option{-lgcc} to tell the linker to do the search and will
pass @option{-L} options to it.
@end defmac
@defmac LINK_LIBGCC_SPECIAL_1
Define this macro if the driver program should find the library
@file{libgcc.a}. If you do not define this macro, the driver program will pass
the argument @option{-lgcc} to tell the linker to do the search.
This macro is similar to @code{LINK_LIBGCC_SPECIAL}, except that it does
not affect @option{-L} options.
@end defmac
@defmac LINK_GCC_C_SEQUENCE_SPEC
The sequence in which libgcc and libc are specified to the linker.
By default this is @code{%G %L %G}.
@end defmac
@defmac LINK_COMMAND_SPEC
A C string constant giving the complete command line need to execute the
linker. When you do this, you will need to update your port each time a
change is made to the link command line within @file{gcc.c}. Therefore,
define this macro only if you need to completely redefine the command
line for invoking the linker and there is no other way to accomplish
the effect you need. Overriding this macro may be avoidable by overriding
@code{LINK_GCC_C_SEQUENCE_SPEC} instead.
@end defmac
@defmac LINK_ELIMINATE_DUPLICATE_LDIRECTORIES
A nonzero value causes @command{collect2} to remove duplicate @option{-L@var{directory}} search
directories from linking commands. Do not give it a nonzero value if
removing duplicate search directories changes the linker's semantics.
@end defmac
@defmac MULTILIB_DEFAULTS
Define this macro as a C expression for the initializer of an array of
string to tell the driver program which options are defaults for this
target and thus do not need to be handled specially when using
@code{MULTILIB_OPTIONS}.
Do not define this macro if @code{MULTILIB_OPTIONS} is not defined in
the target makefile fragment or if none of the options listed in
@code{MULTILIB_OPTIONS} are set by default.
@xref{Target Fragment}.
@end defmac
@defmac RELATIVE_PREFIX_NOT_LINKDIR
Define this macro to tell @command{gcc} that it should only translate
a @option{-B} prefix into a @option{-L} linker option if the prefix
indicates an absolute file name.
@end defmac
@defmac MD_EXEC_PREFIX
If defined, this macro is an additional prefix to try after
@code{STANDARD_EXEC_PREFIX}. @code{MD_EXEC_PREFIX} is not searched
when the @option{-b} option is used, or the compiler is built as a cross
compiler. If you define @code{MD_EXEC_PREFIX}, then be sure to add it
to the list of directories used to find the assembler in @file{configure.in}.
@end defmac
@defmac STANDARD_STARTFILE_PREFIX
Define this macro as a C string constant if you wish to override the
standard choice of @code{libdir} as the default prefix to
try when searching for startup files such as @file{crt0.o}.
@code{STANDARD_STARTFILE_PREFIX} is not searched when the compiler
is built as a cross compiler.
@end defmac
@defmac MD_STARTFILE_PREFIX
If defined, this macro supplies an additional prefix to try after the
standard prefixes. @code{MD_EXEC_PREFIX} is not searched when the
@option{-b} option is used, or when the compiler is built as a cross
compiler.
@end defmac
@defmac MD_STARTFILE_PREFIX_1
If defined, this macro supplies yet another prefix to try after the
standard prefixes. It is not searched when the @option{-b} option is
used, or when the compiler is built as a cross compiler.
@end defmac
@defmac INIT_ENVIRONMENT
Define this macro as a C string constant if you wish to set environment
variables for programs called by the driver, such as the assembler and
loader. The driver passes the value of this macro to @code{putenv} to
initialize the necessary environment variables.
@end defmac
@defmac LOCAL_INCLUDE_DIR
Define this macro as a C string constant if you wish to override the
standard choice of @file{/usr/local/include} as the default prefix to
try when searching for local header files. @code{LOCAL_INCLUDE_DIR}
comes before @code{SYSTEM_INCLUDE_DIR} in the search order.
Cross compilers do not search either @file{/usr/local/include} or its
replacement.
@end defmac
@defmac MODIFY_TARGET_NAME
Define this macro if you wish to define command-line switches that
modify the default target name.
For each switch, you can include a string to be appended to the first
part of the configuration name or a string to be deleted from the
configuration name, if present. The definition should be an initializer
for an array of structures. Each array element should have three
elements: the switch name (a string constant, including the initial
dash), one of the enumeration codes @code{ADD} or @code{DELETE} to
indicate whether the string should be inserted or deleted, and the string
to be inserted or deleted (a string constant).
For example, on a machine where @samp{64} at the end of the
configuration name denotes a 64-bit target and you want the @option{-32}
and @option{-64} switches to select between 32- and 64-bit targets, you would
code
@smallexample
#define MODIFY_TARGET_NAME \
@{ @{ "-32", DELETE, "64"@}, \
@{"-64", ADD, "64"@}@}
@end smallexample
@end defmac
@defmac SYSTEM_INCLUDE_DIR
Define this macro as a C string constant if you wish to specify a
system-specific directory to search for header files before the standard
directory. @code{SYSTEM_INCLUDE_DIR} comes before
@code{STANDARD_INCLUDE_DIR} in the search order.
Cross compilers do not use this macro and do not search the directory
specified.
@end defmac
@defmac STANDARD_INCLUDE_DIR
Define this macro as a C string constant if you wish to override the
standard choice of @file{/usr/include} as the default prefix to
try when searching for header files.
Cross compilers ignore this macro and do not search either
@file{/usr/include} or its replacement.
@end defmac
@defmac STANDARD_INCLUDE_COMPONENT
The ``component'' corresponding to @code{STANDARD_INCLUDE_DIR}.
See @code{INCLUDE_DEFAULTS}, below, for the description of components.
If you do not define this macro, no component is used.
@end defmac
@defmac INCLUDE_DEFAULTS
Define this macro if you wish to override the entire default search path
for include files. For a native compiler, the default search path
usually consists of @code{GCC_INCLUDE_DIR}, @code{LOCAL_INCLUDE_DIR},
@code{SYSTEM_INCLUDE_DIR}, @code{GPLUSPLUS_INCLUDE_DIR}, and
@code{STANDARD_INCLUDE_DIR}. In addition, @code{GPLUSPLUS_INCLUDE_DIR}
and @code{GCC_INCLUDE_DIR} are defined automatically by @file{Makefile},
and specify private search areas for GCC@. The directory
@code{GPLUSPLUS_INCLUDE_DIR} is used only for C++ programs.
The definition should be an initializer for an array of structures.
Each array element should have four elements: the directory name (a
string constant), the component name (also a string constant), a flag
for C++-only directories,
and a flag showing that the includes in the directory don't need to be
wrapped in @code{extern @samp{C}} when compiling C++. Mark the end of
the array with a null element.
The component name denotes what GNU package the include file is part of,
if any, in all uppercase letters. For example, it might be @samp{GCC}
or @samp{BINUTILS}. If the package is part of a vendor-supplied
operating system, code the component name as @samp{0}.
For example, here is the definition used for VAX/VMS:
@example
#define INCLUDE_DEFAULTS \
@{ \
@{ "GNU_GXX_INCLUDE:", "G++", 1, 1@}, \
@{ "GNU_CC_INCLUDE:", "GCC", 0, 0@}, \
@{ "SYS$SYSROOT:[SYSLIB.]", 0, 0, 0@}, \
@{ ".", 0, 0, 0@}, \
@{ 0, 0, 0, 0@} \
@}
@end example
@end defmac
Here is the order of prefixes tried for exec files:
@enumerate
@item
Any prefixes specified by the user with @option{-B}.
@item
The environment variable @code{GCC_EXEC_PREFIX}, if any.
@item
The directories specified by the environment variable @code{COMPILER_PATH}.
@item
The macro @code{STANDARD_EXEC_PREFIX}.
@item
@file{/usr/lib/gcc/}.
@item
The macro @code{MD_EXEC_PREFIX}, if any.
@end enumerate
Here is the order of prefixes tried for startfiles:
@enumerate
@item
Any prefixes specified by the user with @option{-B}.
@item
The environment variable @code{GCC_EXEC_PREFIX}, if any.
@item
The directories specified by the environment variable @code{LIBRARY_PATH}
(or port-specific name; native only, cross compilers do not use this).
@item
The macro @code{STANDARD_EXEC_PREFIX}.
@item
@file{/usr/lib/gcc/}.
@item
The macro @code{MD_EXEC_PREFIX}, if any.
@item
The macro @code{MD_STARTFILE_PREFIX}, if any.
@item
The macro @code{STANDARD_STARTFILE_PREFIX}.
@item
@file{/lib/}.
@item
@file{/usr/lib/}.
@end enumerate
@node Run-time Target
@section Run-time Target Specification
@cindex run-time target specification
@cindex predefined macros
@cindex target specifications
@c prevent bad page break with this line
Here are run-time target specifications.
@defmac TARGET_CPU_CPP_BUILTINS ()
This function-like macro expands to a block of code that defines
built-in preprocessor macros and assertions for the target cpu, using
the functions @code{builtin_define}, @code{builtin_define_std} and
@code{builtin_assert}. When the front end
calls this macro it provides a trailing semicolon, and since it has
finished command line option processing your code can use those
results freely.
@code{builtin_assert} takes a string in the form you pass to the
command-line option @option{-A}, such as @code{cpu=mips}, and creates
the assertion. @code{builtin_define} takes a string in the form
accepted by option @option{-D} and unconditionally defines the macro.
@code{builtin_define_std} takes a string representing the name of an
object-like macro. If it doesn't lie in the user's namespace,
@code{builtin_define_std} defines it unconditionally. Otherwise, it
defines a version with two leading underscores, and another version
with two leading and trailing underscores, and defines the original
only if an ISO standard was not requested on the command line. For
example, passing @code{unix} defines @code{__unix}, @code{__unix__}
and possibly @code{unix}; passing @code{_mips} defines @code{__mips},
@code{__mips__} and possibly @code{_mips}, and passing @code{_ABI64}
defines only @code{_ABI64}.
You can also test for the C dialect being compiled. The variable
@code{c_language} is set to one of @code{clk_c}, @code{clk_cplusplus}
or @code{clk_objective_c}. Note that if we are preprocessing
assembler, this variable will be @code{clk_c} but the function-like
macro @code{preprocessing_asm_p()} will return true, so you might want
to check for that first. If you need to check for strict ANSI, the
variable @code{flag_iso} can be used. The function-like macro
@code{preprocessing_trad_p()} can be used to check for traditional
preprocessing.
@end defmac
@defmac TARGET_OS_CPP_BUILTINS ()
Similarly to @code{TARGET_CPU_CPP_BUILTINS} but this macro is optional
and is used for the target operating system instead.
@end defmac
@defmac TARGET_OBJFMT_CPP_BUILTINS ()
Similarly to @code{TARGET_CPU_CPP_BUILTINS} but this macro is optional
and is used for the target object format. @file{elfos.h} uses this
macro to define @code{__ELF__}, so you probably do not need to define
it yourself.
@end defmac
@deftypevar {extern int} target_flags
This declaration should be present.
@end deftypevar
@cindex optional hardware or system features
@cindex features, optional, in system conventions
@defmac TARGET_@var{featurename}
This series of macros is to allow compiler command arguments to
enable or disable the use of optional features of the target machine.
For example, one machine description serves both the 68000 and
the 68020; a command argument tells the compiler whether it should
use 68020-only instructions or not. This command argument works
by means of a macro @code{TARGET_68020} that tests a bit in
@code{target_flags}.
Define a macro @code{TARGET_@var{featurename}} for each such option.
Its definition should test a bit in @code{target_flags}. It is
recommended that a helper macro @code{MASK_@var{featurename}}
is defined for each bit-value to test, and used in
@code{TARGET_@var{featurename}} and @code{TARGET_SWITCHES}. For
example:
@smallexample
#define TARGET_MASK_68020 1
#define TARGET_68020 (target_flags & MASK_68020)
@end smallexample
One place where these macros are used is in the condition-expressions
of instruction patterns. Note how @code{TARGET_68020} appears
frequently in the 68000 machine description file, @file{m68k.md}.
Another place they are used is in the definitions of the other
macros in the @file{@var{machine}.h} file.
@end defmac
@defmac TARGET_SWITCHES
This macro defines names of command options to set and clear
bits in @code{target_flags}. Its definition is an initializer
with a subgrouping for each command option.
Each subgrouping contains a string constant, that defines the option
name, a number, which contains the bits to set in
@code{target_flags}, and a second string which is the description
displayed by @option{--help}. If the number is negative then the bits specified
by the number are cleared instead of being set. If the description
string is present but empty, then no help information will be displayed
for that option, but it will not count as an undocumented option. The
actual option name is made by appending @samp{-m} to the specified name.
Non-empty description strings should be marked with @code{N_(@dots{})} for
@command{xgettext}. Please do not mark empty strings because the empty
string is reserved by GNU gettext. @code{gettext("")} returns the header entry
of the message catalog with meta information, not the empty string.
In addition to the description for @option{--help},
more detailed documentation for each option should be added to
@file{invoke.texi}.
One of the subgroupings should have a null string. The number in
this grouping is the default value for @code{target_flags}. Any
target options act starting with that value.
Here is an example which defines @option{-m68000} and @option{-m68020}
with opposite meanings, and picks the latter as the default:
@smallexample
#define TARGET_SWITCHES \
@{ @{ "68020", MASK_68020, "" @}, \
@{ "68000", -MASK_68020, \
N_("Compile for the 68000") @}, \
@{ "", MASK_68020, "" @}, \
@}
@end smallexample
@end defmac
@defmac TARGET_OPTIONS
This macro is similar to @code{TARGET_SWITCHES} but defines names of command
options that have values. Its definition is an initializer with a
subgrouping for each command option.
Each subgrouping contains a string constant, that defines the option
name, the address of a variable, a description string, and a value.
Non-empty description strings should be marked with @code{N_(@dots{})}
for @command{xgettext}. Please do not mark empty strings because the
empty string is reserved by GNU gettext. @code{gettext("")} returns the
header entry of the message catalog with meta information, not the empty
string.
If the value listed in the table is @code{NULL}, then the variable, type
@code{char *}, is set to the variable part of the given option if the
fixed part matches. In other words, if the first part of the option
matches what's in the table, the variable will be set to point to the
rest of the option. This allows the user to specify a value for that
option. The actual option name is made by appending @samp{-m} to the
specified name. Again, each option should also be documented in
@file{invoke.texi}.
If the value listed in the table is non-@code{NULL}, then the option
must match the option in the table exactly (with @samp{-m}), and the
variable is set to point to the value listed in the table.
Here is an example which defines @option{-mshort-data-@var{number}}. If the
given option is @option{-mshort-data-512}, the variable @code{m88k_short_data}
will be set to the string @code{"512"}.
@smallexample
extern char *m88k_short_data;
#define TARGET_OPTIONS \
@{ @{ "short-data-", &m88k_short_data, \
N_("Specify the size of the short data section"), 0 @} @}
@end smallexample
Here is a variant of the above that allows the user to also specify
just @option{-mshort-data} where a default of @code{"64"} is used.
@smallexample
extern char *m88k_short_data;
#define TARGET_OPTIONS \
@{ @{ "short-data-", &m88k_short_data, \
N_("Specify the size of the short data section"), 0 @} \
@{ "short-data", &m88k_short_data, "", "64" @},
@}
@end smallexample
Here is an example which defines @option{-mno-alu}, @option{-malu1}, and
@option{-malu2} as a three-state switch, along with suitable macros for
checking the state of the option (documentation is elided for brevity).
@smallexample
[chip.c]
char *chip_alu = ""; /* Specify default here. */
[chip.h]
extern char *chip_alu;
#define TARGET_OPTIONS \
@{ @{ "no-alu", &chip_alu, "", "" @}, \
@{ "alu1", &chip_alu, "", "1" @}, \
@{ "alu2", &chip_alu, "", "2" @}, @}
#define TARGET_ALU (chip_alu[0] != '\0')
#define TARGET_ALU1 (chip_alu[0] == '1')
#define TARGET_ALU2 (chip_alu[0] == '2')
@end smallexample
@end defmac
@defmac TARGET_VERSION
This macro is a C statement to print on @code{stderr} a string
describing the particular machine description choice. Every machine
description should define @code{TARGET_VERSION}. For example:
@smallexample
#ifdef MOTOROLA
#define TARGET_VERSION \
fprintf (stderr, " (68k, Motorola syntax)");
#else
#define TARGET_VERSION \
fprintf (stderr, " (68k, MIT syntax)");
#endif
@end smallexample
@end defmac
@defmac OVERRIDE_OPTIONS
Sometimes certain combinations of command options do not make sense on
a particular target machine. You can define a macro
@code{OVERRIDE_OPTIONS} to take account of this. This macro, if
defined, is executed once just after all the command options have been
parsed.
Don't use this macro to turn on various extra optimizations for
@option{-O}. That is what @code{OPTIMIZATION_OPTIONS} is for.
@end defmac
@defmac OPTIMIZATION_OPTIONS (@var{level}, @var{size})
Some machines may desire to change what optimizations are performed for
various optimization levels. This macro, if defined, is executed once
just after the optimization level is determined and before the remainder
of the command options have been parsed. Values set in this macro are
used as the default values for the other command line options.
@var{level} is the optimization level specified; 2 if @option{-O2} is
specified, 1 if @option{-O} is specified, and 0 if neither is specified.
@var{size} is nonzero if @option{-Os} is specified and zero otherwise.
You should not use this macro to change options that are not
machine-specific. These should uniformly selected by the same
optimization level on all supported machines. Use this macro to enable
machine-specific optimizations.
@strong{Do not examine @code{write_symbols} in
this macro!} The debugging options are not supposed to alter the
generated code.
@end defmac
@defmac CAN_DEBUG_WITHOUT_FP
Define this macro if debugging can be performed even without a frame
pointer. If this macro is defined, GCC will turn on the
@option{-fomit-frame-pointer} option whenever @option{-O} is specified.
@end defmac
@node Per-Function Data
@section Defining data structures for per-function information.
@cindex per-function data
@cindex data structures
If the target needs to store information on a per-function basis, GCC
provides a macro and a couple of variables to allow this. Note, just
using statics to store the information is a bad idea, since GCC supports
nested functions, so you can be halfway through encoding one function
when another one comes along.
GCC defines a data structure called @code{struct function} which
contains all of the data specific to an individual function. This
structure contains a field called @code{machine} whose type is
@code{struct machine_function *}, which can be used by targets to point
to their own specific data.
If a target needs per-function specific data it should define the type
@code{struct machine_function} and also the macro @code{INIT_EXPANDERS}.
This macro should be used to initialize the function pointer
@code{init_machine_status}. This pointer is explained below.
One typical use of per-function, target specific data is to create an
RTX to hold the register containing the function's return address. This
RTX can then be used to implement the @code{__builtin_return_address}
function, for level 0.
Note---earlier implementations of GCC used a single data area to hold
all of the per-function information. Thus when processing of a nested
function began the old per-function data had to be pushed onto a
stack, and when the processing was finished, it had to be popped off the
stack. GCC used to provide function pointers called
@code{save_machine_status} and @code{restore_machine_status} to handle
the saving and restoring of the target specific information. Since the
single data area approach is no longer used, these pointers are no
longer supported.
@defmac INIT_EXPANDERS
Macro called to initialize any target specific information. This macro
is called once per function, before generation of any RTL has begun.
The intention of this macro is to allow the initialization of the
function pointer @code{init_machine_status}.
@end defmac
@deftypevar {void (*)(struct function *)} init_machine_status
If this function pointer is non-@code{NULL} it will be called once per
function, before function compilation starts, in order to allow the
target to perform any target specific initialization of the
@code{struct function} structure. It is intended that this would be
used to initialize the @code{machine} of that structure.
@code{struct machine_function} structures are expected to be freed by GC.
Generally, any memory that they reference must be allocated by using
@code{ggc_alloc}, including the structure itself.
@end deftypevar
@node Storage Layout
@section Storage Layout
@cindex storage layout
Note that the definitions of the macros in this table which are sizes or
alignments measured in bits do not need to be constant. They can be C
expressions that refer to static variables, such as the @code{target_flags}.
@xref{Run-time Target}.
@defmac BITS_BIG_ENDIAN
Define this macro to have the value 1 if the most significant bit in a
byte has the lowest number; otherwise define it to have the value zero.
This means that bit-field instructions count from the most significant
bit. If the machine has no bit-field instructions, then this must still
be defined, but it doesn't matter which value it is defined to. This
macro need not be a constant.
This macro does not affect the way structure fields are packed into
bytes or words; that is controlled by @code{BYTES_BIG_ENDIAN}.
@end defmac
@defmac BYTES_BIG_ENDIAN
Define this macro to have the value 1 if the most significant byte in a
word has the lowest number. This macro need not be a constant.
@end defmac
@defmac WORDS_BIG_ENDIAN
Define this macro to have the value 1 if, in a multiword object, the
most significant word has the lowest number. This applies to both
memory locations and registers; GCC fundamentally assumes that the
order of words in memory is the same as the order in registers. This
macro need not be a constant.
@end defmac
@defmac LIBGCC2_WORDS_BIG_ENDIAN
Define this macro if @code{WORDS_BIG_ENDIAN} is not constant. This must be a
constant value with the same meaning as @code{WORDS_BIG_ENDIAN}, which will be
used only when compiling @file{libgcc2.c}. Typically the value will be set
based on preprocessor defines.
@end defmac
@defmac FLOAT_WORDS_BIG_ENDIAN
Define this macro to have the value 1 if @code{DFmode}, @code{XFmode} or
@code{TFmode} floating point numbers are stored in memory with the word
containing the sign bit at the lowest address; otherwise define it to
have the value 0. This macro need not be a constant.
You need not define this macro if the ordering is the same as for
multi-word integers.
@end defmac
@defmac BITS_PER_UNIT
Define this macro to be the number of bits in an addressable storage
unit (byte). If you do not define this macro the default is 8.
@end defmac
@defmac BITS_PER_WORD
Number of bits in a word. If you do not define this macro, the default
is @code{BITS_PER_UNIT * UNITS_PER_WORD}.
@end defmac
@defmac MAX_BITS_PER_WORD
Maximum number of bits in a word. If this is undefined, the default is
@code{BITS_PER_WORD}. Otherwise, it is the constant value that is the
largest value that @code{BITS_PER_WORD} can have at run-time.
@end defmac
@defmac UNITS_PER_WORD
Number of storage units in a word; normally 4.
@end defmac
@defmac MIN_UNITS_PER_WORD
Minimum number of units in a word. If this is undefined, the default is
@code{UNITS_PER_WORD}. Otherwise, it is the constant value that is the
smallest value that @code{UNITS_PER_WORD} can have at run-time.
@end defmac
@defmac POINTER_SIZE
Width of a pointer, in bits. You must specify a value no wider than the
width of @code{Pmode}. If it is not equal to the width of @code{Pmode},
you must define @code{POINTERS_EXTEND_UNSIGNED}. If you do not specify
a value the default is @code{BITS_PER_WORD}.
@end defmac
@defmac POINTERS_EXTEND_UNSIGNED
A C expression whose value is greater than zero if pointers that need to be
extended from being @code{POINTER_SIZE} bits wide to @code{Pmode} are to
be zero-extended and zero if they are to be sign-extended. If the value
is less then zero then there must be an "ptr_extend" instruction that
extends a pointer from @code{POINTER_SIZE} to @code{Pmode}.
You need not define this macro if the @code{POINTER_SIZE} is equal
to the width of @code{Pmode}.
@end defmac
@defmac PROMOTE_MODE (@var{m}, @var{unsignedp}, @var{type})
A macro to update @var{m} and @var{unsignedp} when an object whose type
is @var{type} and which has the specified mode and signedness is to be
stored in a register. This macro is only called when @var{type} is a
scalar type.
On most RISC machines, which only have operations that operate on a full
register, define this macro to set @var{m} to @code{word_mode} if
@var{m} is an integer mode narrower than @code{BITS_PER_WORD}. In most
cases, only integer modes should be widened because wider-precision
floating-point operations are usually more expensive than their narrower
counterparts.
For most machines, the macro definition does not change @var{unsignedp}.
However, some machines, have instructions that preferentially handle
either signed or unsigned quantities of certain modes. For example, on
the DEC Alpha, 32-bit loads from memory and 32-bit add instructions
sign-extend the result to 64 bits. On such machines, set
@var{unsignedp} according to which kind of extension is more efficient.
Do not define this macro if it would never modify @var{m}.
@end defmac
@deftypefn {Target Hook} bool TARGET_PROMOTE_FUNCTION_ARGS (tree @var{fntype})
This target hook should return @code{true} if the promotion described by
@code{PROMOTE_MODE} should also be done for outgoing function arguments.
@end deftypefn
@deftypefn {Target Hook} bool TARGET_PROMOTE_FUNCTION_RETURN (tree @var{fntype})
This target hook should return @code{true} if the promotion described by
@code{PROMOTE_MODE} should also be done for the return value of
functions.
If this target hook returns @code{true}, @code{FUNCTION_VALUE} must
perform the same promotions done by @code{PROMOTE_MODE}.
@end deftypefn
@defmac PROMOTE_FOR_CALL_ONLY
Define this macro if the promotion described by @code{PROMOTE_MODE}
should @emph{only} be performed for outgoing function arguments or
function return values, as specified by @code{TARGET_PROMOTE_FUNCTION_ARGS}
and @code{TARGET_PROMOTE_FUNCTION_RETURN}, respectively.
@end defmac
@defmac PARM_BOUNDARY
Normal alignment required for function parameters on the stack, in
bits. All stack parameters receive at least this much alignment
regardless of data type. On most machines, this is the same as the
size of an integer.
@end defmac
@defmac STACK_BOUNDARY
Define this macro to the minimum alignment enforced by hardware for the
stack pointer on this machine. The definition is a C expression for the
desired alignment (measured in bits). This value is used as a default
if @code{PREFERRED_STACK_BOUNDARY} is not defined. On most machines,
this should be the same as @code{PARM_BOUNDARY}.
@end defmac
@defmac PREFERRED_STACK_BOUNDARY
Define this macro if you wish to preserve a certain alignment for the
stack pointer, greater than what the hardware enforces. The definition
is a C expression for the desired alignment (measured in bits). This
macro must evaluate to a value equal to or larger than
@code{STACK_BOUNDARY}.
@end defmac
@defmac FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN
A C expression that evaluates true if @code{PREFERRED_STACK_BOUNDARY} is
not guaranteed by the runtime and we should emit code to align the stack
at the beginning of @code{main}.
@cindex @code{PUSH_ROUNDING}, interaction with @code{PREFERRED_STACK_BOUNDARY}
If @code{PUSH_ROUNDING} is not defined, the stack will always be aligned
to the specified boundary. If @code{PUSH_ROUNDING} is defined and specifies
a less strict alignment than @code{PREFERRED_STACK_BOUNDARY}, the stack may
be momentarily unaligned while pushing arguments.
@end defmac
@defmac FUNCTION_BOUNDARY
Alignment required for a function entry point, in bits.
@end defmac
@defmac BIGGEST_ALIGNMENT
Biggest alignment that any data type can require on this machine, in bits.
@end defmac
@defmac MINIMUM_ATOMIC_ALIGNMENT
If defined, the smallest alignment, in bits, that can be given to an
object that can be referenced in one operation, without disturbing any
nearby object. Normally, this is @code{BITS_PER_UNIT}, but may be larger
on machines that don't have byte or half-word store operations.
@end defmac
@defmac BIGGEST_FIELD_ALIGNMENT
Biggest alignment that any structure or union field can require on this
machine, in bits. If defined, this overrides @code{BIGGEST_ALIGNMENT} for
structure and union fields only, unless the field alignment has been set
by the @code{__attribute__ ((aligned (@var{n})))} construct.
@end defmac
@defmac ADJUST_FIELD_ALIGN (@var{field}, @var{computed})
An expression for the alignment of a structure field @var{field} if the
alignment computed in the usual way (including applying of
@code{BIGGEST_ALIGNMENT} and @code{BIGGEST_FIELD_ALIGNMENT} to the
alignment) is @var{computed}. It overrides alignment only if the
field alignment has not been set by the
@code{__attribute__ ((aligned (@var{n})))} construct.
@end defmac
@defmac MAX_OFILE_ALIGNMENT
Biggest alignment supported by the object file format of this machine.
Use this macro to limit the alignment which can be specified using the
@code{__attribute__ ((aligned (@var{n})))} construct. If not defined,
the default value is @code{BIGGEST_ALIGNMENT}.
@end defmac
@defmac DATA_ALIGNMENT (@var{type}, @var{basic-align})
If defined, a C expression to compute the alignment for a variable in
the static store. @var{type} is the data type, and @var{basic-align} is
the alignment that the object would ordinarily have. The value of this
macro is used instead of that alignment to align the object.
If this macro is not defined, then @var{basic-align} is used.
@findex strcpy
One use of this macro is to increase alignment of medium-size data to
make it all fit in fewer cache lines. Another is to cause character
arrays to be word-aligned so that @code{strcpy} calls that copy
constants to character arrays can be done inline.
@end defmac
@defmac CONSTANT_ALIGNMENT (@var{constant}, @var{basic-align})
If defined, a C expression to compute the alignment given to a constant
that is being placed in memory. @var{constant} is the constant and
@var{basic-align} is the alignment that the object would ordinarily
have. The value of this macro is used instead of that alignment to
align the object.
If this macro is not defined, then @var{basic-align} is used.
The typical use of this macro is to increase alignment for string
constants to be word aligned so that @code{strcpy} calls that copy
constants can be done inline.
@end defmac
@defmac LOCAL_ALIGNMENT (@var{type}, @var{basic-align})
If defined, a C expression to compute the alignment for a variable in
the local store. @var{type} is the data type, and @var{basic-align} is
the alignment that the object would ordinarily have. The value of this
macro is used instead of that alignment to align the object.
If this macro is not defined, then @var{basic-align} is used.
One use of this macro is to increase alignment of medium-size data to
make it all fit in fewer cache lines.
@end defmac
@defmac EMPTY_FIELD_BOUNDARY
Alignment in bits to be given to a structure bit-field that follows an
empty field such as @code{int : 0;}.
If @code{PCC_BITFIELD_TYPE_MATTERS} is true, it overrides this macro.
@end defmac
@defmac STRUCTURE_SIZE_BOUNDARY
Number of bits which any structure or union's size must be a multiple of.
Each structure or union's size is rounded up to a multiple of this.
If you do not define this macro, the default is the same as
@code{BITS_PER_UNIT}.
@end defmac
@defmac STRICT_ALIGNMENT
Define this macro to be the value 1 if instructions will fail to work
if given data not on the nominal alignment. If instructions will merely
go slower in that case, define this macro as 0.
@end defmac
@defmac PCC_BITFIELD_TYPE_MATTERS
Define this if you wish to imitate the way many other C compilers handle
alignment of bit-fields and the structures that contain them.
The behavior is that the type written for a named bit-field (@code{int},
@code{short}, or other integer type) imposes an alignment for the entire
structure, as if the structure really did contain an ordinary field of
that type. In addition, the bit-field is placed within the structure so
that it would fit within such a field, not crossing a boundary for it.
Thus, on most machines, a named bit-field whose type is written as
@code{int} would not cross a four-byte boundary, and would force
four-byte alignment for the whole structure. (The alignment used may
not be four bytes; it is controlled by the other alignment parameters.)
An unnamed bit-field will not affect the alignment of the containing
structure.
If the macro is defined, its definition should be a C expression;
a nonzero value for the expression enables this behavior.
Note that if this macro is not defined, or its value is zero, some
bit-fields may cross more than one alignment boundary. The compiler can
support such references if there are @samp{insv}, @samp{extv}, and
@samp{extzv} insns that can directly reference memory.
The other known way of making bit-fields work is to define
@code{STRUCTURE_SIZE_BOUNDARY} as large as @code{BIGGEST_ALIGNMENT}.
Then every structure can be accessed with fullwords.
Unless the machine has bit-field instructions or you define
@code{STRUCTURE_SIZE_BOUNDARY} that way, you must define
@code{PCC_BITFIELD_TYPE_MATTERS} to have a nonzero value.
If your aim is to make GCC use the same conventions for laying out
bit-fields as are used by another compiler, here is how to investigate
what the other compiler does. Compile and run this program:
@example
struct foo1
@{
char x;
char :0;
char y;
@};
struct foo2
@{
char x;
int :0;
char y;
@};
main ()
@{
printf ("Size of foo1 is %d\n",
sizeof (struct foo1));
printf ("Size of foo2 is %d\n",
sizeof (struct foo2));
exit (0);
@}
@end example
If this prints 2 and 5, then the compiler's behavior is what you would
get from @code{PCC_BITFIELD_TYPE_MATTERS}.
@end defmac
@defmac BITFIELD_NBYTES_LIMITED
Like @code{PCC_BITFIELD_TYPE_MATTERS} except that its effect is limited
to aligning a bit-field within the structure.
@end defmac
@defmac MEMBER_TYPE_FORCES_BLK (@var{field}, @var{mode})
Return 1 if a structure or array containing @var{field} should be accessed using
@code{BLKMODE}.
If @var{field} is the only field in the structure, @var{mode} is its
mode, otherwise @var{mode} is VOIDmode. @var{mode} is provided in the
case where structures of one field would require the structure's mode to
retain the field's mode.
Normally, this is not needed. See the file @file{c4x.h} for an example
of how to use this macro to prevent a structure having a floating point
field from being accessed in an integer mode.
@end defmac
@defmac ROUND_TYPE_ALIGN (@var{type}, @var{computed}, @var{specified})
Define this macro as an expression for the alignment of a type (given
by @var{type} as a tree node) if the alignment computed in the usual
way is @var{computed} and the alignment explicitly specified was
@var{specified}.
The default is to use @var{specified} if it is larger; otherwise, use
the smaller of @var{computed} and @code{BIGGEST_ALIGNMENT}
@end defmac
@defmac MAX_FIXED_MODE_SIZE
An integer expression for the size in bits of the largest integer
machine mode that should actually be used. All integer machine modes of
this size or smaller can be used for structures and unions with the
appropriate sizes. If this macro is undefined, @code{GET_MODE_BITSIZE
(DImode)} is assumed.
@end defmac
@defmac VECTOR_MODE_SUPPORTED_P (@var{mode})
Define this macro to be nonzero if the port is prepared to handle insns
involving vector mode @var{mode}. At the very least, it must have move
patterns for this mode.
@end defmac
@defmac STACK_SAVEAREA_MODE (@var{save_level})
If defined, an expression of type @code{enum machine_mode} that
specifies the mode of the save area operand of a
@code{save_stack_@var{level}} named pattern (@pxref{Standard Names}).
@var{save_level} is one of @code{SAVE_BLOCK}, @code{SAVE_FUNCTION}, or
@code{SAVE_NONLOCAL} and selects which of the three named patterns is
having its mode specified.
You need not define this macro if it always returns @code{Pmode}. You
would most commonly define this macro if the
@code{save_stack_@var{level}} patterns need to support both a 32- and a
64-bit mode.
@end defmac
@defmac STACK_SIZE_MODE
If defined, an expression of type @code{enum machine_mode} that
specifies the mode of the size increment operand of an
@code{allocate_stack} named pattern (@pxref{Standard Names}).
You need not define this macro if it always returns @code{word_mode}.
You would most commonly define this macro if the @code{allocate_stack}
pattern needs to support both a 32- and a 64-bit mode.
@end defmac
@defmac TARGET_FLOAT_FORMAT
A code distinguishing the floating point format of the target machine.
There are four defined values:
@ftable @code
@item IEEE_FLOAT_FORMAT
This code indicates IEEE floating point. It is the default; there is no
need to define @code{TARGET_FLOAT_FORMAT} when the format is IEEE@.
@item VAX_FLOAT_FORMAT
This code indicates the ``F float'' (for @code{float}) and ``D float''
or ``G float'' formats (for @code{double}) used on the VAX and PDP-11@.
@item IBM_FLOAT_FORMAT
This code indicates the format used on the IBM System/370.
@item C4X_FLOAT_FORMAT
This code indicates the format used on the TMS320C3x/C4x.
@end ftable
If your target uses a floating point format other than these, you must
define a new @var{name}_FLOAT_FORMAT code for it, and add support for
it to @file{real.c}.
The ordering of the component words of floating point values stored in
memory is controlled by @code{FLOAT_WORDS_BIG_ENDIAN}.
@end defmac
@defmac MODE_HAS_NANS (@var{mode})
When defined, this macro should be true if @var{mode} has a NaN
representation. The compiler assumes that NaNs are not equal to
anything (including themselves) and that addition, subtraction,
multiplication and division all return NaNs when one operand is
NaN@.
By default, this macro is true if @var{mode} is a floating-point
mode and the target floating-point format is IEEE@.
@end defmac
@defmac MODE_HAS_INFINITIES (@var{mode})
This macro should be true if @var{mode} can represent infinity. At
present, the compiler uses this macro to decide whether @samp{x - x}
is always defined. By default, the macro is true when @var{mode}
is a floating-point mode and the target format is IEEE@.
@end defmac
@defmac MODE_HAS_SIGNED_ZEROS (@var{mode})
True if @var{mode} distinguishes between positive and negative zero.
The rules are expected to follow the IEEE standard:
@itemize @bullet
@item
@samp{x + x} has the same sign as @samp{x}.
@item
If the sum of two values with opposite sign is zero, the result is
positive for all rounding modes expect towards @minus{}infinity, for
which it is negative.
@item
The sign of a product or quotient is negative when exactly one
of the operands is negative.
@end itemize
The default definition is true if @var{mode} is a floating-point
mode and the target format is IEEE@.
@end defmac
@defmac MODE_HAS_SIGN_DEPENDENT_ROUNDING (@var{mode})
If defined, this macro should be true for @var{mode} if it has at
least one rounding mode in which @samp{x} and @samp{-x} can be
rounded to numbers of different magnitude. Two such modes are
towards @minus{}infinity and towards +infinity.
The default definition of this macro is true if @var{mode} is
a floating-point mode and the target format is IEEE@.
@end defmac
@defmac ROUND_TOWARDS_ZERO
If defined, this macro should be true if the prevailing rounding
mode is towards zero. A true value has the following effects:
@itemize @bullet
@item
@code{MODE_HAS_SIGN_DEPENDENT_ROUNDING} will be false for all modes.
@item
@file{libgcc.a}'s floating-point emulator will round towards zero
rather than towards nearest.
@item
The compiler's floating-point emulator will round towards zero after
doing arithmetic, and when converting from the internal float format to
the target format.
@end itemize
The macro does not affect the parsing of string literals. When the
primary rounding mode is towards zero, library functions like
@code{strtod} might still round towards nearest, and the compiler's
parser should behave like the target's @code{strtod} where possible.
Not defining this macro is equivalent to returning zero.
@end defmac
@defmac LARGEST_EXPONENT_IS_NORMAL (@var{size})
This macro should return true if floats with @var{size}
bits do not have a NaN or infinity representation, but use the largest
exponent for normal numbers instead.
Defining this macro to true for @var{size} causes @code{MODE_HAS_NANS}
and @code{MODE_HAS_INFINITIES} to be false for @var{size}-bit modes.
It also affects the way @file{libgcc.a} and @file{real.c} emulate
floating-point arithmetic.
The default definition of this macro returns false for all sizes.
@end defmac
@deftypefn {Target Hook} bool TARGET_VECTOR_OPAQUE_P (tree @var{type})
This target hook should return @code{true} a vector is opaque. That
is, if no cast is needed when copying a vector value of type
@var{type} into another vector lvalue of the same size. Vector opaque
types cannot be initialized. The default is that there are no such
types.
@end deftypefn
@deftypefn {Target Hook} bool TARGET_MS_BITFIELD_LAYOUT_P (tree @var{record_type})
This target hook returns @code{true} if bit-fields in the given
@var{record_type} are to be laid out following the rules of Microsoft
Visual C/C++, namely: (i) a bit-field won't share the same storage
unit with the previous bit-field if their underlying types have
different sizes, and the bit-field will be aligned to the highest
alignment of the underlying types of itself and of the previous
bit-field; (ii) a zero-sized bit-field will affect the alignment of
the whole enclosing structure, even if it is unnamed; except that
(iii) a zero-sized bit-field will be disregarded unless it follows
another bit-field of nonzero size. If this hook returns @code{true},
other macros that control bit-field layout are ignored.
When a bit-field is inserted into a packed record, the whole size
of the underlying type is used by one or more same-size adjacent
bit-fields (that is, if its long:3, 32 bits is used in the record,
and any additional adjacent long bit-fields are packed into the same
chunk of 32 bits. However, if the size changes, a new field of that
size is allocated). In an unpacked record, this is the same as using
alignment, but not equivalent when packing.
If both MS bit-fields and @samp{__attribute__((packed))} are used,
the latter will take precedence. If @samp{__attribute__((packed))} is
used on a single field when MS bit-fields are in use, it will take
precedence for that field, but the alignment of the rest of the structure
may affect its placement.
@end deftypefn
@node Type Layout
@section Layout of Source Language Data Types
These macros define the sizes and other characteristics of the standard
basic data types used in programs being compiled. Unlike the macros in
the previous section, these apply to specific features of C and related
languages, rather than to fundamental aspects of storage layout.
@defmac INT_TYPE_SIZE
A C expression for the size in bits of the type @code{int} on the
target machine. If you don't define this, the default is one word.
@end defmac
@defmac SHORT_TYPE_SIZE
A C expression for the size in bits of the type @code{short} on the
target machine. If you don't define this, the default is half a word.
(If this would be less than one storage unit, it is rounded up to one
unit.)
@end defmac
@defmac LONG_TYPE_SIZE
A C expression for the size in bits of the type @code{long} on the
target machine. If you don't define this, the default is one word.
@end defmac
@defmac ADA_LONG_TYPE_SIZE
On some machines, the size used for the Ada equivalent of the type
@code{long} by a native Ada compiler differs from that used by C. In
that situation, define this macro to be a C expression to be used for
the size of that type. If you don't define this, the default is the
value of @code{LONG_TYPE_SIZE}.
@end defmac
@defmac MAX_LONG_TYPE_SIZE
Maximum number for the size in bits of the type @code{long} on the
target machine. If this is undefined, the default is
@code{LONG_TYPE_SIZE}. Otherwise, it is the constant value that is the
largest value that @code{LONG_TYPE_SIZE} can have at run-time. This is
used in @code{cpp}.
@end defmac
@defmac LONG_LONG_TYPE_SIZE
A C expression for the size in bits of the type @code{long long} on the
target machine. If you don't define this, the default is two
words. If you want to support GNU Ada on your machine, the value of this
macro must be at least 64.
@end defmac
@defmac CHAR_TYPE_SIZE
A C expression for the size in bits of the type @code{char} on the
target machine. If you don't define this, the default is
@code{BITS_PER_UNIT}.
@end defmac
@defmac BOOL_TYPE_SIZE
A C expression for the size in bits of the C++ type @code{bool} and
C99 type @code{_Bool} on the target machine. If you don't define
this, and you probably shouldn't, the default is @code{CHAR_TYPE_SIZE}.
@end defmac
@defmac FLOAT_TYPE_SIZE
A C expression for the size in bits of the type @code{float} on the
target machine. If you don't define this, the default is one word.
@end defmac
@defmac DOUBLE_TYPE_SIZE
A C expression for the size in bits of the type @code{double} on the
target machine. If you don't define this, the default is two
words.
@end defmac
@defmac LONG_DOUBLE_TYPE_SIZE
A C expression for the size in bits of the type @code{long double} on
the target machine. If you don't define this, the default is two
words.
@end defmac
@defmac MAX_LONG_DOUBLE_TYPE_SIZE
Maximum number for the size in bits of the type @code{long double} on the
target machine. If this is undefined, the default is
@code{LONG_DOUBLE_TYPE_SIZE}. Otherwise, it is the constant value that is
the largest value that @code{LONG_DOUBLE_TYPE_SIZE} can have at run-time.
This is used in @code{cpp}.
@end defmac
@defmac TARGET_FLT_EVAL_METHOD
A C expression for the value for @code{FLT_EVAL_METHOD} in @file{float.h},
assuming, if applicable, that the floating-point control word is in its
default state. If you do not define this macro the value of
@code{FLT_EVAL_METHOD} will be zero.
@end defmac
@defmac WIDEST_HARDWARE_FP_SIZE
A C expression for the size in bits of the widest floating-point format
supported by the hardware. If you define this macro, you must specify a
value less than or equal to the value of @code{LONG_DOUBLE_TYPE_SIZE}.
If you do not define this macro, the value of @code{LONG_DOUBLE_TYPE_SIZE}
is the default.
@end defmac
@defmac DEFAULT_SIGNED_CHAR
An expression whose value is 1 or 0, according to whether the type
@code{char} should be signed or unsigned by default. The user can
always override this default with the options @option{-fsigned-char}
and @option{-funsigned-char}.
@end defmac
@defmac DEFAULT_SHORT_ENUMS
A C expression to determine whether to give an @code{enum} type
only as many bytes as it takes to represent the range of possible values
of that type. A nonzero value means to do that; a zero value means all
@code{enum} types should be allocated like @code{int}.
If you don't define the macro, the default is 0.
@end defmac
@defmac SIZE_TYPE
A C expression for a string describing the name of the data type to use
for size values. The typedef name @code{size_t} is defined using the
contents of the string.
The string can contain more than one keyword. If so, separate them with
spaces, and write first any length keyword, then @code{unsigned} if
appropriate, and finally @code{int}. The string must exactly match one
of the data type names defined in the function
@code{init_decl_processing} in the file @file{c-decl.c}. You may not
omit @code{int} or change the order---that would cause the compiler to
crash on startup.
If you don't define this macro, the default is @code{"long unsigned
int"}.
@end defmac
@defmac PTRDIFF_TYPE
A C expression for a string describing the name of the data type to use
for the result of subtracting two pointers. The typedef name
@code{ptrdiff_t} is defined using the contents of the string. See
@code{SIZE_TYPE} above for more information.
If you don't define this macro, the default is @code{"long int"}.
@end defmac
@defmac WCHAR_TYPE
A C expression for a string describing the name of the data type to use
for wide characters. The typedef name @code{wchar_t} is defined using
the contents of the string. See @code{SIZE_TYPE} above for more
information.
If you don't define this macro, the default is @code{"int"}.
@end defmac
@defmac WCHAR_TYPE_SIZE
A C expression for the size in bits of the data type for wide
characters. This is used in @code{cpp}, which cannot make use of
@code{WCHAR_TYPE}.
@end defmac
@defmac MAX_WCHAR_TYPE_SIZE
Maximum number for the size in bits of the data type for wide
characters. If this is undefined, the default is
@code{WCHAR_TYPE_SIZE}. Otherwise, it is the constant value that is the
largest value that @code{WCHAR_TYPE_SIZE} can have at run-time. This is
used in @code{cpp}.
@end defmac
@defmac GCOV_TYPE_SIZE
A C expression for the size in bits of the type used for gcov counters on the
target machine. If you don't define this, the default is one
@code{LONG_TYPE_SIZE} in case it is greater or equal to 64-bit and
@code{LONG_LONG_TYPE_SIZE} otherwise. You may want to re-define the type to
ensure atomicity for counters in multithreaded programs.
@end defmac
@defmac WINT_TYPE
A C expression for a string describing the name of the data type to
use for wide characters passed to @code{printf} and returned from
@code{getwc}. The typedef name @code{wint_t} is defined using the
contents of the string. See @code{SIZE_TYPE} above for more
information.
If you don't define this macro, the default is @code{"unsigned int"}.
@end defmac
@defmac INTMAX_TYPE
A C expression for a string describing the name of the data type that
can represent any value of any standard or extended signed integer type.
The typedef name @code{intmax_t} is defined using the contents of the
string. See @code{SIZE_TYPE} above for more information.
If you don't define this macro, the default is the first of
@code{"int"}, @code{"long int"}, or @code{"long long int"} that has as
much precision as @code{long long int}.
@end defmac
@defmac UINTMAX_TYPE
A C expression for a string describing the name of the data type that
can represent any value of any standard or extended unsigned integer
type. The typedef name @code{uintmax_t} is defined using the contents
of the string. See @code{SIZE_TYPE} above for more information.
If you don't define this macro, the default is the first of
@code{"unsigned int"}, @code{"long unsigned int"}, or @code{"long long
unsigned int"} that has as much precision as @code{long long unsigned
int}.
@end defmac
@defmac TARGET_PTRMEMFUNC_VBIT_LOCATION
The C++ compiler represents a pointer-to-member-function with a struct
that looks like:
@example
struct @{
union @{
void (*fn)();
ptrdiff_t vtable_index;
@};
ptrdiff_t delta;
@};
@end example
@noindent
The C++ compiler must use one bit to indicate whether the function that
will be called through a pointer-to-member-function is virtual.
Normally, we assume that the low-order bit of a function pointer must
always be zero. Then, by ensuring that the vtable_index is odd, we can
distinguish which variant of the union is in use. But, on some
platforms function pointers can be odd, and so this doesn't work. In
that case, we use the low-order bit of the @code{delta} field, and shift
the remainder of the @code{delta} field to the left.
GCC will automatically make the right selection about where to store
this bit using the @code{FUNCTION_BOUNDARY} setting for your platform.
However, some platforms such as ARM/Thumb have @code{FUNCTION_BOUNDARY}
set such that functions always start at even addresses, but the lowest
bit of pointers to functions indicate whether the function at that
address is in ARM or Thumb mode. If this is the case of your
architecture, you should define this macro to
@code{ptrmemfunc_vbit_in_delta}.
In general, you should not have to define this macro. On architectures
in which function addresses are always even, according to
@code{FUNCTION_BOUNDARY}, GCC will automatically define this macro to
@code{ptrmemfunc_vbit_in_pfn}.
@end defmac
@defmac TARGET_VTABLE_USES_DESCRIPTORS
Normally, the C++ compiler uses function pointers in vtables. This
macro allows the target to change to use ``function descriptors''
instead. Function descriptors are found on targets for whom a
function pointer is actually a small data structure. Normally the
data structure consists of the actual code address plus a data
pointer to which the function's data is relative.
If vtables are used, the value of this macro should be the number
of words that the function descriptor occupies.
@end defmac
@defmac TARGET_VTABLE_ENTRY_ALIGN
By default, the vtable entries are void pointers, the so the alignment
is the same as pointer alignment. The value of this macro specifies
the alignment of the vtable entry in bits. It should be defined only
when special alignment is necessary. */
@end defmac
@defmac TARGET_VTABLE_DATA_ENTRY_DISTANCE
There are a few non-descriptor entries in the vtable at offsets below
zero. If these entries must be padded (say, to preserve the alignment
specified by @code{TARGET_VTABLE_ENTRY_ALIGN}), set this to the number
of words in each data entry.
@end defmac
@node Escape Sequences
@section Target Character Escape Sequences
@cindex escape sequences
By default, GCC assumes that the C character escape sequences take on
their ASCII values for the target. If this is not correct, you must
explicitly define all of the macros below. All of them must evaluate
to constants; they are used in @code{case} statements.
@findex TARGET_BELL
@findex TARGET_CR
@findex TARGET_ESC
@findex TARGET_FF
@findex TARGET_NEWLINE
@findex TARGET_TAB
@findex TARGET_VT
@multitable {@code{TARGET_NEWLINE}} {Escape} {ASCII character}
@item Macro @tab Escape @tab ASCII character
@item @code{TARGET_BELL} @tab @kbd{\a} @tab @code{07}, @code{BEL}
@item @code{TARGET_CR} @tab @kbd{\r} @tab @code{0D}, @code{CR}
@item @code{TARGET_ESC} @tab @kbd{\e}, @kbd{\E} @tab @code{1B}, @code{ESC}
@item @code{TARGET_FF} @tab @kbd{\f} @tab @code{0C}, @code{FF}
@item @code{TARGET_NEWLINE} @tab @kbd{\n} @tab @code{0A}, @code{LF}
@item @code{TARGET_TAB} @tab @kbd{\t} @tab @code{09}, @code{HT}
@item @code{TARGET_VT} @tab @kbd{\v} @tab @code{0B}, @code{VT}
@end multitable
@noindent
Note that the @kbd{\e} and @kbd{\E} escapes are GNU extensions, not
part of the C standard.
@node Registers
@section Register Usage
@cindex register usage
This section explains how to describe what registers the target machine
has, and how (in general) they can be used.
The description of which registers a specific instruction can use is
done with register classes; see @ref{Register Classes}. For information
on using registers to access a stack frame, see @ref{Frame Registers}.
For passing values in registers, see @ref{Register Arguments}.
For returning values in registers, see @ref{Scalar Return}.
@menu
* Register Basics:: Number and kinds of registers.
* Allocation Order:: Order in which registers are allocated.
* Values in Registers:: What kinds of values each reg can hold.
* Leaf Functions:: Renumbering registers for leaf functions.
* Stack Registers:: Handling a register stack such as 80387.
@end menu
@node Register Basics
@subsection Basic Characteristics of Registers
@c prevent bad page break with this line
Registers have various characteristics.
@defmac FIRST_PSEUDO_REGISTER
Number of hardware registers known to the compiler. They receive
numbers 0 through @code{FIRST_PSEUDO_REGISTER-1}; thus, the first
pseudo register's number really is assigned the number
@code{FIRST_PSEUDO_REGISTER}.
@end defmac
@defmac FIXED_REGISTERS
@cindex fixed register
An initializer that says which registers are used for fixed purposes
all throughout the compiled code and are therefore not available for
general allocation. These would include the stack pointer, the frame
pointer (except on machines where that can be used as a general
register when no frame pointer is needed), the program counter on
machines where that is considered one of the addressable registers,
and any other numbered register with a standard use.
This information is expressed as a sequence of numbers, separated by
commas and surrounded by braces. The @var{n}th number is 1 if
register @var{n} is fixed, 0 otherwise.
The table initialized from this macro, and the table initialized by
the following one, may be overridden at run time either automatically,
by the actions of the macro @code{CONDITIONAL_REGISTER_USAGE}, or by
the user with the command options @option{-ffixed-@var{reg}},
@option{-fcall-used-@var{reg}} and @option{-fcall-saved-@var{reg}}.
@end defmac
@defmac CALL_USED_REGISTERS
@cindex call-used register
@cindex call-clobbered register
@cindex call-saved register
Like @code{FIXED_REGISTERS} but has 1 for each register that is
clobbered (in general) by function calls as well as for fixed
registers. This macro therefore identifies the registers that are not
available for general allocation of values that must live across
function calls.
If a register has 0 in @code{CALL_USED_REGISTERS}, the compiler
automatically saves it on function entry and restores it on function
exit, if the register is used within the function.
@end defmac
@defmac CALL_REALLY_USED_REGISTERS
@cindex call-used register
@cindex call-clobbered register
@cindex call-saved register
Like @code{CALL_USED_REGISTERS} except this macro doesn't require
that the entire set of @code{FIXED_REGISTERS} be included.
(@code{CALL_USED_REGISTERS} must be a superset of @code{FIXED_REGISTERS}).
This macro is optional. If not specified, it defaults to the value
of @code{CALL_USED_REGISTERS}.
@end defmac
@defmac HARD_REGNO_CALL_PART_CLOBBERED (@var{regno}, @var{mode})
@cindex call-used register
@cindex call-clobbered register
@cindex call-saved register
A C expression that is nonzero if it is not permissible to store a
value of mode @var{mode} in hard register number @var{regno} across a
call without some part of it being clobbered. For most machines this
macro need not be defined. It is only required for machines that do not
preserve the entire contents of a register across a call.
@end defmac
@findex fixed_regs
@findex call_used_regs
@findex global_regs
@findex reg_names
@findex reg_class_contents
@defmac CONDITIONAL_REGISTER_USAGE
Zero or more C statements that may conditionally modify five variables
@code{fixed_regs}, @code{call_used_regs}, @code{global_regs},
@code{reg_names}, and @code{reg_class_contents}, to take into account
any dependence of these register sets on target flags. The first three
of these are of type @code{char []} (interpreted as Boolean vectors).
@code{global_regs} is a @code{const char *[]}, and
@code{reg_class_contents} is a @code{HARD_REG_SET}. Before the macro is
called, @code{fixed_regs}, @code{call_used_regs},
@code{reg_class_contents}, and @code{reg_names} have been initialized
from @code{FIXED_REGISTERS}, @code{CALL_USED_REGISTERS},
@code{REG_CLASS_CONTENTS}, and @code{REGISTER_NAMES}, respectively.
@code{global_regs} has been cleared, and any @option{-ffixed-@var{reg}},
@option{-fcall-used-@var{reg}} and @option{-fcall-saved-@var{reg}}
command options have been applied.
You need not define this macro if it has no work to do.
@cindex disabling certain registers
@cindex controlling register usage
If the usage of an entire class of registers depends on the target
flags, you may indicate this to GCC by using this macro to modify
@code{fixed_regs} and @code{call_used_regs} to 1 for each of the
registers in the classes which should not be used by GCC@. Also define
the macro @code{REG_CLASS_FROM_LETTER} / @code{REG_CLASS_FROM_CONSTRAINT}
to return @code{NO_REGS} if it
is called with a letter for a class that shouldn't be used.
(However, if this class is not included in @code{GENERAL_REGS} and all
of the insn patterns whose constraints permit this class are
controlled by target switches, then GCC will automatically avoid using
these registers when the target switches are opposed to them.)
@end defmac
@defmac NON_SAVING_SETJMP
If this macro is defined and has a nonzero value, it means that
@code{setjmp} and related functions fail to save the registers, or that
@code{longjmp} fails to restore them. To compensate, the compiler
avoids putting variables in registers in functions that use
@code{setjmp}.
@end defmac
@defmac INCOMING_REGNO (@var{out})
Define this macro if the target machine has register windows. This C
expression returns the register number as seen by the called function
corresponding to the register number @var{out} as seen by the calling
function. Return @var{out} if register number @var{out} is not an
outbound register.
@end defmac
@defmac OUTGOING_REGNO (@var{in})
Define this macro if the target machine has register windows. This C
expression returns the register number as seen by the calling function
corresponding to the register number @var{in} as seen by the called
function. Return @var{in} if register number @var{in} is not an inbound
register.
@end defmac
@defmac LOCAL_REGNO (@var{regno})
Define this macro if the target machine has register windows. This C
expression returns true if the register is call-saved but is in the
register window. Unlike most call-saved registers, such registers
need not be explicitly restored on function exit or during non-local
gotos.
@end defmac
@defmac PC_REGNUM
If the program counter has a register number, define this as that
register number. Otherwise, do not define it.
@end defmac
@node Allocation Order
@subsection Order of Allocation of Registers
@cindex order of register allocation
@cindex register allocation order
@c prevent bad page break with this line
Registers are allocated in order.
@defmac REG_ALLOC_ORDER
If defined, an initializer for a vector of integers, containing the
numbers of hard registers in the order in which GCC should prefer
to use them (from most preferred to least).
If this macro is not defined, registers are used lowest numbered first
(all else being equal).
One use of this macro is on machines where the highest numbered
registers must always be saved and the save-multiple-registers
instruction supports only sequences of consecutive registers. On such
machines, define @code{REG_ALLOC_ORDER} to be an initializer that lists
the highest numbered allocable register first.
@end defmac
@defmac ORDER_REGS_FOR_LOCAL_ALLOC
A C statement (sans semicolon) to choose the order in which to allocate
hard registers for pseudo-registers local to a basic block.
Store the desired register order in the array @code{reg_alloc_order}.
Element 0 should be the register to allocate first; element 1, the next
register; and so on.
The macro body should not assume anything about the contents of
@code{reg_alloc_order} before execution of the macro.
On most machines, it is not necessary to define this macro.
@end defmac
@node Values in Registers
@subsection How Values Fit in Registers
This section discusses the macros that describe which kinds of values
(specifically, which machine modes) each register can hold, and how many
consecutive registers are needed for a given mode.
@defmac HARD_REGNO_NREGS (@var{regno}, @var{mode})
A C expression for the number of consecutive hard registers, starting
at register number @var{regno}, required to hold a value of mode
@var{mode}.
On a machine where all registers are exactly one word, a suitable
definition of this macro is
@smallexample
#define HARD_REGNO_NREGS(REGNO, MODE) \
((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) \
/ UNITS_PER_WORD)
@end smallexample
@end defmac
@defmac HARD_REGNO_MODE_OK (@var{regno}, @var{mode})
A C expression that is nonzero if it is permissible to store a value
of mode @var{mode} in hard register number @var{regno} (or in several
registers starting with that one). For a machine where all registers
are equivalent, a suitable definition is
@smallexample
#define HARD_REGNO_MODE_OK(REGNO, MODE) 1
@end smallexample
You need not include code to check for the numbers of fixed registers,
because the allocation mechanism considers them to be always occupied.
@cindex register pairs
On some machines, double-precision values must be kept in even/odd
register pairs. You can implement that by defining this macro to reject
odd register numbers for such modes.
The minimum requirement for a mode to be OK in a register is that the
@samp{mov@var{mode}} instruction pattern support moves between the
register and other hard register in the same class and that moving a
value into the register and back out not alter it.
Since the same instruction used to move @code{word_mode} will work for
all narrower integer modes, it is not necessary on any machine for
@code{HARD_REGNO_MODE_OK} to distinguish between these modes, provided
you define patterns @samp{movhi}, etc., to take advantage of this. This
is useful because of the interaction between @code{HARD_REGNO_MODE_OK}
and @code{MODES_TIEABLE_P}; it is very desirable for all integer modes
to be tieable.
Many machines have special registers for floating point arithmetic.
Often people assume that floating point machine modes are allowed only
in floating point registers. This is not true. Any registers that
can hold integers can safely @emph{hold} a floating point machine
mode, whether or not floating arithmetic can be done on it in those
registers. Integer move instructions can be used to move the values.
On some machines, though, the converse is true: fixed-point machine
modes may not go in floating registers. This is true if the floating
registers normalize any value stored in them, because storing a
non-floating value there would garble it. In this case,
@code{HARD_REGNO_MODE_OK} should reject fixed-point machine modes in
floating registers. But if the floating registers do not automatically
normalize, if you can store any bit pattern in one and retrieve it
unchanged without a trap, then any machine mode may go in a floating
register, so you can define this macro to say so.
The primary significance of special floating registers is rather that
they are the registers acceptable in floating point arithmetic
instructions. However, this is of no concern to
@code{HARD_REGNO_MODE_OK}. You handle it by writing the proper
constraints for those instructions.
On some machines, the floating registers are especially slow to access,
so that it is better to store a value in a stack frame than in such a
register if floating point arithmetic is not being done. As long as the
floating registers are not in class @code{GENERAL_REGS}, they will not
be used unless some pattern's constraint asks for one.
@end defmac
@defmac MODES_TIEABLE_P (@var{mode1}, @var{mode2})
A C expression that is nonzero if a value of mode
@var{mode1} is accessible in mode @var{mode2} without copying.
If @code{HARD_REGNO_MODE_OK (@var{r}, @var{mode1})} and
@code{HARD_REGNO_MODE_OK (@var{r}, @var{mode2})} are always the same for
any @var{r}, then @code{MODES_TIEABLE_P (@var{mode1}, @var{mode2})}
should be nonzero. If they differ for any @var{r}, you should define
this macro to return zero unless some other mechanism ensures the
accessibility of the value in a narrower mode.
You should define this macro to return nonzero in as many cases as
possible since doing so will allow GCC to perform better register
allocation.
@end defmac
@defmac AVOID_CCMODE_COPIES
Define this macro if the compiler should avoid copies to/from @code{CCmode}
registers. You should only define this macro if support for copying to/from
@code{CCmode} is incomplete.
@end defmac
@node Leaf Functions
@subsection Handling Leaf Functions
@cindex leaf functions
@cindex functions, leaf
On some machines, a leaf function (i.e., one which makes no calls) can run
more efficiently if it does not make its own register window. Often this
means it is required to receive its arguments in the registers where they
are passed by the caller, instead of the registers where they would
normally arrive.
The special treatment for leaf functions generally applies only when
other conditions are met; for example, often they may use only those
registers for its own variables and temporaries. We use the term ``leaf
function'' to mean a function that is suitable for this special
handling, so that functions with no calls are not necessarily ``leaf
functions''.
GCC assigns register numbers before it knows whether the function is
suitable for leaf function treatment. So it needs to renumber the
registers in order to output a leaf function. The following macros
accomplish this.
@defmac LEAF_REGISTERS
Name of a char vector, indexed by hard register number, which
contains 1 for a register that is allowable in a candidate for leaf
function treatment.
If leaf function treatment involves renumbering the registers, then the
registers marked here should be the ones before renumbering---those that
GCC would ordinarily allocate. The registers which will actually be
used in the assembler code, after renumbering, should not be marked with 1
in this vector.
Define this macro only if the target machine offers a way to optimize
the treatment of leaf functions.
@end defmac
@defmac LEAF_REG_REMAP (@var{regno})
A C expression whose value is the register number to which @var{regno}
should be renumbered, when a function is treated as a leaf function.
If @var{regno} is a register number which should not appear in a leaf
function before renumbering, then the expression should yield @minus{}1, which
will cause the compiler to abort.
Define this macro only if the target machine offers a way to optimize the
treatment of leaf functions, and registers need to be renumbered to do
this.
@end defmac
@findex current_function_is_leaf
@findex current_function_uses_only_leaf_regs
@code{TARGET_ASM_FUNCTION_PROLOGUE} and
@code{TARGET_ASM_FUNCTION_EPILOGUE} must usually treat leaf functions
specially. They can test the C variable @code{current_function_is_leaf}
which is nonzero for leaf functions. @code{current_function_is_leaf} is
set prior to local register allocation and is valid for the remaining
compiler passes. They can also test the C variable
@code{current_function_uses_only_leaf_regs} which is nonzero for leaf
functions which only use leaf registers.
@code{current_function_uses_only_leaf_regs} is valid after reload and is
only useful if @code{LEAF_REGISTERS} is defined.
@c changed this to fix overfull. ALSO: why the "it" at the beginning
@c of the next paragraph?! --mew 2feb93
@node Stack Registers
@subsection Registers That Form a Stack
There are special features to handle computers where some of the
``registers'' form a stack. Stack registers are normally written by
pushing onto the stack, and are numbered relative to the top of the
stack.
Currently, GCC can only handle one group of stack-like registers, and
they must be consecutively numbered. Furthermore, the existing
support for stack-like registers is specific to the 80387 floating
point coprocessor. If you have a new architecture that uses
stack-like registers, you will need to do substantial work on
@file{reg-stack.c} and write your machine description to cooperate
with it, as well as defining these macros.
@defmac STACK_REGS
Define this if the machine has any stack-like registers.
@end defmac
@defmac FIRST_STACK_REG
The number of the first stack-like register. This one is the top
of the stack.
@end defmac
@defmac LAST_STACK_REG
The number of the last stack-like register. This one is the bottom of
the stack.
@end defmac
@node Register Classes
@section Register Classes
@cindex register class definitions
@cindex class definitions, register
On many machines, the numbered registers are not all equivalent.
For example, certain registers may not be allowed for indexed addressing;
certain registers may not be allowed in some instructions. These machine
restrictions are described to the compiler using @dfn{register classes}.
You define a number of register classes, giving each one a name and saying
which of the registers belong to it. Then you can specify register classes
that are allowed as operands to particular instruction patterns.
@findex ALL_REGS
@findex NO_REGS
In general, each register will belong to several classes. In fact, one
class must be named @code{ALL_REGS} and contain all the registers. Another
class must be named @code{NO_REGS} and contain no registers. Often the
union of two classes will be another class; however, this is not required.
@findex GENERAL_REGS
One of the classes must be named @code{GENERAL_REGS}. There is nothing
terribly special about the name, but the operand constraint letters
@samp{r} and @samp{g} specify this class. If @code{GENERAL_REGS} is
the same as @code{ALL_REGS}, just define it as a macro which expands
to @code{ALL_REGS}.
Order the classes so that if class @var{x} is contained in class @var{y}
then @var{x} has a lower class number than @var{y}.
The way classes other than @code{GENERAL_REGS} are specified in operand
constraints is through machine-dependent operand constraint letters.
You can define such letters to correspond to various classes, then use
them in operand constraints.
You should define a class for the union of two classes whenever some
instruction allows both classes. For example, if an instruction allows
either a floating point (coprocessor) register or a general register for a
certain operand, you should define a class @code{FLOAT_OR_GENERAL_REGS}
which includes both of them. Otherwise you will get suboptimal code.
You must also specify certain redundant information about the register
classes: for each class, which classes contain it and which ones are
contained in it; for each pair of classes, the largest class contained
in their union.
When a value occupying several consecutive registers is expected in a
certain class, all the registers used must belong to that class.
Therefore, register classes cannot be used to enforce a requirement for
a register pair to start with an even-numbered register. The way to
specify this requirement is with @code{HARD_REGNO_MODE_OK}.
Register classes used for input-operands of bitwise-and or shift
instructions have a special requirement: each such class must have, for
each fixed-point machine mode, a subclass whose registers can transfer that
mode to or from memory. For example, on some machines, the operations for
single-byte values (@code{QImode}) are limited to certain registers. When
this is so, each register class that is used in a bitwise-and or shift
instruction must have a subclass consisting of registers from which
single-byte values can be loaded or stored. This is so that
@code{PREFERRED_RELOAD_CLASS} can always have a possible value to return.
@deftp {Data type} {enum reg_class}
An enumeral type that must be defined with all the register class names
as enumeral values. @code{NO_REGS} must be first. @code{ALL_REGS}
must be the last register class, followed by one more enumeral value,
@code{LIM_REG_CLASSES}, which is not a register class but rather
tells how many classes there are.
Each register class has a number, which is the value of casting
the class name to type @code{int}. The number serves as an index
in many of the tables described below.
@end deftp
@defmac N_REG_CLASSES
The number of distinct register classes, defined as follows:
@example
#define N_REG_CLASSES (int) LIM_REG_CLASSES
@end example
@end defmac
@defmac REG_CLASS_NAMES
An initializer containing the names of the register classes as C string
constants. These names are used in writing some of the debugging dumps.
@end defmac
@defmac REG_CLASS_CONTENTS
An initializer containing the contents of the register classes, as integers
which are bit masks. The @var{n}th integer specifies the contents of class
@var{n}. The way the integer @var{mask} is interpreted is that
register @var{r} is in the class if @code{@var{mask} & (1 << @var{r})} is 1.
When the machine has more than 32 registers, an integer does not suffice.
Then the integers are replaced by sub-initializers, braced groupings containing
several integers. Each sub-initializer must be suitable as an initializer
for the type @code{HARD_REG_SET} which is defined in @file{hard-reg-set.h}.
In this situation, the first integer in each sub-initializer corresponds to
registers 0 through 31, the second integer to registers 32 through 63, and
so on.
@end defmac
@defmac REGNO_REG_CLASS (@var{regno})
A C expression whose value is a register class containing hard register
@var{regno}. In general there is more than one such class; choose a class
which is @dfn{minimal}, meaning that no smaller class also contains the
register.
@end defmac
@defmac BASE_REG_CLASS
A macro whose definition is the name of the class to which a valid
base register must belong. A base register is one used in an address
which is the register value plus a displacement.
@end defmac
@defmac MODE_BASE_REG_CLASS (@var{mode})
This is a variation of the @code{BASE_REG_CLASS} macro which allows
the selection of a base register in a mode dependent manner. If
@var{mode} is VOIDmode then it should return the same value as
@code{BASE_REG_CLASS}.
@end defmac
@defmac INDEX_REG_CLASS
A macro whose definition is the name of the class to which a valid
index register must belong. An index register is one used in an
address where its value is either multiplied by a scale factor or
added to another register (as well as added to a displacement).
@end defmac
@defmac CONSTRAINT_LEN (@var{char}, @var{str})
For the constraint at the start of @var{str}, which starts with the letter
@var{c}, return the length. This allows you to have register class /
constant / extra constraints that are longer than a single letter;
you don't need to define this macro if you can do with single-letter
constraints only. The definition of this macro should use
DEFAULT_CONSTRAINT_LEN for all the characters that you don't want
to handle specially.
There are some sanity checks in genoutput.c that check the constraint lengths
for the md file, so you can also use this macro to help you while you are
transitioning from a byzantine single-letter-constraint scheme: when you
return a negative length for a constraint you want to re-use, genoutput
will complain about every instance where it is used in the md file.
@end defmac
@defmac REG_CLASS_FROM_LETTER (@var{char})
A C expression which defines the machine-dependent operand constraint
letters for register classes. If @var{char} is such a letter, the
value should be the register class corresponding to it. Otherwise,
the value should be @code{NO_REGS}. The register letter @samp{r},
corresponding to class @code{GENERAL_REGS}, will not be passed
to this macro; you do not need to handle it.
@end defmac
@defmac REG_CLASS_FROM_CONSTRAINT (@var{char}, @var{str})
Like @code{REG_CLASS_FROM_LETTER}, but you also get the constraint string
passed in @var{str}, so that you can use suffixes to distinguish between
different variants.
@end defmac
@defmac REGNO_OK_FOR_BASE_P (@var{num})
A C expression which is nonzero if register number @var{num} is
suitable for use as a base register in operand addresses. It may be
either a suitable hard register or a pseudo register that has been
allocated such a hard register.
@end defmac
@defmac REGNO_MODE_OK_FOR_BASE_P (@var{num}, @var{mode})
A C expression that is just like @code{REGNO_OK_FOR_BASE_P}, except that
that expression may examine the mode of the memory reference in
@var{mode}. You should define this macro if the mode of the memory
reference affects whether a register may be used as a base register. If
you define this macro, the compiler will use it instead of
@code{REGNO_OK_FOR_BASE_P}.
@end defmac
@defmac REGNO_OK_FOR_INDEX_P (@var{num})
A C expression which is nonzero if register number @var{num} is
suitable for use as an index register in operand addresses. It may be
either a suitable hard register or a pseudo register that has been
allocated such a hard register.
The difference between an index register and a base register is that
the index register may be scaled. If an address involves the sum of
two registers, neither one of them scaled, then either one may be
labeled the ``base'' and the other the ``index''; but whichever
labeling is used must fit the machine's constraints of which registers
may serve in each capacity. The compiler will try both labelings,
looking for one that is valid, and will reload one or both registers
only if neither labeling works.
@end defmac
@defmac PREFERRED_RELOAD_CLASS (@var{x}, @var{class})
A C expression that places additional restrictions on the register class
to use when it is necessary to copy value @var{x} into a register in class
@var{class}. The value is a register class; perhaps @var{class}, or perhaps
another, smaller class. On many machines, the following definition is
safe:
@example
#define PREFERRED_RELOAD_CLASS(X,CLASS) CLASS
@end example
Sometimes returning a more restrictive class makes better code. For
example, on the 68000, when @var{x} is an integer constant that is in range
for a @samp{moveq} instruction, the value of this macro is always
@code{DATA_REGS} as long as @var{class} includes the data registers.
Requiring a data register guarantees that a @samp{moveq} will be used.
If @var{x} is a @code{const_double}, by returning @code{NO_REGS}
you can force @var{x} into a memory constant. This is useful on
certain machines where immediate floating values cannot be loaded into
certain kinds of registers.
@end defmac
@defmac PREFERRED_OUTPUT_RELOAD_CLASS (@var{x}, @var{class})
Like @code{PREFERRED_RELOAD_CLASS}, but for output reloads instead of
input reloads. If you don't define this macro, the default is to use
@var{class}, unchanged.
@end defmac
@defmac LIMIT_RELOAD_CLASS (@var{mode}, @var{class})
A C expression that places additional restrictions on the register class
to use when it is necessary to be able to hold a value of mode
@var{mode} in a reload register for which class @var{class} would
ordinarily be used.
Unlike @code{PREFERRED_RELOAD_CLASS}, this macro should be used when
there are certain modes that simply can't go in certain reload classes.
The value is a register class; perhaps @var{class}, or perhaps another,
smaller class.
Don't define this macro unless the target machine has limitations which
require the macro to do something nontrivial.
@end defmac
@defmac SECONDARY_RELOAD_CLASS (@var{class}, @var{mode}, @var{x})
@defmacx SECONDARY_INPUT_RELOAD_CLASS (@var{class}, @var{mode}, @var{x})
@defmacx SECONDARY_OUTPUT_RELOAD_CLASS (@var{class}, @var{mode}, @var{x})
Many machines have some registers that cannot be copied directly to or
from memory or even from other types of registers. An example is the
@samp{MQ} register, which on most machines, can only be copied to or
from general registers, but not memory. Some machines allow copying all
registers to and from memory, but require a scratch register for stores
to some memory locations (e.g., those with symbolic address on the RT,
and those with certain symbolic address on the SPARC when compiling
PIC)@. In some cases, both an intermediate and a scratch register are
required.
You should define these macros to indicate to the reload phase that it may
need to allocate at least one register for a reload in addition to the
register to contain the data. Specifically, if copying @var{x} to a
register @var{class} in @var{mode} requires an intermediate register,
you should define @code{SECONDARY_INPUT_RELOAD_CLASS} to return the
largest register class all of whose registers can be used as
intermediate registers or scratch registers.
If copying a register @var{class} in @var{mode} to @var{x} requires an
intermediate or scratch register, @code{SECONDARY_OUTPUT_RELOAD_CLASS}
should be defined to return the largest register class required. If the
requirements for input and output reloads are the same, the macro
@code{SECONDARY_RELOAD_CLASS} should be used instead of defining both
macros identically.
The values returned by these macros are often @code{GENERAL_REGS}.
Return @code{NO_REGS} if no spare register is needed; i.e., if @var{x}
can be directly copied to or from a register of @var{class} in
@var{mode} without requiring a scratch register. Do not define this
macro if it would always return @code{NO_REGS}.
If a scratch register is required (either with or without an
intermediate register), you should define patterns for
@samp{reload_in@var{m}} or @samp{reload_out@var{m}}, as required
(@pxref{Standard Names}. These patterns, which will normally be
implemented with a @code{define_expand}, should be similar to the
@samp{mov@var{m}} patterns, except that operand 2 is the scratch
register.
Define constraints for the reload register and scratch register that
contain a single register class. If the original reload register (whose
class is @var{class}) can meet the constraint given in the pattern, the
value returned by these macros is used for the class of the scratch
register. Otherwise, two additional reload registers are required.
Their classes are obtained from the constraints in the insn pattern.
@var{x} might be a pseudo-register or a @code{subreg} of a
pseudo-register, which could either be in a hard register or in memory.
Use @code{true_regnum} to find out; it will return @minus{}1 if the pseudo is
in memory and the hard register number if it is in a register.
These macros should not be used in the case where a particular class of
registers can only be copied to memory and not to another class of
registers. In that case, secondary reload registers are not needed and
would not be helpful. Instead, a stack location must be used to perform
the copy and the @code{mov@var{m}} pattern should use memory as an
intermediate storage. This case often occurs between floating-point and
general registers.
@end defmac
@defmac SECONDARY_MEMORY_NEEDED (@var{class1}, @var{class2}, @var{m})
Certain machines have the property that some registers cannot be copied
to some other registers without using memory. Define this macro on
those machines to be a C expression that is nonzero if objects of mode
@var{m} in registers of @var{class1} can only be copied to registers of
class @var{class2} by storing a register of @var{class1} into memory
and loading that memory location into a register of @var{class2}.
Do not define this macro if its value would always be zero.
@end defmac
@defmac SECONDARY_MEMORY_NEEDED_RTX (@var{mode})
Normally when @code{SECONDARY_MEMORY_NEEDED} is defined, the compiler
allocates a stack slot for a memory location needed for register copies.
If this macro is defined, the compiler instead uses the memory location
defined by this macro.
Do not define this macro if you do not define
@code{SECONDARY_MEMORY_NEEDED}.
@end defmac
@defmac SECONDARY_MEMORY_NEEDED_MODE (@var{mode})
When the compiler needs a secondary memory location to copy between two
registers of mode @var{mode}, it normally allocates sufficient memory to
hold a quantity of @code{BITS_PER_WORD} bits and performs the store and
load operations in a mode that many bits wide and whose class is the
same as that of @var{mode}.
This is right thing to do on most machines because it ensures that all
bits of the register are copied and prevents accesses to the registers
in a narrower mode, which some machines prohibit for floating-point
registers.
However, this default behavior is not correct on some machines, such as
the DEC Alpha, that store short integers in floating-point registers
differently than in integer registers. On those machines, the default
widening will not work correctly and you must define this macro to
suppress that widening in some cases. See the file @file{alpha.h} for
details.
Do not define this macro if you do not define
@code{SECONDARY_MEMORY_NEEDED} or if widening @var{mode} to a mode that
is @code{BITS_PER_WORD} bits wide is correct for your machine.
@end defmac
@defmac SMALL_REGISTER_CLASSES
On some machines, it is risky to let hard registers live across arbitrary
insns. Typically, these machines have instructions that require values
to be in specific registers (like an accumulator), and reload will fail
if the required hard register is used for another purpose across such an
insn.
Define @code{SMALL_REGISTER_CLASSES} to be an expression with a nonzero
value on these machines. When this macro has a nonzero value, the
compiler will try to minimize the lifetime of hard registers.
It is always safe to define this macro with a nonzero value, but if you
unnecessarily define it, you will reduce the amount of optimizations
that can be performed in some cases. If you do not define this macro
with a nonzero value when it is required, the compiler will run out of
spill registers and print a fatal error message. For most machines, you
should not define this macro at all.
@end defmac
@defmac CLASS_LIKELY_SPILLED_P (@var{class})
A C expression whose value is nonzero if pseudos that have been assigned
to registers of class @var{class} would likely be spilled because
registers of @var{class} are needed for spill registers.
The default value of this macro returns 1 if @var{class} has exactly one
register and zero otherwise. On most machines, this default should be
used. Only define this macro to some other expression if pseudos
allocated by @file{local-alloc.c} end up in memory because their hard
registers were needed for spill registers. If this macro returns nonzero
for those classes, those pseudos will only be allocated by
@file{global.c}, which knows how to reallocate the pseudo to another
register. If there would not be another register available for
reallocation, you should not change the definition of this macro since
the only effect of such a definition would be to slow down register
allocation.
@end defmac
@defmac CLASS_MAX_NREGS (@var{class}, @var{mode})
A C expression for the maximum number of consecutive registers
of class @var{class} needed to hold a value of mode @var{mode}.
This is closely related to the macro @code{HARD_REGNO_NREGS}. In fact,
the value of the macro @code{CLASS_MAX_NREGS (@var{class}, @var{mode})}
should be the maximum value of @code{HARD_REGNO_NREGS (@var{regno},
@var{mode})} for all @var{regno} values in the class @var{class}.
This macro helps control the handling of multiple-word values
in the reload pass.
@end defmac
@defmac CANNOT_CHANGE_MODE_CLASS (@var{from}, @var{to}, @var{class})
If defined, a C expression that returns nonzero for a @var{class} for which
a change from mode @var{from} to mode @var{to} is invalid.
For the example, loading 32-bit integer or floating-point objects into
floating-point registers on the Alpha extends them to 64 bits.
Therefore loading a 64-bit object and then storing it as a 32-bit object
does not store the low-order 32 bits, as would be the case for a normal
register. Therefore, @file{alpha.h} defines @code{CANNOT_CHANGE_MODE_CLASS}
as below:
@example
#define CANNOT_CHANGE_MODE_CLASS(FROM, TO, CLASS) \
(GET_MODE_SIZE (FROM) != GET_MODE_SIZE (TO) \
? reg_classes_intersect_p (FLOAT_REGS, (CLASS)) : 0)
@end example
@end defmac
Three other special macros describe which operands fit which constraint
letters.
@defmac CONST_OK_FOR_LETTER_P (@var{value}, @var{c})
A C expression that defines the machine-dependent operand constraint
letters (@samp{I}, @samp{J}, @samp{K}, @dots{} @samp{P}) that specify
particular ranges of integer values. If @var{c} is one of those
letters, the expression should check that @var{value}, an integer, is in
the appropriate range and return 1 if so, 0 otherwise. If @var{c} is
not one of those letters, the value should be 0 regardless of
@var{value}.
@end defmac
@defmac CONST_OK_FOR_CONSTRAINT_P (@var{value}, @var{c}, @var{str})
Like @code{CONST_OK_FOR_LETTER_P}, but you also get the constraint
string passed in @var{str}, so that you can use suffixes to distinguish
between different variants.
@end defmac
@defmac CONST_DOUBLE_OK_FOR_LETTER_P (@var{value}, @var{c})
A C expression that defines the machine-dependent operand constraint
letters that specify particular ranges of @code{const_double} values
(@samp{G} or @samp{H}).
If @var{c} is one of those letters, the expression should check that
@var{value}, an RTX of code @code{const_double}, is in the appropriate
range and return 1 if so, 0 otherwise. If @var{c} is not one of those
letters, the value should be 0 regardless of @var{value}.
@code{const_double} is used for all floating-point constants and for
@code{DImode} fixed-point constants. A given letter can accept either
or both kinds of values. It can use @code{GET_MODE} to distinguish
between these kinds.
@end defmac
@defmac CONST_DOUBLE_OK_FOR_CONSTRAINT_P (@var{value}, @var{c}, @var{str})
Like @code{CONST_DOUBLE_OK_FOR_LETTER_P}, but you also get the constraint
string passed in @var{str}, so that you can use suffixes to distinguish
between different variants.
@end defmac
@defmac EXTRA_CONSTRAINT (@var{value}, @var{c})
A C expression that defines the optional machine-dependent constraint
letters that can be used to segregate specific types of operands, usually
memory references, for the target machine. Any letter that is not
elsewhere defined and not matched by @code{REG_CLASS_FROM_LETTER} /
@code{REG_CLASS_FROM_CONSTRAINT}
may be used. Normally this macro will not be defined.
If it is required for a particular target machine, it should return 1
if @var{value} corresponds to the operand type represented by the
constraint letter @var{c}. If @var{c} is not defined as an extra
constraint, the value returned should be 0 regardless of @var{value}.
For example, on the ROMP, load instructions cannot have their output
in r0 if the memory reference contains a symbolic address. Constraint
letter @samp{Q} is defined as representing a memory address that does
@emph{not} contain a symbolic address. An alternative is specified with
a @samp{Q} constraint on the input and @samp{r} on the output. The next
alternative specifies @samp{m} on the input and a register class that
does not include r0 on the output.
@end defmac
@defmac EXTRA_CONSTRAINT_STR (@var{value}, @var{c}, @var{str})
Like @code{EXTRA_CONSTRAINT}, but you also get the constraint string passed
in @var{str}, so that you can use suffixes to distinguish between different
variants.
@end defmac
@defmac EXTRA_MEMORY_CONSTRAINT (@var{c}, @var{str})
A C expression that defines the optional machine-dependent constraint
letters, amongst those accepted by @code{EXTRA_CONSTRAINT}, that should
be treated like memory constraints by the reload pass.
It should return 1 if the operand type represented by the constraint
at the start of @var{str}, the first letter of which is the letter @var{c},
comprises a subset of all memory references including
all those whose address is simply a base register. This allows the reload
pass to reload an operand, if it does not directly correspond to the operand
type of @var{c}, by copying its address into a base register.
For example, on the S/390, some instructions do not accept arbitrary
memory references, but only those that do not make use of an index
register. The constraint letter @samp{Q} is defined via
@code{EXTRA_CONSTRAINT} as representing a memory address of this type.
If the letter @samp{Q} is marked as @code{EXTRA_MEMORY_CONSTRAINT},
a @samp{Q} constraint can handle any memory operand, because the
reload pass knows it can be reloaded by copying the memory address
into a base register if required. This is analogous to the way
a @samp{o} constraint can handle any memory operand.
@end defmac
@defmac EXTRA_ADDRESS_CONSTRAINT (@var{c}, @var{str})
A C expression that defines the optional machine-dependent constraint
letters, amongst those accepted by @code{EXTRA_CONSTRAINT} /
@code{EXTRA_CONSTRAINT_STR}, that should
be treated like address constraints by the reload pass.
It should return 1 if the operand type represented by the constraint
at the start of @var{str}, which starts with the letter @var{c}, comprises
a subset of all memory addresses including
all those that consist of just a base register. This allows the reload
pass to reload an operand, if it does not directly correspond to the operand
type of @var{str}, by copying it into a base register.
Any constraint marked as @code{EXTRA_ADDRESS_CONSTRAINT} can only
be used with the @code{address_operand} predicate. It is treated
analogously to the @samp{p} constraint.
@end defmac
@node Stack and Calling
@section Stack Layout and Calling Conventions
@cindex calling conventions
@c prevent bad page break with this line
This describes the stack layout and calling conventions.
@menu
* Frame Layout::
* Exception Handling::
* Stack Checking::
* Frame Registers::
* Elimination::
* Stack Arguments::
* Register Arguments::
* Scalar Return::
* Aggregate Return::
* Caller Saves::
* Function Entry::
* Profiling::
* Tail Calls::
@end menu
@node Frame Layout
@subsection Basic Stack Layout
@cindex stack frame layout
@cindex frame layout
@c prevent bad page break with this line
Here is the basic stack layout.
@defmac STACK_GROWS_DOWNWARD
Define this macro if pushing a word onto the stack moves the stack
pointer to a smaller address.
When we say, ``define this macro if @dots{},'' it means that the
compiler checks this macro only with @code{#ifdef} so the precise
definition used does not matter.
@end defmac
@defmac STACK_PUSH_CODE
This macro defines the operation used when something is pushed
on the stack. In RTL, a push operation will be
@code{(set (mem (STACK_PUSH_CODE (reg sp))) @dots{})}
The choices are @code{PRE_DEC}, @code{POST_DEC}, @code{PRE_INC},
and @code{POST_INC}. Which of these is correct depends on
the stack direction and on whether the stack pointer points
to the last item on the stack or whether it points to the
space for the next item on the stack.
The default is @code{PRE_DEC} when @code{STACK_GROWS_DOWNWARD} is
defined, which is almost always right, and @code{PRE_INC} otherwise,
which is often wrong.
@end defmac
@defmac FRAME_GROWS_DOWNWARD
Define this macro if the addresses of local variable slots are at negative
offsets from the frame pointer.
@end defmac
@defmac ARGS_GROW_DOWNWARD
Define this macro if successive arguments to a function occupy decreasing
addresses on the stack.
@end defmac
@defmac STARTING_FRAME_OFFSET
Offset from the frame pointer to the first local variable slot to be allocated.
If @code{FRAME_GROWS_DOWNWARD}, find the next slot's offset by
subtracting the first slot's length from @code{STARTING_FRAME_OFFSET}.
Otherwise, it is found by adding the length of the first slot to the
value @code{STARTING_FRAME_OFFSET}.
@c i'm not sure if the above is still correct.. had to change it to get
@c rid of an overfull. --mew 2feb93
@end defmac
@defmac STACK_ALIGNMENT_NEEDED
Define to zero to disable final alignment of the stack during reload.
The nonzero default for this macro is suitable for most ports.
On ports where @code{STARTING_FRAME_OFFSET} is nonzero or where there
is a register save block following the local block that doesn't require
alignment to @code{STACK_BOUNDARY}, it may be beneficial to disable
stack alignment and do it in the backend.
@end defmac
@defmac STACK_POINTER_OFFSET
Offset from the stack pointer register to the first location at which
outgoing arguments are placed. If not specified, the default value of
zero is used. This is the proper value for most machines.
If @code{ARGS_GROW_DOWNWARD}, this is the offset to the location above
the first location at which outgoing arguments are placed.
@end defmac
@defmac FIRST_PARM_OFFSET (@var{fundecl})
Offset from the argument pointer register to the first argument's
address. On some machines it may depend on the data type of the
function.
If @code{ARGS_GROW_DOWNWARD}, this is the offset to the location above
the first argument's address.
@end defmac
@defmac STACK_DYNAMIC_OFFSET (@var{fundecl})
Offset from the stack pointer register to an item dynamically allocated
on the stack, e.g., by @code{alloca}.
The default value for this macro is @code{STACK_POINTER_OFFSET} plus the
length of the outgoing arguments. The default is correct for most
machines. See @file{function.c} for details.
@end defmac
@defmac DYNAMIC_CHAIN_ADDRESS (@var{frameaddr})
A C expression whose value is RTL representing the address in a stack
frame where the pointer to the caller's frame is stored. Assume that
@var{frameaddr} is an RTL expression for the address of the stack frame
itself.
If you don't define this macro, the default is to return the value
of @var{frameaddr}---that is, the stack frame address is also the
address of the stack word that points to the previous frame.
@end defmac
@defmac SETUP_FRAME_ADDRESSES
If defined, a C expression that produces the machine-specific code to
setup the stack so that arbitrary frames can be accessed. For example,
on the SPARC, we must flush all of the register windows to the stack
before we can access arbitrary stack frames. You will seldom need to
define this macro.
@end defmac
@defmac BUILTIN_SETJMP_FRAME_VALUE
If defined, a C expression that contains an rtx that is used to store
the address of the current frame into the built in @code{setjmp} buffer.
The default value, @code{virtual_stack_vars_rtx}, is correct for most
machines. One reason you may need to define this macro is if
@code{hard_frame_pointer_rtx} is the appropriate value on your machine.
@end defmac
@defmac RETURN_ADDR_RTX (@var{count}, @var{frameaddr})
A C expression whose value is RTL representing the value of the return
address for the frame @var{count} steps up from the current frame, after
the prologue. @var{frameaddr} is the frame pointer of the @var{count}
frame, or the frame pointer of the @var{count} @minus{} 1 frame if
@code{RETURN_ADDR_IN_PREVIOUS_FRAME} is defined.
The value of the expression must always be the correct address when
@var{count} is zero, but may be @code{NULL_RTX} if there is not way to
determine the return address of other frames.
@end defmac
@defmac RETURN_ADDR_IN_PREVIOUS_FRAME
Define this if the return address of a particular stack frame is accessed
from the frame pointer of the previous stack frame.
@end defmac
@defmac INCOMING_RETURN_ADDR_RTX
A C expression whose value is RTL representing the location of the
incoming return address at the beginning of any function, before the
prologue. This RTL is either a @code{REG}, indicating that the return
value is saved in @samp{REG}, or a @code{MEM} representing a location in
the stack.
You only need to define this macro if you want to support call frame
debugging information like that provided by DWARF 2.
If this RTL is a @code{REG}, you should also define
@code{DWARF_FRAME_RETURN_COLUMN} to @code{DWARF_FRAME_REGNUM (REGNO)}.
@end defmac
@defmac DWARF_ALT_FRAME_RETURN_COLUMN
A C expression whose value is an integer giving a DWARF 2 column
number that may be used as an alternate return column. This should
be defined only if @code{DWARF_FRAME_RETURN_COLUMN} is set to a
general register, but an alternate column needs to be used for
signal frames.
@end defmac
@defmac INCOMING_FRAME_SP_OFFSET
A C expression whose value is an integer giving the offset, in bytes,
from the value of the stack pointer register to the top of the stack
frame at the beginning of any function, before the prologue. The top of
the frame is defined to be the value of the stack pointer in the
previous frame, just before the call instruction.
You only need to define this macro if you want to support call frame
debugging information like that provided by DWARF 2.
@end defmac
@defmac ARG_POINTER_CFA_OFFSET (@var{fundecl})
A C expression whose value is an integer giving the offset, in bytes,
from the argument pointer to the canonical frame address (cfa). The
final value should coincide with that calculated by
@code{INCOMING_FRAME_SP_OFFSET}. Which is unfortunately not usable
during virtual register instantiation.
The default value for this macro is @code{FIRST_PARM_OFFSET (fundecl)},
which is correct for most machines; in general, the arguments are found
immediately before the stack frame. Note that this is not the case on
some targets that save registers into the caller's frame, such as SPARC
and rs6000, and so such targets need to define this macro.
You only need to define this macro if the default is incorrect, and you
want to support call frame debugging information like that provided by
DWARF 2.
@end defmac
@node Exception Handling
@subsection Exception Handling Support
@cindex exception handling
@defmac EH_RETURN_DATA_REGNO (@var{N})
A C expression whose value is the @var{N}th register number used for
data by exception handlers, or @code{INVALID_REGNUM} if fewer than
@var{N} registers are usable.
The exception handling library routines communicate with the exception
handlers via a set of agreed upon registers. Ideally these registers
should be call-clobbered; it is possible to use call-saved registers,
but may negatively impact code size. The target must support at least
2 data registers, but should define 4 if there are enough free registers.
You must define this macro if you want to support call frame exception
handling like that provided by DWARF 2.
@end defmac
@defmac EH_RETURN_STACKADJ_RTX
A C expression whose value is RTL representing a location in which
to store a stack adjustment to be applied before function return.
This is used to unwind the stack to an exception handler's call frame.
It will be assigned zero on code paths that return normally.
Typically this is a call-clobbered hard register that is otherwise
untouched by the epilogue, but could also be a stack slot.
Do not define this macro if the stack pointer is saved and restored
by the regular prolog and epilog code in the call frame itself; in
this case, the exception handling library routines will update the
stack location to be restored in place. Otherwise, you must define
this macro if you want to support call frame exception handling like
that provided by DWARF 2.
@end defmac
@defmac EH_RETURN_HANDLER_RTX
A C expression whose value is RTL representing a location in which
to store the address of an exception handler to which we should
return. It will not be assigned on code paths that return normally.
Typically this is the location in the call frame at which the normal
return address is stored. For targets that return by popping an
address off the stack, this might be a memory address just below
the @emph{target} call frame rather than inside the current call
frame. If defined, @code{EH_RETURN_STACKADJ_RTX} will have already
been assigned, so it may be used to calculate the location of the
target call frame.
Some targets have more complex requirements than storing to an
address calculable during initial code generation. In that case
the @code{eh_return} instruction pattern should be used instead.
If you want to support call frame exception handling, you must
define either this macro or the @code{eh_return} instruction pattern.
@end defmac
@defmac RETURN_ADDR_OFFSET
If defined, an integer-valued C expression for which rtl will be generated
to add it to the exception handler address before it is searched in the
exception handling tables, and to subtract it again from the address before
using it to return to the exception handler.
@end defmac
@defmac ASM_PREFERRED_EH_DATA_FORMAT (@var{code}, @var{global})
This macro chooses the encoding of pointers embedded in the exception
handling sections. If at all possible, this should be defined such
that the exception handling section will not require dynamic relocations,
and so may be read-only.
@var{code} is 0 for data, 1 for code labels, 2 for function pointers.
@var{global} is true if the symbol may be affected by dynamic relocations.
The macro should return a combination of the @code{DW_EH_PE_*} defines
as found in @file{dwarf2.h}.
If this macro is not defined, pointers will not be encoded but
represented directly.
@end defmac
@defmac ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX (@var{file}, @var{encoding}, @var{size}, @var{addr}, @var{done})
This macro allows the target to emit whatever special magic is required
to represent the encoding chosen by @code{ASM_PREFERRED_EH_DATA_FORMAT}.
Generic code takes care of pc-relative and indirect encodings; this must
be defined if the target uses text-relative or data-relative encodings.
This is a C statement that branches to @var{done} if the format was
handled. @var{encoding} is the format chosen, @var{size} is the number
of bytes that the format occupies, @var{addr} is the @code{SYMBOL_REF}
to be emitted.
@end defmac
@defmac MD_FALLBACK_FRAME_STATE_FOR (@var{context}, @var{fs}, @var{success})
This macro allows the target to add cpu and operating system specific
code to the call-frame unwinder for use when there is no unwind data
available. The most common reason to implement this macro is to unwind
through signal frames.
This macro is called from @code{uw_frame_state_for} in @file{unwind-dw2.c}
and @file{unwind-ia64.c}. @var{context} is an @code{_Unwind_Context};
@var{fs} is an @code{_Unwind_FrameState}. Examine @code{context->ra}
for the address of the code being executed and @code{context->cfa} for
the stack pointer value. If the frame can be decoded, the register save
addresses should be updated in @var{fs} and the macro should branch to
@var{success}. If the frame cannot be decoded, the macro should do
nothing.
For proper signal handling in Java this macro is accompanied by
@code{MAKE_THROW_FRAME}, defined in @file{libjava/include/*-signal.h} headers.
@end defmac
@defmac MD_HANDLE_UNWABI (@var{context}, @var{fs})
This macro allows the target to add operating system specific code to the
call-frame unwinder to handle the IA-64 @code{.unwabi} unwinding directive,
usually used for signal or interrupt frames.
This macro is called from @code{uw_update_context} in @file{unwind-ia64.c}.
@var{context} is an @code{_Unwind_Context};
@var{fs} is an @code{_Unwind_FrameState}. Examine @code{fs->unwabi}
for the abi and context in the @code{.unwabi} directive. If the
@code{.unwabi} directive can be handled, the register save addresses should
be updated in @var{fs}.
@end defmac
@node Stack Checking
@subsection Specifying How Stack Checking is Done
GCC will check that stack references are within the boundaries of
the stack, if the @option{-fstack-check} is specified, in one of three ways:
@enumerate
@item
If the value of the @code{STACK_CHECK_BUILTIN} macro is nonzero, GCC
will assume that you have arranged for stack checking to be done at
appropriate places in the configuration files, e.g., in
@code{TARGET_ASM_FUNCTION_PROLOGUE}. GCC will do not other special
processing.
@item
If @code{STACK_CHECK_BUILTIN} is zero and you defined a named pattern
called @code{check_stack} in your @file{md} file, GCC will call that
pattern with one argument which is the address to compare the stack
value against. You must arrange for this pattern to report an error if
the stack pointer is out of range.
@item
If neither of the above are true, GCC will generate code to periodically
``probe'' the stack pointer using the values of the macros defined below.
@end enumerate
Normally, you will use the default values of these macros, so GCC
will use the third approach.
@defmac STACK_CHECK_BUILTIN
A nonzero value if stack checking is done by the configuration files in a
machine-dependent manner. You should define this macro if stack checking
is require by the ABI of your machine or if you would like to have to stack
checking in some more efficient way than GCC's portable approach.
The default value of this macro is zero.
@end defmac
@defmac STACK_CHECK_PROBE_INTERVAL
An integer representing the interval at which GCC must generate stack
probe instructions. You will normally define this macro to be no larger
than the size of the ``guard pages'' at the end of a stack area. The
default value of 4096 is suitable for most systems.
@end defmac
@defmac STACK_CHECK_PROBE_LOAD
A integer which is nonzero if GCC should perform the stack probe
as a load instruction and zero if GCC should use a store instruction.
The default is zero, which is the most efficient choice on most systems.
@end defmac
@defmac STACK_CHECK_PROTECT
The number of bytes of stack needed to recover from a stack overflow,
for languages where such a recovery is supported. The default value of
75 words should be adequate for most machines.
@end defmac
@defmac STACK_CHECK_MAX_FRAME_SIZE
The maximum size of a stack frame, in bytes. GCC will generate probe
instructions in non-leaf functions to ensure at least this many bytes of
stack are available. If a stack frame is larger than this size, stack
checking will not be reliable and GCC will issue a warning. The
default is chosen so that GCC only generates one instruction on most
systems. You should normally not change the default value of this macro.
@end defmac
@defmac STACK_CHECK_FIXED_FRAME_SIZE
GCC uses this value to generate the above warning message. It
represents the amount of fixed frame used by a function, not including
space for any callee-saved registers, temporaries and user variables.
You need only specify an upper bound for this amount and will normally
use the default of four words.
@end defmac
@defmac STACK_CHECK_MAX_VAR_SIZE
The maximum size, in bytes, of an object that GCC will place in the
fixed area of the stack frame when the user specifies
@option{-fstack-check}.
GCC computed the default from the values of the above macros and you will
normally not need to override that default.
@end defmac
@need 2000
@node Frame Registers
@subsection Registers That Address the Stack Frame
@c prevent bad page break with this line
This discusses registers that address the stack frame.
@defmac STACK_POINTER_REGNUM
The register number of the stack pointer register, which must also be a
fixed register according to @code{FIXED_REGISTERS}. On most machines,
the hardware determines which register this is.
@end defmac
@defmac FRAME_POINTER_REGNUM
The register number of the frame pointer register, which is used to
access automatic variables in the stack frame. On some machines, the
hardware determines which register this is. On other machines, you can
choose any register you wish for this purpose.
@end defmac
@defmac HARD_FRAME_POINTER_REGNUM
On some machines the offset between the frame pointer and starting
offset of the automatic variables is not known until after register
allocation has been done (for example, because the saved registers are
between these two locations). On those machines, define
@code{FRAME_POINTER_REGNUM} the number of a special, fixed register to
be used internally until the offset is known, and define
@code{HARD_FRAME_POINTER_REGNUM} to be the actual hard register number
used for the frame pointer.
You should define this macro only in the very rare circumstances when it
is not possible to calculate the offset between the frame pointer and
the automatic variables until after register allocation has been
completed. When this macro is defined, you must also indicate in your
definition of @code{ELIMINABLE_REGS} how to eliminate
@code{FRAME_POINTER_REGNUM} into either @code{HARD_FRAME_POINTER_REGNUM}
or @code{STACK_POINTER_REGNUM}.
Do not define this macro if it would be the same as
@code{FRAME_POINTER_REGNUM}.
@end defmac
@defmac ARG_POINTER_REGNUM
The register number of the arg pointer register, which is used to access
the function's argument list. On some machines, this is the same as the
frame pointer register. On some machines, the hardware determines which
register this is. On other machines, you can choose any register you
wish for this purpose. If this is not the same register as the frame
pointer register, then you must mark it as a fixed register according to
@code{FIXED_REGISTERS}, or arrange to be able to eliminate it
(@pxref{Elimination}).
@end defmac
@defmac RETURN_ADDRESS_POINTER_REGNUM
The register number of the return address pointer register, which is used to
access the current function's return address from the stack. On some
machines, the return address is not at a fixed offset from the frame
pointer or stack pointer or argument pointer. This register can be defined
to point to the return address on the stack, and then be converted by
@code{ELIMINABLE_REGS} into either the frame pointer or stack pointer.
Do not define this macro unless there is no other way to get the return
address from the stack.
@end defmac
@defmac STATIC_CHAIN_REGNUM
@defmacx STATIC_CHAIN_INCOMING_REGNUM
Register numbers used for passing a function's static chain pointer. If
register windows are used, the register number as seen by the called
function is @code{STATIC_CHAIN_INCOMING_REGNUM}, while the register
number as seen by the calling function is @code{STATIC_CHAIN_REGNUM}. If
these registers are the same, @code{STATIC_CHAIN_INCOMING_REGNUM} need
not be defined.
The static chain register need not be a fixed register.
If the static chain is passed in memory, these macros should not be
defined; instead, the next two macros should be defined.
@end defmac
@defmac STATIC_CHAIN
@defmacx STATIC_CHAIN_INCOMING
If the static chain is passed in memory, these macros provide rtx giving
@code{mem} expressions that denote where they are stored.
@code{STATIC_CHAIN} and @code{STATIC_CHAIN_INCOMING} give the locations
as seen by the calling and called functions, respectively. Often the former
will be at an offset from the stack pointer and the latter at an offset from
the frame pointer.
@findex stack_pointer_rtx
@findex frame_pointer_rtx
@findex arg_pointer_rtx
The variables @code{stack_pointer_rtx}, @code{frame_pointer_rtx}, and
@code{arg_pointer_rtx} will have been initialized prior to the use of these
macros and should be used to refer to those items.
If the static chain is passed in a register, the two previous macros should
be defined instead.
@end defmac
@defmac DWARF_FRAME_REGISTERS
This macro specifies the maximum number of hard registers that can be
saved in a call frame. This is used to size data structures used in
DWARF2 exception handling.
Prior to GCC 3.0, this macro was needed in order to establish a stable
exception handling ABI in the face of adding new hard registers for ISA
extensions. In GCC 3.0 and later, the EH ABI is insulated from changes
in the number of hard registers. Nevertheless, this macro can still be
used to reduce the runtime memory requirements of the exception handling
routines, which can be substantial if the ISA contains a lot of
registers that are not call-saved.
If this macro is not defined, it defaults to
@code{FIRST_PSEUDO_REGISTER}.
@end defmac
@defmac PRE_GCC3_DWARF_FRAME_REGISTERS
This macro is similar to @code{DWARF_FRAME_REGISTERS}, but is provided
for backward compatibility in pre GCC 3.0 compiled code.
If this macro is not defined, it defaults to
@code{DWARF_FRAME_REGISTERS}.
@end defmac
@defmac DWARF_REG_TO_UNWIND_COLUMN (@var{regno})
Define this macro if the target's representation for dwarf registers
is different than the internal representation for unwind column.
Given a dwarf register, this macro should return the internal unwind
column number to use instead.
See the PowerPC's SPE target for an example.
@end defmac
@node Elimination
@subsection Eliminating Frame Pointer and Arg Pointer
@c prevent bad page break with this line
This is about eliminating the frame pointer and arg pointer.
@defmac FRAME_POINTER_REQUIRED
A C expression which is nonzero if a function must have and use a frame
pointer. This expression is evaluated in the reload pass. If its value is
nonzero the function will have a frame pointer.
The expression can in principle examine the current function and decide
according to the facts, but on most machines the constant 0 or the
constant 1 suffices. Use 0 when the machine allows code to be generated
with no frame pointer, and doing so saves some time or space. Use 1
when there is no possible advantage to avoiding a frame pointer.
In certain cases, the compiler does not know how to produce valid code
without a frame pointer. The compiler recognizes those cases and
automatically gives the function a frame pointer regardless of what
@code{FRAME_POINTER_REQUIRED} says. You don't need to worry about
them.
In a function that does not require a frame pointer, the frame pointer
register can be allocated for ordinary usage, unless you mark it as a
fixed register. See @code{FIXED_REGISTERS} for more information.
@end defmac
@findex get_frame_size
@defmac INITIAL_FRAME_POINTER_OFFSET (@var{depth-var})
A C statement to store in the variable @var{depth-var} the difference
between the frame pointer and the stack pointer values immediately after
the function prologue. The value would be computed from information
such as the result of @code{get_frame_size ()} and the tables of
registers @code{regs_ever_live} and @code{call_used_regs}.
If @code{ELIMINABLE_REGS} is defined, this macro will be not be used and
need not be defined. Otherwise, it must be defined even if
@code{FRAME_POINTER_REQUIRED} is defined to always be true; in that
case, you may set @var{depth-var} to anything.
@end defmac
@defmac ELIMINABLE_REGS
If defined, this macro specifies a table of register pairs used to
eliminate unneeded registers that point into the stack frame. If it is not
defined, the only elimination attempted by the compiler is to replace
references to the frame pointer with references to the stack pointer.
The definition of this macro is a list of structure initializations, each
of which specifies an original and replacement register.
On some machines, the position of the argument pointer is not known until
the compilation is completed. In such a case, a separate hard register
must be used for the argument pointer. This register can be eliminated by
replacing it with either the frame pointer or the argument pointer,
depending on whether or not the frame pointer has been eliminated.
In this case, you might specify:
@example
#define ELIMINABLE_REGS \
@{@{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM@}, \
@{ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM@}, \
@{FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM@}@}
@end example
Note that the elimination of the argument pointer with the stack pointer is
specified first since that is the preferred elimination.
@end defmac
@defmac CAN_ELIMINATE (@var{from-reg}, @var{to-reg})
A C expression that returns nonzero if the compiler is allowed to try
to replace register number @var{from-reg} with register number
@var{to-reg}. This macro need only be defined if @code{ELIMINABLE_REGS}
is defined, and will usually be the constant 1, since most of the cases
preventing register elimination are things that the compiler already
knows about.
@end defmac
@defmac INITIAL_ELIMINATION_OFFSET (@var{from-reg}, @var{to-reg}, @var{offset-var})
This macro is similar to @code{INITIAL_FRAME_POINTER_OFFSET}. It
specifies the initial difference between the specified pair of
registers. This macro must be defined if @code{ELIMINABLE_REGS} is
defined.
@end defmac
@node Stack Arguments
@subsection Passing Function Arguments on the Stack
@cindex arguments on stack
@cindex stack arguments
The macros in this section control how arguments are passed
on the stack. See the following section for other macros that
control passing certain arguments in registers.
@deftypefn {Target Hook} bool TARGET_PROMOTE_PROTOTYPES (tree @var{fntype})
This target hook returns @code{true} if an argument declared in a
prototype as an integral type smaller than @code{int} should actually be
passed as an @code{int}. In addition to avoiding errors in certain
cases of mismatch, it also makes for better code on certain machines.
The default is to not promote prototypes.
@end deftypefn
@defmac PUSH_ARGS
A C expression. If nonzero, push insns will be used to pass
outgoing arguments.
If the target machine does not have a push instruction, set it to zero.
That directs GCC to use an alternate strategy: to
allocate the entire argument block and then store the arguments into
it. When @code{PUSH_ARGS} is nonzero, @code{PUSH_ROUNDING} must be defined too.
@end defmac
@defmac PUSH_ARGS_REVERSED
A C expression. If nonzero, function arguments will be evaluated from
last to first, rather than from first to last. If this macro is not
defined, it defaults to @code{PUSH_ARGS} on targets where the stack
and args grow in opposite directions, and 0 otherwise.
@end defmac
@defmac PUSH_ROUNDING (@var{npushed})
A C expression that is the number of bytes actually pushed onto the
stack when an instruction attempts to push @var{npushed} bytes.
On some machines, the definition
@example
#define PUSH_ROUNDING(BYTES) (BYTES)
@end example
@noindent
will suffice. But on other machines, instructions that appear
to push one byte actually push two bytes in an attempt to maintain
alignment. Then the definition should be
@example
#define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & ~1)
@end example
@end defmac
@findex current_function_outgoing_args_size
@defmac ACCUMULATE_OUTGOING_ARGS
A C expression. If nonzero, the maximum amount of space required for outgoing arguments
will be computed and placed into the variable
@code{current_function_outgoing_args_size}. No space will be pushed
onto the stack for each call; instead, the function prologue should
increase the stack frame size by this amount.
Setting both @code{PUSH_ARGS} and @code{ACCUMULATE_OUTGOING_ARGS}
is not proper.
@end defmac
@defmac REG_PARM_STACK_SPACE (@var{fndecl})
Define this macro if functions should assume that stack space has been
allocated for arguments even when their values are passed in
registers.
The value of this macro is the size, in bytes, of the area reserved for
arguments passed in registers for the function represented by @var{fndecl},
which can be zero if GCC is calling a library function.
This space can be allocated by the caller, or be a part of the
machine-dependent stack frame: @code{OUTGOING_REG_PARM_STACK_SPACE} says
which.
@end defmac
@c above is overfull. not sure what to do. --mew 5feb93 did
@c something, not sure if it looks good. --mew 10feb93
@defmac MAYBE_REG_PARM_STACK_SPACE
@defmacx FINAL_REG_PARM_STACK_SPACE (@var{const_size}, @var{var_size})
Define these macros in addition to the one above if functions might
allocate stack space for arguments even when their values are passed
in registers. These should be used when the stack space allocated
for arguments in registers is not a simple constant independent of the
function declaration.
The value of the first macro is the size, in bytes, of the area that
we should initially assume would be reserved for arguments passed in registers.
The value of the second macro is the actual size, in bytes, of the area
that will be reserved for arguments passed in registers. This takes two
arguments: an integer representing the number of bytes of fixed sized
arguments on the stack, and a tree representing the number of bytes of
variable sized arguments on the stack.
When these macros are defined, @code{REG_PARM_STACK_SPACE} will only be
called for libcall functions, the current function, or for a function
being called when it is known that such stack space must be allocated.
In each case this value can be easily computed.
When deciding whether a called function needs such stack space, and how
much space to reserve, GCC uses these two macros instead of
@code{REG_PARM_STACK_SPACE}.
@end defmac
@defmac OUTGOING_REG_PARM_STACK_SPACE
Define this if it is the responsibility of the caller to allocate the area
reserved for arguments passed in registers.
If @code{ACCUMULATE_OUTGOING_ARGS} is defined, this macro controls
whether the space for these arguments counts in the value of
@code{current_function_outgoing_args_size}.
@end defmac
@defmac STACK_PARMS_IN_REG_PARM_AREA
Define this macro if @code{REG_PARM_STACK_SPACE} is defined, but the
stack parameters don't skip the area specified by it.
@c i changed this, makes more sens and it should have taken care of the
@c overfull.. not as specific, tho. --mew 5feb93
Normally, when a parameter is not passed in registers, it is placed on the
stack beyond the @code{REG_PARM_STACK_SPACE} area. Defining this macro
suppresses this behavior and causes the parameter to be passed on the
stack in its natural location.
@end defmac
@defmac RETURN_POPS_ARGS (@var{fundecl}, @var{funtype}, @var{stack-size})
A C expression that should indicate the number of bytes of its own
arguments that a function pops on returning, or 0 if the
function pops no arguments and the caller must therefore pop them all
after the function returns.
@var{fundecl} is a C variable whose value is a tree node that describes
the function in question. Normally it is a node of type
@code{FUNCTION_DECL} that describes the declaration of the function.
From this you can obtain the @code{DECL_ATTRIBUTES} of the function.
@var{funtype} is a C variable whose value is a tree node that
describes the function in question. Normally it is a node of type
@code{FUNCTION_TYPE} that describes the data type of the function.
From this it is possible to obtain the data types of the value and
arguments (if known).
When a call to a library function is being considered, @var{fundecl}
will contain an identifier node for the library function. Thus, if
you need to distinguish among various library functions, you can do so
by their names. Note that ``library function'' in this context means
a function used to perform arithmetic, whose name is known specially
in the compiler and was not mentioned in the C code being compiled.
@var{stack-size} is the number of bytes of arguments passed on the
stack. If a variable number of bytes is passed, it is zero, and
argument popping will always be the responsibility of the calling function.
On the VAX, all functions always pop their arguments, so the definition
of this macro is @var{stack-size}. On the 68000, using the standard
calling convention, no functions pop their arguments, so the value of
the macro is always 0 in this case. But an alternative calling
convention is available in which functions that take a fixed number of
arguments pop them but other functions (such as @code{printf}) pop
nothing (the caller pops all). When this convention is in use,
@var{funtype} is examined to determine whether a function takes a fixed
number of arguments.
@end defmac
@defmac CALL_POPS_ARGS (@var{cum})
A C expression that should indicate the number of bytes a call sequence
pops off the stack. It is added to the value of @code{RETURN_POPS_ARGS}
when compiling a function call.
@var{cum} is the variable in which all arguments to the called function
have been accumulated.
On certain architectures, such as the SH5, a call trampoline is used
that pops certain registers off the stack, depending on the arguments
that have been passed to the function. Since this is a property of the
call site, not of the called function, @code{RETURN_POPS_ARGS} is not
appropriate.
@end defmac
@node Register Arguments
@subsection Passing Arguments in Registers
@cindex arguments in registers
@cindex registers arguments
This section describes the macros which let you control how various
types of arguments are passed in registers or how they are arranged in
the stack.
@defmac FUNCTION_ARG (@var{cum}, @var{mode}, @var{type}, @var{named})
A C expression that controls whether a function argument is passed
in a register, and which register.
The arguments are @var{cum}, which summarizes all the previous
arguments; @var{mode}, the machine mode of the argument; @var{type},
the data type of the argument as a tree node or 0 if that is not known
(which happens for C support library functions); and @var{named},
which is 1 for an ordinary argument and 0 for nameless arguments that
correspond to @samp{@dots{}} in the called function's prototype.
@var{type} can be an incomplete type if a syntax error has previously
occurred.
The value of the expression is usually either a @code{reg} RTX for the
hard register in which to pass the argument, or zero to pass the
argument on the stack.
For machines like the VAX and 68000, where normally all arguments are
pushed, zero suffices as a definition.
The value of the expression can also be a @code{parallel} RTX@. This is
used when an argument is passed in multiple locations. The mode of the
@code{parallel} should be the mode of the entire argument. The
@code{parallel} holds any number of @code{expr_list} pairs; each one
describes where part of the argument is passed. In each
@code{expr_list} the first operand must be a @code{reg} RTX for the hard
register in which to pass this part of the argument, and the mode of the
register RTX indicates how large this part of the argument is. The
second operand of the @code{expr_list} is a @code{const_int} which gives
the offset in bytes into the entire argument of where this part starts.
As a special exception the first @code{expr_list} in the @code{parallel}
RTX may have a first operand of zero. This indicates that the entire
argument is also stored on the stack.
The last time this macro is called, it is called with @code{MODE ==
VOIDmode}, and its result is passed to the @code{call} or @code{call_value}
pattern as operands 2 and 3 respectively.
@cindex @file{stdarg.h} and register arguments
The usual way to make the ISO library @file{stdarg.h} work on a machine
where some arguments are usually passed in registers, is to cause
nameless arguments to be passed on the stack instead. This is done
by making @code{FUNCTION_ARG} return 0 whenever @var{named} is 0.
@cindex @code{MUST_PASS_IN_STACK}, and @code{FUNCTION_ARG}
@cindex @code{REG_PARM_STACK_SPACE}, and @code{FUNCTION_ARG}
You may use the macro @code{MUST_PASS_IN_STACK (@var{mode}, @var{type})}
in the definition of this macro to determine if this argument is of a
type that must be passed in the stack. If @code{REG_PARM_STACK_SPACE}
is not defined and @code{FUNCTION_ARG} returns nonzero for such an
argument, the compiler will abort. If @code{REG_PARM_STACK_SPACE} is
defined, the argument will be computed in the stack and then loaded into
a register.
@end defmac
@defmac MUST_PASS_IN_STACK (@var{mode}, @var{type})
Define as a C expression that evaluates to nonzero if we do not know how
to pass TYPE solely in registers. The file @file{expr.h} defines a
definition that is usually appropriate, refer to @file{expr.h} for additional
documentation.
@end defmac
@defmac FUNCTION_INCOMING_ARG (@var{cum}, @var{mode}, @var{type}, @var{named})
Define this macro if the target machine has ``register windows'', so
that the register in which a function sees an arguments is not
necessarily the same as the one in which the caller passed the
argument.
For such machines, @code{FUNCTION_ARG} computes the register in which
the caller passes the value, and @code{FUNCTION_INCOMING_ARG} should
be defined in a similar fashion to tell the function being called
where the arguments will arrive.
If @code{FUNCTION_INCOMING_ARG} is not defined, @code{FUNCTION_ARG}
serves both purposes.
@end defmac
@defmac FUNCTION_ARG_PARTIAL_NREGS (@var{cum}, @var{mode}, @var{type}, @var{named})
A C expression for the number of words, at the beginning of an
argument, that must be put in registers. The value must be zero for
arguments that are passed entirely in registers or that are entirely
pushed on the stack.
On some machines, certain arguments must be passed partially in
registers and partially in memory. On these machines, typically the
first @var{n} words of arguments are passed in registers, and the rest
on the stack. If a multi-word argument (a @code{double} or a
structure) crosses that boundary, its first few words must be passed
in registers and the rest must be pushed. This macro tells the
compiler when this occurs, and how many of the words should go in
registers.
@code{FUNCTION_ARG} for these arguments should return the first
register to be used by the caller for this argument; likewise
@code{FUNCTION_INCOMING_ARG}, for the called function.
@end defmac
@defmac FUNCTION_ARG_PASS_BY_REFERENCE (@var{cum}, @var{mode}, @var{type}, @var{named})
A C expression that indicates when an argument must be passed by reference.
If nonzero for an argument, a copy of that argument is made in memory and a
pointer to the argument is passed instead of the argument itself.
The pointer is passed in whatever way is appropriate for passing a pointer
to that type.
On machines where @code{REG_PARM_STACK_SPACE} is not defined, a suitable
definition of this macro might be
@smallexample
#define FUNCTION_ARG_PASS_BY_REFERENCE\
(CUM, MODE, TYPE, NAMED) \
MUST_PASS_IN_STACK (MODE, TYPE)
@end smallexample
@c this is *still* too long. --mew 5feb93
@end defmac
@defmac FUNCTION_ARG_CALLEE_COPIES (@var{cum}, @var{mode}, @var{type}, @var{named})
If defined, a C expression that indicates when it is the called function's
responsibility to make a copy of arguments passed by invisible reference.
Normally, the caller makes a copy and passes the address of the copy to the
routine being called. When @code{FUNCTION_ARG_CALLEE_COPIES} is defined and is
nonzero, the caller does not make a copy. Instead, it passes a pointer to the
``live'' value. The called function must not modify this value. If it can be
determined that the value won't be modified, it need not make a copy;
otherwise a copy must be made.
@end defmac
@defmac CUMULATIVE_ARGS
A C type for declaring a variable that is used as the first argument of
@code{FUNCTION_ARG} and other related values. For some target machines,
the type @code{int} suffices and can hold the number of bytes of
argument so far.
There is no need to record in @code{CUMULATIVE_ARGS} anything about the
arguments that have been passed on the stack. The compiler has other
variables to keep track of that. For target machines on which all
arguments are passed on the stack, there is no need to store anything in
@code{CUMULATIVE_ARGS}; however, the data structure must exist and
should not be empty, so use @code{int}.
@end defmac
@defmac INIT_CUMULATIVE_ARGS (@var{cum}, @var{fntype}, @var{libname}, @var{fndecl})
A C statement (sans semicolon) for initializing the variable
@var{cum} for the state at the beginning of the argument list. The
variable has type @code{CUMULATIVE_ARGS}. The value of @var{fntype}
is the tree node for the data type of the function which will receive
the args, or 0 if the args are to a compiler support library function.
For direct calls that are not libcalls, @var{fndecl} contain the
declaration node of the function. @var{fndecl} is also set when
@code{INIT_CUMULATIVE_ARGS} is used to find arguments for the function
being compiled.
When processing a call to a compiler support library function,
@var{libname} identifies which one. It is a @code{symbol_ref} rtx which
contains the name of the function, as a string. @var{libname} is 0 when
an ordinary C function call is being processed. Thus, each time this
macro is called, either @var{libname} or @var{fntype} is nonzero, but
never both of them at once.
@end defmac
@defmac INIT_CUMULATIVE_LIBCALL_ARGS (@var{cum}, @var{mode}, @var{libname})
Like @code{INIT_CUMULATIVE_ARGS} but only used for outgoing libcalls,
it gets a @code{MODE} argument instead of @var{fntype}, that would be
@code{NULL}. @var{indirect} would always be zero, too. If this macro
is not defined, @code{INIT_CUMULATIVE_ARGS (cum, NULL_RTX, libname,
0)} is used instead.
@end defmac
@defmac INIT_CUMULATIVE_INCOMING_ARGS (@var{cum}, @var{fntype}, @var{libname})
Like @code{INIT_CUMULATIVE_ARGS} but overrides it for the purposes of
finding the arguments for the function being compiled. If this macro is
undefined, @code{INIT_CUMULATIVE_ARGS} is used instead.
The value passed for @var{libname} is always 0, since library routines
with special calling conventions are never compiled with GCC@. The
argument @var{libname} exists for symmetry with
@code{INIT_CUMULATIVE_ARGS}.
@c could use "this macro" in place of @code{INIT_CUMULATIVE_ARGS}, maybe.
@c --mew 5feb93 i switched the order of the sentences. --mew 10feb93
@end defmac
@defmac FUNCTION_ARG_ADVANCE (@var{cum}, @var{mode}, @var{type}, @var{named})
A C statement (sans semicolon) to update the summarizer variable
@var{cum} to advance past an argument in the argument list. The
values @var{mode}, @var{type} and @var{named} describe that argument.
Once this is done, the variable @var{cum} is suitable for analyzing
the @emph{following} argument with @code{FUNCTION_ARG}, etc.
This macro need not do anything if the argument in question was passed
on the stack. The compiler knows how to track the amount of stack space
used for arguments without any special help.
@end defmac
@defmac FUNCTION_ARG_PADDING (@var{mode}, @var{type})
If defined, a C expression which determines whether, and in which direction,
to pad out an argument with extra space. The value should be of type
@code{enum direction}: either @code{upward} to pad above the argument,
@code{downward} to pad below, or @code{none} to inhibit padding.
The @emph{amount} of padding is always just enough to reach the next
multiple of @code{FUNCTION_ARG_BOUNDARY}; this macro does not control
it.
This macro has a default definition which is right for most systems.
For little-endian machines, the default is to pad upward. For
big-endian machines, the default is to pad downward for an argument of
constant size shorter than an @code{int}, and upward otherwise.
@end defmac
@defmac PAD_VARARGS_DOWN
If defined, a C expression which determines whether the default
implementation of va_arg will attempt to pad down before reading the
next argument, if that argument is smaller than its aligned space as
controlled by @code{PARM_BOUNDARY}. If this macro is not defined, all such
arguments are padded down if @code{BYTES_BIG_ENDIAN} is true.
@end defmac
@defmac BLOCK_REG_PADDING (@var{mode}, @var{type}, @var{first})
Specify padding for the last element of a block move between registers and
memory. @var{first} is nonzero if this is the only element. Defining this
macro allows better control of register function parameters on big-endian
machines, without using @code{PARALLEL} rtl. In particular,
@code{MUST_PASS_IN_STACK} need not test padding and mode of types in
registers, as there is no longer a "wrong" part of a register; For example,
a three byte aggregate may be passed in the high part of a register if so
required.
@end defmac
@defmac FUNCTION_ARG_BOUNDARY (@var{mode}, @var{type})
If defined, a C expression that gives the alignment boundary, in bits,
of an argument with the specified mode and type. If it is not defined,
@code{PARM_BOUNDARY} is used for all arguments.
@end defmac
@defmac FUNCTION_ARG_REGNO_P (@var{regno})
A C expression that is nonzero if @var{regno} is the number of a hard
register in which function arguments are sometimes passed. This does
@emph{not} include implicit arguments such as the static chain and
the structure-value address. On many machines, no registers can be
used for this purpose since all function arguments are pushed on the
stack.
@end defmac
@defmac SPLIT_COMPLEX_ARGS
Define this macro to a nonzero value if complex function arguments
should be split into their corresponding components. By default, GCC
will attempt to pack complex arguments into the target's word size.
Some ABIs require complex arguments to be split and treated as their
individual components. For example, on AIX64, complex floats should
be passed in a pair of floating point registers, even though a complex
float would fit in one 64-bit floating point register.
@end defmac
@node Scalar Return
@subsection How Scalar Function Values Are Returned
@cindex return values in registers
@cindex values, returned by functions
@cindex scalars, returned as values
This section discusses the macros that control returning scalars as
values---values that can fit in registers.
@defmac FUNCTION_VALUE (@var{valtype}, @var{func})
A C expression to create an RTX representing the place where a
function returns a value of data type @var{valtype}. @var{valtype} is
a tree node representing a data type. Write @code{TYPE_MODE
(@var{valtype})} to get the machine mode used to represent that type.
On many machines, only the mode is relevant. (Actually, on most
machines, scalar values are returned in the same place regardless of
mode).
The value of the expression is usually a @code{reg} RTX for the hard
register where the return value is stored. The value can also be a
@code{parallel} RTX, if the return value is in multiple places. See
@code{FUNCTION_ARG} for an explanation of the @code{parallel} form.
If @code{TARGET_PROMOTE_FUNCTION_RETURN} is defined, you must apply the same
promotion rules specified in @code{PROMOTE_MODE} if @var{valtype} is a
scalar type.
If the precise function being called is known, @var{func} is a tree
node (@code{FUNCTION_DECL}) for it; otherwise, @var{func} is a null
pointer. This makes it possible to use a different value-returning
convention for specific functions when all their calls are
known.
@code{FUNCTION_VALUE} is not used for return vales with aggregate data
types, because these are returned in another way. See
@code{STRUCT_VALUE_REGNUM} and related macros, below.
@end defmac
@defmac FUNCTION_OUTGOING_VALUE (@var{valtype}, @var{func})
Define this macro if the target machine has ``register windows''
so that the register in which a function returns its value is not
the same as the one in which the caller sees the value.
For such machines, @code{FUNCTION_VALUE} computes the register in which
the caller will see the value. @code{FUNCTION_OUTGOING_VALUE} should be
defined in a similar fashion to tell the function where to put the
value.
If @code{FUNCTION_OUTGOING_VALUE} is not defined,
@code{FUNCTION_VALUE} serves both purposes.
@code{FUNCTION_OUTGOING_VALUE} is not used for return vales with
aggregate data types, because these are returned in another way. See
@code{STRUCT_VALUE_REGNUM} and related macros, below.
@end defmac
@defmac LIBCALL_VALUE (@var{mode})
A C expression to create an RTX representing the place where a library
function returns a value of mode @var{mode}. If the precise function
being called is known, @var{func} is a tree node
(@code{FUNCTION_DECL}) for it; otherwise, @var{func} is a null
pointer. This makes it possible to use a different value-returning
convention for specific functions when all their calls are
known.
Note that ``library function'' in this context means a compiler
support routine, used to perform arithmetic, whose name is known
specially by the compiler and was not mentioned in the C code being
compiled.
The definition of @code{LIBRARY_VALUE} need not be concerned aggregate
data types, because none of the library functions returns such types.
@end defmac
@defmac FUNCTION_VALUE_REGNO_P (@var{regno})
A C expression that is nonzero if @var{regno} is the number of a hard
register in which the values of called function may come back.
A register whose use for returning values is limited to serving as the
second of a pair (for a value of type @code{double}, say) need not be
recognized by this macro. So for most machines, this definition
suffices:
@example
#define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
@end example
If the machine has register windows, so that the caller and the called
function use different registers for the return value, this macro
should recognize only the caller's register numbers.
@end defmac
@defmac APPLY_RESULT_SIZE
Define this macro if @samp{untyped_call} and @samp{untyped_return}
need more space than is implied by @code{FUNCTION_VALUE_REGNO_P} for
saving and restoring an arbitrary return value.
@end defmac
@deftypefn {Target Hook} bool TARGET_RETURN_IN_MSB (tree @var{type})
This hook should return true if values of type @var{type} are returned
at the most significant end of a register (in other words, if they are
padded at the least significant end). You can assume that @var{type}
is returned in a register; the caller is required to check this.
Note that the register provided by @code{FUNCTION_VALUE} must be able
to hold the complete return value. For example, if a 1-, 2- or 3-byte
structure is returned at the most significant end of a 4-byte register,
@code{FUNCTION_VALUE} should provide an @code{SImode} rtx.
@end deftypefn
@node Aggregate Return
@subsection How Large Values Are Returned
@cindex aggregates as return values
@cindex large return values
@cindex returning aggregate values
@cindex structure value address
When a function value's mode is @code{BLKmode} (and in some other
cases), the value is not returned according to @code{FUNCTION_VALUE}
(@pxref{Scalar Return}). Instead, the caller passes the address of a
block of memory in which the value should be stored. This address
is called the @dfn{structure value address}.
This section describes how to control returning structure values in
memory.
@deftypefn {Target Hook} bool RETURN_IN_MEMORY (tree @var{type}, tree @var{fntype})
This target hook should return a nonzero value to say to return the
function value in memory, just as large structures are always returned.
Here @var{type} will be the data type of the value, and @var{fntype}
will be the type of the function doing the returning, or @code{NULL} for
libcalls.
Note that values of mode @code{BLKmode} must be explicitly handled
by this function. Also, the option @option{-fpcc-struct-return}
takes effect regardless of this macro. On most systems, it is
possible to leave the hook undefined; this causes a default
definition to be used, whose value is the constant 1 for @code{BLKmode}
values, and 0 otherwise.
Do not use this hook to indicate that structures and unions should always
be returned in memory. You should instead use @code{DEFAULT_PCC_STRUCT_RETURN}
to indicate this.
@end deftypefn
@defmac DEFAULT_PCC_STRUCT_RETURN
Define this macro to be 1 if all structure and union return values must be
in memory. Since this results in slower code, this should be defined
only if needed for compatibility with other compilers or with an ABI@.
If you define this macro to be 0, then the conventions used for structure
and union return values are decided by the @code{RETURN_IN_MEMORY} macro.
If not defined, this defaults to the value 1.
@end defmac
@deftypefn {Target Hook} rtx TARGET_STRUCT_VALUE_RTX (tree @var{fndecl}, int @var{incoming})
This target hook should return the location of the structure value
address (normally a @code{mem} or @code{reg}), or 0 if the address is
passed as an ``invisible'' first argument. Note that @var{fndecl} may
be @code{NULL}, for libcalls.
On some architectures the place where the structure value address
is found by the called function is not the same place that the
caller put it. This can be due to register windows, or it could
be because the function prologue moves it to a different place.
@var{incoming} is @code{true} when the location is needed in
the context of the called function, and @code{false} in the context of
the caller.
If @var{incoming} is @code{true} and the address is to be found on the
stack, return a @code{mem} which refers to the frame pointer.
@end deftypefn
@defmac PCC_STATIC_STRUCT_RETURN
Define this macro if the usual system convention on the target machine
for returning structures and unions is for the called function to return
the address of a static variable containing the value.
Do not define this if the usual system convention is for the caller to
pass an address to the subroutine.
This macro has effect in @option{-fpcc-struct-return} mode, but it does
nothing when you use @option{-freg-struct-return} mode.
@end defmac
@node Caller Saves
@subsection Caller-Saves Register Allocation
If you enable it, GCC can save registers around function calls. This
makes it possible to use call-clobbered registers to hold variables that
must live across calls.
@defmac CALLER_SAVE_PROFITABLE (@var{refs}, @var{calls})
A C expression to determine whether it is worthwhile to consider placing
a pseudo-register in a call-clobbered hard register and saving and
restoring it around each function call. The expression should be 1 when
this is worth doing, and 0 otherwise.
If you don't define this macro, a default is used which is good on most
machines: @code{4 * @var{calls} < @var{refs}}.
@end defmac
@defmac HARD_REGNO_CALLER_SAVE_MODE (@var{regno}, @var{nregs})
A C expression specifying which mode is required for saving @var{nregs}
of a pseudo-register in call-clobbered hard register @var{regno}. If
@var{regno} is unsuitable for caller save, @code{VOIDmode} should be
returned. For most machines this macro need not be defined since GCC
will select the smallest suitable mode.
@end defmac
@node Function Entry
@subsection Function Entry and Exit
@cindex function entry and exit
@cindex prologue
@cindex epilogue
This section describes the macros that output function entry
(@dfn{prologue}) and exit (@dfn{epilogue}) code.
@deftypefn {Target Hook} void TARGET_ASM_FUNCTION_PROLOGUE (FILE *@var{file}, HOST_WIDE_INT @var{size})
If defined, a function that outputs the assembler code for entry to a
function. The prologue is responsible for setting up the stack frame,
initializing the frame pointer register, saving registers that must be
saved, and allocating @var{size} additional bytes of storage for the
local variables. @var{size} is an integer. @var{file} is a stdio
stream to which the assembler code should be output.
The label for the beginning of the function need not be output by this
macro. That has already been done when the macro is run.
@findex regs_ever_live
To determine which registers to save, the macro can refer to the array
@code{regs_ever_live}: element @var{r} is nonzero if hard register
@var{r} is used anywhere within the function. This implies the function
prologue should save register @var{r}, provided it is not one of the
call-used registers. (@code{TARGET_ASM_FUNCTION_EPILOGUE} must likewise use
@code{regs_ever_live}.)
On machines that have ``register windows'', the function entry code does
not save on the stack the registers that are in the windows, even if
they are supposed to be preserved by function calls; instead it takes
appropriate steps to ``push'' the register stack, if any non-call-used
registers are used in the function.
@findex frame_pointer_needed
On machines where functions may or may not have frame-pointers, the
function entry code must vary accordingly; it must set up the frame
pointer if one is wanted, and not otherwise. To determine whether a
frame pointer is in wanted, the macro can refer to the variable
@code{frame_pointer_needed}. The variable's value will be 1 at run
time in a function that needs a frame pointer. @xref{Elimination}.
The function entry code is responsible for allocating any stack space
required for the function. This stack space consists of the regions
listed below. In most cases, these regions are allocated in the
order listed, with the last listed region closest to the top of the
stack (the lowest address if @code{STACK_GROWS_DOWNWARD} is defined, and
the highest address if it is not defined). You can use a different order
for a machine if doing so is more convenient or required for
compatibility reasons. Except in cases where required by standard
or by a debugger, there is no reason why the stack layout used by GCC
need agree with that used by other compilers for a machine.
@end deftypefn
@deftypefn {Target Hook} void TARGET_ASM_FUNCTION_END_PROLOGUE (FILE *@var{file})
If defined, a function that outputs assembler code at the end of a
prologue. This should be used when the function prologue is being
emitted as RTL, and you have some extra assembler that needs to be
emitted. @xref{prologue instruction pattern}.
@end deftypefn
@deftypefn {Target Hook} void TARGET_ASM_FUNCTION_BEGIN_EPILOGUE (FILE *@var{file})
If defined, a function that outputs assembler code at the start of an
epilogue. This should be used when the function epilogue is being
emitted as RTL, and you have some extra assembler that needs to be
emitted. @xref{epilogue instruction pattern}.
@end deftypefn
@deftypefn {Target Hook} void TARGET_ASM_FUNCTION_EPILOGUE (FILE *@var{file}, HOST_WIDE_INT @var{size})
If defined, a function that outputs the assembler code for exit from a
function. The epilogue is responsible for restoring the saved
registers and stack pointer to their values when the function was
called, and returning control to the caller. This macro takes the
same arguments as the macro @code{TARGET_ASM_FUNCTION_PROLOGUE}, and the
registers to restore are determined from @code{regs_ever_live} and
@code{CALL_USED_REGISTERS} in the same way.
On some machines, there is a single instruction that does all the work
of returning from the function. On these machines, give that
instruction the name @samp{return} and do not define the macro
@code{TARGET_ASM_FUNCTION_EPILOGUE} at all.
Do not define a pattern named @samp{return} if you want the
@code{TARGET_ASM_FUNCTION_EPILOGUE} to be used. If you want the target
switches to control whether return instructions or epilogues are used,
define a @samp{return} pattern with a validity condition that tests the
target switches appropriately. If the @samp{return} pattern's validity
condition is false, epilogues will be used.
On machines where functions may or may not have frame-pointers, the
function exit code must vary accordingly. Sometimes the code for these
two cases is completely different. To determine whether a frame pointer
is wanted, the macro can refer to the variable
@code{frame_pointer_needed}. The variable's value will be 1 when compiling
a function that needs a frame pointer.
Normally, @code{TARGET_ASM_FUNCTION_PROLOGUE} and
@code{TARGET_ASM_FUNCTION_EPILOGUE} must treat leaf functions specially.
The C variable @code{current_function_is_leaf} is nonzero for such a
function. @xref{Leaf Functions}.
On some machines, some functions pop their arguments on exit while
others leave that for the caller to do. For example, the 68020 when
given @option{-mrtd} pops arguments in functions that take a fixed
number of arguments.
@findex current_function_pops_args
Your definition of the macro @code{RETURN_POPS_ARGS} decides which
functions pop their own arguments. @code{TARGET_ASM_FUNCTION_EPILOGUE}
needs to know what was decided. The variable that is called
@code{current_function_pops_args} is the number of bytes of its
arguments that a function should pop. @xref{Scalar Return}.
@c what is the "its arguments" in the above sentence referring to, pray
@c tell? --mew 5feb93
@end deftypefn
@itemize @bullet
@item
@findex current_function_pretend_args_size
A region of @code{current_function_pretend_args_size} bytes of
uninitialized space just underneath the first argument arriving on the
stack. (This may not be at the very start of the allocated stack region
if the calling sequence has pushed anything else since pushing the stack
arguments. But usually, on such machines, nothing else has been pushed
yet, because the function prologue itself does all the pushing.) This
region is used on machines where an argument may be passed partly in
registers and partly in memory, and, in some cases to support the
features in @code{<stdarg.h>}.
@item
An area of memory used to save certain registers used by the function.
The size of this area, which may also include space for such things as
the return address and pointers to previous stack frames, is
machine-specific and usually depends on which registers have been used
in the function. Machines with register windows often do not require
a save area.
@item
A region of at least @var{size} bytes, possibly rounded up to an allocation
boundary, to contain the local variables of the function. On some machines,
this region and the save area may occur in the opposite order, with the
save area closer to the top of the stack.
@item
@cindex @code{ACCUMULATE_OUTGOING_ARGS} and stack frames
Optionally, when @code{ACCUMULATE_OUTGOING_ARGS} is defined, a region of
@code{current_function_outgoing_args_size} bytes to be used for outgoing
argument lists of the function. @xref{Stack Arguments}.
@end itemize
Normally, it is necessary for the macros
@code{TARGET_ASM_FUNCTION_PROLOGUE} and
@code{TARGET_ASM_FUNCTION_EPILOGUE} to treat leaf functions specially.
The C variable @code{current_function_is_leaf} is nonzero for such a
function.
@defmac EXIT_IGNORE_STACK
Define this macro as a C expression that is nonzero if the return
instruction or the function epilogue ignores the value of the stack
pointer; in other words, if it is safe to delete an instruction to
adjust the stack pointer before a return from the function. The
default is 0.
Note that this macro's value is relevant only for functions for which
frame pointers are maintained. It is never safe to delete a final
stack adjustment in a function that has no frame pointer, and the
compiler knows this regardless of @code{EXIT_IGNORE_STACK}.
@end defmac
@defmac EPILOGUE_USES (@var{regno})
Define this macro as a C expression that is nonzero for registers that are
used by the epilogue or the @samp{return} pattern. The stack and frame
pointer registers are already be assumed to be used as needed.
@end defmac
@defmac EH_USES (@var{regno})
Define this macro as a C expression that is nonzero for registers that are
used by the exception handling mechanism, and so should be considered live
on entry to an exception edge.
@end defmac
@defmac DELAY_SLOTS_FOR_EPILOGUE
Define this macro if the function epilogue contains delay slots to which
instructions from the rest of the function can be ``moved''. The
definition should be a C expression whose value is an integer
representing the number of delay slots there.
@end defmac
@defmac ELIGIBLE_FOR_EPILOGUE_DELAY (@var{insn}, @var{n})
A C expression that returns 1 if @var{insn} can be placed in delay
slot number @var{n} of the epilogue.
The argument @var{n} is an integer which identifies the delay slot now
being considered (since different slots may have different rules of
eligibility). It is never negative and is always less than the number
of epilogue delay slots (what @code{DELAY_SLOTS_FOR_EPILOGUE} returns).
If you reject a particular insn for a given delay slot, in principle, it
may be reconsidered for a subsequent delay slot. Also, other insns may
(at least in principle) be considered for the so far unfilled delay
slot.
@findex current_function_epilogue_delay_list
@findex final_scan_insn
The insns accepted to fill the epilogue delay slots are put in an RTL
list made with @code{insn_list} objects, stored in the variable
@code{current_function_epilogue_delay_list}. The insn for the first
delay slot comes first in the list. Your definition of the macro
@code{TARGET_ASM_FUNCTION_EPILOGUE} should fill the delay slots by
outputting the insns in this list, usually by calling
@code{final_scan_insn}.
You need not define this macro if you did not define
@code{DELAY_SLOTS_FOR_EPILOGUE}.
@end defmac
@deftypefn {Target Hook} void TARGET_ASM_OUTPUT_MI_THUNK (FILE *@var{file}, tree @var{thunk_fndecl}, HOST_WIDE_INT @var{delta}, tree @var{function})
A function that outputs the assembler code for a thunk
function, used to implement C++ virtual function calls with multiple
inheritance. The thunk acts as a wrapper around a virtual function,
adjusting the implicit object parameter before handing control off to
the real function.
First, emit code to add the integer @var{delta} to the location that
contains the incoming first argument. Assume that this argument
contains a pointer, and is the one used to pass the @code{this} pointer
in C++. This is the incoming argument @emph{before} the function prologue,
e.g.@: @samp{%o0} on a sparc. The addition must preserve the values of
all other incoming arguments.
After the addition, emit code to jump to @var{function}, which is a
@code{FUNCTION_DECL}. This is a direct pure jump, not a call, and does
not touch the return address. Hence returning from @var{FUNCTION} will
return to whoever called the current @samp{thunk}.
The effect must be as if @var{function} had been called directly with
the adjusted first argument. This macro is responsible for emitting all
of the code for a thunk function; @code{TARGET_ASM_FUNCTION_PROLOGUE}
and @code{TARGET_ASM_FUNCTION_EPILOGUE} are not invoked.
The @var{thunk_fndecl} is redundant. (@var{delta} and @var{function}
have already been extracted from it.) It might possibly be useful on
some targets, but probably not.
If you do not define this macro, the target-independent code in the C++
front end will generate a less efficient heavyweight thunk that calls
@var{function} instead of jumping to it. The generic approach does
not support varargs.
@end deftypefn
@deftypefn {Target Hook} void TARGET_ASM_OUTPUT_MI_VCALL_THUNK (FILE *@var{file}, tree @var{thunk_fndecl}, HOST_WIDE_INT @var{delta}, int @var{vcall_offset}, tree @var{function})
A function like @code{TARGET_ASM_OUTPUT_MI_THUNK}, except that if
@var{vcall_offset} is nonzero, an additional adjustment should be made
after adding @code{delta}. In particular, if @var{p} is the
adjusted pointer, the following adjustment should be made:
@example
p += (*((ptrdiff_t **)p))[vcall_offset/sizeof(ptrdiff_t)]
@end example
@noindent
If this function is defined, it will always be used in place of
@code{TARGET_ASM_OUTPUT_MI_THUNK}.
@end deftypefn
@node Profiling
@subsection Generating Code for Profiling
@cindex profiling, code generation
These macros will help you generate code for profiling.
@defmac FUNCTION_PROFILER (@var{file}, @var{labelno})
A C statement or compound statement to output to @var{file} some
assembler code to call the profiling subroutine @code{mcount}.
@findex mcount
The details of how @code{mcount} expects to be called are determined by
your operating system environment, not by GCC@. To figure them out,
compile a small program for profiling using the system's installed C
compiler and look at the assembler code that results.
Older implementations of @code{mcount} expect the address of a counter
variable to be loaded into some register. The name of this variable is
@samp{LP} followed by the number @var{labelno}, so you would generate
the name using @samp{LP%d} in a @code{fprintf}.
@end defmac
@defmac PROFILE_HOOK
A C statement or compound statement to output to @var{file} some assembly
code to call the profiling subroutine @code{mcount} even the target does
not support profiling.
@end defmac
@defmac NO_PROFILE_COUNTERS
Define this macro if the @code{mcount} subroutine on your system does
not need a counter variable allocated for each function. This is true
for almost all modern implementations. If you define this macro, you
must not use the @var{labelno} argument to @code{FUNCTION_PROFILER}.
@end defmac
@defmac PROFILE_BEFORE_PROLOGUE
Define this macro if the code for function profiling should come before
the function prologue. Normally, the profiling code comes after.
@end defmac
@node Tail Calls
@subsection Permitting tail calls
@cindex tail calls
@deftypefn {Target Hook} bool TARGET_FUNCTION_OK_FOR_SIBCALL (tree @var{decl}, tree @var{exp})
True if it is ok to do sibling call optimization for the specified
call expression @var{exp}. @var{decl} will be the called function,
or @code{NULL} if this is an indirect call.
It is not uncommon for limitations of calling conventions to prevent
tail calls to functions outside the current unit of translation, or
during PIC compilation. The hook is used to enforce these restrictions,
as the @code{sibcall} md pattern can not fail, or fall over to a
``normal'' call. The criteria for successful sibling call optimization
may vary greatly between different architectures.
@end deftypefn
@node Varargs
@section Implementing the Varargs Macros
@cindex varargs implementation
GCC comes with an implementation of @code{<varargs.h>} and
@code{<stdarg.h>} that work without change on machines that pass arguments
on the stack. Other machines require their own implementations of
varargs, and the two machine independent header files must have
conditionals to include it.
ISO @code{<stdarg.h>} differs from traditional @code{<varargs.h>} mainly in
the calling convention for @code{va_start}. The traditional
implementation takes just one argument, which is the variable in which
to store the argument pointer. The ISO implementation of
@code{va_start} takes an additional second argument. The user is
supposed to write the last named argument of the function here.
However, @code{va_start} should not use this argument. The way to find
the end of the named arguments is with the built-in functions described
below.
@defmac __builtin_saveregs ()
Use this built-in function to save the argument registers in memory so
that the varargs mechanism can access them. Both ISO and traditional
versions of @code{va_start} must use @code{__builtin_saveregs}, unless
you use @code{SETUP_INCOMING_VARARGS} (see below) instead.
On some machines, @code{__builtin_saveregs} is open-coded under the
control of the macro @code{EXPAND_BUILTIN_SAVEREGS}. On other machines,
it calls a routine written in assembler language, found in
@file{libgcc2.c}.
Code generated for the call to @code{__builtin_saveregs} appears at the
beginning of the function, as opposed to where the call to
@code{__builtin_saveregs} is written, regardless of what the code is.
This is because the registers must be saved before the function starts
to use them for its own purposes.
@c i rewrote the first sentence above to fix an overfull hbox. --mew
@c 10feb93
@end defmac
@defmac __builtin_args_info (@var{category})
Use this built-in function to find the first anonymous arguments in
registers.
In general, a machine may have several categories of registers used for
arguments, each for a particular category of data types. (For example,
on some machines, floating-point registers are used for floating-point
arguments while other arguments are passed in the general registers.)
To make non-varargs functions use the proper calling convention, you
have defined the @code{CUMULATIVE_ARGS} data type to record how many
registers in each category have been used so far
@code{__builtin_args_info} accesses the same data structure of type
@code{CUMULATIVE_ARGS} after the ordinary argument layout is finished
with it, with @var{category} specifying which word to access. Thus, the
value indicates the first unused register in a given category.
Normally, you would use @code{__builtin_args_info} in the implementation
of @code{va_start}, accessing each category just once and storing the
value in the @code{va_list} object. This is because @code{va_list} will
have to update the values, and there is no way to alter the
values accessed by @code{__builtin_args_info}.
@end defmac
@defmac __builtin_next_arg (@var{lastarg})
This is the equivalent of @code{__builtin_args_info}, for stack
arguments. It returns the address of the first anonymous stack
argument, as type @code{void *}. If @code{ARGS_GROW_DOWNWARD}, it
returns the address of the location above the first anonymous stack
argument. Use it in @code{va_start} to initialize the pointer for
fetching arguments from the stack. Also use it in @code{va_start} to
verify that the second parameter @var{lastarg} is the last named argument
of the current function.
@end defmac
@defmac __builtin_classify_type (@var{object})
Since each machine has its own conventions for which data types are
passed in which kind of register, your implementation of @code{va_arg}
has to embody these conventions. The easiest way to categorize the
specified data type is to use @code{__builtin_classify_type} together
with @code{sizeof} and @code{__alignof__}.
@code{__builtin_classify_type} ignores the value of @var{object},
considering only its data type. It returns an integer describing what
kind of type that is---integer, floating, pointer, structure, and so on.
The file @file{typeclass.h} defines an enumeration that you can use to
interpret the values of @code{__builtin_classify_type}.
@end defmac
These machine description macros help implement varargs:
@deftypefn {Target Hook} rtx TARGET_EXPAND_BUILTIN_SAVEREGS (void)
If defined, this hook produces the machine-specific code for a call to
@code{__builtin_saveregs}. This code will be moved to the very
beginning of the function, before any parameter access are made. The
return value of this function should be an RTX that contains the value
to use as the return of @code{__builtin_saveregs}.
@end deftypefn
@deftypefn {Target Hook} void TARGET_SETUP_INCOMING_VARARGS (CUMULATIVE_ARGS *@var{args_so_far}, enum machine_mode @var{mode}, tree @var{type}, int *@var{pretend_args_size}, int @var{second_time})
This target hook offers an alternative to using
@code{__builtin_saveregs} and defining the hook
@code{TARGET_EXPAND_BUILTIN_SAVEREGS}. Use it to store the anonymous
register arguments into the stack so that all the arguments appear to
have been passed consecutively on the stack. Once this is done, you can
use the standard implementation of varargs that works for machines that
pass all their arguments on the stack.
The argument @var{args_so_far} points to the @code{CUMULATIVE_ARGS} data
structure, containing the values that are obtained after processing the
named arguments. The arguments @var{mode} and @var{type} describe the
last named argument---its machine mode and its data type as a tree node.
The target hook should do two things: first, push onto the stack all the
argument registers @emph{not} used for the named arguments, and second,
store the size of the data thus pushed into the @code{int}-valued
variable pointed to by @var{pretend_args_size}. The value that you
store here will serve as additional offset for setting up the stack
frame.
Because you must generate code to push the anonymous arguments at
compile time without knowing their data types,
@code{TARGET_SETUP_INCOMING_VARARGS} is only useful on machines that
have just a single category of argument register and use it uniformly
for all data types.
If the argument @var{second_time} is nonzero, it means that the
arguments of the function are being analyzed for the second time. This
happens for an inline function, which is not actually compiled until the
end of the source file. The hook @code{TARGET_SETUP_INCOMING_VARARGS} should
not generate any instructions in this case.
@end deftypefn
@deftypefn {Target Hook} bool TARGET_STRICT_ARGUMENT_NAMING (CUMULATIVE_ARGS *@var{ca})
Define this hook to return @code{true} if the location where a function
argument is passed depends on whether or not it is a named argument.
This hook controls how the @var{named} argument to @code{FUNCTION_ARG}
is set for varargs and stdarg functions. If this hook returns
@code{true}, the @var{named} argument is always true for named
arguments, and false for unnamed arguments. If it returns @code{false},
but @code{TARGET_PRETEND_OUTOGOING_VARARGS_NAMED} returns @code{true},
then all arguments are treated as named. Otherwise, all named arguments
except the last are treated as named.
You need not define this hook if it always returns zero.
@end deftypefn
@deftypefn {Target Hook} bool TARGET_PRETEND_OUTGOING_VARARGS_NAMED
If you need to conditionally change ABIs so that one works with
@code{TARGET_SETUP_INCOMING_VARARGS}, but the other works like neither
@code{TARGET_SETUP_INCOMING_VARARGS} nor @code{TARGET_STRICT_ARGUMENT_NAMING} was
defined, then define this hook to return @code{true} if
@code{SETUP_INCOMING_VARARGS} is used, @code{false} otherwise.
Otherwise, you should not define this hook.
@end deftypefn
@node Trampolines
@section Trampolines for Nested Functions
@cindex trampolines for nested functions
@cindex nested functions, trampolines for
A @dfn{trampoline} is a small piece of code that is created at run time
when the address of a nested function is taken. It normally resides on
the stack, in the stack frame of the containing function. These macros
tell GCC how to generate code to allocate and initialize a
trampoline.
The instructions in the trampoline must do two things: load a constant
address into the static chain register, and jump to the real address of
the nested function. On CISC machines such as the m68k, this requires
two instructions, a move immediate and a jump. Then the two addresses
exist in the trampoline as word-long immediate operands. On RISC
machines, it is often necessary to load each address into a register in
two parts. Then pieces of each address form separate immediate
operands.
The code generated to initialize the trampoline must store the variable
parts---the static chain value and the function address---into the
immediate operands of the instructions. On a CISC machine, this is
simply a matter of copying each address to a memory reference at the
proper offset from the start of the trampoline. On a RISC machine, it
may be necessary to take out pieces of the address and store them
separately.
@defmac TRAMPOLINE_TEMPLATE (@var{file})
A C statement to output, on the stream @var{file}, assembler code for a
block of data that contains the constant parts of a trampoline. This
code should not include a label---the label is taken care of
automatically.
If you do not define this macro, it means no template is needed
for the target. Do not define this macro on systems where the block move
code to copy the trampoline into place would be larger than the code
to generate it on the spot.
@end defmac
@defmac TRAMPOLINE_SECTION
The name of a subroutine to switch to the section in which the
trampoline template is to be placed (@pxref{Sections}). The default is
a value of @samp{readonly_data_section}, which places the trampoline in
the section containing read-only data.
@end defmac
@defmac TRAMPOLINE_SIZE
A C expression for the size in bytes of the trampoline, as an integer.
@end defmac
@defmac TRAMPOLINE_ALIGNMENT
Alignment required for trampolines, in bits.
If you don't define this macro, the value of @code{BIGGEST_ALIGNMENT}
is used for aligning trampolines.
@end defmac
@defmac INITIALIZE_TRAMPOLINE (@var{addr}, @var{fnaddr}, @var{static_chain})
A C statement to initialize the variable parts of a trampoline.
@var{addr} is an RTX for the address of the trampoline; @var{fnaddr} is
an RTX for the address of the nested function; @var{static_chain} is an
RTX for the static chain value that should be passed to the function
when it is called.
@end defmac
@defmac TRAMPOLINE_ADJUST_ADDRESS (@var{addr})
A C statement that should perform any machine-specific adjustment in
the address of the trampoline. Its argument contains the address that
was passed to @code{INITIALIZE_TRAMPOLINE}. In case the address to be
used for a function call should be different from the address in which
the template was stored, the different address should be assigned to
@var{addr}. If this macro is not defined, @var{addr} will be used for
function calls.
@cindex @code{TARGET_ASM_FUNCTION_EPILOGUE} and trampolines
@cindex @code{TARGET_ASM_FUNCTION_PROLOGUE} and trampolines
If this macro is not defined, by default the trampoline is allocated as
a stack slot. This default is right for most machines. The exceptions
are machines where it is impossible to execute instructions in the stack
area. On such machines, you may have to implement a separate stack,
using this macro in conjunction with @code{TARGET_ASM_FUNCTION_PROLOGUE}
and @code{TARGET_ASM_FUNCTION_EPILOGUE}.
@var{fp} points to a data structure, a @code{struct function}, which
describes the compilation status of the immediate containing function of
the function which the trampoline is for. The stack slot for the
trampoline is in the stack frame of this containing function. Other
allocation strategies probably must do something analogous with this
information.
@end defmac
Implementing trampolines is difficult on many machines because they have
separate instruction and data caches. Writing into a stack location
fails to clear the memory in the instruction cache, so when the program
jumps to that location, it executes the old contents.
Here are two possible solutions. One is to clear the relevant parts of
the instruction cache whenever a trampoline is set up. The other is to
make all trampolines identical, by having them jump to a standard
subroutine. The former technique makes trampoline execution faster; the
latter makes initialization faster.
To clear the instruction cache when a trampoline is initialized, define
the following macro.
@defmac CLEAR_INSN_CACHE (@var{beg}, @var{end})
If defined, expands to a C expression clearing the @emph{instruction
cache} in the specified interval. The definition of this macro would
typically be a series of @code{asm} statements. Both @var{beg} and
@var{end} are both pointer expressions.
@end defmac
To use a standard subroutine, define the following macro. In addition,
you must make sure that the instructions in a trampoline fill an entire
cache line with identical instructions, or else ensure that the
beginning of the trampoline code is always aligned at the same point in
its cache line. Look in @file{m68k.h} as a guide.
@defmac TRANSFER_FROM_TRAMPOLINE
Define this macro if trampolines need a special subroutine to do their
work. The macro should expand to a series of @code{asm} statements
which will be compiled with GCC@. They go in a library function named
@code{__transfer_from_trampoline}.
If you need to avoid executing the ordinary prologue code of a compiled
C function when you jump to the subroutine, you can do so by placing a
special label of your own in the assembler code. Use one @code{asm}
statement to generate an assembler label, and another to make the label
global. Then trampolines can use that label to jump directly to your
special assembler code.
@end defmac
@node Library Calls
@section Implicit Calls to Library Routines
@cindex library subroutine names
@cindex @file{libgcc.a}
@c prevent bad page break with this line
Here is an explanation of implicit calls to library routines.
@defmac DECLARE_LIBRARY_RENAMES
This macro, if defined, should expand to a piece of C code that will get
expanded when compiling functions for libgcc.a. It can be used to
provide alternate names for gcc's internal library functions if there
are ABI-mandated names that the compiler should provide.
@end defmac
@findex init_one_libfunc
@findex set_optab_libfunc
@deftypefn {Target Hook} void TARGET_INIT_LIBFUNCS (void)
This hook should declare additional library routines or rename
existing ones, using the functions @code{set_optab_libfunc} and
@code{init_one_libfunc} defined in @file{optabs.c}.
@code{init_optabs} calls this macro after initializing all the normal
library routines.
The default is to do nothing. Most ports don't need to define this hook.
@end deftypefn
@defmac TARGET_FLOAT_LIB_COMPARE_RETURNS_BOOL (@var{mode}, @var{comparison})
This macro should return @code{true} if the library routine that
implements the floating point comparison operator @var{comparison} in
mode @var{mode} will return a boolean, and @var{false} if it will
return a tristate.
GCC's own floating point libraries return tristates from the
comparison operators, so the default returns false always. Most ports
don't need to define this macro.
@end defmac
@cindex US Software GOFAST, floating point emulation library
@cindex floating point emulation library, US Software GOFAST
@cindex GOFAST, floating point emulation library
@findex gofast_maybe_init_libfuncs
@defmac US_SOFTWARE_GOFAST
Define this macro if your system C library uses the US Software GOFAST
library to provide floating point emulation.
In addition to defining this macro, your architecture must set
@code{TARGET_INIT_LIBFUNCS} to @code{gofast_maybe_init_libfuncs}, or
else call that function from its version of that hook. It is defined
in @file{config/gofast.h}, which must be included by your
architecture's @file{@var{cpu}.c} file. See @file{sparc/sparc.c} for
an example.
If this macro is defined, the
@code{TARGET_FLOAT_LIB_COMPARE_RETURNS_BOOL} target hook must return
false for @code{SFmode} and @code{DFmode} comparisons.
@end defmac
@cindex @code{EDOM}, implicit usage
@findex matherr
@defmac TARGET_EDOM
The value of @code{EDOM} on the target machine, as a C integer constant
expression. If you don't define this macro, GCC does not attempt to
deposit the value of @code{EDOM} into @code{errno} directly. Look in
@file{/usr/include/errno.h} to find the value of @code{EDOM} on your
system.
If you do not define @code{TARGET_EDOM}, then compiled code reports
domain errors by calling the library function and letting it report the
error. If mathematical functions on your system use @code{matherr} when
there is an error, then you should leave @code{TARGET_EDOM} undefined so
that @code{matherr} is used normally.
@end defmac
@cindex @code{errno}, implicit usage
@defmac GEN_ERRNO_RTX
Define this macro as a C expression to create an rtl expression that
refers to the global ``variable'' @code{errno}. (On certain systems,
@code{errno} may not actually be a variable.) If you don't define this
macro, a reasonable default is used.
@end defmac
@cindex @code{bcopy}, implicit usage
@cindex @code{memcpy}, implicit usage
@cindex @code{memmove}, implicit usage
@cindex @code{bzero}, implicit usage
@cindex @code{memset}, implicit usage
@defmac TARGET_MEM_FUNCTIONS
Define this macro if GCC should generate calls to the ISO C
(and System V) library functions @code{memcpy}, @code{memmove} and
@code{memset} rather than the BSD functions @code{bcopy} and @code{bzero}.
@end defmac
@cindex C99 math functions, implicit usage
@defmac TARGET_C99_FUNCTIONS
When this macro is nonzero, GCC will implicitly optimize @code{sin} calls into
@code{sinf} and similarly for other functions defined by C99 standard. The
default is nonzero that should be proper value for most modern systems, however
number of existing systems lacks support for these functions in the runtime so
they needs this macro to be redefined to 0.
@end defmac
@defmac NEXT_OBJC_RUNTIME
Define this macro to generate code for Objective-C message sending using
the calling convention of the NeXT system. This calling convention
involves passing the object, the selector and the method arguments all
at once to the method-lookup library function.
The default calling convention passes just the object and the selector
to the lookup function, which returns a pointer to the method.
@end defmac
@node Addressing Modes
@section Addressing Modes
@cindex addressing modes
@c prevent bad page break with this line
This is about addressing modes.
@defmac HAVE_PRE_INCREMENT
@defmacx HAVE_PRE_DECREMENT
@defmacx HAVE_POST_INCREMENT
@defmacx HAVE_POST_DECREMENT
A C expression that is nonzero if the machine supports pre-increment,
pre-decrement, post-increment, or post-decrement addressing respectively.
@end defmac
@defmac HAVE_PRE_MODIFY_DISP
@defmacx HAVE_POST_MODIFY_DISP
A C expression that is nonzero if the machine supports pre- or
post-address side-effect generation involving constants other than
the size of the memory operand.
@end defmac
@defmac HAVE_PRE_MODIFY_REG
@defmacx HAVE_POST_MODIFY_REG
A C expression that is nonzero if the machine supports pre- or
post-address side-effect generation involving a register displacement.
@end defmac
@defmac CONSTANT_ADDRESS_P (@var{x})
A C expression that is 1 if the RTX @var{x} is a constant which
is a valid address. On most machines, this can be defined as
@code{CONSTANT_P (@var{x})}, but a few machines are more restrictive
in which constant addresses are supported.
@end defmac
@defmac CONSTANT_P (@var{x})
@code{CONSTANT_P}, which is defined by target-independent code,
accepts integer-values expressions whose values are not explicitly
known, such as @code{symbol_ref}, @code{label_ref}, and @code{high}
expressions and @code{const} arithmetic expressions, in addition to
@code{const_int} and @code{const_double} expressions.
@end defmac
@defmac MAX_REGS_PER_ADDRESS
A number, the maximum number of registers that can appear in a valid
memory address. Note that it is up to you to specify a value equal to
the maximum number that @code{GO_IF_LEGITIMATE_ADDRESS} would ever
accept.
@end defmac
@defmac GO_IF_LEGITIMATE_ADDRESS (@var{mode}, @var{x}, @var{label})
A C compound statement with a conditional @code{goto @var{label};}
executed if @var{x} (an RTX) is a legitimate memory address on the
target machine for a memory operand of mode @var{mode}.
It usually pays to define several simpler macros to serve as
subroutines for this one. Otherwise it may be too complicated to
understand.
This macro must exist in two variants: a strict variant and a
non-strict one. The strict variant is used in the reload pass. It
must be defined so that any pseudo-register that has not been
allocated a hard register is considered a memory reference. In
contexts where some kind of register is required, a pseudo-register
with no hard register must be rejected.
The non-strict variant is used in other passes. It must be defined to
accept all pseudo-registers in every context where some kind of
register is required.
@findex REG_OK_STRICT
Compiler source files that want to use the strict variant of this
macro define the macro @code{REG_OK_STRICT}. You should use an
@code{#ifdef REG_OK_STRICT} conditional to define the strict variant
in that case and the non-strict variant otherwise.
Subroutines to check for acceptable registers for various purposes (one
for base registers, one for index registers, and so on) are typically
among the subroutines used to define @code{GO_IF_LEGITIMATE_ADDRESS}.
Then only these subroutine macros need have two variants; the higher
levels of macros may be the same whether strict or not.
Normally, constant addresses which are the sum of a @code{symbol_ref}
and an integer are stored inside a @code{const} RTX to mark them as
constant. Therefore, there is no need to recognize such sums
specifically as legitimate addresses. Normally you would simply
recognize any @code{const} as legitimate.
Usually @code{PRINT_OPERAND_ADDRESS} is not prepared to handle constant
sums that are not marked with @code{const}. It assumes that a naked
@code{plus} indicates indexing. If so, then you @emph{must} reject such
naked constant sums as illegitimate addresses, so that none of them will
be given to @code{PRINT_OPERAND_ADDRESS}.
@cindex @code{TARGET_ENCODE_SECTION_INFO} and address validation
On some machines, whether a symbolic address is legitimate depends on
the section that the address refers to. On these machines, define the
target hook @code{TARGET_ENCODE_SECTION_INFO} to store the information
into the @code{symbol_ref}, and then check for it here. When you see a
@code{const}, you will have to look inside it to find the
@code{symbol_ref} in order to determine the section. @xref{Assembler
Format}.
@end defmac
@defmac REG_OK_FOR_BASE_P (@var{x})
A C expression that is nonzero if @var{x} (assumed to be a @code{reg}
RTX) is valid for use as a base register. For hard registers, it
should always accept those which the hardware permits and reject the
others. Whether the macro accepts or rejects pseudo registers must be
controlled by @code{REG_OK_STRICT} as described above. This usually
requires two variant definitions, of which @code{REG_OK_STRICT}
controls the one actually used.
@end defmac
@defmac REG_MODE_OK_FOR_BASE_P (@var{x}, @var{mode})
A C expression that is just like @code{REG_OK_FOR_BASE_P}, except that
that expression may examine the mode of the memory reference in
@var{mode}. You should define this macro if the mode of the memory
reference affects whether a register may be used as a base register. If
you define this macro, the compiler will use it instead of
@code{REG_OK_FOR_BASE_P}.
@end defmac
@defmac REG_OK_FOR_INDEX_P (@var{x})
A C expression that is nonzero if @var{x} (assumed to be a @code{reg}
RTX) is valid for use as an index register.
The difference between an index register and a base register is that
the index register may be scaled. If an address involves the sum of
two registers, neither one of them scaled, then either one may be
labeled the ``base'' and the other the ``index''; but whichever
labeling is used must fit the machine's constraints of which registers
may serve in each capacity. The compiler will try both labelings,
looking for one that is valid, and will reload one or both registers
only if neither labeling works.
@end defmac
@defmac FIND_BASE_TERM (@var{x})
A C expression to determine the base term of address @var{x}.
This macro is used in only one place: `find_base_term' in alias.c.
It is always safe for this macro to not be defined. It exists so
that alias analysis can understand machine-dependent addresses.
The typical use of this macro is to handle addresses containing
a label_ref or symbol_ref within an UNSPEC@.
@end defmac
@defmac LEGITIMIZE_ADDRESS (@var{x}, @var{oldx}, @var{mode}, @var{win})
A C compound statement that attempts to replace @var{x} with a valid
memory address for an operand of mode @var{mode}. @var{win} will be a
C statement label elsewhere in the code; the macro definition may use
@example
GO_IF_LEGITIMATE_ADDRESS (@var{mode}, @var{x}, @var{win});
@end example
@noindent
to avoid further processing if the address has become legitimate.
@findex break_out_memory_refs
@var{x} will always be the result of a call to @code{break_out_memory_refs},
and @var{oldx} will be the operand that was given to that function to produce
@var{x}.
The code generated by this macro should not alter the substructure of
@var{x}. If it transforms @var{x} into a more legitimate form, it
should assign @var{x} (which will always be a C variable) a new value.
It is not necessary for this macro to come up with a legitimate
address. The compiler has standard ways of doing so in all cases. In
fact, it is safe for this macro to do nothing. But often a
machine-dependent strategy can generate better code.
@end defmac
@defmac LEGITIMIZE_RELOAD_ADDRESS (@var{x}, @var{mode}, @var{opnum}, @var{type}, @var{ind_levels}, @var{win})
A C compound statement that attempts to replace @var{x}, which is an address
that needs reloading, with a valid memory address for an operand of mode
@var{mode}. @var{win} will be a C statement label elsewhere in the code.
It is not necessary to define this macro, but it might be useful for
performance reasons.
For example, on the i386, it is sometimes possible to use a single
reload register instead of two by reloading a sum of two pseudo
registers into a register. On the other hand, for number of RISC
processors offsets are limited so that often an intermediate address
needs to be generated in order to address a stack slot. By defining
@code{LEGITIMIZE_RELOAD_ADDRESS} appropriately, the intermediate addresses
generated for adjacent some stack slots can be made identical, and thus
be shared.
@emph{Note}: This macro should be used with caution. It is necessary
to know something of how reload works in order to effectively use this,
and it is quite easy to produce macros that build in too much knowledge
of reload internals.
@emph{Note}: This macro must be able to reload an address created by a
previous invocation of this macro. If it fails to handle such addresses
then the compiler may generate incorrect code or abort.
@findex push_reload
The macro definition should use @code{push_reload} to indicate parts that
need reloading; @var{opnum}, @var{type} and @var{ind_levels} are usually
suitable to be passed unaltered to @code{push_reload}.
The code generated by this macro must not alter the substructure of
@var{x}. If it transforms @var{x} into a more legitimate form, it
should assign @var{x} (which will always be a C variable) a new value.
This also applies to parts that you change indirectly by calling
@code{push_reload}.
@findex strict_memory_address_p
The macro definition may use @code{strict_memory_address_p} to test if
the address has become legitimate.
@findex copy_rtx
If you want to change only a part of @var{x}, one standard way of doing
this is to use @code{copy_rtx}. Note, however, that is unshares only a
single level of rtl. Thus, if the part to be changed is not at the
top level, you'll need to replace first the top level.
It is not necessary for this macro to come up with a legitimate
address; but often a machine-dependent strategy can generate better code.
@end defmac
@defmac GO_IF_MODE_DEPENDENT_ADDRESS (@var{addr}, @var{label})
A C statement or compound statement with a conditional @code{goto
@var{label};} executed if memory address @var{x} (an RTX) can have
different meanings depending on the machine mode of the memory
reference it is used for or if the address is valid for some modes
but not others.
Autoincrement and autodecrement addresses typically have mode-dependent
effects because the amount of the increment or decrement is the size
of the operand being addressed. Some machines have other mode-dependent
addresses. Many RISC machines have no mode-dependent addresses.
You may assume that @var{addr} is a valid address for the machine.
@end defmac
@defmac LEGITIMATE_CONSTANT_P (@var{x})
A C expression that is nonzero if @var{x} is a legitimate constant for
an immediate operand on the target machine. You can assume that
@var{x} satisfies @code{CONSTANT_P}, so you need not check this. In fact,
@samp{1} is a suitable definition for this macro on machines where
anything @code{CONSTANT_P} is valid.
@end defmac
@node Condition Code
@section Condition Code Status
@cindex condition code status
@c prevent bad page break with this line
This describes the condition code status.
@findex cc_status
The file @file{conditions.h} defines a variable @code{cc_status} to
describe how the condition code was computed (in case the interpretation of
the condition code depends on the instruction that it was set by). This
variable contains the RTL expressions on which the condition code is
currently based, and several standard flags.
Sometimes additional machine-specific flags must be defined in the machine
description header file. It can also add additional machine-specific
information by defining @code{CC_STATUS_MDEP}.
@defmac CC_STATUS_MDEP
C code for a data type which is used for declaring the @code{mdep}
component of @code{cc_status}. It defaults to @code{int}.
This macro is not used on machines that do not use @code{cc0}.
@end defmac
@defmac CC_STATUS_MDEP_INIT
A C expression to initialize the @code{mdep} field to ``empty''.
The default definition does nothing, since most machines don't use
the field anyway. If you want to use the field, you should probably
define this macro to initialize it.
This macro is not used on machines that do not use @code{cc0}.
@end defmac
@defmac NOTICE_UPDATE_CC (@var{exp}, @var{insn})
A C compound statement to set the components of @code{cc_status}
appropriately for an insn @var{insn} whose body is @var{exp}. It is
this macro's responsibility to recognize insns that set the condition
code as a byproduct of other activity as well as those that explicitly
set @code{(cc0)}.
This macro is not used on machines that do not use @code{cc0}.
If there are insns that do not set the condition code but do alter
other machine registers, this macro must check to see whether they
invalidate the expressions that the condition code is recorded as
reflecting. For example, on the 68000, insns that store in address
registers do not set the condition code, which means that usually
@code{NOTICE_UPDATE_CC} can leave @code{cc_status} unaltered for such
insns. But suppose that the previous insn set the condition code
based on location @samp{a4@@(102)} and the current insn stores a new
value in @samp{a4}. Although the condition code is not changed by
this, it will no longer be true that it reflects the contents of
@samp{a4@@(102)}. Therefore, @code{NOTICE_UPDATE_CC} must alter
@code{cc_status} in this case to say that nothing is known about the
condition code value.
The definition of @code{NOTICE_UPDATE_CC} must be prepared to deal
with the results of peephole optimization: insns whose patterns are
@code{parallel} RTXs containing various @code{reg}, @code{mem} or
constants which are just the operands. The RTL structure of these
insns is not sufficient to indicate what the insns actually do. What
@code{NOTICE_UPDATE_CC} should do when it sees one is just to run
@code{CC_STATUS_INIT}.
A possible definition of @code{NOTICE_UPDATE_CC} is to call a function
that looks at an attribute (@pxref{Insn Attributes}) named, for example,
@samp{cc}. This avoids having detailed information about patterns in
two places, the @file{md} file and in @code{NOTICE_UPDATE_CC}.
@end defmac
@defmac SELECT_CC_MODE (@var{op}, @var{x}, @var{y})
Returns a mode from class @code{MODE_CC} to be used when comparison
operation code @var{op} is applied to rtx @var{x} and @var{y}. For
example, on the SPARC, @code{SELECT_CC_MODE} is defined as (see
@pxref{Jump Patterns} for a description of the reason for this
definition)
@smallexample
#define SELECT_CC_MODE(OP,X,Y) \
(GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
? ((OP == EQ || OP == NE) ? CCFPmode : CCFPEmode) \
: ((GET_CODE (X) == PLUS || GET_CODE (X) == MINUS \
|| GET_CODE (X) == NEG) \
? CC_NOOVmode : CCmode))
@end smallexample
You should define this macro if and only if you define extra CC modes
in @file{@var{machine}-modes.def}.
@end defmac
@defmac CANONICALIZE_COMPARISON (@var{code}, @var{op0}, @var{op1})
On some machines not all possible comparisons are defined, but you can
convert an invalid comparison into a valid one. For example, the Alpha
does not have a @code{GT} comparison, but you can use an @code{LT}
comparison instead and swap the order of the operands.
On such machines, define this macro to be a C statement to do any
required conversions. @var{code} is the initial comparison code
and @var{op0} and @var{op1} are the left and right operands of the
comparison, respectively. You should modify @var{code}, @var{op0}, and
@var{op1} as required.
GCC will not assume that the comparison resulting from this macro is
valid but will see if the resulting insn matches a pattern in the
@file{md} file.
You need not define this macro if it would never change the comparison
code or operands.
@end defmac
@defmac REVERSIBLE_CC_MODE (@var{mode})
A C expression whose value is one if it is always safe to reverse a
comparison whose mode is @var{mode}. If @code{SELECT_CC_MODE}
can ever return @var{mode} for a floating-point inequality comparison,
then @code{REVERSIBLE_CC_MODE (@var{mode})} must be zero.
You need not define this macro if it would always returns zero or if the
floating-point format is anything other than @code{IEEE_FLOAT_FORMAT}.
For example, here is the definition used on the SPARC, where floating-point
inequality comparisons are always given @code{CCFPEmode}:
@smallexample
#define REVERSIBLE_CC_MODE(MODE) ((MODE) != CCFPEmode)
@end smallexample
@end defmac
@defmac REVERSE_CONDITION (@var{code}, @var{mode})
A C expression whose value is reversed condition code of the @var{code} for
comparison done in CC_MODE @var{mode}. The macro is used only in case
@code{REVERSIBLE_CC_MODE (@var{mode})} is nonzero. Define this macro in case
machine has some non-standard way how to reverse certain conditionals. For
instance in case all floating point conditions are non-trapping, compiler may
freely convert unordered compares to ordered one. Then definition may look
like:
@smallexample
#define REVERSE_CONDITION(CODE, MODE) \
((MODE) != CCFPmode ? reverse_condition (CODE) \
: reverse_condition_maybe_unordered (CODE))
@end smallexample
@end defmac
@defmac REVERSE_CONDEXEC_PREDICATES_P (@var{code1}, @var{code2})
A C expression that returns true if the conditional execution predicate
@var{code1} is the inverse of @var{code2} and vice versa. Define this to
return 0 if the target has conditional execution predicates that cannot be
reversed safely. If no expansion is specified, this macro is defined as
follows:
@smallexample
#define REVERSE_CONDEXEC_PREDICATES_P (x, y) \
((x) == reverse_condition (y))
@end smallexample
@end defmac
@node Costs
@section Describing Relative Costs of Operations
@cindex costs of instructions
@cindex relative costs
@cindex speed of instructions
These macros let you describe the relative speed of various operations
on the target machine.
@defmac REGISTER_MOVE_COST (@var{mode}, @var{from}, @var{to})
A C expression for the cost of moving data of mode @var{mode} from a
register in class @var{from} to one in class @var{to}. The classes are
expressed using the enumeration values such as @code{GENERAL_REGS}. A
value of 2 is the default; other values are interpreted relative to
that.
It is not required that the cost always equal 2 when @var{from} is the
same as @var{to}; on some machines it is expensive to move between
registers if they are not general registers.
If reload sees an insn consisting of a single @code{set} between two
hard registers, and if @code{REGISTER_MOVE_COST} applied to their
classes returns a value of 2, reload does not check to ensure that the
constraints of the insn are met. Setting a cost of other than 2 will
allow reload to verify that the constraints are met. You should do this
if the @samp{mov@var{m}} pattern's constraints do not allow such copying.
@end defmac
@defmac MEMORY_MOVE_COST (@var{mode}, @var{class}, @var{in})
A C expression for the cost of moving data of mode @var{mode} between a
register of class @var{class} and memory; @var{in} is zero if the value
is to be written to memory, nonzero if it is to be read in. This cost
is relative to those in @code{REGISTER_MOVE_COST}. If moving between
registers and memory is more expensive than between two registers, you
should define this macro to express the relative cost.
If you do not define this macro, GCC uses a default cost of 4 plus
the cost of copying via a secondary reload register, if one is
needed. If your machine requires a secondary reload register to copy
between memory and a register of @var{class} but the reload mechanism is
more complex than copying via an intermediate, define this macro to
reflect the actual cost of the move.
GCC defines the function @code{memory_move_secondary_cost} if
secondary reloads are needed. It computes the costs due to copying via
a secondary register. If your machine copies from memory using a
secondary register in the conventional way but the default base value of
4 is not correct for your machine, define this macro to add some other
value to the result of that function. The arguments to that function
are the same as to this macro.
@end defmac
@defmac BRANCH_COST
A C expression for the cost of a branch instruction. A value of 1 is
the default; other values are interpreted relative to that.
@end defmac
Here are additional macros which do not specify precise relative costs,
but only that certain actions are more expensive than GCC would
ordinarily expect.
@defmac SLOW_BYTE_ACCESS
Define this macro as a C expression which is nonzero if accessing less
than a word of memory (i.e.@: a @code{char} or a @code{short}) is no
faster than accessing a word of memory, i.e., if such access
require more than one instruction or if there is no difference in cost
between byte and (aligned) word loads.
When this macro is not defined, the compiler will access a field by
finding the smallest containing object; when it is defined, a fullword
load will be used if alignment permits. Unless bytes accesses are
faster than word accesses, using word accesses is preferable since it
may eliminate subsequent memory access if subsequent accesses occur to
other fields in the same word of the structure, but to different bytes.
@end defmac
@defmac SLOW_UNALIGNED_ACCESS (@var{mode}, @var{alignment})
Define this macro to be the value 1 if memory accesses described by the
@var{mode} and @var{alignment} parameters have a cost many times greater
than aligned accesses, for example if they are emulated in a trap
handler.
When this macro is nonzero, the compiler will act as if
@code{STRICT_ALIGNMENT} were nonzero when generating code for block
moves. This can cause significantly more instructions to be produced.
Therefore, do not set this macro nonzero if unaligned accesses only add a
cycle or two to the time for a memory access.
If the value of this macro is always zero, it need not be defined. If
this macro is defined, it should produce a nonzero value when
@code{STRICT_ALIGNMENT} is nonzero.
@end defmac
@defmac MOVE_RATIO
The threshold of number of scalar memory-to-memory move insns, @emph{below}
which a sequence of insns should be generated instead of a
string move insn or a library call. Increasing the value will always
make code faster, but eventually incurs high cost in increased code size.
Note that on machines where the corresponding move insn is a
@code{define_expand} that emits a sequence of insns, this macro counts
the number of such sequences.
If you don't define this, a reasonable default is used.
@end defmac
@defmac MOVE_BY_PIECES_P (@var{size}, @var{alignment})
A C expression used to determine whether @code{move_by_pieces} will be used to
copy a chunk of memory, or whether some other block move mechanism
will be used. Defaults to 1 if @code{move_by_pieces_ninsns} returns less
than @code{MOVE_RATIO}.
@end defmac
@defmac MOVE_MAX_PIECES
A C expression used by @code{move_by_pieces} to determine the largest unit
a load or store used to copy memory is. Defaults to @code{MOVE_MAX}.
@end defmac
@defmac CLEAR_RATIO
The threshold of number of scalar move insns, @emph{below} which a sequence
of insns should be generated to clear memory instead of a string clear insn
or a library call. Increasing the value will always make code faster, but
eventually incurs high cost in increased code size.
If you don't define this, a reasonable default is used.
@end defmac
@defmac CLEAR_BY_PIECES_P (@var{size}, @var{alignment})
A C expression used to determine whether @code{clear_by_pieces} will be used
to clear a chunk of memory, or whether some other block clear mechanism
will be used. Defaults to 1 if @code{move_by_pieces_ninsns} returns less
than @code{CLEAR_RATIO}.
@end defmac
@defmac STORE_BY_PIECES_P (@var{size}, @var{alignment})
A C expression used to determine whether @code{store_by_pieces} will be
used to set a chunk of memory to a constant value, or whether some other
mechanism will be used. Used by @code{__builtin_memset} when storing
values other than constant zero and by @code{__builtin_strcpy} when
when called with a constant source string.
Defaults to @code{MOVE_BY_PIECES_P}.
@end defmac
@defmac USE_LOAD_POST_INCREMENT (@var{mode})
A C expression used to determine whether a load postincrement is a good
thing to use for a given mode. Defaults to the value of
@code{HAVE_POST_INCREMENT}.
@end defmac
@defmac USE_LOAD_POST_DECREMENT (@var{mode})
A C expression used to determine whether a load postdecrement is a good
thing to use for a given mode. Defaults to the value of
@code{HAVE_POST_DECREMENT}.
@end defmac
@defmac USE_LOAD_PRE_INCREMENT (@var{mode})
A C expression used to determine whether a load preincrement is a good
thing to use for a given mode. Defaults to the value of
@code{HAVE_PRE_INCREMENT}.
@end defmac
@defmac USE_LOAD_PRE_DECREMENT (@var{mode})
A C expression used to determine whether a load predecrement is a good
thing to use for a given mode. Defaults to the value of
@code{HAVE_PRE_DECREMENT}.
@end defmac
@defmac USE_STORE_POST_INCREMENT (@var{mode})
A C expression used to determine whether a store postincrement is a good
thing to use for a given mode. Defaults to the value of
@code{HAVE_POST_INCREMENT}.
@end defmac
@defmac USE_STORE_POST_DECREMENT (@var{mode})
A C expression used to determine whether a store postdecrement is a good
thing to use for a given mode. Defaults to the value of
@code{HAVE_POST_DECREMENT}.
@end defmac
@defmac USE_STORE_PRE_INCREMENT (@var{mode})
This macro is used to determine whether a store preincrement is a good
thing to use for a given mode. Defaults to the value of
@code{HAVE_PRE_INCREMENT}.
@end defmac
@defmac USE_STORE_PRE_DECREMENT (@var{mode})
This macro is used to determine whether a store predecrement is a good
thing to use for a given mode. Defaults to the value of
@code{HAVE_PRE_DECREMENT}.
@end defmac
@defmac NO_FUNCTION_CSE
Define this macro if it is as good or better to call a constant
function address than to call an address kept in a register.
@end defmac
@defmac NO_RECURSIVE_FUNCTION_CSE
Define this macro if it is as good or better for a function to call
itself with an explicit address than to call an address kept in a
register.
@end defmac
@defmac RANGE_TEST_NON_SHORT_CIRCUIT
Define this macro if a non-short-circuit operation produced by
@samp{fold_range_test ()} is optimal. This macro defaults to true if
@code{BRANCH_COST} is greater than or equal to the value 2.
@end defmac
@deftypefn {Target Hook} bool TARGET_RTX_COSTS (rtx @var{x}, int @var{code}, int @var{outer_code}, int *@var{total})
This target hook describes the relative costs of RTL expressions.
The cost may depend on the precise form of the expression, which is
available for examination in @var{x}, and the rtx code of the expression
in which it is contained, found in @var{outer_code}. @var{code} is the
expression code---redundant, since it can be obtained with
@code{GET_CODE (@var{x})}.
In implementing this hook, you can use the construct
@code{COSTS_N_INSNS (@var{n})} to specify a cost equal to @var{n} fast
instructions.
On entry to the hook, @code{*@var{total}} contains a default estimate
for the cost of the expression. The hook should modify this value as
necessary.
The hook returns true when all subexpressions of @var{x} have been
processed, and false when @code{rtx_cost} should recurse.
@end deftypefn
@deftypefn {Target Hook} int TARGET_ADDRESS_COST (rtx @var{address})
This hook computes the cost of an addressing mode that contains
@var{address}. If not defined, the cost is computed from
the @var{address} expression and the @code{TARGET_RTX_COST} hook.
For most CISC machines, the default cost is a good approximation of the
true cost of the addressing mode. However, on RISC machines, all
instructions normally have the same length and execution time. Hence
all addresses will have equal costs.
In cases where more than one form of an address is known, the form with
the lowest cost will be used. If multiple forms have the same, lowest,
cost, the one that is the most complex will be used.
For example, suppose an address that is equal to the sum of a register
and a constant is used twice in the same basic block. When this macro
is not defined, the address will be computed in a register and memory
references will be indirect through that register. On machines where
the cost of the addressing mode containing the sum is no higher than
that of a simple indirect reference, this will produce an additional
instruction and possibly require an additional register. Proper
specification of this macro eliminates this overhead for such machines.
This hook is never called with an invalid address.
On machines where an address involving more than one register is as
cheap as an address computation involving only one register, defining
@code{TARGET_ADDRESS_COST} to reflect this can cause two registers to
be live over a region of code where only one would have been if
@code{TARGET_ADDRESS_COST} were not defined in that manner. This effect
should be considered in the definition of this macro. Equivalent costs
should probably only be given to addresses with different numbers of
registers on machines with lots of registers.
@end deftypefn
@node Scheduling
@section Adjusting the Instruction Scheduler
The instruction scheduler may need a fair amount of machine-specific
adjustment in order to produce good code. GCC provides several target
hooks for this purpose. It is usually enough to define just a few of
them: try the first ones in this list first.
@deftypefn {Target Hook} int TARGET_SCHED_ISSUE_RATE (void)
This hook returns the maximum number of instructions that can ever
issue at the same time on the target machine. The default is one.
Although the insn scheduler can define itself the possibility of issue
an insn on the same cycle, the value can serve as an additional
constraint to issue insns on the same simulated processor cycle (see
hooks @samp{TARGET_SCHED_REORDER} and @samp{TARGET_SCHED_REORDER2}).
This value must be constant over the entire compilation. If you need
it to vary depending on what the instructions are, you must use
@samp{TARGET_SCHED_VARIABLE_ISSUE}.
For the automaton based pipeline interface, you could define this hook
to return the value of the macro @code{MAX_DFA_ISSUE_RATE}.
@end deftypefn
@deftypefn {Target Hook} int TARGET_SCHED_VARIABLE_ISSUE (FILE *@var{file}, int @var{verbose}, rtx @var{insn}, int @var{more})
This hook is executed by the scheduler after it has scheduled an insn
from the ready list. It should return the number of insns which can
still be issued in the current cycle. The default is
@samp{@w{@var{more} - 1}} for insns other than @code{CLOBBER} and
@code{USE}, which normally are not counted against the issue rate.
You should define this hook if some insns take more machine resources
than others, so that fewer insns can follow them in the same cycle.
@var{file} is either a null pointer, or a stdio stream to write any
debug output to. @var{verbose} is the verbose level provided by
@option{-fsched-verbose-@var{n}}. @var{insn} is the instruction that
was scheduled.
@end deftypefn
@deftypefn {Target Hook} int TARGET_SCHED_ADJUST_COST (rtx @var{insn}, rtx @var{link}, rtx @var{dep_insn}, int @var{cost})
This function corrects the value of @var{cost} based on the
relationship between @var{insn} and @var{dep_insn} through the
dependence @var{link}. It should return the new value. The default
is to make no adjustment to @var{cost}. This can be used for example
to specify to the scheduler using the traditional pipeline description
that an output- or anti-dependence does not incur the same cost as a
data-dependence. If the scheduler using the automaton based pipeline
description, the cost of anti-dependence is zero and the cost of
output-dependence is maximum of one and the difference of latency
times of the first and the second insns. If these values are not
acceptable, you could use the hook to modify them too. See also
@pxref{Automaton pipeline description}.
@end deftypefn
@deftypefn {Target Hook} int TARGET_SCHED_ADJUST_PRIORITY (rtx @var{insn}, int @var{priority})
This hook adjusts the integer scheduling priority @var{priority} of
@var{insn}. It should return the new priority. Reduce the priority to
execute @var{insn} earlier, increase the priority to execute @var{insn}
later. Do not define this hook if you do not need to adjust the
scheduling priorities of insns.
@end deftypefn
@deftypefn {Target Hook} int TARGET_SCHED_REORDER (FILE *@var{file}, int @var{verbose}, rtx *@var{ready}, int *@var{n_readyp}, int @var{clock})
This hook is executed by the scheduler after it has scheduled the ready
list, to allow the machine description to reorder it (for example to
combine two small instructions together on @samp{VLIW} machines).
@var{file} is either a null pointer, or a stdio stream to write any
debug output to. @var{verbose} is the verbose level provided by
@option{-fsched-verbose-@var{n}}. @var{ready} is a pointer to the ready
list of instructions that are ready to be scheduled. @var{n_readyp} is
a pointer to the number of elements in the ready list. The scheduler
reads the ready list in reverse order, starting with
@var{ready}[@var{*n_readyp}-1] and going to @var{ready}[0]. @var{clock}
is the timer tick of the scheduler. You may modify the ready list and
the number of ready insns. The return value is the number of insns that
can issue this cycle; normally this is just @code{issue_rate}. See also
@samp{TARGET_SCHED_REORDER2}.
@end deftypefn
@deftypefn {Target Hook} int TARGET_SCHED_REORDER2 (FILE *@var{file}, int @var{verbose}, rtx *@var{ready}, int *@var{n_ready}, @var{clock})
Like @samp{TARGET_SCHED_REORDER}, but called at a different time. That
function is called whenever the scheduler starts a new cycle. This one
is called once per iteration over a cycle, immediately after
@samp{TARGET_SCHED_VARIABLE_ISSUE}; it can reorder the ready list and
return the number of insns to be scheduled in the same cycle. Defining
this hook can be useful if there are frequent situations where
scheduling one insn causes other insns to become ready in the same
cycle. These other insns can then be taken into account properly.
@end deftypefn
@deftypefn {Target Hook} void TARGET_SCHED_DEPENDENCIES_EVALUATION_HOOK (rtx @var{head}, rtx @var{tail})
This hook is called after evaluation forward dependencies of insns in
chain given by two parameter values (@var{head} and @var{tail}
correspondingly) but before insns scheduling of the insn chain. For
example, it can be used for better insn classification if it requires
analysis of dependencies. This hook can use backward and forward
dependencies of the insn scheduler because they are already
calculated.
@end deftypefn
@deftypefn {Target Hook} void TARGET_SCHED_INIT (FILE *@var{file}, int @var{verbose}, int @var{max_ready})
This hook is executed by the scheduler at the beginning of each block of
instructions that are to be scheduled. @var{file} is either a null
pointer, or a stdio stream to write any debug output to. @var{verbose}
is the verbose level provided by @option{-fsched-verbose-@var{n}}.
@var{max_ready} is the maximum number of insns in the current scheduling
region that can be live at the same time. This can be used to allocate
scratch space if it is needed, e.g. by @samp{TARGET_SCHED_REORDER}.
@end deftypefn
@deftypefn {Target Hook} void TARGET_SCHED_FINISH (FILE *@var{file}, int @var{verbose})
This hook is executed by the scheduler at the end of each block of
instructions that are to be scheduled. It can be used to perform
cleanup of any actions done by the other scheduling hooks. @var{file}
is either a null pointer, or a stdio stream to write any debug output
to. @var{verbose} is the verbose level provided by
@option{-fsched-verbose-@var{n}}.
@end deftypefn
@deftypefn {Target Hook} int TARGET_SCHED_USE_DFA_PIPELINE_INTERFACE (void)
This hook is called many times during insn scheduling. If the hook
returns nonzero, the automaton based pipeline description is used for
insn scheduling. Otherwise the traditional pipeline description is
used. The default is usage of the traditional pipeline description.
You should also remember that to simplify the insn scheduler sources
an empty traditional pipeline description interface is generated even
if there is no a traditional pipeline description in the @file{.md}
file. The same is true for the automaton based pipeline description.
That means that you should be accurate in defining the hook.
@end deftypefn
@deftypefn {Target Hook} int TARGET_SCHED_DFA_PRE_CYCLE_INSN (void)
The hook returns an RTL insn. The automaton state used in the
pipeline hazard recognizer is changed as if the insn were scheduled
when the new simulated processor cycle starts. Usage of the hook may
simplify the automaton pipeline description for some @acronym{VLIW}
processors. If the hook is defined, it is used only for the automaton
based pipeline description. The default is not to change the state
when the new simulated processor cycle starts.
@end deftypefn
@deftypefn {Target Hook} void TARGET_SCHED_INIT_DFA_PRE_CYCLE_INSN (void)
The hook can be used to initialize data used by the previous hook.
@end deftypefn
@deftypefn {Target Hook} int TARGET_SCHED_DFA_POST_CYCLE_INSN (void)
The hook is analogous to @samp{TARGET_SCHED_DFA_PRE_CYCLE_INSN} but used
to changed the state as if the insn were scheduled when the new
simulated processor cycle finishes.
@end deftypefn
@deftypefn {Target Hook} void TARGET_SCHED_INIT_DFA_POST_CYCLE_INSN (void)
The hook is analogous to @samp{TARGET_SCHED_INIT_DFA_PRE_CYCLE_INSN} but
used to initialize data used by the previous hook.
@end deftypefn
@deftypefn {Target Hook} int TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD (void)
This hook controls better choosing an insn from the ready insn queue
for the @acronym{DFA}-based insn scheduler. Usually the scheduler
chooses the first insn from the queue. If the hook returns a positive
value, an additional scheduler code tries all permutations of
@samp{TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD ()}
subsequent ready insns to choose an insn whose issue will result in
maximal number of issued insns on the same cycle. For the
@acronym{VLIW} processor, the code could actually solve the problem of
packing simple insns into the @acronym{VLIW} insn. Of course, if the
rules of @acronym{VLIW} packing are described in the automaton.
This code also could be used for superscalar @acronym{RISC}
processors. Let us consider a superscalar @acronym{RISC} processor
with 3 pipelines. Some insns can be executed in pipelines @var{A} or
@var{B}, some insns can be executed only in pipelines @var{B} or
@var{C}, and one insn can be executed in pipeline @var{B}. The
processor may issue the 1st insn into @var{A} and the 2nd one into
@var{B}. In this case, the 3rd insn will wait for freeing @var{B}
until the next cycle. If the scheduler issues the 3rd insn the first,
the processor could issue all 3 insns per cycle.
Actually this code demonstrates advantages of the automaton based
pipeline hazard recognizer. We try quickly and easy many insn
schedules to choose the best one.
The default is no multipass scheduling.
@end deftypefn
@deftypefn {Target Hook} int TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD_GUARD (rtx)
This hook controls what insns from the ready insn queue will be
considered for the multipass insn scheduling. If the hook returns
zero for insn passed as the parameter, the insn will be not chosen to
be issued.
The default is that any ready insns can be chosen to be issued.
@end deftypefn
@deftypefn {Target Hook} int TARGET_SCHED_DFA_NEW_CYCLE (FILE *, int, rtx, int, int, int *)
This hook is called by the insn scheduler before issuing insn passed
as the third parameter on given cycle. If the hook returns nonzero,
the insn is not issued on given processors cycle. Instead of that,
the processor cycle is advanced. If the value passed through the last
parameter is zero, the insn ready queue is not sorted on the new cycle
start as usually. The first parameter passes file for debugging
output. The second one passes the scheduler verbose level of the
debugging output. The forth and the fifth parameter values are
correspondingly processor cycle on which the previous insn has been
issued and the current processor cycle.
@end deftypefn
@deftypefn {Target Hook} void TARGET_SCHED_INIT_DFA_BUBBLES (void)
The @acronym{DFA}-based scheduler could take the insertion of nop
operations for better insn scheduling into account. It can be done
only if the multi-pass insn scheduling works (see hook
@samp{TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD}).
Let us consider a @acronym{VLIW} processor insn with 3 slots. Each
insn can be placed only in one of the three slots. We have 3 ready
insns @var{A}, @var{B}, and @var{C}. @var{A} and @var{C} can be
placed only in the 1st slot, @var{B} can be placed only in the 3rd
slot. We described the automaton which does not permit empty slot
gaps between insns (usually such description is simpler). Without
this code the scheduler would place each insn in 3 separate
@acronym{VLIW} insns. If the scheduler places a nop insn into the 2nd
slot, it could place the 3 insns into 2 @acronym{VLIW} insns. What is
the nop insn is returned by hook @samp{TARGET_SCHED_DFA_BUBBLE}. Hook
@samp{TARGET_SCHED_INIT_DFA_BUBBLES} can be used to initialize or
create the nop insns.
You should remember that the scheduler does not insert the nop insns.
It is not wise because of the following optimizations. The scheduler
only considers such possibility to improve the result schedule. The
nop insns should be inserted lately, e.g. on the final phase.
@end deftypefn
@deftypefn {Target Hook} rtx TARGET_SCHED_DFA_BUBBLE (int @var{index})
This hook @samp{FIRST_CYCLE_MULTIPASS_SCHEDULING} is used to insert
nop operations for better insn scheduling when @acronym{DFA}-based
scheduler makes multipass insn scheduling (see also description of
hook @samp{TARGET_SCHED_INIT_DFA_BUBBLES}). This hook
returns a nop insn with given @var{index}. The indexes start with
zero. The hook should return @code{NULL} if there are no more nop
insns with indexes greater than given index.
@end deftypefn
@deftypefn {Target Hook} bool IS_COSTLY_DEPENDENCE (rtx @var{insn1}, rtx @var{insn2}, rtx @var{dep_link}, int @var{dep_cost}, int @var{distance})
This hook is used to define which dependences are considered costly by
the target, so costly that it is not advisable to schedule the insns that
are involved in the dependence too close to one another. The parameters
to this hook are as follows: The second parameter @var{insn2} is dependent
upon the first parameter @var{insn1}. The dependence between @var{insn1}
and @var{insn2} is represented by the third parameter @var{dep_link}. The
fourth parameter @var{cost} is the cost of the dependence, and the fifth
parameter @var{distance} is the distance in cycles between the two insns.
The hook returns @code{true} if considering the distance between the two
insns the dependence between them is considered costly by the target,
and @code{false} otherwise.
Defining this hook can be useful in multiple-issue out-of-order machines,
where (a) it's practically hopeless to predict the actual data/resource
delays, however: (b) there's a better chance to predict the actual grouping
that will be formed, and (c) correctly emulating the grouping can be very
important. In such targets one may want to allow issuing dependent insns
closer to one another - i.e, closer than the dependence distance; however,
not in cases of "costly dependences", which this hooks allows to define.
@end deftypefn
Macros in the following table are generated by the program
@file{genattr} and can be useful for writing the hooks.
@defmac TRADITIONAL_PIPELINE_INTERFACE
The macro definition is generated if there is a traditional pipeline
description in @file{.md} file. You should also remember that to
simplify the insn scheduler sources an empty traditional pipeline
description interface is generated even if there is no a traditional
pipeline description in the @file{.md} file. The macro can be used to
distinguish the two types of the traditional interface.
@end defmac
@defmac DFA_PIPELINE_INTERFACE
The macro definition is generated if there is an automaton pipeline
description in @file{.md} file. You should also remember that to
simplify the insn scheduler sources an empty automaton pipeline
description interface is generated even if there is no an automaton
pipeline description in the @file{.md} file. The macro can be used to
distinguish the two types of the automaton interface.
@end defmac
@defmac MAX_DFA_ISSUE_RATE
The macro definition is generated in the automaton based pipeline
description interface. Its value is calculated from the automaton
based pipeline description and is equal to maximal number of all insns
described in constructions @samp{define_insn_reservation} which can be
issued on the same processor cycle.
@end defmac
@node Sections
@section Dividing the Output into Sections (Texts, Data, @dots{})
@c the above section title is WAY too long. maybe cut the part between
@c the (...)? --mew 10feb93
An object file is divided into sections containing different types of
data. In the most common case, there are three sections: the @dfn{text
section}, which holds instructions and read-only data; the @dfn{data
section}, which holds initialized writable data; and the @dfn{bss
section}, which holds uninitialized data. Some systems have other kinds
of sections.
The compiler must tell the assembler when to switch sections. These
macros control what commands to output to tell the assembler this. You
can also define additional sections.
@defmac TEXT_SECTION_ASM_OP
A C expression whose value is a string, including spacing, containing the
assembler operation that should precede instructions and read-only data.
Normally @code{"\t.text"} is right.
@end defmac
@defmac TEXT_SECTION
A C statement that switches to the default section containing instructions.
Normally this is not needed, as simply defining @code{TEXT_SECTION_ASM_OP}
is enough. The MIPS port uses this to sort all functions after all data
declarations.
@end defmac
@defmac HOT_TEXT_SECTION_NAME
If defined, a C string constant for the name of the section containing most
frequently executed functions of the program. If not defined, GCC will provide
a default definition if the target supports named sections.
@end defmac
@defmac UNLIKELY_EXECUTED_TEXT_SECTION_NAME
If defined, a C string constant for the name of the section containing unlikely
executed functions in the program.
@end defmac
@defmac DATA_SECTION_ASM_OP
A C expression whose value is a string, including spacing, containing the
assembler operation to identify the following data as writable initialized
data. Normally @code{"\t.data"} is right.
@end defmac
@defmac READONLY_DATA_SECTION_ASM_OP
A C expression whose value is a string, including spacing, containing the
assembler operation to identify the following data as read-only initialized
data.
@end defmac
@defmac READONLY_DATA_SECTION
A macro naming a function to call to switch to the proper section for
read-only data. The default is to use @code{READONLY_DATA_SECTION_ASM_OP}
if defined, else fall back to @code{text_section}.
The most common definition will be @code{data_section}, if the target
does not have a special read-only data section, and does not put data
in the text section.
@end defmac
@defmac SHARED_SECTION_ASM_OP
If defined, a C expression whose value is a string, including spacing,
containing the assembler operation to identify the following data as
shared data. If not defined, @code{DATA_SECTION_ASM_OP} will be used.
@end defmac
@defmac BSS_SECTION_ASM_OP
If defined, a C expression whose value is a string, including spacing,
containing the assembler operation to identify the following data as
uninitialized global data. If not defined, and neither
@code{ASM_OUTPUT_BSS} nor @code{ASM_OUTPUT_ALIGNED_BSS} are defined,
uninitialized global data will be output in the data section if
@option{-fno-common} is passed, otherwise @code{ASM_OUTPUT_COMMON} will be
used.
@end defmac
@defmac SHARED_BSS_SECTION_ASM_OP
If defined, a C expression whose value is a string, including spacing,
containing the assembler operation to identify the following data as
uninitialized global shared data. If not defined, and
@code{BSS_SECTION_ASM_OP} is, the latter will be used.
@end defmac
@defmac INIT_SECTION_ASM_OP
If defined, a C expression whose value is a string, including spacing,
containing the assembler operation to identify the following data as
initialization code. If not defined, GCC will assume such a section does
not exist.
@end defmac
@defmac FINI_SECTION_ASM_OP
If defined, a C expression whose value is a string, including spacing,
containing the assembler operation to identify the following data as
finalization code. If not defined, GCC will assume such a section does
not exist.
@end defmac
@defmac CRT_CALL_STATIC_FUNCTION (@var{section_op}, @var{function})
If defined, an ASM statement that switches to a different section
via @var{section_op}, calls @var{function}, and switches back to
the text section. This is used in @file{crtstuff.c} if
@code{INIT_SECTION_ASM_OP} or @code{FINI_SECTION_ASM_OP} to calls
to initialization and finalization functions from the init and fini
sections. By default, this macro uses a simple function call. Some
ports need hand-crafted assembly code to avoid dependencies on
registers initialized in the function prologue or to ensure that
constant pools don't end up too far way in the text section.
@end defmac
@defmac FORCE_CODE_SECTION_ALIGN
If defined, an ASM statement that aligns a code section to some
arbitrary boundary. This is used to force all fragments of the
@code{.init} and @code{.fini} sections to have to same alignment
and thus prevent the linker from having to add any padding.
@end defmac
@findex in_text
@findex in_data
@defmac EXTRA_SECTIONS
A list of names for sections other than the standard two, which are
@code{in_text} and @code{in_data}. You need not define this macro
on a system with no other sections (that GCC needs to use).
@end defmac
@findex text_section
@findex data_section
@defmac EXTRA_SECTION_FUNCTIONS
One or more functions to be defined in @file{varasm.c}. These
functions should do jobs analogous to those of @code{text_section} and
@code{data_section}, for your additional sections. Do not define this
macro if you do not define @code{EXTRA_SECTIONS}.
@end defmac
@defmac JUMP_TABLES_IN_TEXT_SECTION
Define this macro to be an expression with a nonzero value if jump
tables (for @code{tablejump} insns) should be output in the text
section, along with the assembler instructions. Otherwise, the
readonly data section is used.
This macro is irrelevant if there is no separate readonly data section.
@end defmac
@deftypefn {Target Hook} void TARGET_ASM_SELECT_SECTION (tree @var{exp}, int @var{reloc}, unsigned HOST_WIDE_INT @var{align})
Switches to the appropriate section for output of @var{exp}. You can
assume that @var{exp} is either a @code{VAR_DECL} node or a constant of
some sort. @var{reloc} indicates whether the initial value of @var{exp}
requires link-time relocations. Bit 0 is set when variable contains
local relocations only, while bit 1 is set for global relocations.
Select the section by calling @code{data_section} or one of the
alternatives for other sections. @var{align} is the constant alignment
in bits.
The default version of this function takes care of putting read-only
variables in @code{readonly_data_section}.
@end deftypefn
@deftypefn {Target Hook} void TARGET_ASM_UNIQUE_SECTION (tree @var{decl}, int @var{reloc})
Build up a unique section name, expressed as a @code{STRING_CST} node,
and assign it to @samp{DECL_SECTION_NAME (@var{decl})}.
As with @code{TARGET_ASM_SELECT_SECTION}, @var{reloc} indicates whether
the initial value of @var{exp} requires link-time relocations.
The default version of this function appends the symbol name to the
ELF section name that would normally be used for the symbol. For
example, the function @code{foo} would be placed in @code{.text.foo}.
Whatever the actual target object format, this is often good enough.
@end deftypefn
@deftypefn {Target Hook} void TARGET_ASM_SELECT_RTX_SECTION (enum machine_mode @var{mode}, rtx @var{x}, unsigned HOST_WIDE_INT @var{align})
Switches to the appropriate section for output of constant pool entry
@var{x} in @var{mode}. You can assume that @var{x} is some kind of
constant in RTL@. The argument @var{mode} is redundant except in the
case of a @code{const_int} rtx. Select the section by calling
@code{readonly_data_section} or one of the alternatives for other
sections. @var{align} is the constant alignment in bits.
The default version of this function takes care of putting symbolic
constants in @code{flag_pic} mode in @code{data_section} and everything
else in @code{readonly_data_section}.
@end deftypefn
@deftypefn {Target Hook} void TARGET_ENCODE_SECTION_INFO (tree @var{decl}, rtx @var{rtl}, int @var{new_decl_p})
Define this hook if references to a symbol or a constant must be
treated differently depending on something about the variable or
function named by the symbol (such as what section it is in).
The hook is executed immediately after rtl has been created for
@var{decl}, which may be a variable or function declaration or
an entry in the constant pool. In either case, @var{rtl} is the
rtl in question. Do @emph{not} use @code{DECL_RTL (@var{decl})}
in this hook; that field may not have been initialized yet.
In the case of a constant, it is safe to assume that the rtl is
a @code{mem} whose address is a @code{symbol_ref}. Most decls
will also have this form, but that is not guaranteed. Global
register variables, for instance, will have a @code{reg} for their
rtl. (Normally the right thing to do with such unusual rtl is
leave it alone.)
The @var{new_decl_p} argument will be true if this is the first time
that @code{TARGET_ENCODE_SECTION_INFO} has been invoked on this decl. It will
be false for subsequent invocations, which will happen for duplicate
declarations. Whether or not anything must be done for the duplicate
declaration depends on whether the hook examines @code{DECL_ATTRIBUTES}.
@var{new_decl_p} is always true when the hook is called for a constant.
@cindex @code{SYMBOL_REF_FLAG}, in @code{TARGET_ENCODE_SECTION_INFO}
The usual thing for this hook to do is to record flags in the
@code{symbol_ref}, using @code{SYMBOL_REF_FLAG} or @code{SYMBOL_REF_FLAGS}.
Historically, the name string was modified if it was necessary to
encode more than one bit of information, but this practice is now
discouraged; use @code{SYMBOL_REF_FLAGS}.
The default definition of this hook, @code{default_encode_section_info}
in @file{varasm.c}, sets a number of commonly-useful bits in
@code{SYMBOL_REF_FLAGS}. Check whether the default does what you need
before overriding it.
@end deftypefn
@deftypefn {Target Hook} const char *TARGET_STRIP_NAME_ENCODING (const char *name)
Decode @var{name} and return the real name part, sans
the characters that @code{TARGET_ENCODE_SECTION_INFO}
may have added.
@end deftypefn
@deftypefn {Target Hook} bool TARGET_IN_SMALL_DATA_P (tree @var{exp})
Returns true if @var{exp} should be placed into a ``small data'' section.
The default version of this hook always returns false.
@end deftypefn
@deftypevar {Target Hook} bool TARGET_HAVE_SRODATA_SECTION
Contains the value true if the target places read-only
``small data'' into a separate section. The default value is false.
@end deftypevar
@deftypefn {Target Hook} bool TARGET_BINDS_LOCAL_P (tree @var{exp})
Returns true if @var{exp} names an object for which name resolution
rules must resolve to the current ``module'' (dynamic shared library
or executable image).
The default version of this hook implements the name resolution rules
for ELF, which has a looser model of global name binding than other
currently supported object file formats.
@end deftypefn
@deftypevar {Target Hook} bool TARGET_HAVE_TLS
Contains the value true if the target supports thread-local storage.
The default value is false.
@end deftypevar
@node PIC
@section Position Independent Code
@cindex position independent code
@cindex PIC
This section describes macros that help implement generation of position
independent code. Simply defining these macros is not enough to
generate valid PIC; you must also add support to the macros
@code{GO_IF_LEGITIMATE_ADDRESS} and @code{PRINT_OPERAND_ADDRESS}, as
well as @code{LEGITIMIZE_ADDRESS}. You must modify the definition of
@samp{movsi} to do something appropriate when the source operand
contains a symbolic address. You may also need to alter the handling of
switch statements so that they use relative addresses.
@c i rearranged the order of the macros above to try to force one of
@c them to the next line, to eliminate an overfull hbox. --mew 10feb93
@defmac PIC_OFFSET_TABLE_REGNUM
The register number of the register used to address a table of static
data addresses in memory. In some cases this register is defined by a
processor's ``application binary interface'' (ABI)@. When this macro
is defined, RTL is generated for this register once, as with the stack
pointer and frame pointer registers. If this macro is not defined, it
is up to the machine-dependent files to allocate such a register (if
necessary). Note that this register must be fixed when in use (e.g.@:
when @code{flag_pic} is true).
@end defmac
@defmac PIC_OFFSET_TABLE_REG_CALL_CLOBBERED
Define this macro if the register defined by
@code{PIC_OFFSET_TABLE_REGNUM} is clobbered by calls. Do not define
this macro if @code{PIC_OFFSET_TABLE_REGNUM} is not defined.
@end defmac
@defmac FINALIZE_PIC
By generating position-independent code, when two different programs (A
and B) share a common library (libC.a), the text of the library can be
shared whether or not the library is linked at the same address for both
programs. In some of these environments, position-independent code
requires not only the use of different addressing modes, but also
special code to enable the use of these addressing modes.
The @code{FINALIZE_PIC} macro serves as a hook to emit these special
codes once the function is being compiled into assembly code, but not
before. (It is not done before, because in the case of compiling an
inline function, it would lead to multiple PIC prologues being
included in functions which used inline functions and were compiled to
assembly language.)
@end defmac
@defmac LEGITIMATE_PIC_OPERAND_P (@var{x})
A C expression that is nonzero if @var{x} is a legitimate immediate
operand on the target machine when generating position independent code.
You can assume that @var{x} satisfies @code{CONSTANT_P}, so you need not
check this. You can also assume @var{flag_pic} is true, so you need not
check it either. You need not define this macro if all constants
(including @code{SYMBOL_REF}) can be immediate operands when generating
position independent code.
@end defmac
@node Assembler Format
@section Defining the Output Assembler Language
This section describes macros whose principal purpose is to describe how
to write instructions in assembler language---rather than what the
instructions do.
@menu
* File Framework:: Structural information for the assembler file.
* Data Output:: Output of constants (numbers, strings, addresses).
* Uninitialized Data:: Output of uninitialized variables.
* Label Output:: Output and generation of labels.
* Initialization:: General principles of initialization
and termination routines.
* Macros for Initialization::
Specific macros that control the handling of
initialization and termination routines.
* Instruction Output:: Output of actual instructions.
* Dispatch Tables:: Output of jump tables.
* Exception Region Output:: Output of exception region code.
* Alignment Output:: Pseudo ops for alignment and skipping data.
@end menu
@node File Framework
@subsection The Overall Framework of an Assembler File
@cindex assembler format
@cindex output of assembler code
@c prevent bad page break with this line
This describes the overall framework of an assembly file.
@deftypefn {Target Hook} void TARGET_ASM_FILE_START ()
@findex default_file_start
Output to @code{asm_out_file} any text which the assembler expects to
find at the beginning of a file. The default behavior is controlled
by two flags, documented below. Unless your target's assembler is
quite unusual, if you override the default, you should call
@code{default_file_start} at some point in your target hook. This
lets other target files rely on these variables.
@end deftypefn
@deftypevr {Target Hook} bool TARGET_ASM_FILE_START_APP_OFF
If this flag is true, the text of the macro @code{ASM_APP_OFF} will be
printed as the very first line in the assembly file, unless
@option{-fverbose-asm} is in effect. (If that macro has been defined
to the empty string, this variable has no effect.) With the normal
definition of @code{ASM_APP_OFF}, the effect is to notify the GNU
assembler that it need not bother stripping comments or extra
whitespace from its input. This allows it to work a bit faster.
The default is false. You should not set it to true unless you have
verified that your port does not generate any extra whitespace or
comments that will cause GAS to issue errors in NO_APP mode.
@end deftypevr
@deftypevr {Target Hook} bool TARGET_ASM_FILE_START_FILE_DIRECTIVE
If this flag is true, @code{output_file_directive} will be called
for the primary source file, immediately after printing
@code{ASM_APP_OFF} (if that is enabled). Most ELF assemblers expect
this to be done. The default is false.
@end deftypevr
@deftypefn {Target Hook} void TARGET_ASM_FILE_END ()
Output to @code{asm_out_file} any text which the assembler expects
to find at the end of a file. The default is to output nothing.
@end deftypefn
@deftypefun void file_end_indicate_exec_stack ()
Some systems use a common convention, the @samp{.note.GNU-stack}
special section, to indicate whether or not an object file relies on
the stack being executable. If your system uses this convention, you
should define @code{TARGET_ASM_FILE_END} to this function. If you
need to do other things in that hook, have your hook function call
this function.
@end deftypefun
@defmac ASM_COMMENT_START
A C string constant describing how to begin a comment in the target
assembler language. The compiler assumes that the comment will end at
the end of the line.
@end defmac
@defmac ASM_APP_ON
A C string constant for text to be output before each @code{asm}
statement or group of consecutive ones. Normally this is
@code{"#APP"}, which is a comment that has no effect on most
assemblers but tells the GNU assembler that it must check the lines
that follow for all valid assembler constructs.
@end defmac
@defmac ASM_APP_OFF
A C string constant for text to be output after each @code{asm}
statement or group of consecutive ones. Normally this is
@code{"#NO_APP"}, which tells the GNU assembler to resume making the
time-saving assumptions that are valid for ordinary compiler output.
@end defmac
@defmac ASM_OUTPUT_SOURCE_FILENAME (@var{stream}, @var{name})
A C statement to output COFF information or DWARF debugging information
which indicates that filename @var{name} is the current source file to
the stdio stream @var{stream}.
This macro need not be defined if the standard form of output
for the file format in use is appropriate.
@end defmac
@defmac OUTPUT_QUOTED_STRING (@var{stream}, @var{string})
A C statement to output the string @var{string} to the stdio stream
@var{stream}. If you do not call the function @code{output_quoted_string}
in your config files, GCC will only call it to output filenames to
the assembler source. So you can use it to canonicalize the format
of the filename using this macro.
@end defmac
@defmac ASM_OUTPUT_SOURCE_LINE (@var{stream}, @var{line}, @var{counter})
A C statement to output DBX or SDB debugging information before code
for line number @var{line} of the current source file to the
stdio stream @var{stream}. @var{counter} is the number of time the
macro was invoked, including the current invocation; it is intended
to generate unique labels in the assembly output.
This macro need not be defined if the standard form of debugging
information for the debugger in use is appropriate.
@end defmac
@defmac ASM_OUTPUT_IDENT (@var{stream}, @var{string})
A C statement to output something to the assembler file to handle a
@samp{#ident} directive containing the text @var{string}. If this
macro is not defined, nothing is output for a @samp{#ident} directive.
@end defmac
@deftypefn {Target Hook} void TARGET_ASM_NAMED_SECTION (const char *@var{name}, unsigned int @var{flags}, unsigned int @var{align})
Output assembly directives to switch to section @var{name}. The section
should have attributes as specified by @var{flags}, which is a bit mask
of the @code{SECTION_*} flags defined in @file{output.h}. If @var{align}
is nonzero, it contains an alignment in bytes to be used for the section,
otherwise some target default should be used. Only targets that must
specify an alignment within the section directive need pay attention to
@var{align} -- we will still use @code{ASM_OUTPUT_ALIGN}.
@end deftypefn
@deftypefn {Target Hook} bool TARGET_HAVE_NAMED_SECTIONS
This flag is true if the target supports @code{TARGET_ASM_NAMED_SECTION}.
@end deftypefn
@deftypefn {Target Hook} {unsigned int} TARGET_SECTION_TYPE_FLAGS (tree @var{decl}, const char *@var{name}, int @var{reloc})
Choose a set of section attributes for use by @code{TARGET_ASM_NAMED_SECTION}
based on a variable or function decl, a section name, and whether or not the
declaration's initializer may contain runtime relocations. @var{decl} may be
null, in which case read-write data should be assumed.
The default version if this function handles choosing code vs data,
read-only vs read-write data, and @code{flag_pic}. You should only
need to override this if your target has special flags that might be
set via @code{__attribute__}.
@end deftypefn
@need 2000
@node Data Output
@subsection Output of Data
@deftypevr {Target Hook} {const char *} TARGET_ASM_BYTE_OP
@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_HI_OP
@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_SI_OP
@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_DI_OP
@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_TI_OP
@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_HI_OP
@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_SI_OP
@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_DI_OP
@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_TI_OP
These hooks specify assembly directives for creating certain kinds
of integer object. The @code{TARGET_ASM_BYTE_OP} directive creates a
byte-sized object, the @code{TARGET_ASM_ALIGNED_HI_OP} one creates an
aligned two-byte object, and so on. Any of the hooks may be
@code{NULL}, indicating that no suitable directive is available.
The compiler will print these strings at the start of a new line,
followed immediately by the object's initial value. In most cases,
the string should contain a tab, a pseudo-op, and then another tab.
@end deftypevr
@deftypefn {Target Hook} bool TARGET_ASM_INTEGER (rtx @var{x}, unsigned int @var{size}, int @var{aligned_p})
The @code{assemble_integer} function uses this hook to output an
integer object. @var{x} is the object's value, @var{size} is its size
in bytes and @var{aligned_p} indicates whether it is aligned. The
function should return @code{true} if it was able to output the
object. If it returns false, @code{assemble_integer} will try to
split the object into smaller parts.
The default implementation of this hook will use the
@code{TARGET_ASM_BYTE_OP} family of strings, returning @code{false}
when the relevant string is @code{NULL}.
@end deftypefn
@defmac OUTPUT_ADDR_CONST_EXTRA (@var{stream}, @var{x}, @var{fail})
A C statement to recognize @var{rtx} patterns that
@code{output_addr_const} can't deal with, and output assembly code to
@var{stream} corresponding to the pattern @var{x}. This may be used to
allow machine-dependent @code{UNSPEC}s to appear within constants.
If @code{OUTPUT_ADDR_CONST_EXTRA} fails to recognize a pattern, it must
@code{goto fail}, so that a standard error message is printed. If it
prints an error message itself, by calling, for example,
@code{output_operand_lossage}, it may just complete normally.
@end defmac
@defmac ASM_OUTPUT_ASCII (@var{stream}, @var{ptr}, @var{len})
A C statement to output to the stdio stream @var{stream} an assembler
instruction to assemble a string constant containing the @var{len}
bytes at @var{ptr}. @var{ptr} will be a C expression of type
@code{char *} and @var{len} a C expression of type @code{int}.
If the assembler has a @code{.ascii} pseudo-op as found in the
Berkeley Unix assembler, do not define the macro
@code{ASM_OUTPUT_ASCII}.
@end defmac
@defmac ASM_OUTPUT_FDESC (@var{stream}, @var{decl}, @var{n})
A C statement to output word @var{n} of a function descriptor for
@var{decl}. This must be defined if @code{TARGET_VTABLE_USES_DESCRIPTORS}
is defined, and is otherwise unused.
@end defmac
@defmac CONSTANT_POOL_BEFORE_FUNCTION
You may define this macro as a C expression. You should define the
expression to have a nonzero value if GCC should output the constant
pool for a function before the code for the function, or a zero value if
GCC should output the constant pool after the function. If you do
not define this macro, the usual case, GCC will output the constant
pool before the function.
@end defmac
@defmac ASM_OUTPUT_POOL_PROLOGUE (@var{file}, @var{funname}, @var{fundecl}, @var{size})
A C statement to output assembler commands to define the start of the
constant pool for a function. @var{funname} is a string giving
the name of the function. Should the return type of the function
be required, it can be obtained via @var{fundecl}. @var{size}
is the size, in bytes, of the constant pool that will be written
immediately after this call.
If no constant-pool prefix is required, the usual case, this macro need
not be defined.
@end defmac
@defmac ASM_OUTPUT_SPECIAL_POOL_ENTRY (@var{file}, @var{x}, @var{mode}, @var{align}, @var{labelno}, @var{jumpto})
A C statement (with or without semicolon) to output a constant in the
constant pool, if it needs special treatment. (This macro need not do
anything for RTL expressions that can be output normally.)
The argument @var{file} is the standard I/O stream to output the
assembler code on. @var{x} is the RTL expression for the constant to
output, and @var{mode} is the machine mode (in case @var{x} is a
@samp{const_int}). @var{align} is the required alignment for the value
@var{x}; you should output an assembler directive to force this much
alignment.
The argument @var{labelno} is a number to use in an internal label for
the address of this pool entry. The definition of this macro is
responsible for outputting the label definition at the proper place.
Here is how to do this:
@example
@code{(*targetm.asm_out.internal_label)} (@var{file}, "LC", @var{labelno});
@end example
When you output a pool entry specially, you should end with a
@code{goto} to the label @var{jumpto}. This will prevent the same pool
entry from being output a second time in the usual manner.
You need not define this macro if it would do nothing.
@end defmac
@defmac ASM_OUTPUT_POOL_EPILOGUE (@var{file} @var{funname} @var{fundecl} @var{size})
A C statement to output assembler commands to at the end of the constant
pool for a function. @var{funname} is a string giving the name of the
function. Should the return type of the function be required, you can
obtain it via @var{fundecl}. @var{size} is the size, in bytes, of the
constant pool that GCC wrote immediately before this call.
If no constant-pool epilogue is required, the usual case, you need not
define this macro.
@end defmac
@defmac IS_ASM_LOGICAL_LINE_SEPARATOR (@var{C})
Define this macro as a C expression which is nonzero if @var{C} is
used as a logical line separator by the assembler.
If you do not define this macro, the default is that only
the character @samp{;} is treated as a logical line separator.
@end defmac
@deftypevr {Target Hook} {const char *} TARGET_ASM_OPEN_PAREN
@deftypevrx {Target Hook} {const char *} TARGET_ASM_CLOSE_PAREN
These target hooks are C string constants, describing the syntax in the
assembler for grouping arithmetic expressions. If not overridden, they
default to normal parentheses, which is correct for most assemblers.
@end deftypevr
These macros are provided by @file{real.h} for writing the definitions
of @code{ASM_OUTPUT_DOUBLE} and the like:
@defmac REAL_VALUE_TO_TARGET_SINGLE (@var{x}, @var{l})
@defmacx REAL_VALUE_TO_TARGET_DOUBLE (@var{x}, @var{l})
@defmacx REAL_VALUE_TO_TARGET_LONG_DOUBLE (@var{x}, @var{l})
These translate @var{x}, of type @code{REAL_VALUE_TYPE}, to the target's
floating point representation, and store its bit pattern in the variable
@var{l}. For @code{REAL_VALUE_TO_TARGET_SINGLE}, this variable should
be a simple @code{long int}. For the others, it should be an array of
@code{long int}. The number of elements in this array is determined by
the size of the desired target floating point data type: 32 bits of it
go in each @code{long int} array element. Each array element holds 32
bits of the result, even if @code{long int} is wider than 32 bits on the
host machine.
The array element values are designed so that you can print them out
using @code{fprintf} in the order they should appear in the target
machine's memory.
@end defmac
@node Uninitialized Data
@subsection Output of Uninitialized Variables
Each of the macros in this section is used to do the whole job of
outputting a single uninitialized variable.
@defmac ASM_OUTPUT_COMMON (@var{stream}, @var{name}, @var{size}, @var{rounded})
A C statement (sans semicolon) to output to the stdio stream
@var{stream} the assembler definition of a common-label named
@var{name} whose size is @var{size} bytes. The variable @var{rounded}
is the size rounded up to whatever alignment the caller wants.
Use the expression @code{assemble_name (@var{stream}, @var{name})} to
output the name itself; before and after that, output the additional
assembler syntax for defining the name, and a newline.
This macro controls how the assembler definitions of uninitialized
common global variables are output.
@end defmac
@defmac ASM_OUTPUT_ALIGNED_COMMON (@var{stream}, @var{name}, @var{size}, @var{alignment})
Like @code{ASM_OUTPUT_COMMON} except takes the required alignment as a
separate, explicit argument. If you define this macro, it is used in
place of @code{ASM_OUTPUT_COMMON}, and gives you more flexibility in
handling the required alignment of the variable. The alignment is specified
as the number of bits.
@end defmac
@defmac ASM_OUTPUT_ALIGNED_DECL_COMMON (@var{stream}, @var{decl}, @var{name}, @var{size}, @var{alignment})
Like @code{ASM_OUTPUT_ALIGNED_COMMON} except that @var{decl} of the
variable to be output, if there is one, or @code{NULL_TREE} if there
is no corresponding variable. If you define this macro, GCC will use it
in place of both @code{ASM_OUTPUT_COMMON} and
@code{ASM_OUTPUT_ALIGNED_COMMON}. Define this macro when you need to see
the variable's decl in order to chose what to output.
@end defmac
@defmac ASM_OUTPUT_SHARED_COMMON (@var{stream}, @var{name}, @var{size}, @var{rounded})
If defined, it is similar to @code{ASM_OUTPUT_COMMON}, except that it
is used when @var{name} is shared. If not defined, @code{ASM_OUTPUT_COMMON}
will be used.
@end defmac
@defmac ASM_OUTPUT_BSS (@var{stream}, @var{decl}, @var{name}, @var{size}, @var{rounded})
A C statement (sans semicolon) to output to the stdio stream
@var{stream} the assembler definition of uninitialized global @var{decl} named
@var{name} whose size is @var{size} bytes. The variable @var{rounded}
is the size rounded up to whatever alignment the caller wants.
Try to use function @code{asm_output_bss} defined in @file{varasm.c} when
defining this macro. If unable, use the expression
@code{assemble_name (@var{stream}, @var{name})} to output the name itself;
before and after that, output the additional assembler syntax for defining
the name, and a newline.
This macro controls how the assembler definitions of uninitialized global
variables are output. This macro exists to properly support languages like
C++ which do not have @code{common} data. However, this macro currently
is not defined for all targets. If this macro and
@code{ASM_OUTPUT_ALIGNED_BSS} are not defined then @code{ASM_OUTPUT_COMMON}
or @code{ASM_OUTPUT_ALIGNED_COMMON} or
@code{ASM_OUTPUT_ALIGNED_DECL_COMMON} is used.
@end defmac
@defmac ASM_OUTPUT_ALIGNED_BSS (@var{stream}, @var{decl}, @var{name}, @var{size}, @var{alignment})
Like @code{ASM_OUTPUT_BSS} except takes the required alignment as a
separate, explicit argument. If you define this macro, it is used in
place of @code{ASM_OUTPUT_BSS}, and gives you more flexibility in
handling the required alignment of the variable. The alignment is specified
as the number of bits.
Try to use function @code{asm_output_aligned_bss} defined in file
@file{varasm.c} when defining this macro.
@end defmac
@defmac ASM_OUTPUT_SHARED_BSS (@var{stream}, @var{decl}, @var{name}, @var{size}, @var{rounded})
If defined, it is similar to @code{ASM_OUTPUT_BSS}, except that it
is used when @var{name} is shared. If not defined, @code{ASM_OUTPUT_BSS}
will be used.
@end defmac
@defmac ASM_OUTPUT_LOCAL (@var{stream}, @var{name}, @var{size}, @var{rounded})
A C statement (sans semicolon) to output to the stdio stream
@var{stream} the assembler definition of a local-common-label named
@var{name} whose size is @var{size} bytes. The variable @var{rounded}
is the size rounded up to whatever alignment the caller wants.
Use the expression @code{assemble_name (@var{stream}, @var{name})} to
output the name itself; before and after that, output the additional
assembler syntax for defining the name, and a newline.
This macro controls how the assembler definitions of uninitialized
static variables are output.
@end defmac
@defmac ASM_OUTPUT_ALIGNED_LOCAL (@var{stream}, @var{name}, @var{size}, @var{alignment})
Like @code{ASM_OUTPUT_LOCAL} except takes the required alignment as a
separate, explicit argument. If you define this macro, it is used in
place of @code{ASM_OUTPUT_LOCAL}, and gives you more flexibility in
handling the required alignment of the variable. The alignment is specified
as the number of bits.
@end defmac
@defmac ASM_OUTPUT_ALIGNED_DECL_LOCAL (@var{stream}, @var{decl}, @var{name}, @var{size}, @var{alignment})
Like @code{ASM_OUTPUT_ALIGNED_DECL} except that @var{decl} of the
variable to be output, if there is one, or @code{NULL_TREE} if there
is no corresponding variable. If you define this macro, GCC will use it
in place of both @code{ASM_OUTPUT_DECL} and
@code{ASM_OUTPUT_ALIGNED_DECL}. Define this macro when you need to see
the variable's decl in order to chose what to output.
@end defmac
@defmac ASM_OUTPUT_SHARED_LOCAL (@var{stream}, @var{name}, @var{size}, @var{rounded})
If defined, it is similar to @code{ASM_OUTPUT_LOCAL}, except that it
is used when @var{name} is shared. If not defined, @code{ASM_OUTPUT_LOCAL}
will be used.
@end defmac
@node Label Output
@subsection Output and Generation of Labels
@c prevent bad page break with this line
This is about outputting labels.
@findex assemble_name
@defmac ASM_OUTPUT_LABEL (@var{stream}, @var{name})
A C statement (sans semicolon) to output to the stdio stream
@var{stream} the assembler definition of a label named @var{name}.
Use the expression @code{assemble_name (@var{stream}, @var{name})} to
output the name itself; before and after that, output the additional
assembler syntax for defining the name, and a newline. A default
definition of this macro is provided which is correct for most systems.
@end defmac
@defmac SIZE_ASM_OP
A C string containing the appropriate assembler directive to specify the
size of a symbol, without any arguments. On systems that use ELF, the
default (in @file{config/elfos.h}) is @samp{"\t.size\t"}; on other
systems, the default is not to define this macro.
Define this macro only if it is correct to use the default definitions
of @code{ASM_OUTPUT_SIZE_DIRECTIVE} and @code{ASM_OUTPUT_MEASURED_SIZE}
for your system. If you need your own custom definitions of those
macros, or if you do not need explicit symbol sizes at all, do not
define this macro.
@end defmac
@defmac ASM_OUTPUT_SIZE_DIRECTIVE (@var{stream}, @var{name}, @var{size})
A C statement (sans semicolon) to output to the stdio stream
@var{stream} a directive telling the assembler that the size of the
symbol @var{name} is @var{size}. @var{size} is a @code{HOST_WIDE_INT}.
If you define @code{SIZE_ASM_OP}, a default definition of this macro is
provided.
@end defmac
@defmac ASM_OUTPUT_MEASURED_SIZE (@var{stream}, @var{name})
A C statement (sans semicolon) to output to the stdio stream
@var{stream} a directive telling the assembler to calculate the size of
the symbol @var{name} by subtracting its address from the current
address.
If you define @code{SIZE_ASM_OP}, a default definition of this macro is
provided. The default assumes that the assembler recognizes a special
@samp{.} symbol as referring to the current address, and can calculate
the difference between this and another symbol. If your assembler does
not recognize @samp{.} or cannot do calculations with it, you will need
to redefine @code{ASM_OUTPUT_MEASURED_SIZE} to use some other technique.
@end defmac
@defmac TYPE_ASM_OP
A C string containing the appropriate assembler directive to specify the
type of a symbol, without any arguments. On systems that use ELF, the
default (in @file{config/elfos.h}) is @samp{"\t.type\t"}; on other
systems, the default is not to define this macro.
Define this macro only if it is correct to use the default definition of
@code{ASM_OUTPUT_TYPE_DIRECTIVE} for your system. If you need your own
custom definition of this macro, or if you do not need explicit symbol
types at all, do not define this macro.
@end defmac
@defmac TYPE_OPERAND_FMT
A C string which specifies (using @code{printf} syntax) the format of
the second operand to @code{TYPE_ASM_OP}. On systems that use ELF, the
default (in @file{config/elfos.h}) is @samp{"@@%s"}; on other systems,
the default is not to define this macro.
Define this macro only if it is correct to use the default definition of
@code{ASM_OUTPUT_TYPE_DIRECTIVE} for your system. If you need your own
custom definition of this macro, or if you do not need explicit symbol
types at all, do not define this macro.
@end defmac
@defmac ASM_OUTPUT_TYPE_DIRECTIVE (@var{stream}, @var{type})
A C statement (sans semicolon) to output to the stdio stream
@var{stream} a directive telling the assembler that the type of the
symbol @var{name} is @var{type}. @var{type} is a C string; currently,
that string is always either @samp{"function"} or @samp{"object"}, but
you should not count on this.
If you define @code{TYPE_ASM_OP} and @code{TYPE_OPERAND_FMT}, a default
definition of this macro is provided.
@end defmac
@defmac ASM_DECLARE_FUNCTION_NAME (@var{stream}, @var{name}, @var{decl})
A C statement (sans semicolon) to output to the stdio stream
@var{stream} any text necessary for declaring the name @var{name} of a
function which is being defined. This macro is responsible for
outputting the label definition (perhaps using
@code{ASM_OUTPUT_LABEL}). The argument @var{decl} is the
@code{FUNCTION_DECL} tree node representing the function.
If this macro is not defined, then the function name is defined in the
usual manner as a label (by means of @code{ASM_OUTPUT_LABEL}).
You may wish to use @code{ASM_OUTPUT_TYPE_DIRECTIVE} in the definition
of this macro.
@end defmac
@defmac ASM_DECLARE_FUNCTION_SIZE (@var{stream}, @var{name}, @var{decl})
A C statement (sans semicolon) to output to the stdio stream
@var{stream} any text necessary for declaring the size of a function
which is being defined. The argument @var{name} is the name of the
function. The argument @var{decl} is the @code{FUNCTION_DECL} tree node
representing the function.
If this macro is not defined, then the function size is not defined.
You may wish to use @code{ASM_OUTPUT_MEASURED_SIZE} in the definition
of this macro.
@end defmac
@defmac ASM_DECLARE_OBJECT_NAME (@var{stream}, @var{name}, @var{decl})
A C statement (sans semicolon) to output to the stdio stream
@var{stream} any text necessary for declaring the name @var{name} of an
initialized variable which is being defined. This macro must output the
label definition (perhaps using @code{ASM_OUTPUT_LABEL}). The argument
@var{decl} is the @code{VAR_DECL} tree node representing the variable.
If this macro is not defined, then the variable name is defined in the
usual manner as a label (by means of @code{ASM_OUTPUT_LABEL}).
You may wish to use @code{ASM_OUTPUT_TYPE_DIRECTIVE} and/or
@code{ASM_OUTPUT_SIZE_DIRECTIVE} in the definition of this macro.
@end defmac
@defmac ASM_DECLARE_CONSTANT_NAME (@var{stream}, @var{name}, @var{exp}, @var{size})
A C statement (sans semicolon) to output to the stdio stream
@var{stream} any text necessary for declaring the name @var{name} of a
constant which is being defined. This macro is responsible for
outputting the label definition (perhaps using
@code{ASM_OUTPUT_LABEL}). The argument @var{exp} is the
value of the constant, and @var{size} is the size of the constant
in bytes. @var{name} will be an internal label.
If this macro is not defined, then the @var{name} is defined in the
usual manner as a label (by means of @code{ASM_OUTPUT_LABEL}).
You may wish to use @code{ASM_OUTPUT_TYPE_DIRECTIVE} in the definition
of this macro.
@end defmac
@defmac ASM_DECLARE_REGISTER_GLOBAL (@var{stream}, @var{decl}, @var{regno}, @var{name})
A C statement (sans semicolon) to output to the stdio stream
@var{stream} any text necessary for claiming a register @var{regno}
for a global variable @var{decl} with name @var{name}.
If you don't define this macro, that is equivalent to defining it to do
nothing.
@end defmac
@defmac ASM_FINISH_DECLARE_OBJECT (@var{stream}, @var{decl}, @var{toplevel}, @var{atend})
A C statement (sans semicolon) to finish up declaring a variable name
once the compiler has processed its initializer fully and thus has had a
chance to determine the size of an array when controlled by an
initializer. This is used on systems where it's necessary to declare
something about the size of the object.
If you don't define this macro, that is equivalent to defining it to do
nothing.
You may wish to use @code{ASM_OUTPUT_SIZE_DIRECTIVE} and/or
@code{ASM_OUTPUT_MEASURED_SIZE} in the definition of this macro.
@end defmac
@deftypefn {Target Hook} void TARGET_ASM_GLOBALIZE_LABEL (FILE *@var{stream}, const char *@var{name})
This target hook is a function to output to the stdio stream
@var{stream} some commands that will make the label @var{name} global;
that is, available for reference from other files.
The default implementation relies on a proper definition of
@code{GLOBAL_ASM_OP}.
@end deftypefn
@defmac ASM_WEAKEN_LABEL (@var{stream}, @var{name})
A C statement (sans semicolon) to output to the stdio stream
@var{stream} some commands that will make the label @var{name} weak;
that is, available for reference from other files but only used if
no other definition is available. Use the expression
@code{assemble_name (@var{stream}, @var{name})} to output the name
itself; before and after that, output the additional assembler syntax
for making that name weak, and a newline.
If you don't define this macro or @code{ASM_WEAKEN_DECL}, GCC will not
support weak symbols and you should not define the @code{SUPPORTS_WEAK}
macro.
@end defmac
@defmac ASM_WEAKEN_DECL (@var{stream}, @var{decl}, @var{name}, @var{value})
Combines (and replaces) the function of @code{ASM_WEAKEN_LABEL} and
@code{ASM_OUTPUT_WEAK_ALIAS}, allowing access to the associated function
or variable decl. If @var{value} is not @code{NULL}, this C statement
should output to the stdio stream @var{stream} assembler code which
defines (equates) the weak symbol @var{name} to have the value
@var{value}. If @var{value} is @code{NULL}, it should output commands
to make @var{name} weak.
@end defmac
@defmac SUPPORTS_WEAK
A C expression which evaluates to true if the target supports weak symbols.
If you don't define this macro, @file{defaults.h} provides a default
definition. If either @code{ASM_WEAKEN_LABEL} or @code{ASM_WEAKEN_DECL}
is defined, the default definition is @samp{1}; otherwise, it is
@samp{0}. Define this macro if you want to control weak symbol support
with a compiler flag such as @option{-melf}.
@end defmac
@defmac MAKE_DECL_ONE_ONLY (@var{decl})
A C statement (sans semicolon) to mark @var{decl} to be emitted as a
public symbol such that extra copies in multiple translation units will
be discarded by the linker. Define this macro if your object file
format provides support for this concept, such as the @samp{COMDAT}
section flags in the Microsoft Windows PE/COFF format, and this support
requires changes to @var{decl}, such as putting it in a separate section.
@end defmac
@defmac SUPPORTS_ONE_ONLY
A C expression which evaluates to true if the target supports one-only
semantics.
If you don't define this macro, @file{varasm.c} provides a default
definition. If @code{MAKE_DECL_ONE_ONLY} is defined, the default
definition is @samp{1}; otherwise, it is @samp{0}. Define this macro if
you want to control one-only symbol support with a compiler flag, or if
setting the @code{DECL_ONE_ONLY} flag is enough to mark a declaration to
be emitted as one-only.
@end defmac
@deftypefn {Target Hook} void TARGET_ASM_ASSEMBLE_VISIBILITY (tree @var{decl}, const char *@var{visibility})
This target hook is a function to output to @var{asm_out_file} some
commands that will make the symbol(s) associated with @var{decl} have
hidden, protected or internal visibility as specified by @var{visibility}.
@end deftypefn
@defmac ASM_OUTPUT_EXTERNAL (@var{stream}, @var{decl}, @var{name})
A C statement (sans semicolon) to output to the stdio stream
@var{stream} any text necessary for declaring the name of an external
symbol named @var{name} which is referenced in this compilation but
not defined. The value of @var{decl} is the tree node for the
declaration.
This macro need not be defined if it does not need to output anything.
The GNU assembler and most Unix assemblers don't require anything.
@end defmac
@deftypefn {Target Hook} void TARGET_ASM_EXTERNAL_LIBCALL (rtx @var{symref})
This target hook is a function to output to @var{asm_out_file} an assembler
pseudo-op to declare a library function name external. The name of the
library function is given by @var{symref}, which is a @code{symbol_ref}.
@end deftypefn
@defmac ASM_OUTPUT_LABELREF (@var{stream}, @var{name})
A C statement (sans semicolon) to output to the stdio stream
@var{stream} a reference in assembler syntax to a label named
@var{name}. This should add @samp{_} to the front of the name, if that
is customary on your operating system, as it is in most Berkeley Unix
systems. This macro is used in @code{assemble_name}.
@end defmac
@defmac ASM_OUTPUT_SYMBOL_REF (@var{stream}, @var{sym})
A C statement (sans semicolon) to output a reference to
@code{SYMBOL_REF} @var{sym}. If not defined, @code{assemble_name}
will be used to output the name of the symbol. This macro may be used
to modify the way a symbol is referenced depending on information
encoded by @code{TARGET_ENCODE_SECTION_INFO}.
@end defmac
@defmac ASM_OUTPUT_LABEL_REF (@var{stream}, @var{buf})
A C statement (sans semicolon) to output a reference to @var{buf}, the
result of @code{ASM_GENERATE_INTERNAL_LABEL}. If not defined,
@code{assemble_name} will be used to output the name of the symbol.
This macro is not used by @code{output_asm_label}, or the @code{%l}
specifier that calls it; the intention is that this macro should be set
when it is necessary to output a label differently when its address is
being taken.
@end defmac
@deftypefn {Target Hook} void TARGET_ASM_INTERNAL_LABEL (FILE *@var{stream}, const char *@var{prefix}, unsigned long @var{labelno})
A function to output to the stdio stream @var{stream} a label whose
name is made from the string @var{prefix} and the number @var{labelno}.
It is absolutely essential that these labels be distinct from the labels
used for user-level functions and variables. Otherwise, certain programs
will have name conflicts with internal labels.
It is desirable to exclude internal labels from the symbol table of the
object file. Most assemblers have a naming convention for labels that
should be excluded; on many systems, the letter @samp{L} at the
beginning of a label has this effect. You should find out what
convention your system uses, and follow it.
The default version of this function utilizes ASM_GENERATE_INTERNAL_LABEL.
@end deftypefn
@defmac ASM_OUTPUT_DEBUG_LABEL (@var{stream}, @var{prefix}, @var{num})
A C statement to output to the stdio stream @var{stream} a debug info
label whose name is made from the string @var{prefix} and the number
@var{num}. This is useful for VLIW targets, where debug info labels
may need to be treated differently than branch target labels. On some
systems, branch target labels must be at the beginning of instruction
bundles, but debug info labels can occur in the middle of instruction
bundles.
If this macro is not defined, then @code{(*targetm.asm_out.internal_label)} will be
used.
@end defmac
@defmac ASM_GENERATE_INTERNAL_LABEL (@var{string}, @var{prefix}, @var{num})
A C statement to store into the string @var{string} a label whose name
is made from the string @var{prefix} and the number @var{num}.
This string, when output subsequently by @code{assemble_name}, should
produce the output that @code{(*targetm.asm_out.internal_label)} would produce
with the same @var{prefix} and @var{num}.
If the string begins with @samp{*}, then @code{assemble_name} will
output the rest of the string unchanged. It is often convenient for
@code{ASM_GENERATE_INTERNAL_LABEL} to use @samp{*} in this way. If the
string doesn't start with @samp{*}, then @code{ASM_OUTPUT_LABELREF} gets
to output the string, and may change it. (Of course,
@code{ASM_OUTPUT_LABELREF} is also part of your machine description, so
you should know what it does on your machine.)
@end defmac
@defmac ASM_FORMAT_PRIVATE_NAME (@var{outvar}, @var{name}, @var{number})
A C expression to assign to @var{outvar} (which is a variable of type
@code{char *}) a newly allocated string made from the string
@var{name} and the number @var{number}, with some suitable punctuation
added. Use @code{alloca} to get space for the string.
The string will be used as an argument to @code{ASM_OUTPUT_LABELREF} to
produce an assembler label for an internal static variable whose name is
@var{name}. Therefore, the string must be such as to result in valid
assembler code. The argument @var{number} is different each time this
macro is executed; it prevents conflicts between similarly-named
internal static variables in different scopes.
Ideally this string should not be a valid C identifier, to prevent any
conflict with the user's own symbols. Most assemblers allow periods
or percent signs in assembler symbols; putting at least one of these
between the name and the number will suffice.
If this macro is not defined, a default definition will be provided
which is correct for most systems.
@end defmac
@defmac ASM_OUTPUT_DEF (@var{stream}, @var{name}, @var{value})
A C statement to output to the stdio stream @var{stream} assembler code
which defines (equates) the symbol @var{name} to have the value @var{value}.
@findex SET_ASM_OP
If @code{SET_ASM_OP} is defined, a default definition is provided which is
correct for most systems.
@end defmac
@defmac ASM_OUTPUT_DEF_FROM_DECLS (@var{stream}, @var{decl_of_name}, @var{decl_of_value})
A C statement to output to the stdio stream @var{stream} assembler code
which defines (equates) the symbol whose tree node is @var{decl_of_name}
to have the value of the tree node @var{decl_of_value}. This macro will
be used in preference to @samp{ASM_OUTPUT_DEF} if it is defined and if
the tree nodes are available.
@findex SET_ASM_OP
If @code{SET_ASM_OP} is defined, a default definition is provided which is
correct for most systems.
@end defmac
@defmac ASM_OUTPUT_WEAK_ALIAS (@var{stream}, @var{name}, @var{value})
A C statement to output to the stdio stream @var{stream} assembler code
which defines (equates) the weak symbol @var{name} to have the value
@var{value}. If @var{value} is @code{NULL}, it defines @var{name} as
an undefined weak symbol.
Define this macro if the target only supports weak aliases; define
@code{ASM_OUTPUT_DEF} instead if possible.
@end defmac
@defmac OBJC_GEN_METHOD_LABEL (@var{buf}, @var{is_inst}, @var{class_name}, @var{cat_name}, @var{sel_name})
Define this macro to override the default assembler names used for
Objective-C methods.
The default name is a unique method number followed by the name of the
class (e.g.@: @samp{_1_Foo}). For methods in categories, the name of
the category is also included in the assembler name (e.g.@:
@samp{_1_Foo_Bar}).
These names are safe on most systems, but make debugging difficult since
the method's selector is not present in the name. Therefore, particular
systems define other ways of computing names.
@var{buf} is an expression of type @code{char *} which gives you a
buffer in which to store the name; its length is as long as
@var{class_name}, @var{cat_name} and @var{sel_name} put together, plus
50 characters extra.
The argument @var{is_inst} specifies whether the method is an instance
method or a class method; @var{class_name} is the name of the class;
@var{cat_name} is the name of the category (or @code{NULL} if the method is not
in a category); and @var{sel_name} is the name of the selector.
On systems where the assembler can handle quoted names, you can use this
macro to provide more human-readable names.
@end defmac
@defmac ASM_DECLARE_CLASS_REFERENCE (@var{stream}, @var{name})
A C statement (sans semicolon) to output to the stdio stream
@var{stream} commands to declare that the label @var{name} is an
Objective-C class reference. This is only needed for targets whose
linkers have special support for NeXT-style runtimes.
@end defmac
@defmac ASM_DECLARE_UNRESOLVED_REFERENCE (@var{stream}, @var{name})
A C statement (sans semicolon) to output to the stdio stream
@var{stream} commands to declare that the label @var{name} is an
unresolved Objective-C class reference. This is only needed for targets
whose linkers have special support for NeXT-style runtimes.
@end defmac
@node Initialization
@subsection How Initialization Functions Are Handled
@cindex initialization routines
@cindex termination routines
@cindex constructors, output of
@cindex destructors, output of
The compiled code for certain languages includes @dfn{constructors}
(also called @dfn{initialization routines})---functions to initialize
data in the program when the program is started. These functions need
to be called before the program is ``started''---that is to say, before
@code{main} is called.
Compiling some languages generates @dfn{destructors} (also called
@dfn{termination routines}) that should be called when the program
terminates.
To make the initialization and termination functions work, the compiler
must output something in the assembler code to cause those functions to
be called at the appropriate time. When you port the compiler to a new
system, you need to specify how to do this.
There are two major ways that GCC currently supports the execution of
initialization and termination functions. Each way has two variants.
Much of the structure is common to all four variations.
@findex __CTOR_LIST__
@findex __DTOR_LIST__
The linker must build two lists of these functions---a list of
initialization functions, called @code{__CTOR_LIST__}, and a list of
termination functions, called @code{__DTOR_LIST__}.
Each list always begins with an ignored function pointer (which may hold
0, @minus{}1, or a count of the function pointers after it, depending on
the environment). This is followed by a series of zero or more function
pointers to constructors (or destructors), followed by a function
pointer containing zero.
Depending on the operating system and its executable file format, either
@file{crtstuff.c} or @file{libgcc2.c} traverses these lists at startup
time and exit time. Constructors are called in reverse order of the
list; destructors in forward order.
The best way to handle static constructors works only for object file
formats which provide arbitrarily-named sections. A section is set
aside for a list of constructors, and another for a list of destructors.
Traditionally these are called @samp{.ctors} and @samp{.dtors}. Each
object file that defines an initialization function also puts a word in
the constructor section to point to that function. The linker
accumulates all these words into one contiguous @samp{.ctors} section.
Termination functions are handled similarly.
This method will be chosen as the default by @file{target-def.h} if
@code{TARGET_ASM_NAMED_SECTION} is defined. A target that does not
support arbitrary sections, but does support special designated
constructor and destructor sections may define @code{CTORS_SECTION_ASM_OP}
and @code{DTORS_SECTION_ASM_OP} to achieve the same effect.
When arbitrary sections are available, there are two variants, depending
upon how the code in @file{crtstuff.c} is called. On systems that
support a @dfn{.init} section which is executed at program startup,
parts of @file{crtstuff.c} are compiled into that section. The
program is linked by the @command{gcc} driver like this:
@example
ld -o @var{output_file} crti.o crtbegin.o @dots{} -lgcc crtend.o crtn.o
@end example
The prologue of a function (@code{__init}) appears in the @code{.init}
section of @file{crti.o}; the epilogue appears in @file{crtn.o}. Likewise
for the function @code{__fini} in the @dfn{.fini} section. Normally these
files are provided by the operating system or by the GNU C library, but
are provided by GCC for a few targets.
The objects @file{crtbegin.o} and @file{crtend.o} are (for most targets)
compiled from @file{crtstuff.c}. They contain, among other things, code
fragments within the @code{.init} and @code{.fini} sections that branch
to routines in the @code{.text} section. The linker will pull all parts
of a section together, which results in a complete @code{__init} function
that invokes the routines we need at startup.
To use this variant, you must define the @code{INIT_SECTION_ASM_OP}
macro properly.
If no init section is available, when GCC compiles any function called
@code{main} (or more accurately, any function designated as a program
entry point by the language front end calling @code{expand_main_function}),
it inserts a procedure call to @code{__main} as the first executable code
after the function prologue. The @code{__main} function is defined
in @file{libgcc2.c} and runs the global constructors.
In file formats that don't support arbitrary sections, there are again
two variants. In the simplest variant, the GNU linker (GNU @code{ld})
and an `a.out' format must be used. In this case,
@code{TARGET_ASM_CONSTRUCTOR} is defined to produce a @code{.stabs}
entry of type @samp{N_SETT}, referencing the name @code{__CTOR_LIST__},
and with the address of the void function containing the initialization
code as its value. The GNU linker recognizes this as a request to add
the value to a @dfn{set}; the values are accumulated, and are eventually
placed in the executable as a vector in the format described above, with
a leading (ignored) count and a trailing zero element.
@code{TARGET_ASM_DESTRUCTOR} is handled similarly. Since no init
section is available, the absence of @code{INIT_SECTION_ASM_OP} causes
the compilation of @code{main} to call @code{__main} as above, starting
the initialization process.
The last variant uses neither arbitrary sections nor the GNU linker.
This is preferable when you want to do dynamic linking and when using
file formats which the GNU linker does not support, such as `ECOFF'@. In
this case, @code{TARGET_HAVE_CTORS_DTORS} is false, initialization and
termination functions are recognized simply by their names. This requires
an extra program in the linkage step, called @command{collect2}. This program
pretends to be the linker, for use with GCC; it does its job by running
the ordinary linker, but also arranges to include the vectors of
initialization and termination functions. These functions are called
via @code{__main} as described above. In order to use this method,
@code{use_collect2} must be defined in the target in @file{config.gcc}.
@ifinfo
The following section describes the specific macros that control and
customize the handling of initialization and termination functions.
@end ifinfo
@node Macros for Initialization
@subsection Macros Controlling Initialization Routines
Here are the macros that control how the compiler handles initialization
and termination functions:
@defmac INIT_SECTION_ASM_OP
If defined, a C string constant, including spacing, for the assembler
operation to identify the following data as initialization code. If not
defined, GCC will assume such a section does not exist. When you are
using special sections for initialization and termination functions, this
macro also controls how @file{crtstuff.c} and @file{libgcc2.c} arrange to
run the initialization functions.
@end defmac
@defmac HAS_INIT_SECTION
If defined, @code{main} will not call @code{__main} as described above.
This macro should be defined for systems that control start-up code
on a symbol-by-symbol basis, such as OSF/1, and should not
be defined explicitly for systems that support @code{INIT_SECTION_ASM_OP}.
@end defmac
@defmac LD_INIT_SWITCH
If defined, a C string constant for a switch that tells the linker that
the following symbol is an initialization routine.
@end defmac
@defmac LD_FINI_SWITCH
If defined, a C string constant for a switch that tells the linker that
the following symbol is a finalization routine.
@end defmac
@defmac COLLECT_SHARED_INIT_FUNC (@var{stream}, @var{func})
If defined, a C statement that will write a function that can be
automatically called when a shared library is loaded. The function
should call @var{func}, which takes no arguments. If not defined, and
the object format requires an explicit initialization function, then a
function called @code{_GLOBAL__DI} will be generated.
This function and the following one are used by collect2 when linking a
shared library that needs constructors or destructors, or has DWARF2
exception tables embedded in the code.
@end defmac
@defmac COLLECT_SHARED_FINI_FUNC (@var{stream}, @var{func})
If defined, a C statement that will write a function that can be
automatically called when a shared library is unloaded. The function
should call @var{func}, which takes no arguments. If not defined, and
the object format requires an explicit finalization function, then a
function called @code{_GLOBAL__DD} will be generated.
@end defmac
@defmac INVOKE__main
If defined, @code{main} will call @code{__main} despite the presence of
@code{INIT_SECTION_ASM_OP}. This macro should be defined for systems
where the init section is not actually run automatically, but is still
useful for collecting the lists of constructors and destructors.
@end defmac
@defmac SUPPORTS_INIT_PRIORITY
If nonzero, the C++ @code{init_priority} attribute is supported and the
compiler should emit instructions to control the order of initialization
of objects. If zero, the compiler will issue an error message upon
encountering an @code{init_priority} attribute.
@end defmac
@deftypefn {Target Hook} bool TARGET_HAVE_CTORS_DTORS
This value is true if the target supports some ``native'' method of
collecting constructors and destructors to be run at startup and exit.
It is false if we must use @command{collect2}.
@end deftypefn
@deftypefn {Target Hook} void TARGET_ASM_CONSTRUCTOR (rtx @var{symbol}, int @var{priority})
If defined, a function that outputs assembler code to arrange to call
the function referenced by @var{symbol} at initialization time.
Assume that @var{symbol} is a @code{SYMBOL_REF} for a function taking
no arguments and with no return value. If the target supports initialization
priorities, @var{priority} is a value between 0 and @code{MAX_INIT_PRIORITY};
otherwise it must be @code{DEFAULT_INIT_PRIORITY}.
If this macro is not defined by the target, a suitable default will
be chosen if (1) the target supports arbitrary section names, (2) the
target defines @code{CTORS_SECTION_ASM_OP}, or (3) @code{USE_COLLECT2}
is not defined.
@end deftypefn
@deftypefn {Target Hook} void TARGET_ASM_DESTRUCTOR (rtx @var{symbol}, int @var{priority})
This is like @code{TARGET_ASM_CONSTRUCTOR} but used for termination
functions rather than initialization functions.
@end deftypefn
If @code{TARGET_HAVE_CTORS_DTORS} is true, the initialization routine
generated for the generated object file will have static linkage.
If your system uses @command{collect2} as the means of processing
constructors, then that program normally uses @command{nm} to scan
an object file for constructor functions to be called.
On certain kinds of systems, you can define this macro to make
@command{collect2} work faster (and, in some cases, make it work at all):
@defmac OBJECT_FORMAT_COFF
Define this macro if the system uses COFF (Common Object File Format)
object files, so that @command{collect2} can assume this format and scan
object files directly for dynamic constructor/destructor functions.
This macro is effective only in a native compiler; @command{collect2} as
part of a cross compiler always uses @command{nm} for the target machine.
@end defmac
@defmac COLLECT_PARSE_FLAG (@var{flag})
Define this macro to be C code that examines @command{collect2} command
line option @var{flag} and performs special actions if
@command{collect2} needs to behave differently depending on @var{flag}.
@end defmac
@defmac REAL_NM_FILE_NAME
Define this macro as a C string constant containing the file name to use
to execute @command{nm}. The default is to search the path normally for
@command{nm}.
If your system supports shared libraries and has a program to list the
dynamic dependencies of a given library or executable, you can define
these macros to enable support for running initialization and
termination functions in shared libraries:
@end defmac
@defmac LDD_SUFFIX
Define this macro to a C string constant containing the name of the program
which lists dynamic dependencies, like @command{"ldd"} under SunOS 4.
@end defmac
@defmac PARSE_LDD_OUTPUT (@var{ptr})
Define this macro to be C code that extracts filenames from the output
of the program denoted by @code{LDD_SUFFIX}. @var{ptr} is a variable
of type @code{char *} that points to the beginning of a line of output
from @code{LDD_SUFFIX}. If the line lists a dynamic dependency, the
code must advance @var{ptr} to the beginning of the filename on that
line. Otherwise, it must set @var{ptr} to @code{NULL}.
@end defmac
@node Instruction Output
@subsection Output of Assembler Instructions
@c prevent bad page break with this line
This describes assembler instruction output.
@defmac REGISTER_NAMES
A C initializer containing the assembler's names for the machine
registers, each one as a C string constant. This is what translates
register numbers in the compiler into assembler language.
@end defmac
@defmac ADDITIONAL_REGISTER_NAMES
If defined, a C initializer for an array of structures containing a name
and a register number. This macro defines additional names for hard
registers, thus allowing the @code{asm} option in declarations to refer
to registers using alternate names.
@end defmac
@defmac ASM_OUTPUT_OPCODE (@var{stream}, @var{ptr})
Define this macro if you are using an unusual assembler that
requires different names for the machine instructions.
The definition is a C statement or statements which output an
assembler instruction opcode to the stdio stream @var{stream}. The
macro-operand @var{ptr} is a variable of type @code{char *} which
points to the opcode name in its ``internal'' form---the form that is
written in the machine description. The definition should output the
opcode name to @var{stream}, performing any translation you desire, and
increment the variable @var{ptr} to point at the end of the opcode
so that it will not be output twice.
In fact, your macro definition may process less than the entire opcode
name, or more than the opcode name; but if you want to process text
that includes @samp{%}-sequences to substitute operands, you must take
care of the substitution yourself. Just be sure to increment
@var{ptr} over whatever text should not be output normally.
@findex recog_data.operand
If you need to look at the operand values, they can be found as the
elements of @code{recog_data.operand}.
If the macro definition does nothing, the instruction is output
in the usual way.
@end defmac
@defmac FINAL_PRESCAN_INSN (@var{insn}, @var{opvec}, @var{noperands})
If defined, a C statement to be executed just prior to the output of
assembler code for @var{insn}, to modify the extracted operands so
they will be output differently.
Here the argument @var{opvec} is the vector containing the operands
extracted from @var{insn}, and @var{noperands} is the number of
elements of the vector which contain meaningful data for this insn.
The contents of this vector are what will be used to convert the insn
template into assembler code, so you can change the assembler output
by changing the contents of the vector.
This macro is useful when various assembler syntaxes share a single
file of instruction patterns; by defining this macro differently, you
can cause a large class of instructions to be output differently (such
as with rearranged operands). Naturally, variations in assembler
syntax affecting individual insn patterns ought to be handled by
writing conditional output routines in those patterns.
If this macro is not defined, it is equivalent to a null statement.
@end defmac
@defmac PRINT_OPERAND (@var{stream}, @var{x}, @var{code})
A C compound statement to output to stdio stream @var{stream} the
assembler syntax for an instruction operand @var{x}. @var{x} is an
RTL expression.
@var{code} is a value that can be used to specify one of several ways
of printing the operand. It is used when identical operands must be
printed differently depending on the context. @var{code} comes from
the @samp{%} specification that was used to request printing of the
operand. If the specification was just @samp{%@var{digit}} then
@var{code} is 0; if the specification was @samp{%@var{ltr}
@var{digit}} then @var{code} is the ASCII code for @var{ltr}.
@findex reg_names
If @var{x} is a register, this macro should print the register's name.
The names can be found in an array @code{reg_names} whose type is
@code{char *[]}. @code{reg_names} is initialized from
@code{REGISTER_NAMES}.
When the machine description has a specification @samp{%@var{punct}}
(a @samp{%} followed by a punctuation character), this macro is called
with a null pointer for @var{x} and the punctuation character for
@var{code}.
@end defmac
@defmac PRINT_OPERAND_PUNCT_VALID_P (@var{code})
A C expression which evaluates to true if @var{code} is a valid
punctuation character for use in the @code{PRINT_OPERAND} macro. If
@code{PRINT_OPERAND_PUNCT_VALID_P} is not defined, it means that no
punctuation characters (except for the standard one, @samp{%}) are used
in this way.
@end defmac
@defmac PRINT_OPERAND_ADDRESS (@var{stream}, @var{x})
A C compound statement to output to stdio stream @var{stream} the
assembler syntax for an instruction operand that is a memory reference
whose address is @var{x}. @var{x} is an RTL expression.
@cindex @code{TARGET_ENCODE_SECTION_INFO} usage
On some machines, the syntax for a symbolic address depends on the
section that the address refers to. On these machines, define the hook
@code{TARGET_ENCODE_SECTION_INFO} to store the information into the
@code{symbol_ref}, and then check for it here. @xref{Assembler
Format}.
@end defmac
@findex dbr_sequence_length
@defmac DBR_OUTPUT_SEQEND (@var{file})
A C statement, to be executed after all slot-filler instructions have
been output. If necessary, call @code{dbr_sequence_length} to
determine the number of slots filled in a sequence (zero if not
currently outputting a sequence), to decide how many no-ops to output,
or whatever.
Don't define this macro if it has nothing to do, but it is helpful in
reading assembly output if the extent of the delay sequence is made
explicit (e.g.@: with white space).
@end defmac
@findex final_sequence
Note that output routines for instructions with delay slots must be
prepared to deal with not being output as part of a sequence
(i.e.@: when the scheduling pass is not run, or when no slot fillers could be
found.) The variable @code{final_sequence} is null when not
processing a sequence, otherwise it contains the @code{sequence} rtx
being output.
@findex asm_fprintf
@defmac REGISTER_PREFIX
@defmacx LOCAL_LABEL_PREFIX
@defmacx USER_LABEL_PREFIX
@defmacx IMMEDIATE_PREFIX
If defined, C string expressions to be used for the @samp{%R}, @samp{%L},
@samp{%U}, and @samp{%I} options of @code{asm_fprintf} (see
@file{final.c}). These are useful when a single @file{md} file must
support multiple assembler formats. In that case, the various @file{tm.h}
files can define these macros differently.
@end defmac
@defmac ASM_FPRINTF_EXTENSIONS (@var{file}, @var{argptr}, @var{format})
If defined this macro should expand to a series of @code{case}
statements which will be parsed inside the @code{switch} statement of
the @code{asm_fprintf} function. This allows targets to define extra
printf formats which may useful when generating their assembler
statements. Note that uppercase letters are reserved for future
generic extensions to asm_fprintf, and so are not available to target
specific code. The output file is given by the parameter @var{file}.
The varargs input pointer is @var{argptr} and the rest of the format
string, starting the character after the one that is being switched
upon, is pointed to by @var{format}.
@end defmac
@defmac ASSEMBLER_DIALECT
If your target supports multiple dialects of assembler language (such as
different opcodes), define this macro as a C expression that gives the
numeric index of the assembler language dialect to use, with zero as the
first variant.
If this macro is defined, you may use constructs of the form
@smallexample
@samp{@{option0|option1|option2@dots{}@}}
@end smallexample
@noindent
in the output templates of patterns (@pxref{Output Template}) or in the
first argument of @code{asm_fprintf}. This construct outputs
@samp{option0}, @samp{option1}, @samp{option2}, etc., if the value of
@code{ASSEMBLER_DIALECT} is zero, one, two, etc. Any special characters
within these strings retain their usual meaning. If there are fewer
alternatives within the braces than the value of
@code{ASSEMBLER_DIALECT}, the construct outputs nothing.
If you do not define this macro, the characters @samp{@{}, @samp{|} and
@samp{@}} do not have any special meaning when used in templates or
operands to @code{asm_fprintf}.
Define the macros @code{REGISTER_PREFIX}, @code{LOCAL_LABEL_PREFIX},
@code{USER_LABEL_PREFIX} and @code{IMMEDIATE_PREFIX} if you can express
the variations in assembler language syntax with that mechanism. Define
@code{ASSEMBLER_DIALECT} and use the @samp{@{option0|option1@}} syntax
if the syntax variant are larger and involve such things as different
opcodes or operand order.
@end defmac
@defmac ASM_OUTPUT_REG_PUSH (@var{stream}, @var{regno})
A C expression to output to @var{stream} some assembler code
which will push hard register number @var{regno} onto the stack.
The code need not be optimal, since this macro is used only when
profiling.
@end defmac
@defmac ASM_OUTPUT_REG_POP (@var{stream}, @var{regno})
A C expression to output to @var{stream} some assembler code
which will pop hard register number @var{regno} off of the stack.
The code need not be optimal, since this macro is used only when
profiling.
@end defmac
@node Dispatch Tables
@subsection Output of Dispatch Tables
@c prevent bad page break with this line
This concerns dispatch tables.
@cindex dispatch table
@defmac ASM_OUTPUT_ADDR_DIFF_ELT (@var{stream}, @var{body}, @var{value}, @var{rel})
A C statement to output to the stdio stream @var{stream} an assembler
pseudo-instruction to generate a difference between two labels.
@var{value} and @var{rel} are the numbers of two internal labels. The
definitions of these labels are output using
@code{(*targetm.asm_out.internal_label)}, and they must be printed in the same
way here. For example,
@example
fprintf (@var{stream}, "\t.word L%d-L%d\n",
@var{value}, @var{rel})
@end example
You must provide this macro on machines where the addresses in a
dispatch table are relative to the table's own address. If defined, GCC
will also use this macro on all machines when producing PIC@.
@var{body} is the body of the @code{ADDR_DIFF_VEC}; it is provided so that the
mode and flags can be read.
@end defmac
@defmac ASM_OUTPUT_ADDR_VEC_ELT (@var{stream}, @var{value})
This macro should be provided on machines where the addresses
in a dispatch table are absolute.
The definition should be a C statement to output to the stdio stream
@var{stream} an assembler pseudo-instruction to generate a reference to
a label. @var{value} is the number of an internal label whose
definition is output using @code{(*targetm.asm_out.internal_label)}.
For example,
@example
fprintf (@var{stream}, "\t.word L%d\n", @var{value})
@end example
@end defmac
@defmac ASM_OUTPUT_CASE_LABEL (@var{stream}, @var{prefix}, @var{num}, @var{table})
Define this if the label before a jump-table needs to be output
specially. The first three arguments are the same as for
@code{(*targetm.asm_out.internal_label)}; the fourth argument is the
jump-table which follows (a @code{jump_insn} containing an
@code{addr_vec} or @code{addr_diff_vec}).
This feature is used on system V to output a @code{swbeg} statement
for the table.
If this macro is not defined, these labels are output with
@code{(*targetm.asm_out.internal_label)}.
@end defmac
@defmac ASM_OUTPUT_CASE_END (@var{stream}, @var{num}, @var{table})
Define this if something special must be output at the end of a
jump-table. The definition should be a C statement to be executed
after the assembler code for the table is written. It should write
the appropriate code to stdio stream @var{stream}. The argument
@var{table} is the jump-table insn, and @var{num} is the label-number
of the preceding label.
If this macro is not defined, nothing special is output at the end of
the jump-table.
@end defmac
@node Exception Region Output
@subsection Assembler Commands for Exception Regions
@c prevent bad page break with this line
This describes commands marking the start and the end of an exception
region.
@defmac EH_FRAME_SECTION_NAME
If defined, a C string constant for the name of the section containing
exception handling frame unwind information. If not defined, GCC will
provide a default definition if the target supports named sections.
@file{crtstuff.c} uses this macro to switch to the appropriate section.
You should define this symbol if your target supports DWARF 2 frame
unwind information and the default definition does not work.
@end defmac
@defmac EH_FRAME_IN_DATA_SECTION
If defined, DWARF 2 frame unwind information will be placed in the
data section even though the target supports named sections. This
might be necessary, for instance, if the system linker does garbage
collection and sections cannot be marked as not to be collected.
Do not define this macro unless @code{TARGET_ASM_NAMED_SECTION} is
also defined.
@end defmac
@defmac MASK_RETURN_ADDR
An rtx used to mask the return address found via @code{RETURN_ADDR_RTX}, so
that it does not contain any extraneous set bits in it.
@end defmac
@defmac DWARF2_UNWIND_INFO
Define this macro to 0 if your target supports DWARF 2 frame unwind
information, but it does not yet work with exception handling.
Otherwise, if your target supports this information (if it defines
@samp{INCOMING_RETURN_ADDR_RTX} and either @samp{UNALIGNED_INT_ASM_OP}
or @samp{OBJECT_FORMAT_ELF}), GCC will provide a default definition of
1.
If this macro is defined to 1, the DWARF 2 unwinder will be the default
exception handling mechanism; otherwise, @code{setjmp}/@code{longjmp} will be used by
default.
If this macro is defined to anything, the DWARF 2 unwinder will be used
instead of inline unwinders and @code{__unwind_function} in the non-@code{setjmp} case.
@end defmac
@defmac MUST_USE_SJLJ_EXCEPTIONS
This macro need only be defined if @code{DWARF2_UNWIND_INFO} is
runtime-variable. In that case, @file{except.h} cannot correctly
determine the corresponding definition of
@code{MUST_USE_SJLJ_EXCEPTIONS}, so the target must provide it directly.
@end defmac
@defmac DWARF_CIE_DATA_ALIGNMENT
This macro need only be defined if the target might save registers in the
function prologue at an offset to the stack pointer that is not aligned to
@code{UNITS_PER_WORD}. The definition should be the negative minimum
alignment if @code{STACK_GROWS_DOWNWARD} is defined, and the positive
minimum alignment otherwise. @xref{SDB and DWARF}. Only applicable if
the target supports DWARF 2 frame unwind information.
@end defmac
@deftypefn {Target Hook} void TARGET_ASM_EXCEPTION_SECTION ()
If defined, a function that switches to the section in which the main
exception table is to be placed (@pxref{Sections}). The default is a
function that switches to a section named @code{.gcc_except_table} on
machines that support named sections via
@code{TARGET_ASM_NAMED_SECTION}, otherwise if @option{-fpic} or
@option{-fPIC} is in effect, the @code{data_section}, otherwise the
@code{readonly_data_section}.
@end deftypefn
@deftypefn {Target Hook} void TARGET_ASM_EH_FRAME_SECTION ()
If defined, a function that switches to the section in which the DWARF 2
frame unwind information to be placed (@pxref{Sections}). The default
is a function that outputs a standard GAS section directive, if
@code{EH_FRAME_SECTION_NAME} is defined, or else a data section
directive followed by a synthetic label.
@end deftypefn
@deftypevar {Target Hook} bool TARGET_TERMINATE_DW2_EH_FRAME_INFO
Contains the value true if the target should add a zero word onto the
end of a Dwarf-2 frame info section when used for exception handling.
Default value is false if @code{EH_FRAME_SECTION_NAME} is defined, and
true otherwise.
@end deftypevar
@deftypefn {Target Hook} rtx TARGET_DWARF_REGISTER_SPAN (rtx @var{reg})
Given a register, this hook should return a parallel of registers to
represent where to find the register pieces. Define this hook if the
register and its mode are represented in Dwarf in non-contiguous
locations, or if the register should be represented in more than one
register in Dwarf. Otherwise, this hook should return @code{NULL_RTX}.
If not defined, the default is to return @code{NULL_RTX}.
@end deftypefn
@node Alignment Output
@subsection Assembler Commands for Alignment
@c prevent bad page break with this line
This describes commands for alignment.
@defmac JUMP_ALIGN (@var{label})
The alignment (log base 2) to put in front of @var{label}, which is
a common destination of jumps and has no fallthru incoming edge.
This macro need not be defined if you don't want any special alignment
to be done at such a time. Most machine descriptions do not currently
define the macro.
Unless it's necessary to inspect the @var{label} parameter, it is better
to set the variable @var{align_jumps} in the target's
@code{OVERRIDE_OPTIONS}. Otherwise, you should try to honor the user's
selection in @var{align_jumps} in a @code{JUMP_ALIGN} implementation.
@end defmac
@defmac LABEL_ALIGN_AFTER_BARRIER (@var{label})
The alignment (log base 2) to put in front of @var{label}, which follows
a @code{BARRIER}.
This macro need not be defined if you don't want any special alignment
to be done at such a time. Most machine descriptions do not currently
define the macro.
@end defmac
@defmac LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP
The maximum number of bytes to skip when applying
@code{LABEL_ALIGN_AFTER_BARRIER}. This works only if
@code{ASM_OUTPUT_MAX_SKIP_ALIGN} is defined.
@end defmac
@defmac LOOP_ALIGN (@var{label})
The alignment (log base 2) to put in front of @var{label}, which follows
a @code{NOTE_INSN_LOOP_BEG} note.
This macro need not be defined if you don't want any special alignment
to be done at such a time. Most machine descriptions do not currently
define the macro.
Unless it's necessary to inspect the @var{label} parameter, it is better
to set the variable @code{align_loops} in the target's
@code{OVERRIDE_OPTIONS}. Otherwise, you should try to honor the user's
selection in @code{align_loops} in a @code{LOOP_ALIGN} implementation.
@end defmac
@defmac LOOP_ALIGN_MAX_SKIP
The maximum number of bytes to skip when applying @code{LOOP_ALIGN}.
This works only if @code{ASM_OUTPUT_MAX_SKIP_ALIGN} is defined.
@end defmac
@defmac LABEL_ALIGN (@var{label})
The alignment (log base 2) to put in front of @var{label}.
If @code{LABEL_ALIGN_AFTER_BARRIER} / @code{LOOP_ALIGN} specify a different alignment,
the maximum of the specified values is used.
Unless it's necessary to inspect the @var{label} parameter, it is better
to set the variable @code{align_labels} in the target's
@code{OVERRIDE_OPTIONS}. Otherwise, you should try to honor the user's
selection in @code{align_labels} in a @code{LABEL_ALIGN} implementation.
@end defmac
@defmac LABEL_ALIGN_MAX_SKIP
The maximum number of bytes to skip when applying @code{LABEL_ALIGN}.
This works only if @code{ASM_OUTPUT_MAX_SKIP_ALIGN} is defined.
@end defmac
@defmac ASM_OUTPUT_SKIP (@var{stream}, @var{nbytes})
A C statement to output to the stdio stream @var{stream} an assembler
instruction to advance the location counter by @var{nbytes} bytes.
Those bytes should be zero when loaded. @var{nbytes} will be a C
expression of type @code{int}.
@end defmac
@defmac ASM_NO_SKIP_IN_TEXT
Define this macro if @code{ASM_OUTPUT_SKIP} should not be used in the
text section because it fails to put zeros in the bytes that are skipped.
This is true on many Unix systems, where the pseudo--op to skip bytes
produces no-op instructions rather than zeros when used in the text
section.
@end defmac
@defmac ASM_OUTPUT_ALIGN (@var{stream}, @var{power})
A C statement to output to the stdio stream @var{stream} an assembler
command to advance the location counter to a multiple of 2 to the
@var{power} bytes. @var{power} will be a C expression of type @code{int}.
@end defmac
@defmac ASM_OUTPUT_ALIGN_WITH_NOP (@var{stream}, @var{power})
Like @code{ASM_OUTPUT_ALIGN}, except that the ``nop'' instruction is used
for padding, if necessary.
@end defmac
@defmac ASM_OUTPUT_MAX_SKIP_ALIGN (@var{stream}, @var{power}, @var{max_skip})
A C statement to output to the stdio stream @var{stream} an assembler
command to advance the location counter to a multiple of 2 to the
@var{power} bytes, but only if @var{max_skip} or fewer bytes are needed to
satisfy the alignment request. @var{power} and @var{max_skip} will be
a C expression of type @code{int}.
@end defmac
@need 3000
@node Debugging Info
@section Controlling Debugging Information Format
@c prevent bad page break with this line
This describes how to specify debugging information.
@menu
* All Debuggers:: Macros that affect all debugging formats uniformly.
* DBX Options:: Macros enabling specific options in DBX format.
* DBX Hooks:: Hook macros for varying DBX format.
* File Names and DBX:: Macros controlling output of file names in DBX format.
* SDB and DWARF:: Macros for SDB (COFF) and DWARF formats.
* VMS Debug:: Macros for VMS debug format.
@end menu
@node All Debuggers
@subsection Macros Affecting All Debugging Formats
@c prevent bad page break with this line
These macros affect all debugging formats.
@defmac DBX_REGISTER_NUMBER (@var{regno})
A C expression that returns the DBX register number for the compiler
register number @var{regno}. In the default macro provided, the value
of this expression will be @var{regno} itself. But sometimes there are
some registers that the compiler knows about and DBX does not, or vice
versa. In such cases, some register may need to have one number in the
compiler and another for DBX@.
If two registers have consecutive numbers inside GCC, and they can be
used as a pair to hold a multiword value, then they @emph{must} have
consecutive numbers after renumbering with @code{DBX_REGISTER_NUMBER}.
Otherwise, debuggers will be unable to access such a pair, because they
expect register pairs to be consecutive in their own numbering scheme.
If you find yourself defining @code{DBX_REGISTER_NUMBER} in way that
does not preserve register pairs, then what you must do instead is
redefine the actual register numbering scheme.
@end defmac
@defmac DEBUGGER_AUTO_OFFSET (@var{x})
A C expression that returns the integer offset value for an automatic
variable having address @var{x} (an RTL expression). The default
computation assumes that @var{x} is based on the frame-pointer and
gives the offset from the frame-pointer. This is required for targets
that produce debugging output for DBX or COFF-style debugging output
for SDB and allow the frame-pointer to be eliminated when the
@option{-g} options is used.
@end defmac
@defmac DEBUGGER_ARG_OFFSET (@var{offset}, @var{x})
A C expression that returns the integer offset value for an argument
having address @var{x} (an RTL expression). The nominal offset is
@var{offset}.
@end defmac
@defmac PREFERRED_DEBUGGING_TYPE
A C expression that returns the type of debugging output GCC should
produce when the user specifies just @option{-g}. Define
this if you have arranged for GCC to support more than one format of
debugging output. Currently, the allowable values are @code{DBX_DEBUG},
@code{SDB_DEBUG}, @code{DWARF_DEBUG}, @code{DWARF2_DEBUG},
@code{XCOFF_DEBUG}, @code{VMS_DEBUG}, and @code{VMS_AND_DWARF2_DEBUG}.
When the user specifies @option{-ggdb}, GCC normally also uses the
value of this macro to select the debugging output format, but with two
exceptions. If @code{DWARF2_DEBUGGING_INFO} is defined and
@code{LINKER_DOES_NOT_WORK_WITH_DWARF2} is not defined, GCC uses the
value @code{DWARF2_DEBUG}. Otherwise, if @code{DBX_DEBUGGING_INFO} is
defined, GCC uses @code{DBX_DEBUG}.
The value of this macro only affects the default debugging output; the
user can always get a specific type of output by using @option{-gstabs},
@option{-gcoff}, @option{-gdwarf-1}, @option{-gdwarf-2}, @option{-gxcoff},
or @option{-gvms}.
@end defmac
@node DBX Options
@subsection Specific Options for DBX Output
@c prevent bad page break with this line
These are specific options for DBX output.
@defmac DBX_DEBUGGING_INFO
Define this macro if GCC should produce debugging output for DBX
in response to the @option{-g} option.
@end defmac
@defmac XCOFF_DEBUGGING_INFO
Define this macro if GCC should produce XCOFF format debugging output
in response to the @option{-g} option. This is a variant of DBX format.
@end defmac
@defmac DEFAULT_GDB_EXTENSIONS
Define this macro to control whether GCC should by default generate
GDB's extended version of DBX debugging information (assuming DBX-format
debugging information is enabled at all). If you don't define the
macro, the default is 1: always generate the extended information
if there is any occasion to.
@end defmac
@defmac DEBUG_SYMS_TEXT
Define this macro if all @code{.stabs} commands should be output while
in the text section.
@end defmac
@defmac ASM_STABS_OP
A C string constant, including spacing, naming the assembler pseudo op to
use instead of @code{"\t.stabs\t"} to define an ordinary debugging symbol.
If you don't define this macro, @code{"\t.stabs\t"} is used. This macro
applies only to DBX debugging information format.
@end defmac
@defmac ASM_STABD_OP
A C string constant, including spacing, naming the assembler pseudo op to
use instead of @code{"\t.stabd\t"} to define a debugging symbol whose
value is the current location. If you don't define this macro,
@code{"\t.stabd\t"} is used. This macro applies only to DBX debugging
information format.
@end defmac
@defmac ASM_STABN_OP
A C string constant, including spacing, naming the assembler pseudo op to
use instead of @code{"\t.stabn\t"} to define a debugging symbol with no
name. If you don't define this macro, @code{"\t.stabn\t"} is used. This
macro applies only to DBX debugging information format.
@end defmac
@defmac DBX_NO_XREFS
Define this macro if DBX on your system does not support the construct
@samp{xs@var{tagname}}. On some systems, this construct is used to
describe a forward reference to a structure named @var{tagname}.
On other systems, this construct is not supported at all.
@end defmac
@defmac DBX_CONTIN_LENGTH
A symbol name in DBX-format debugging information is normally
continued (split into two separate @code{.stabs} directives) when it
exceeds a certain length (by default, 80 characters). On some
operating systems, DBX requires this splitting; on others, splitting
must not be done. You can inhibit splitting by defining this macro
with the value zero. You can override the default splitting-length by
defining this macro as an expression for the length you desire.
@end defmac
@defmac DBX_CONTIN_CHAR
Normally continuation is indicated by adding a @samp{\} character to
the end of a @code{.stabs} string when a continuation follows. To use
a different character instead, define this macro as a character
constant for the character you want to use. Do not define this macro
if backslash is correct for your system.
@end defmac
@defmac DBX_STATIC_STAB_DATA_SECTION
Define this macro if it is necessary to go to the data section before
outputting the @samp{.stabs} pseudo-op for a non-global static
variable.
@end defmac
@defmac DBX_TYPE_DECL_STABS_CODE
The value to use in the ``code'' field of the @code{.stabs} directive
for a typedef. The default is @code{N_LSYM}.
@end defmac
@defmac DBX_STATIC_CONST_VAR_CODE
The value to use in the ``code'' field of the @code{.stabs} directive
for a static variable located in the text section. DBX format does not
provide any ``right'' way to do this. The default is @code{N_FUN}.
@end defmac
@defmac DBX_REGPARM_STABS_CODE
The value to use in the ``code'' field of the @code{.stabs} directive
for a parameter passed in registers. DBX format does not provide any
``right'' way to do this. The default is @code{N_RSYM}.
@end defmac
@defmac DBX_REGPARM_STABS_LETTER
The letter to use in DBX symbol data to identify a symbol as a parameter
passed in registers. DBX format does not customarily provide any way to
do this. The default is @code{'P'}.
@end defmac
@defmac DBX_MEMPARM_STABS_LETTER
The letter to use in DBX symbol data to identify a symbol as a stack
parameter. The default is @code{'p'}.
@end defmac
@defmac DBX_FUNCTION_FIRST
Define this macro if the DBX information for a function and its
arguments should precede the assembler code for the function. Normally,
in DBX format, the debugging information entirely follows the assembler
code.
@end defmac
@defmac DBX_BLOCKS_FUNCTION_RELATIVE
Define this macro if the value of a symbol describing the scope of a
block (@code{N_LBRAC} or @code{N_RBRAC}) should be relative to the start
of the enclosing function. Normally, GCC uses an absolute address.
@end defmac
@defmac DBX_USE_BINCL
Define this macro if GCC should generate @code{N_BINCL} and
@code{N_EINCL} stabs for included header files, as on Sun systems. This
macro also directs GCC to output a type number as a pair of a file
number and a type number within the file. Normally, GCC does not
generate @code{N_BINCL} or @code{N_EINCL} stabs, and it outputs a single
number for a type number.
@end defmac
@node DBX Hooks
@subsection Open-Ended Hooks for DBX Format
@c prevent bad page break with this line
These are hooks for DBX format.
@defmac DBX_OUTPUT_LBRAC (@var{stream}, @var{name})
Define this macro to say how to output to @var{stream} the debugging
information for the start of a scope level for variable names. The
argument @var{name} is the name of an assembler symbol (for use with
@code{assemble_name}) whose value is the address where the scope begins.
@end defmac
@defmac DBX_OUTPUT_RBRAC (@var{stream}, @var{name})
Like @code{DBX_OUTPUT_LBRAC}, but for the end of a scope level.
@end defmac
@defmac DBX_OUTPUT_NFUN (@var{stream}, @var{lscope_label}, @var{decl})
Define this macro if the target machine requires special handling to
output an @code{N_FUN} entry for the function @var{decl}.
@end defmac
@defmac DBX_OUTPUT_FUNCTION_END (@var{stream}, @var{function})
Define this macro if the target machine requires special output at the
end of the debugging information for a function. The definition should
be a C statement (sans semicolon) to output the appropriate information
to @var{stream}. @var{function} is the @code{FUNCTION_DECL} node for
the function.
@end defmac
@defmac DBX_OUTPUT_STANDARD_TYPES (@var{syms})
Define this macro if you need to control the order of output of the
standard data types at the beginning of compilation. The argument
@var{syms} is a @code{tree} which is a chain of all the predefined
global symbols, including names of data types.
Normally, DBX output starts with definitions of the types for integers
and characters, followed by all the other predefined types of the
particular language in no particular order.
On some machines, it is necessary to output different particular types
first. To do this, define @code{DBX_OUTPUT_STANDARD_TYPES} to output
those symbols in the necessary order. Any predefined types that you
don't explicitly output will be output afterward in no particular order.
Be careful not to define this macro so that it works only for C@. There
are no global variables to access most of the built-in types, because
another language may have another set of types. The way to output a
particular type is to look through @var{syms} to see if you can find it.
Here is an example:
@smallexample
@{
tree decl;
for (decl = syms; decl; decl = TREE_CHAIN (decl))
if (!strcmp (IDENTIFIER_POINTER (DECL_NAME (decl)),
"long int"))
dbxout_symbol (decl);
@dots{}
@}
@end smallexample
@noindent
This does nothing if the expected type does not exist.
See the function @code{init_decl_processing} in @file{c-decl.c} to find
the names to use for all the built-in C types.
Here is another way of finding a particular type:
@c this is still overfull. --mew 10feb93
@smallexample
@{
tree decl;
for (decl = syms; decl; decl = TREE_CHAIN (decl))
if (TREE_CODE (decl) == TYPE_DECL
&& (TREE_CODE (TREE_TYPE (decl))
== INTEGER_CST)
&& TYPE_PRECISION (TREE_TYPE (decl)) == 16
&& TYPE_UNSIGNED (TREE_TYPE (decl)))
@group
/* @r{This must be @code{unsigned short}.} */
dbxout_symbol (decl);
@dots{}
@}
@end group
@end smallexample
@end defmac
@defmac NO_DBX_FUNCTION_END
Some stabs encapsulation formats (in particular ECOFF), cannot handle the
@code{.stabs "",N_FUN,,0,0,Lscope-function-1} gdb dbx extension construct.
On those machines, define this macro to turn this feature off without
disturbing the rest of the gdb extensions.
@end defmac
@node File Names and DBX
@subsection File Names in DBX Format
@c prevent bad page break with this line
This describes file names in DBX format.
@defmac DBX_OUTPUT_MAIN_SOURCE_FILENAME (@var{stream}, @var{name})
A C statement to output DBX debugging information to the stdio stream
@var{stream} which indicates that file @var{name} is the main source
file---the file specified as the input file for compilation.
This macro is called only once, at the beginning of compilation.
This macro need not be defined if the standard form of output
for DBX debugging information is appropriate.
@end defmac
@defmac DBX_OUTPUT_MAIN_SOURCE_DIRECTORY (@var{stream}, @var{name})
A C statement to output DBX debugging information to the stdio stream
@var{stream} which indicates that the current directory during
compilation is named @var{name}.
This macro need not be defined if the standard form of output
for DBX debugging information is appropriate.
@end defmac
@defmac DBX_OUTPUT_MAIN_SOURCE_FILE_END (@var{stream}, @var{name})
A C statement to output DBX debugging information at the end of
compilation of the main source file @var{name}.
If you don't define this macro, nothing special is output at the end
of compilation, which is correct for most machines.
@end defmac
@need 2000
@node SDB and DWARF
@subsection Macros for SDB and DWARF Output
@c prevent bad page break with this line
Here are macros for SDB and DWARF output.
@defmac SDB_DEBUGGING_INFO
Define this macro if GCC should produce COFF-style debugging output
for SDB in response to the @option{-g} option.
@end defmac
@defmac DWARF_DEBUGGING_INFO
Define this macro if GCC should produce dwarf format debugging output
in response to the @option{-g} option.
@end defmac
@defmac DWARF2_DEBUGGING_INFO
Define this macro if GCC should produce dwarf version 2 format
debugging output in response to the @option{-g} option.
To support optional call frame debugging information, you must also
define @code{INCOMING_RETURN_ADDR_RTX} and either set
@code{RTX_FRAME_RELATED_P} on the prologue insns if you use RTL for the
prologue, or call @code{dwarf2out_def_cfa} and @code{dwarf2out_reg_save}
as appropriate from @code{TARGET_ASM_FUNCTION_PROLOGUE} if you don't.
@end defmac
@defmac DWARF2_FRAME_INFO
Define this macro to a nonzero value if GCC should always output
Dwarf 2 frame information. If @code{DWARF2_UNWIND_INFO}
(@pxref{Exception Region Output} is nonzero, GCC will output this
information not matter how you define @code{DWARF2_FRAME_INFO}.
@end defmac
@defmac LINKER_DOES_NOT_WORK_WITH_DWARF2
Define this macro if the linker does not work with Dwarf version 2.
Normally, if the user specifies only @option{-ggdb} GCC will use Dwarf
version 2 if available; this macro disables this. See the description
of the @code{PREFERRED_DEBUGGING_TYPE} macro for more details.
@end defmac
@defmac DWARF2_GENERATE_TEXT_SECTION_LABEL
By default, the Dwarf 2 debugging information generator will generate a
label to mark the beginning of the text section. If it is better simply
to use the name of the text section itself, rather than an explicit label,
to indicate the beginning of the text section, define this macro to zero.
@end defmac
@defmac DWARF2_ASM_LINE_DEBUG_INFO
Define this macro to be a nonzero value if the assembler can generate Dwarf 2
line debug info sections. This will result in much more compact line number
tables, and hence is desirable if it works.
@end defmac
@defmac ASM_OUTPUT_DWARF_DELTA (@var{stream}, @var{size}, @var{label1}, @var{label2})
A C statement to issue assembly directives that create a difference
between the two given labels, using an integer of the given size.
@end defmac
@defmac ASM_OUTPUT_DWARF_OFFSET (@var{stream}, @var{size}, @var{label})
A C statement to issue assembly directives that create a
section-relative reference to the given label, using an integer of the
given size.
@end defmac
@defmac ASM_OUTPUT_DWARF_PCREL (@var{stream}, @var{size}, @var{label})
A C statement to issue assembly directives that create a self-relative
reference to the given label, using an integer of the given size.
@end defmac
@defmac PUT_SDB_@dots{}
Define these macros to override the assembler syntax for the special
SDB assembler directives. See @file{sdbout.c} for a list of these
macros and their arguments. If the standard syntax is used, you need
not define them yourself.
@end defmac
@defmac SDB_DELIM
Some assemblers do not support a semicolon as a delimiter, even between
SDB assembler directives. In that case, define this macro to be the
delimiter to use (usually @samp{\n}). It is not necessary to define
a new set of @code{PUT_SDB_@var{op}} macros if this is the only change
required.
@end defmac
@defmac SDB_GENERATE_FAKE
Define this macro to override the usual method of constructing a dummy
name for anonymous structure and union types. See @file{sdbout.c} for
more information.
@end defmac
@defmac SDB_ALLOW_UNKNOWN_REFERENCES
Define this macro to allow references to unknown structure,
union, or enumeration tags to be emitted. Standard COFF does not
allow handling of unknown references, MIPS ECOFF has support for
it.
@end defmac
@defmac SDB_ALLOW_FORWARD_REFERENCES
Define this macro to allow references to structure, union, or
enumeration tags that have not yet been seen to be handled. Some
assemblers choke if forward tags are used, while some require it.
@end defmac
@need 2000
@node VMS Debug
@subsection Macros for VMS Debug Format
@c prevent bad page break with this line
Here are macros for VMS debug format.
@defmac VMS_DEBUGGING_INFO
Define this macro if GCC should produce debugging output for VMS
in response to the @option{-g} option. The default behavior for VMS
is to generate minimal debug info for a traceback in the absence of
@option{-g} unless explicitly overridden with @option{-g0}. This
behavior is controlled by @code{OPTIMIZATION_OPTIONS} and
@code{OVERRIDE_OPTIONS}.
@end defmac
@node Floating Point
@section Cross Compilation and Floating Point
@cindex cross compilation and floating point
@cindex floating point and cross compilation
While all modern machines use twos-complement representation for integers,
there are a variety of representations for floating point numbers. This
means that in a cross-compiler the representation of floating point numbers
in the compiled program may be different from that used in the machine
doing the compilation.
Because different representation systems may offer different amounts of
range and precision, all floating point constants must be represented in
the target machine's format. Therefore, the cross compiler cannot
safely use the host machine's floating point arithmetic; it must emulate
the target's arithmetic. To ensure consistency, GCC always uses
emulation to work with floating point values, even when the host and
target floating point formats are identical.
The following macros are provided by @file{real.h} for the compiler to
use. All parts of the compiler which generate or optimize
floating-point calculations must use these macros. They may evaluate
their operands more than once, so operands must not have side effects.
@defmac REAL_VALUE_TYPE
The C data type to be used to hold a floating point value in the target
machine's format. Typically this is a @code{struct} containing an
array of @code{HOST_WIDE_INT}, but all code should treat it as an opaque
quantity.
@end defmac
@deftypefn Macro int REAL_VALUES_EQUAL (REAL_VALUE_TYPE @var{x}, REAL_VALUE_TYPE @var{y})
Compares for equality the two values, @var{x} and @var{y}. If the target
floating point format supports negative zeroes and/or NaNs,
@samp{REAL_VALUES_EQUAL (-0.0, 0.0)} is true, and
@samp{REAL_VALUES_EQUAL (NaN, NaN)} is false.
@end deftypefn
@deftypefn Macro int REAL_VALUES_LESS (REAL_VALUE_TYPE @var{x}, REAL_VALUE_TYPE @var{y})
Tests whether @var{x} is less than @var{y}.
@end deftypefn
@deftypefn Macro HOST_WIDE_INT REAL_VALUE_FIX (REAL_VALUE_TYPE @var{x})
Truncates @var{x} to a signed integer, rounding toward zero.
@end deftypefn
@deftypefn Macro {unsigned HOST_WIDE_INT} REAL_VALUE_UNSIGNED_FIX (REAL_VALUE_TYPE @var{x})
Truncates @var{x} to an unsigned integer, rounding toward zero. If
@var{x} is negative, returns zero.
@end deftypefn
@deftypefn Macro REAL_VALUE_TYPE REAL_VALUE_ATOF (const char *@var{string}, enum machine_mode @var{mode})
Converts @var{string} into a floating point number in the target machine's
representation for mode @var{mode}. This routine can handle both
decimal and hexadecimal floating point constants, using the syntax
defined by the C language for both.
@end deftypefn
@deftypefn Macro int REAL_VALUE_NEGATIVE (REAL_VALUE_TYPE @var{x})
Returns 1 if @var{x} is negative (including negative zero), 0 otherwise.
@end deftypefn
@deftypefn Macro int REAL_VALUE_ISINF (REAL_VALUE_TYPE @var{x})
Determines whether @var{x} represents infinity (positive or negative).
@end deftypefn
@deftypefn Macro int REAL_VALUE_ISNAN (REAL_VALUE_TYPE @var{x})
Determines whether @var{x} represents a ``NaN'' (not-a-number).
@end deftypefn
@deftypefn Macro void REAL_ARITHMETIC (REAL_VALUE_TYPE @var{output}, enum tree_code @var{code}, REAL_VALUE_TYPE @var{x}, REAL_VALUE_TYPE @var{y})
Calculates an arithmetic operation on the two floating point values
@var{x} and @var{y}, storing the result in @var{output} (which must be a
variable).
The operation to be performed is specified by @var{code}. Only the
following codes are supported: @code{PLUS_EXPR}, @code{MINUS_EXPR},
@code{MULT_EXPR}, @code{RDIV_EXPR}, @code{MAX_EXPR}, @code{MIN_EXPR}.
If @code{REAL_ARITHMETIC} is asked to evaluate division by zero and the
target's floating point format cannot represent infinity, it will call
@code{abort}. Callers should check for this situation first, using
@code{MODE_HAS_INFINITIES}. @xref{Storage Layout}.
@end deftypefn
@deftypefn Macro REAL_VALUE_TYPE REAL_VALUE_NEGATE (REAL_VALUE_TYPE @var{x})
Returns the negative of the floating point value @var{x}.
@end deftypefn
@deftypefn Macro REAL_VALUE_TYPE REAL_VALUE_ABS (REAL_VALUE_TYPE @var{x})
Returns the absolute value of @var{x}.
@end deftypefn
@deftypefn Macro REAL_VALUE_TYPE REAL_VALUE_TRUNCATE (REAL_VALUE_TYPE @var{mode}, enum machine_mode @var{x})
Truncates the floating point value @var{x} to fit in @var{mode}. The
return value is still a full-size @code{REAL_VALUE_TYPE}, but it has an
appropriate bit pattern to be output asa floating constant whose
precision accords with mode @var{mode}.
@end deftypefn
@deftypefn Macro void REAL_VALUE_TO_INT (HOST_WIDE_INT @var{low}, HOST_WIDE_INT @var{high}, REAL_VALUE_TYPE @var{x})
Converts a floating point value @var{x} into a double-precision integer
which is then stored into @var{low} and @var{high}. If the value is not
integral, it is truncated.
@end deftypefn
@deftypefn Macro void REAL_VALUE_FROM_INT (REAL_VALUE_TYPE @var{x}, HOST_WIDE_INT @var{low}, HOST_WIDE_INT @var{high}, enum machine_mode @var{mode})
Converts a double-precision integer found in @var{low} and @var{high},
into a floating point value which is then stored into @var{x}. The
value is truncated to fit in mode @var{mode}.
@end deftypefn
@node Mode Switching
@section Mode Switching Instructions
@cindex mode switching
The following macros control mode switching optimizations:
@defmac OPTIMIZE_MODE_SWITCHING (@var{entity})
Define this macro if the port needs extra instructions inserted for mode
switching in an optimizing compilation.
For an example, the SH4 can perform both single and double precision
floating point operations, but to perform a single precision operation,
the FPSCR PR bit has to be cleared, while for a double precision
operation, this bit has to be set. Changing the PR bit requires a general
purpose register as a scratch register, hence these FPSCR sets have to
be inserted before reload, i.e.@: you can't put this into instruction emitting
or @code{TARGET_MACHINE_DEPENDENT_REORG}.
You can have multiple entities that are mode-switched, and select at run time
which entities actually need it. @code{OPTIMIZE_MODE_SWITCHING} should
return nonzero for any @var{entity} that needs mode-switching.
If you define this macro, you also have to define
@code{NUM_MODES_FOR_MODE_SWITCHING}, @code{MODE_NEEDED},
@code{MODE_PRIORITY_TO_MODE} and @code{EMIT_MODE_SET}.
@code{MODE_AFTER}, @code{MODE_ENTRY}, and @code{MODE_EXIT}
are optional.
@end defmac
@defmac NUM_MODES_FOR_MODE_SWITCHING
If you define @code{OPTIMIZE_MODE_SWITCHING}, you have to define this as
initializer for an array of integers. Each initializer element
N refers to an entity that needs mode switching, and specifies the number
of different modes that might need to be set for this entity.
The position of the initializer in the initializer - starting counting at
zero - determines the integer that is used to refer to the mode-switched
entity in question.
In macros that take mode arguments / yield a mode result, modes are
represented as numbers 0 @dots{} N @minus{} 1. N is used to specify that no mode
switch is needed / supplied.
@end defmac
@defmac MODE_NEEDED (@var{entity}, @var{insn})
@var{entity} is an integer specifying a mode-switched entity. If
@code{OPTIMIZE_MODE_SWITCHING} is defined, you must define this macro to
return an integer value not larger than the corresponding element in
@code{NUM_MODES_FOR_MODE_SWITCHING}, to denote the mode that @var{entity} must
be switched into prior to the execution of @var{insn}.
@end defmac
@defmac MODE_AFTER (@var{mode}, @var{insn})
If this macro is defined, it is evaluated for every @var{insn} during
mode switching. It determines the mode that an insn results in (if
different from the incoming mode).
@end defmac
@defmac MODE_ENTRY (@var{entity})
If this macro is defined, it is evaluated for every @var{entity} that needs
mode switching. It should evaluate to an integer, which is a mode that
@var{entity} is assumed to be switched to at function entry. If @code{MODE_ENTRY}
is defined then @code{MODE_EXIT} must be defined.
@end defmac
@defmac MODE_EXIT (@var{entity})
If this macro is defined, it is evaluated for every @var{entity} that needs
mode switching. It should evaluate to an integer, which is a mode that
@var{entity} is assumed to be switched to at function exit. If @code{MODE_EXIT}
is defined then @code{MODE_ENTRY} must be defined.
@end defmac
@defmac MODE_PRIORITY_TO_MODE (@var{entity}, @var{n})
This macro specifies the order in which modes for @var{entity} are processed.
0 is the highest priority, @code{NUM_MODES_FOR_MODE_SWITCHING[@var{entity}] - 1} the
lowest. The value of the macro should be an integer designating a mode
for @var{entity}. For any fixed @var{entity}, @code{mode_priority_to_mode}
(@var{entity}, @var{n}) shall be a bijection in 0 @dots{}
@code{num_modes_for_mode_switching[@var{entity}] - 1}.
@end defmac
@defmac EMIT_MODE_SET (@var{entity}, @var{mode}, @var{hard_regs_live})
Generate one or more insns to set @var{entity} to @var{mode}.
@var{hard_reg_live} is the set of hard registers live at the point where
the insn(s) are to be inserted.
@end defmac
@node Target Attributes
@section Defining target-specific uses of @code{__attribute__}
@cindex target attributes
@cindex machine attributes
@cindex attributes, target-specific
Target-specific attributes may be defined for functions, data and types.
These are described using the following target hooks; they also need to
be documented in @file{extend.texi}.
@deftypevr {Target Hook} {const struct attribute_spec *} TARGET_ATTRIBUTE_TABLE
If defined, this target hook points to an array of @samp{struct
attribute_spec} (defined in @file{tree.h}) specifying the machine
specific attributes for this target and some of the restrictions on the
entities to which these attributes are applied and the arguments they
take.
@end deftypevr
@deftypefn {Target Hook} int TARGET_COMP_TYPE_ATTRIBUTES (tree @var{type1}, tree @var{type2})
If defined, this target hook is a function which returns zero if the attributes on
@var{type1} and @var{type2} are incompatible, one if they are compatible,
and two if they are nearly compatible (which causes a warning to be
generated). If this is not defined, machine-specific attributes are
supposed always to be compatible.
@end deftypefn
@deftypefn {Target Hook} void TARGET_SET_DEFAULT_TYPE_ATTRIBUTES (tree @var{type})
If defined, this target hook is a function which assigns default attributes to
newly defined @var{type}.
@end deftypefn
@deftypefn {Target Hook} tree TARGET_MERGE_TYPE_ATTRIBUTES (tree @var{type1}, tree @var{type2})
Define this target hook if the merging of type attributes needs special
handling. If defined, the result is a list of the combined
@code{TYPE_ATTRIBUTES} of @var{type1} and @var{type2}. It is assumed
that @code{comptypes} has already been called and returned 1. This
function may call @code{merge_attributes} to handle machine-independent
merging.
@end deftypefn
@deftypefn {Target Hook} tree TARGET_MERGE_DECL_ATTRIBUTES (tree @var{olddecl}, tree @var{newdecl})
Define this target hook if the merging of decl attributes needs special
handling. If defined, the result is a list of the combined
@code{DECL_ATTRIBUTES} of @var{olddecl} and @var{newdecl}.
@var{newdecl} is a duplicate declaration of @var{olddecl}. Examples of
when this is needed are when one attribute overrides another, or when an
attribute is nullified by a subsequent definition. This function may
call @code{merge_attributes} to handle machine-independent merging.
@findex TARGET_DLLIMPORT_DECL_ATTRIBUTES
If the only target-specific handling you require is @samp{dllimport} for
Windows targets, you should define the macro
@code{TARGET_DLLIMPORT_DECL_ATTRIBUTES}. This links in a function
called @code{merge_dllimport_decl_attributes} which can then be defined
as the expansion of @code{TARGET_MERGE_DECL_ATTRIBUTES}. This is done
in @file{i386/cygwin.h} and @file{i386/i386.c}, for example.
@end deftypefn
@deftypefn {Target Hook} void TARGET_INSERT_ATTRIBUTES (tree @var{node}, tree *@var{attr_ptr})
Define this target hook if you want to be able to add attributes to a decl
when it is being created. This is normally useful for back ends which
wish to implement a pragma by using the attributes which correspond to
the pragma's effect. The @var{node} argument is the decl which is being
created. The @var{attr_ptr} argument is a pointer to the attribute list
for this decl. The list itself should not be modified, since it may be
shared with other decls, but attributes may be chained on the head of
the list and @code{*@var{attr_ptr}} modified to point to the new
attributes, or a copy of the list may be made if further changes are
needed.
@end deftypefn
@deftypefn {Target Hook} bool TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P (tree @var{fndecl})
@cindex inlining
This target hook returns @code{true} if it is ok to inline @var{fndecl}
into the current function, despite its having target-specific
attributes, @code{false} otherwise. By default, if a function has a
target specific attribute attached to it, it will not be inlined.
@end deftypefn
@node MIPS Coprocessors
@section Defining coprocessor specifics for MIPS targets.
@cindex MIPS coprocessor-definition macros
The MIPS specification allows MIPS implementations to have as many as 4
coprocessors, each with as many as 32 private registers. gcc supports
accessing these registers and transferring values between the registers
and memory using asm-ized variables. For example:
@smallexample
register unsigned int cp0count asm ("c0r1");
unsigned int d;
d = cp0count + 3;
@end smallexample
(``c0r1'' is the default name of register 1 in coprocessor 0; alternate
names may be added as described below, or the default names may be
overridden entirely in @code{SUBTARGET_CONDITIONAL_REGISTER_USAGE}.)
Coprocessor registers are assumed to be epilogue-used; sets to them will
be preserved even if it does not appear that the register is used again
later in the function.
Another note: according to the MIPS spec, coprocessor 1 (if present) is
the FPU. One accesses COP1 registers through standard mips
floating-point support; they are not included in this mechanism.
There is one macro used in defining the MIPS coprocessor interface which
you may want to override in subtargets; it is described below.
@defmac ALL_COP_ADDITIONAL_REGISTER_NAMES
A comma-separated list (with leading comma) of pairs describing the
alternate names of coprocessor registers. The format of each entry should be
@smallexample
@{ @var{alternatename}, @var{register_number}@}
@end smallexample
Default: empty.
@end defmac
@node PCH Target
@section Parameters for Precompiled Header Validity Checking
@cindex parameters, precompiled headers
@deftypefn {Target Hook} void * TARGET_GET_PCH_VALIDITY (size_t * @var{sz})
Define this hook if your target needs to check a different collection
of flags than the default, which is every flag defined by
@code{TARGET_SWITCHES} and @code{TARGET_OPTIONS}. It should return
some data which will be saved in the PCH file and presented to
@code{TARGET_PCH_VALID_P} later; it should set @code{SZ} to the size
of the data.
@end deftypefn
@deftypefn {Target Hook} const char * TARGET_PCH_VALID_P (const void * @var{data}, size_t @var{sz})
Define this hook if your target needs to check a different collection of
flags than the default, which is every flag defined by @code{TARGET_SWITCHES}
and @code{TARGET_OPTIONS}. It is given data which came from
@code{TARGET_GET_PCH_VALIDITY} (in this version of this compiler, so there
is no need for extensive validity checking). It returns @code{NULL} if
it is safe to load a PCH file with this data, or a suitable error message
if not. The error message will be presented to the user, so it should
be localised.
@end deftypefn
@node Misc
@section Miscellaneous Parameters
@cindex parameters, miscellaneous
@c prevent bad page break with this line
Here are several miscellaneous parameters.
@defmac PREDICATE_CODES
Define this if you have defined special-purpose predicates in the file
@file{@var{machine}.c}. This macro is called within an initializer of an
array of structures. The first field in the structure is the name of a
predicate and the second field is an array of rtl codes. For each
predicate, list all rtl codes that can be in expressions matched by the
predicate. The list should have a trailing comma. Here is an example
of two entries in the list for a typical RISC machine:
@smallexample
#define PREDICATE_CODES \
@{"gen_reg_rtx_operand", @{SUBREG, REG@}@}, \
@{"reg_or_short_cint_operand", @{SUBREG, REG, CONST_INT@}@},
@end smallexample
Defining this macro does not affect the generated code (however,
incorrect definitions that omit an rtl code that may be matched by the
predicate can cause the compiler to malfunction). Instead, it allows
the table built by @file{genrecog} to be more compact and efficient,
thus speeding up the compiler. The most important predicates to include
in the list specified by this macro are those used in the most insn
patterns.
For each predicate function named in @code{PREDICATE_CODES}, a
declaration will be generated in @file{insn-codes.h}.
@end defmac
@defmac SPECIAL_MODE_PREDICATES
Define this if you have special predicates that know special things
about modes. Genrecog will warn about certain forms of
@code{match_operand} without a mode; if the operand predicate is
listed in @code{SPECIAL_MODE_PREDICATES}, the warning will be
suppressed.
Here is an example from the IA-32 port (@code{ext_register_operand}
specially checks for @code{HImode} or @code{SImode} in preparation
for a byte extraction from @code{%ah} etc.).
@smallexample
#define SPECIAL_MODE_PREDICATES \
"ext_register_operand",
@end smallexample
@end defmac
@defmac CASE_VECTOR_MODE
An alias for a machine mode name. This is the machine mode that
elements of a jump-table should have.
@end defmac
@defmac CASE_VECTOR_SHORTEN_MODE (@var{min_offset}, @var{max_offset}, @var{body})
Optional: return the preferred mode for an @code{addr_diff_vec}
when the minimum and maximum offset are known. If you define this,
it enables extra code in branch shortening to deal with @code{addr_diff_vec}.
To make this work, you also have to define @code{INSN_ALIGN} and
make the alignment for @code{addr_diff_vec} explicit.
The @var{body} argument is provided so that the offset_unsigned and scale
flags can be updated.
@end defmac
@defmac CASE_VECTOR_PC_RELATIVE
Define this macro to be a C expression to indicate when jump-tables
should contain relative addresses. If jump-tables never contain
relative addresses, then you need not define this macro.
@end defmac
@defmac CASE_DROPS_THROUGH
Define this if control falls through a @code{case} insn when the index
value is out of range. This means the specified default-label is
actually ignored by the @code{case} insn proper.
@end defmac
@defmac CASE_VALUES_THRESHOLD
Define this to be the smallest number of different values for which it
is best to use a jump-table instead of a tree of conditional branches.
The default is four for machines with a @code{casesi} instruction and
five otherwise. This is best for most machines.
@end defmac
@defmac CASE_USE_BIT_TESTS
Define this macro to be a C expression to indicate whether C switch
statements may be implemented by a sequence of bit tests. This is
advantageous on processors that can efficiently implement left shift
of 1 by the number of bits held in a register, but inappropriate on
targets that would require a loop. By default, this macro returns
@code{true} if the target defines an @code{ashlsi3} pattern, and
@code{false} otherwise.
@end defmac
@defmac WORD_REGISTER_OPERATIONS
Define this macro if operations between registers with integral mode
smaller than a word are always performed on the entire register.
Most RISC machines have this property and most CISC machines do not.
@end defmac
@defmac LOAD_EXTEND_OP (@var{mode})
Define this macro to be a C expression indicating when insns that read
memory in @var{mode}, an integral mode narrower than a word, set the
bits outside of @var{mode} to be either the sign-extension or the
zero-extension of the data read. Return @code{SIGN_EXTEND} for values
of @var{mode} for which the
insn sign-extends, @code{ZERO_EXTEND} for which it zero-extends, and
@code{NIL} for other modes.
This macro is not called with @var{mode} non-integral or with a width
greater than or equal to @code{BITS_PER_WORD}, so you may return any
value in this case. Do not define this macro if it would always return
@code{NIL}. On machines where this macro is defined, you will normally
define it as the constant @code{SIGN_EXTEND} or @code{ZERO_EXTEND}.
@end defmac
@defmac SHORT_IMMEDIATES_SIGN_EXTEND
Define this macro if loading short immediate values into registers sign
extends.
@end defmac
@defmac FIXUNS_TRUNC_LIKE_FIX_TRUNC
Define this macro if the same instructions that convert a floating
point number to a signed fixed point number also convert validly to an
unsigned one.
@end defmac
@defmac MOVE_MAX
The maximum number of bytes that a single instruction can move quickly
between memory and registers or between two memory locations.
@end defmac
@defmac MAX_MOVE_MAX
The maximum number of bytes that a single instruction can move quickly
between memory and registers or between two memory locations. If this
is undefined, the default is @code{MOVE_MAX}. Otherwise, it is the
constant value that is the largest value that @code{MOVE_MAX} can have
at run-time.
@end defmac
@defmac SHIFT_COUNT_TRUNCATED
A C expression that is nonzero if on this machine the number of bits
actually used for the count of a shift operation is equal to the number
of bits needed to represent the size of the object being shifted. When
this macro is nonzero, the compiler will assume that it is safe to omit
a sign-extend, zero-extend, and certain bitwise `and' instructions that
truncates the count of a shift operation. On machines that have
instructions that act on bit-fields at variable positions, which may
include `bit test' instructions, a nonzero @code{SHIFT_COUNT_TRUNCATED}
also enables deletion of truncations of the values that serve as
arguments to bit-field instructions.
If both types of instructions truncate the count (for shifts) and
position (for bit-field operations), or if no variable-position bit-field
instructions exist, you should define this macro.
However, on some machines, such as the 80386 and the 680x0, truncation
only applies to shift operations and not the (real or pretended)
bit-field operations. Define @code{SHIFT_COUNT_TRUNCATED} to be zero on
such machines. Instead, add patterns to the @file{md} file that include
the implied truncation of the shift instructions.
You need not define this macro if it would always have the value of zero.
@end defmac
@defmac TRULY_NOOP_TRUNCATION (@var{outprec}, @var{inprec})
A C expression which is nonzero if on this machine it is safe to
``convert'' an integer of @var{inprec} bits to one of @var{outprec}
bits (where @var{outprec} is smaller than @var{inprec}) by merely
operating on it as if it had only @var{outprec} bits.
On many machines, this expression can be 1.
@c rearranged this, removed the phrase "it is reported that". this was
@c to fix an overfull hbox. --mew 10feb93
When @code{TRULY_NOOP_TRUNCATION} returns 1 for a pair of sizes for
modes for which @code{MODES_TIEABLE_P} is 0, suboptimal code can result.
If this is the case, making @code{TRULY_NOOP_TRUNCATION} return 0 in
such cases may improve things.
@end defmac
@defmac STORE_FLAG_VALUE
A C expression describing the value returned by a comparison operator
with an integral mode and stored by a store-flag instruction
(@samp{s@var{cond}}) when the condition is true. This description must
apply to @emph{all} the @samp{s@var{cond}} patterns and all the
comparison operators whose results have a @code{MODE_INT} mode.
A value of 1 or @minus{}1 means that the instruction implementing the
comparison operator returns exactly 1 or @minus{}1 when the comparison is true
and 0 when the comparison is false. Otherwise, the value indicates
which bits of the result are guaranteed to be 1 when the comparison is
true. This value is interpreted in the mode of the comparison
operation, which is given by the mode of the first operand in the
@samp{s@var{cond}} pattern. Either the low bit or the sign bit of
@code{STORE_FLAG_VALUE} be on. Presently, only those bits are used by
the compiler.
If @code{STORE_FLAG_VALUE} is neither 1 or @minus{}1, the compiler will
generate code that depends only on the specified bits. It can also
replace comparison operators with equivalent operations if they cause
the required bits to be set, even if the remaining bits are undefined.
For example, on a machine whose comparison operators return an
@code{SImode} value and where @code{STORE_FLAG_VALUE} is defined as
@samp{0x80000000}, saying that just the sign bit is relevant, the
expression
@smallexample
(ne:SI (and:SI @var{x} (const_int @var{power-of-2})) (const_int 0))
@end smallexample
@noindent
can be converted to
@smallexample
(ashift:SI @var{x} (const_int @var{n}))
@end smallexample
@noindent
where @var{n} is the appropriate shift count to move the bit being
tested into the sign bit.
There is no way to describe a machine that always sets the low-order bit
for a true value, but does not guarantee the value of any other bits,
but we do not know of any machine that has such an instruction. If you
are trying to port GCC to such a machine, include an instruction to
perform a logical-and of the result with 1 in the pattern for the
comparison operators and let us know at @email{gcc@@gcc.gnu.org}.
Often, a machine will have multiple instructions that obtain a value
from a comparison (or the condition codes). Here are rules to guide the
choice of value for @code{STORE_FLAG_VALUE}, and hence the instructions
to be used:
@itemize @bullet
@item
Use the shortest sequence that yields a valid definition for
@code{STORE_FLAG_VALUE}. It is more efficient for the compiler to
``normalize'' the value (convert it to, e.g., 1 or 0) than for the
comparison operators to do so because there may be opportunities to
combine the normalization with other operations.
@item
For equal-length sequences, use a value of 1 or @minus{}1, with @minus{}1 being
slightly preferred on machines with expensive jumps and 1 preferred on
other machines.
@item
As a second choice, choose a value of @samp{0x80000001} if instructions
exist that set both the sign and low-order bits but do not define the
others.
@item
Otherwise, use a value of @samp{0x80000000}.
@end itemize
Many machines can produce both the value chosen for
@code{STORE_FLAG_VALUE} and its negation in the same number of
instructions. On those machines, you should also define a pattern for
those cases, e.g., one matching
@smallexample
(set @var{A} (neg:@var{m} (ne:@var{m} @var{B} @var{C})))
@end smallexample
Some machines can also perform @code{and} or @code{plus} operations on
condition code values with less instructions than the corresponding
@samp{s@var{cond}} insn followed by @code{and} or @code{plus}. On those
machines, define the appropriate patterns. Use the names @code{incscc}
and @code{decscc}, respectively, for the patterns which perform
@code{plus} or @code{minus} operations on condition code values. See
@file{rs6000.md} for some examples. The GNU Superoptizer can be used to
find such instruction sequences on other machines.
If this macro is not defined, the default value, 1, is used. You need
not define @code{STORE_FLAG_VALUE} if the machine has no store-flag
instructions, or if the value generated by these instructions is 1.
@end defmac
@defmac FLOAT_STORE_FLAG_VALUE (@var{mode})
A C expression that gives a nonzero @code{REAL_VALUE_TYPE} value that is
returned when comparison operators with floating-point results are true.
Define this macro on machine that have comparison operations that return
floating-point values. If there are no such operations, do not define
this macro.
@end defmac
@defmac CLZ_DEFINED_VALUE_AT_ZERO (@var{mode}, @var{value})
@defmacx CTZ_DEFINED_VALUE_AT_ZERO (@var{mode}, @var{value})
A C expression that evaluates to true if the architecture defines a value
for @code{clz} or @code{ctz} with a zero operand. If so, @var{value}
should be set to this value. If this macro is not defined, the value of
@code{clz} or @code{ctz} is assumed to be undefined.
This macro must be defined if the target's expansion for @code{ffs}
relies on a particular value to get correct results. Otherwise it
is not necessary, though it may be used to optimize some corner cases.
Note that regardless of this macro the ``definedness'' of @code{clz}
and @code{ctz} at zero do @emph{not} extend to the builtin functions
visible to the user. Thus one may be free to adjust the value at will
to match the target expansion of these operations without fear of
breaking the API.
@end defmac
@defmac Pmode
An alias for the machine mode for pointers. On most machines, define
this to be the integer mode corresponding to the width of a hardware
pointer; @code{SImode} on 32-bit machine or @code{DImode} on 64-bit machines.
On some machines you must define this to be one of the partial integer
modes, such as @code{PSImode}.
The width of @code{Pmode} must be at least as large as the value of
@code{POINTER_SIZE}. If it is not equal, you must define the macro
@code{POINTERS_EXTEND_UNSIGNED} to specify how pointers are extended
to @code{Pmode}.
@end defmac
@defmac FUNCTION_MODE
An alias for the machine mode used for memory references to functions
being called, in @code{call} RTL expressions. On most machines this
should be @code{QImode}.
@end defmac
@defmac INTEGRATE_THRESHOLD (@var{decl})
A C expression for the maximum number of instructions above which the
function @var{decl} should not be inlined. @var{decl} is a
@code{FUNCTION_DECL} node.
The default definition of this macro is 64 plus 8 times the number of
arguments that the function accepts. Some people think a larger
threshold should be used on RISC machines.
@end defmac
@defmac STDC_0_IN_SYSTEM_HEADERS
In normal operation, the preprocessor expands @code{__STDC__} to the
constant 1, to signify that GCC conforms to ISO Standard C@. On some
hosts, like Solaris, the system compiler uses a different convention,
where @code{__STDC__} is normally 0, but is 1 if the user specifies
strict conformance to the C Standard.
Defining @code{STDC_0_IN_SYSTEM_HEADERS} makes GNU CPP follows the host
convention when processing system header files, but when processing user
files @code{__STDC__} will always expand to 1.
@end defmac
@defmac NO_IMPLICIT_EXTERN_C
Define this macro if the system header files support C++ as well as C@.
This macro inhibits the usual method of using system header files in
C++, which is to pretend that the file's contents are enclosed in
@samp{extern "C" @{@dots{}@}}.
@end defmac
@findex #pragma
@findex pragma
@defmac REGISTER_TARGET_PRAGMAS ()
Define this macro if you want to implement any target-specific pragmas.
If defined, it is a C expression which makes a series of calls to
@code{c_register_pragma} for each pragma. The macro may also do any
setup required for the pragmas.
The primary reason to define this macro is to provide compatibility with
other compilers for the same target. In general, we discourage
definition of target-specific pragmas for GCC@.
If the pragma can be implemented by attributes then you should consider
defining the target hook @samp{TARGET_INSERT_ATTRIBUTES} as well.
Preprocessor macros that appear on pragma lines are not expanded. All
@samp{#pragma} directives that do not match any registered pragma are
silently ignored, unless the user specifies @option{-Wunknown-pragmas}.
@end defmac
@deftypefun void c_register_pragma (const char *@var{space}, const char *@var{name}, void (*@var{callback}) (struct cpp_reader *))
Each call to @code{c_register_pragma} establishes one pragma. The
@var{callback} routine will be called when the preprocessor encounters a
pragma of the form
@smallexample
#pragma [@var{space}] @var{name} @dots{}
@end smallexample
@var{space} is the case-sensitive namespace of the pragma, or
@code{NULL} to put the pragma in the global namespace. The callback
routine receives @var{pfile} as its first argument, which can be passed
on to cpplib's functions if necessary. You can lex tokens after the
@var{name} by calling @code{c_lex}. Tokens that are not read by the
callback will be silently ignored. The end of the line is indicated by
a token of type @code{CPP_EOF}
For an example use of this routine, see @file{c4x.h} and the callback
routines defined in @file{c4x-c.c}.
Note that the use of @code{c_lex} is specific to the C and C++
compilers. It will not work in the Java or Fortran compilers, or any
other language compilers for that matter. Thus if @code{c_lex} is going
to be called from target-specific code, it must only be done so when
building the C and C++ compilers. This can be done by defining the
variables @code{c_target_objs} and @code{cxx_target_objs} in the
target entry in the @file{config.gcc} file. These variables should name
the target-specific, language-specific object file which contains the
code that uses @code{c_lex}. Note it will also be necessary to add a
rule to the makefile fragment pointed to by @code{tmake_file} that shows
how to build this object file.
@end deftypefun
@findex #pragma
@findex pragma
@defmac HANDLE_SYSV_PRAGMA
Define this macro (to a value of 1) if you want the System V style
pragmas @samp{#pragma pack(<n>)} and @samp{#pragma weak <name>
[=<value>]} to be supported by gcc.
The pack pragma specifies the maximum alignment (in bytes) of fields
within a structure, in much the same way as the @samp{__aligned__} and
@samp{__packed__} @code{__attribute__}s do. A pack value of zero resets
the behavior to the default.
A subtlety for Microsoft Visual C/C++ style bit-field packing
(e.g. -mms-bitfields) for targets that support it:
When a bit-field is inserted into a packed record, the whole size
of the underlying type is used by one or more same-size adjacent
bit-fields (that is, if its long:3, 32 bits is used in the record,
and any additional adjacent long bit-fields are packed into the same
chunk of 32 bits. However, if the size changes, a new field of that
size is allocated).
If both MS bit-fields and @samp{__attribute__((packed))} are used,
the latter will take precedence. If @samp{__attribute__((packed))} is
used on a single field when MS bit-fields are in use, it will take
precedence for that field, but the alignment of the rest of the structure
may affect its placement.
The weak pragma only works if @code{SUPPORTS_WEAK} and
@code{ASM_WEAKEN_LABEL} are defined. If enabled it allows the creation
of specifically named weak labels, optionally with a value.
@end defmac
@findex #pragma
@findex pragma
@defmac HANDLE_PRAGMA_PACK_PUSH_POP
Define this macro (to a value of 1) if you want to support the Win32
style pragmas @samp{#pragma pack(push,@var{n})} and @samp{#pragma
pack(pop)}. The @samp{pack(push,@var{n})} pragma specifies the maximum alignment
(in bytes) of fields within a structure, in much the same way as the
@samp{__aligned__} and @samp{__packed__} @code{__attribute__}s do. A
pack value of zero resets the behavior to the default. Successive
invocations of this pragma cause the previous values to be stacked, so
that invocations of @samp{#pragma pack(pop)} will return to the previous
value.
@end defmac
@defmac DOLLARS_IN_IDENTIFIERS
Define this macro to control use of the character @samp{$} in
identifier names for the C family of languages. 0 means @samp{$} is
not allowed by default; 1 means it is allowed. 1 is the default;
there is no need to define this macro in that case.
@end defmac
@defmac NO_DOLLAR_IN_LABEL
Define this macro if the assembler does not accept the character
@samp{$} in label names. By default constructors and destructors in
G++ have @samp{$} in the identifiers. If this macro is defined,
@samp{.} is used instead.
@end defmac
@defmac NO_DOT_IN_LABEL
Define this macro if the assembler does not accept the character
@samp{.} in label names. By default constructors and destructors in G++
have names that use @samp{.}. If this macro is defined, these names
are rewritten to avoid @samp{.}.
@end defmac
@defmac DEFAULT_MAIN_RETURN
Define this macro if the target system expects every program's @code{main}
function to return a standard ``success'' value by default (if no other
value is explicitly returned).
The definition should be a C statement (sans semicolon) to generate the
appropriate rtl instructions. It is used only when compiling the end of
@code{main}.
@end defmac
@defmac INSN_SETS_ARE_DELAYED (@var{insn})
Define this macro as a C expression that is nonzero if it is safe for the
delay slot scheduler to place instructions in the delay slot of @var{insn},
even if they appear to use a resource set or clobbered in @var{insn}.
@var{insn} is always a @code{jump_insn} or an @code{insn}; GCC knows that
every @code{call_insn} has this behavior. On machines where some @code{insn}
or @code{jump_insn} is really a function call and hence has this behavior,
you should define this macro.
You need not define this macro if it would always return zero.
@end defmac
@defmac INSN_REFERENCES_ARE_DELAYED (@var{insn})
Define this macro as a C expression that is nonzero if it is safe for the
delay slot scheduler to place instructions in the delay slot of @var{insn},
even if they appear to set or clobber a resource referenced in @var{insn}.
@var{insn} is always a @code{jump_insn} or an @code{insn}. On machines where
some @code{insn} or @code{jump_insn} is really a function call and its operands
are registers whose use is actually in the subroutine it calls, you should
define this macro. Doing so allows the delay slot scheduler to move
instructions which copy arguments into the argument registers into the delay
slot of @var{insn}.
You need not define this macro if it would always return zero.
@end defmac
@defmac MULTIPLE_SYMBOL_SPACES
Define this macro if in some cases global symbols from one translation
unit may not be bound to undefined symbols in another translation unit
without user intervention. For instance, under Microsoft Windows
symbols must be explicitly imported from shared libraries (DLLs).
@end defmac
@defmac MD_ASM_CLOBBERS (@var{clobbers})
A C statement that adds to @var{clobbers} @code{STRING_CST} trees for
any hard regs the port wishes to automatically clobber for all asms.
@end defmac
@defmac MATH_LIBRARY
Define this macro as a C string constant for the linker argument to link
in the system math library, or @samp{""} if the target does not have a
separate math library.
You need only define this macro if the default of @samp{"-lm"} is wrong.
@end defmac
@defmac LIBRARY_PATH_ENV
Define this macro as a C string constant for the environment variable that
specifies where the linker should look for libraries.
You need only define this macro if the default of @samp{"LIBRARY_PATH"}
is wrong.
@end defmac
@defmac TARGET_HAS_F_SETLKW
Define this macro if the target supports file locking with fcntl / F_SETLKW@.
Note that this functionality is part of POSIX@.
Defining @code{TARGET_HAS_F_SETLKW} will enable the test coverage code
to use file locking when exiting a program, which avoids race conditions
if the program has forked.
@end defmac
@defmac MAX_CONDITIONAL_EXECUTE
A C expression for the maximum number of instructions to execute via
conditional execution instructions instead of a branch. A value of
@code{BRANCH_COST}+1 is the default if the machine does not use cc0, and
1 if it does use cc0.
@end defmac
@defmac IFCVT_MODIFY_TESTS (@var{ce_info}, @var{true_expr}, @var{false_expr})
Used if the target needs to perform machine-dependent modifications on the
conditionals used for turning basic blocks into conditionally executed code.
@var{ce_info} points to a data structure, @code{struct ce_if_block}, which
contains information about the currently processed blocks. @var{true_expr}
and @var{false_expr} are the tests that are used for converting the
then-block and the else-block, respectively. Set either @var{true_expr} or
@var{false_expr} to a null pointer if the tests cannot be converted.
@end defmac
@defmac IFCVT_MODIFY_MULTIPLE_TESTS (@var{ce_info}, @var{bb}, @var{true_expr}, @var{false_expr})
Like @code{IFCVT_MODIFY_TESTS}, but used when converting more complicated
if-statements into conditions combined by @code{and} and @code{or} operations.
@var{bb} contains the basic block that contains the test that is currently
being processed and about to be turned into a condition.
@end defmac
@defmac IFCVT_MODIFY_INSN (@var{ce_info}, @var{pattern}, @var{insn})
A C expression to modify the @var{PATTERN} of an @var{INSN} that is to
be converted to conditional execution format. @var{ce_info} points to
a data structure, @code{struct ce_if_block}, which contains information
about the currently processed blocks.
@end defmac
@defmac IFCVT_MODIFY_FINAL (@var{ce_info})
A C expression to perform any final machine dependent modifications in
converting code to conditional execution. The involved basic blocks
can be found in the @code{struct ce_if_block} structure that is pointed
to by @var{ce_info}.
@end defmac
@defmac IFCVT_MODIFY_CANCEL (@var{ce_info})
A C expression to cancel any machine dependent modifications in
converting code to conditional execution. The involved basic blocks
can be found in the @code{struct ce_if_block} structure that is pointed
to by @var{ce_info}.
@end defmac
@defmac IFCVT_INIT_EXTRA_FIELDS (@var{ce_info})
A C expression to initialize any extra fields in a @code{struct ce_if_block}
structure, which are defined by the @code{IFCVT_EXTRA_FIELDS} macro.
@end defmac
@defmac IFCVT_EXTRA_FIELDS
If defined, it should expand to a set of field declarations that will be
added to the @code{struct ce_if_block} structure. These should be initialized
by the @code{IFCVT_INIT_EXTRA_FIELDS} macro.
@end defmac
@deftypefn {Target Hook} void TARGET_MACHINE_DEPENDENT_REORG ()
If non-null, this hook performs a target-specific pass over the
instruction stream. The compiler will run it at all optimization levels,
just before the point at which it normally does delayed-branch scheduling.
The exact purpose of the hook varies from target to target. Some use
it to do transformations that are necessary for correctness, such as
laying out in-function constant pools or avoiding hardware hazards.
Others use it as an opportunity to do some machine-dependent optimizations.
You need not implement the hook if it has nothing to do. The default
definition is null.
@end deftypefn
@deftypefn {Target Hook} void TARGET_INIT_BUILTINS ()
Define this hook if you have any machine-specific built-in functions
that need to be defined. It should be a function that performs the
necessary setup.
Machine specific built-in functions can be useful to expand special machine
instructions that would otherwise not normally be generated because
they have no equivalent in the source language (for example, SIMD vector
instructions or prefetch instructions).
To create a built-in function, call the function @code{builtin_function}
which is defined by the language front end. You can use any type nodes set
up by @code{build_common_tree_nodes} and @code{build_common_tree_nodes_2};
only language front ends that use those two functions will call
@samp{TARGET_INIT_BUILTINS}.
@end deftypefn
@deftypefn {Target Hook} rtx TARGET_EXPAND_BUILTIN (tree @var{exp}, rtx @var{target}, rtx @var{subtarget}, enum machine_mode @var{mode}, int @var{ignore})
Expand a call to a machine specific built-in function that was set up by
@samp{TARGET_INIT_BUILTINS}. @var{exp} is the expression for the
function call; the result should go to @var{target} if that is
convenient, and have mode @var{mode} if that is convenient.
@var{subtarget} may be used as the target for computing one of
@var{exp}'s operands. @var{ignore} is nonzero if the value is to be
ignored. This function should return the result of the call to the
built-in function.
@end deftypefn
@defmac MD_CAN_REDIRECT_BRANCH (@var{branch1}, @var{branch2})
Take a branch insn in @var{branch1} and another in @var{branch2}.
Return true if redirecting @var{branch1} to the destination of
@var{branch2} is possible.
On some targets, branches may have a limited range. Optimizing the
filling of delay slots can result in branches being redirected, and this
may in turn cause a branch offset to overflow.
@end defmac
@defmac ALLOCATE_INITIAL_VALUE (@var{hard_reg})
When the initial value of a hard register has been copied in a pseudo
register, it is often not necessary to actually allocate another register
to this pseudo register, because the original hard register or a stack slot
it has been saved into can be used. @code{ALLOCATE_INITIAL_VALUE}, if
defined, is called at the start of register allocation once for each
hard register that had its initial value copied by using
@code{get_func_hard_reg_initial_val} or @code{get_hard_reg_initial_val}.
Possible values are @code{NULL_RTX}, if you don't want
to do any special allocation, a @code{REG} rtx---that would typically be
the hard register itself, if it is known not to be clobbered---or a
@code{MEM}.
If you are returning a @code{MEM}, this is only a hint for the allocator;
it might decide to use another register anyways.
You may use @code{current_function_leaf_function} in the definition of the
macro, functions that use @code{REG_N_SETS}, to determine if the hard
register in question will not be clobbered.
@end defmac
@defmac TARGET_OBJECT_SUFFIX
Define this macro to be a C string representing the suffix for object
files on your target machine. If you do not define this macro, GCC will
use @samp{.o} as the suffix for object files.
@end defmac
@defmac TARGET_EXECUTABLE_SUFFIX
Define this macro to be a C string representing the suffix to be
automatically added to executable files on your target machine. If you
do not define this macro, GCC will use the null string as the suffix for
executable files.
@end defmac
@defmac COLLECT_EXPORT_LIST
If defined, @code{collect2} will scan the individual object files
specified on its command line and create an export list for the linker.
Define this macro for systems like AIX, where the linker discards
object files that are not referenced from @code{main} and uses export
lists.
@end defmac
@defmac MODIFY_JNI_METHOD_CALL (@var{mdecl})
Define this macro to a C expression representing a variant of the
method call @var{mdecl}, if Java Native Interface (JNI) methods
must be invoked differently from other methods on your target.
For example, on 32-bit Windows, JNI methods must be invoked using
the @code{stdcall} calling convention and this macro is then
defined as this expression:
@smallexample
build_type_attribute_variant (@var{mdecl},
build_tree_list
(get_identifier ("stdcall"),
NULL))
@end smallexample
@end defmac
@deftypefn {Target Hook} bool TARGET_CANNOT_MODIFY_JUMPS_P (void)
This target hook returns @code{true} past the point in which new jump
instructions could be created. On machines that require a register for
every jump such as the SHmedia ISA of SH5, this point would typically be
reload, so this target hook should be defined to a function such as:
@smallexample
static bool
cannot_modify_jumps_past_reload_p ()
@{
return (reload_completed || reload_in_progress);
@}
@end smallexample
@end deftypefn
@deftypefn {Target Hook} int TARGET_BRANCH_TARGET_REGISTER_CLASS (void)
This target hook returns a register class for which branch target register
optimizations should be applied. All registers in this class should be
usable interchangeably. After reload, registers in this class will be
re-allocated and loads will be hoisted out of loops and be subjected
to inter-block scheduling.
@end deftypefn
@deftypefn {Target Hook} bool TARGET_BRANCH_TARGET_REGISTER_CALLEE_SAVED (bool @var{after_prologue_epilogue_gen})
Branch target register optimization will by default exclude callee-saved
registers
that are not already live during the current function; if this target hook
returns true, they will be included. The target code must than make sure
that all target registers in the class returned by
@samp{TARGET_BRANCH_TARGET_REGISTER_CLASS} that might need saving are
saved. @var{after_prologue_epilogue_gen} indicates if prologues and
epilogues have already been generated. Note, even if you only return
true when @var{after_prologue_epilogue_gen} is false, you still are likely
to have to make special provisions in @code{INITIAL_ELIMINATION_OFFSET}
to reserve space for caller-saved target registers.
@end deftypefn
@defmac POWI_MAX_MULTS
If defined, this macro is interpreted as a signed integer C expression
that specifies the maximum number of floating point multiplications
that should be emitted when expanding exponentiation by an integer
constant inline. When this value is defined, exponentiation requiring
more than this number of multiplications is implemented by calling the
system library's @code{pow}, @code{powf} or @code{powl} routines.
The default value places no upper bound on the multiplication count.
@end defmac
|