Mercurial > hg > CbC > CbC_gcc
comparison gcc/config/frv/frv.h @ 55:77e2b8dfacca gcc-4.4.5
update it from 4.4.3 to 4.5.0
author | ryoma <e075725@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 12 Feb 2010 23:39:51 +0900 |
parents | a06113de4d67 |
children | f6334be47118 |
comparison
equal
deleted
inserted
replaced
52:c156f1bd5cd9 | 55:77e2b8dfacca |
---|---|
1 /* Target macros for the FRV port of GCC. | 1 /* Target macros for the FRV port of GCC. |
2 Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008 | 2 Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009 |
3 Free Software Foundation, Inc. | 3 Free Software Foundation, Inc. |
4 Contributed by Red Hat Inc. | 4 Contributed by Red Hat Inc. |
5 | 5 |
6 This file is part of GCC. | 6 This file is part of GCC. |
7 | 7 |
797 1, 1, 1, 1, /* 152-155, acc8 - acc11 */ \ | 797 1, 1, 1, 1, /* 152-155, acc8 - acc11 */ \ |
798 1, 1, 1, 1, 1, 1, 1, 1, /* 156-163, accg0 - accg7 */ \ | 798 1, 1, 1, 1, 1, 1, 1, 1, /* 156-163, accg0 - accg7 */ \ |
799 1, 1, 1, 1, /* 164-167, accg8 - accg11 */ \ | 799 1, 1, 1, 1, /* 164-167, accg8 - accg11 */ \ |
800 /* Other registers */ \ | 800 /* Other registers */ \ |
801 1, /* 168, AP - fake arg ptr */ \ | 801 1, /* 168, AP - fake arg ptr */ \ |
802 0, /* 169, LR - Link register*/ \ | 802 1, /* 169, LR - Link register*/ \ |
803 0, /* 170, LCR - Loop count reg*/ \ | 803 0, /* 170, LCR - Loop count reg*/ \ |
804 1, 1 /* 171-172, iacc0 */ \ | 804 1, 1 /* 171-172, iacc0 */ \ |
805 } | 805 } |
806 | 806 |
807 /* Like `FIXED_REGISTERS' but has 1 for each register that is clobbered (in | 807 /* Like `FIXED_REGISTERS' but has 1 for each register that is clobbered (in |
1562 #define STATIC_CHAIN_INCOMING_REGNUM (GPR_FIRST + 7) | 1562 #define STATIC_CHAIN_INCOMING_REGNUM (GPR_FIRST + 7) |
1563 | 1563 |
1564 | 1564 |
1565 /* Eliminating the Frame Pointer and the Arg Pointer. */ | 1565 /* Eliminating the Frame Pointer and the Arg Pointer. */ |
1566 | 1566 |
1567 /* A C expression which is nonzero if a function must have and use a frame | |
1568 pointer. This expression is evaluated in the reload pass. If its value is | |
1569 nonzero the function will have a frame pointer. | |
1570 | |
1571 The expression can in principle examine the current function and decide | |
1572 according to the facts, but on most machines the constant 0 or the constant | |
1573 1 suffices. Use 0 when the machine allows code to be generated with no | |
1574 frame pointer, and doing so saves some time or space. Use 1 when there is | |
1575 no possible advantage to avoiding a frame pointer. | |
1576 | |
1577 In certain cases, the compiler does not know how to produce valid code | |
1578 without a frame pointer. The compiler recognizes those cases and | |
1579 automatically gives the function a frame pointer regardless of what | |
1580 `FRAME_POINTER_REQUIRED' says. You don't need to worry about them. | |
1581 | |
1582 In a function that does not require a frame pointer, the frame pointer | |
1583 register can be allocated for ordinary usage, unless you mark it as a fixed | |
1584 register. See `FIXED_REGISTERS' for more information. */ | |
1585 #define FRAME_POINTER_REQUIRED frv_frame_pointer_required () | |
1586 | |
1587 /* If defined, this macro specifies a table of register pairs used to eliminate | 1567 /* If defined, this macro specifies a table of register pairs used to eliminate |
1588 unneeded registers that point into the stack frame. If it is not defined, | 1568 unneeded registers that point into the stack frame. If it is not defined, |
1589 the only elimination attempted by the compiler is to replace references to | 1569 the only elimination attempted by the compiler is to replace references to |
1590 the frame pointer with references to the stack pointer. | 1570 the frame pointer with references to the stack pointer. |
1591 | 1571 |
1611 { \ | 1591 { \ |
1612 {ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ | 1592 {ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ |
1613 {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \ | 1593 {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \ |
1614 {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM} \ | 1594 {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM} \ |
1615 } | 1595 } |
1616 | |
1617 /* A C expression that returns nonzero if the compiler is allowed to try to | |
1618 replace register number FROM with register number TO. This macro need only | |
1619 be defined if `ELIMINABLE_REGS' is defined, and will usually be the constant | |
1620 1, since most of the cases preventing register elimination are things that | |
1621 the compiler already knows about. */ | |
1622 | |
1623 #define CAN_ELIMINATE(FROM, TO) \ | |
1624 ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM \ | |
1625 ? ! frame_pointer_needed \ | |
1626 : 1) | |
1627 | 1596 |
1628 /* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'. It specifies the | 1597 /* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'. It specifies the |
1629 initial difference between the specified pair of registers. This macro must | 1598 initial difference between the specified pair of registers. This macro must |
1630 be defined if `ELIMINABLE_REGS' is defined. */ | 1599 be defined if `ELIMINABLE_REGS' is defined. */ |
1631 | 1600 |
1775 | 1744 |
1776 /* The number of the hard register that is used to return a scalar value from a | 1745 /* The number of the hard register that is used to return a scalar value from a |
1777 function call. */ | 1746 function call. */ |
1778 #define RETURN_VALUE_REGNUM (GPR_FIRST + 8) | 1747 #define RETURN_VALUE_REGNUM (GPR_FIRST + 8) |
1779 | 1748 |
1780 /* A C expression to create an RTX representing the place where a function | 1749 #define FUNCTION_VALUE_REGNO_P(REGNO) frv_function_value_regno_p (REGNO) |
1781 returns a value of data type VALTYPE. VALTYPE is a tree node representing a | |
1782 data type. Write `TYPE_MODE (VALTYPE)' to get the machine mode used to | |
1783 represent that type. On many machines, only the mode is relevant. | |
1784 (Actually, on most machines, scalar values are returned in the same place | |
1785 regardless of mode). | |
1786 | |
1787 If `TARGET_PROMOTE_FUNCTION_RETURN' is defined to return true, you | |
1788 must apply the same promotion rules specified in `PROMOTE_MODE' if | |
1789 VALTYPE is a scalar type. | |
1790 | |
1791 If the precise function being called is known, FUNC is a tree node | |
1792 (`FUNCTION_DECL') for it; otherwise, FUNC is a null pointer. This makes it | |
1793 possible to use a different value-returning convention for specific | |
1794 functions when all their calls are known. | |
1795 | |
1796 `FUNCTION_VALUE' is not used for return vales with aggregate data types, | |
1797 because these are returned in another way. See | |
1798 `TARGET_STRUCT_VALUE_RTX' and related macros, below. */ | |
1799 #define FUNCTION_VALUE(VALTYPE, FUNC) \ | |
1800 gen_rtx_REG (TYPE_MODE (VALTYPE), RETURN_VALUE_REGNUM) | |
1801 | |
1802 /* A C expression to create an RTX representing the place where a library | |
1803 function returns a value of mode MODE. | |
1804 | |
1805 Note that "library function" in this context means a compiler support | |
1806 routine, used to perform arithmetic, whose name is known specially by the | |
1807 compiler and was not mentioned in the C code being compiled. | |
1808 | |
1809 The definition of `LIBRARY_VALUE' need not be concerned aggregate data | |
1810 types, because none of the library functions returns such types. */ | |
1811 #define LIBCALL_VALUE(MODE) gen_rtx_REG (MODE, RETURN_VALUE_REGNUM) | |
1812 | |
1813 /* A C expression that is nonzero if REGNO is the number of a hard register in | |
1814 which the values of called function may come back. | |
1815 | |
1816 A register whose use for returning values is limited to serving as the | |
1817 second of a pair (for a value of type `double', say) need not be recognized | |
1818 by this macro. So for most machines, this definition suffices: | |
1819 | |
1820 #define FUNCTION_VALUE_REGNO_P(N) ((N) == RETURN) | |
1821 | |
1822 If the machine has register windows, so that the caller and the called | |
1823 function use different registers for the return value, this macro should | |
1824 recognize only the caller's register numbers. */ | |
1825 #define FUNCTION_VALUE_REGNO_P(REGNO) ((REGNO) == RETURN_VALUE_REGNUM) | |
1826 | 1750 |
1827 | 1751 |
1828 /* How Large Values are Returned. */ | 1752 /* How Large Values are Returned. */ |
1829 | 1753 |
1830 /* The number of the register that is used to pass the structure | 1754 /* The number of the register that is used to pass the structure |
1872 /* Alignment required for trampolines, in bits. | 1796 /* Alignment required for trampolines, in bits. |
1873 | 1797 |
1874 If you don't define this macro, the value of `BIGGEST_ALIGNMENT' is used for | 1798 If you don't define this macro, the value of `BIGGEST_ALIGNMENT' is used for |
1875 aligning trampolines. */ | 1799 aligning trampolines. */ |
1876 #define TRAMPOLINE_ALIGNMENT (TARGET_FDPIC ? 64 : 32) | 1800 #define TRAMPOLINE_ALIGNMENT (TARGET_FDPIC ? 64 : 32) |
1877 | |
1878 /* A C statement to initialize the variable parts of a trampoline. ADDR is an | |
1879 RTX for the address of the trampoline; FNADDR is an RTX for the address of | |
1880 the nested function; STATIC_CHAIN is an RTX for the static chain value that | |
1881 should be passed to the function when it is called. */ | |
1882 #define INITIALIZE_TRAMPOLINE(ADDR, FNADDR, STATIC_CHAIN) \ | |
1883 frv_initialize_trampoline (ADDR, FNADDR, STATIC_CHAIN) | |
1884 | 1801 |
1885 /* Define this macro if trampolines need a special subroutine to do their work. | 1802 /* Define this macro if trampolines need a special subroutine to do their work. |
1886 The macro should expand to a series of `asm' statements which will be | 1803 The macro should expand to a series of `asm' statements which will be |
1887 compiled with GCC. They go in a library function named | 1804 compiled with GCC. They go in a library function named |
1888 `__transfer_from_trampoline'. | 1805 `__transfer_from_trampoline'. |
2008 #endif | 1925 #endif |
2009 | 1926 |
2010 | 1927 |
2011 /* Addressing Modes. */ | 1928 /* Addressing Modes. */ |
2012 | 1929 |
2013 /* A C expression that is 1 if the RTX X is a constant which is a valid | |
2014 address. On most machines, this can be defined as `CONSTANT_P (X)', but a | |
2015 few machines are more restrictive in which constant addresses are supported. | |
2016 | |
2017 `CONSTANT_P' accepts integer-values expressions whose values are not | |
2018 explicitly known, such as `symbol_ref', `label_ref', and `high' expressions | |
2019 and `const' arithmetic expressions, in addition to `const_int' and | |
2020 `const_double' expressions. */ | |
2021 #define CONSTANT_ADDRESS_P(X) CONSTANT_P (X) | |
2022 | |
2023 /* A number, the maximum number of registers that can appear in a valid memory | 1930 /* A number, the maximum number of registers that can appear in a valid memory |
2024 address. Note that it is up to you to specify a value equal to the maximum | 1931 address. Note that it is up to you to specify a value equal to the maximum |
2025 number that `GO_IF_LEGITIMATE_ADDRESS' would ever accept. */ | 1932 number that `TARGET_LEGITIMATE_ADDRESS_P' would ever accept. */ |
2026 #define MAX_REGS_PER_ADDRESS 2 | 1933 #define MAX_REGS_PER_ADDRESS 2 |
2027 | |
2028 /* A C compound statement with a conditional `goto LABEL;' executed if X (an | |
2029 RTX) is a legitimate memory address on the target machine for a memory | |
2030 operand of mode MODE. | |
2031 | |
2032 It usually pays to define several simpler macros to serve as subroutines for | |
2033 this one. Otherwise it may be too complicated to understand. | |
2034 | |
2035 This macro must exist in two variants: a strict variant and a non-strict | |
2036 one. The strict variant is used in the reload pass. It must be defined so | |
2037 that any pseudo-register that has not been allocated a hard register is | |
2038 considered a memory reference. In contexts where some kind of register is | |
2039 required, a pseudo-register with no hard register must be rejected. | |
2040 | |
2041 The non-strict variant is used in other passes. It must be defined to | |
2042 accept all pseudo-registers in every context where some kind of register is | |
2043 required. | |
2044 | |
2045 Compiler source files that want to use the strict variant of this macro | |
2046 define the macro `REG_OK_STRICT'. You should use an `#ifdef REG_OK_STRICT' | |
2047 conditional to define the strict variant in that case and the non-strict | |
2048 variant otherwise. | |
2049 | |
2050 Subroutines to check for acceptable registers for various purposes (one for | |
2051 base registers, one for index registers, and so on) are typically among the | |
2052 subroutines used to define `GO_IF_LEGITIMATE_ADDRESS'. Then only these | |
2053 subroutine macros need have two variants; the higher levels of macros may be | |
2054 the same whether strict or not. | |
2055 | |
2056 Normally, constant addresses which are the sum of a `symbol_ref' and an | |
2057 integer are stored inside a `const' RTX to mark them as constant. | |
2058 Therefore, there is no need to recognize such sums specifically as | |
2059 legitimate addresses. Normally you would simply recognize any `const' as | |
2060 legitimate. | |
2061 | |
2062 Usually `PRINT_OPERAND_ADDRESS' is not prepared to handle constant sums that | |
2063 are not marked with `const'. It assumes that a naked `plus' indicates | |
2064 indexing. If so, then you *must* reject such naked constant sums as | |
2065 illegitimate addresses, so that none of them will be given to | |
2066 `PRINT_OPERAND_ADDRESS'. | |
2067 | |
2068 On some machines, whether a symbolic address is legitimate depends on the | |
2069 section that the address refers to. On these machines, define the macro | |
2070 `ENCODE_SECTION_INFO' to store the information into the `symbol_ref', and | |
2071 then check for it here. When you see a `const', you will have to look | |
2072 inside it to find the `symbol_ref' in order to determine the section. | |
2073 | |
2074 The best way to modify the name string is by adding text to the beginning, | |
2075 with suitable punctuation to prevent any ambiguity. Allocate the new name | |
2076 in `saveable_obstack'. You will have to modify `ASM_OUTPUT_LABELREF' to | |
2077 remove and decode the added text and output the name accordingly, and define | |
2078 `(* targetm.strip_name_encoding)' to access the original name string. | |
2079 | |
2080 You can check the information stored here into the `symbol_ref' in the | |
2081 definitions of the macros `GO_IF_LEGITIMATE_ADDRESS' and | |
2082 `PRINT_OPERAND_ADDRESS'. */ | |
2083 | |
2084 #ifdef REG_OK_STRICT | |
2085 #define REG_OK_STRICT_P 1 | |
2086 #else | |
2087 #define REG_OK_STRICT_P 0 | |
2088 #endif | |
2089 | |
2090 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \ | |
2091 do \ | |
2092 { \ | |
2093 if (frv_legitimate_address_p (MODE, X, REG_OK_STRICT_P, \ | |
2094 FALSE, FALSE)) \ | |
2095 goto LABEL; \ | |
2096 } \ | |
2097 while (0) | |
2098 | 1934 |
2099 /* A C expression that is nonzero if X (assumed to be a `reg' RTX) is valid for | 1935 /* A C expression that is nonzero if X (assumed to be a `reg' RTX) is valid for |
2100 use as a base register. For hard registers, it should always accept those | 1936 use as a base register. For hard registers, it should always accept those |
2101 which the hardware permits and reject the others. Whether the macro accepts | 1937 which the hardware permits and reject the others. Whether the macro accepts |
2102 or rejects pseudo registers must be controlled by `REG_OK_STRICT' as | 1938 or rejects pseudo registers must be controlled by `REG_OK_STRICT' as |
2118 the machine's constraints of which registers may serve in each capacity. | 1954 the machine's constraints of which registers may serve in each capacity. |
2119 The compiler will try both labelings, looking for one that is valid, and | 1955 The compiler will try both labelings, looking for one that is valid, and |
2120 will reload one or both registers only if neither labeling works. */ | 1956 will reload one or both registers only if neither labeling works. */ |
2121 #define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_BASE_P (X) | 1957 #define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_BASE_P (X) |
2122 | 1958 |
2123 #define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \ | |
2124 do { \ | |
2125 rtx new_x = frv_legitimize_address (X, OLDX, MODE); \ | |
2126 if (new_x) \ | |
2127 { \ | |
2128 (X) = new_x; \ | |
2129 goto WIN; \ | |
2130 } \ | |
2131 } while (0) | |
2132 | |
2133 #define FIND_BASE_TERM frv_find_base_term | 1959 #define FIND_BASE_TERM frv_find_base_term |
2134 | |
2135 /* A C statement or compound statement with a conditional `goto LABEL;' | |
2136 executed if memory address X (an RTX) can have different meanings depending | |
2137 on the machine mode of the memory reference it is used for or if the address | |
2138 is valid for some modes but not others. | |
2139 | |
2140 Autoincrement and autodecrement addresses typically have mode-dependent | |
2141 effects because the amount of the increment or decrement is the size of the | |
2142 operand being addressed. Some machines have other mode-dependent addresses. | |
2143 Many RISC machines have no mode-dependent addresses. | |
2144 | |
2145 You may assume that ADDR is a valid address for the machine. */ | |
2146 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL) | |
2147 | 1960 |
2148 /* A C expression that is nonzero if X is a legitimate constant for an | 1961 /* A C expression that is nonzero if X is a legitimate constant for an |
2149 immediate operand on the target machine. You can assume that X satisfies | 1962 immediate operand on the target machine. You can assume that X satisfies |
2150 `CONSTANT_P', so you need not check this. In fact, `1' is a suitable | 1963 `CONSTANT_P', so you need not check this. In fact, `1' is a suitable |
2151 definition for this macro on machines where anything `CONSTANT_P' is valid. */ | 1964 definition for this macro on machines where anything `CONSTANT_P' is valid. */ |
2934 #define FRV_BUILTIN_FIRST_NONMEDIA FRV_BUILTIN_SMUL | 2747 #define FRV_BUILTIN_FIRST_NONMEDIA FRV_BUILTIN_SMUL |
2935 | 2748 |
2936 /* Enable prototypes on the call rtl functions. */ | 2749 /* Enable prototypes on the call rtl functions. */ |
2937 #define MD_CALL_PROTOTYPES 1 | 2750 #define MD_CALL_PROTOTYPES 1 |
2938 | 2751 |
2939 extern GTY(()) rtx frv_compare_op0; /* operand save for */ | |
2940 extern GTY(()) rtx frv_compare_op1; /* comparison generation */ | |
2941 | |
2942 #define CPU_UNITS_QUERY 1 | 2752 #define CPU_UNITS_QUERY 1 |
2943 | 2753 |
2944 #ifdef __FRV_FDPIC__ | 2754 #ifdef __FRV_FDPIC__ |
2945 #define CRT_GET_RFIB_DATA(dbase) \ | 2755 #define CRT_GET_RFIB_DATA(dbase) \ |
2946 ({ extern void *_GLOBAL_OFFSET_TABLE_; (dbase) = &_GLOBAL_OFFSET_TABLE_; }) | 2756 ({ extern void *_GLOBAL_OFFSET_TABLE_; (dbase) = &_GLOBAL_OFFSET_TABLE_; }) |