1 /* Definitions for option handling for Renesas M32R cpu. 2 Copyright (C) 1996-2019 Free Software Foundation, Inc. 3 4 This file is part of GCC. 5 6 GCC is free software; you can redistribute it and/or modify it 7 under the terms of the GNU General Public License as published 8 by the Free Software Foundation; either version 3, or (at your 9 option) any later version. 10 11 GCC is distributed in the hope that it will be useful, but WITHOUT 12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 14 License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with GCC; see the file COPYING3. If not see 18 <http://www.gnu.org/licenses/>. */ 19 20 #ifndef M32R_OPTS_H 21 #define M32R_OPTS_H 22 23 /* Code Models 24 25 Code models are used to select between two choices of two separate 26 possibilities (address space size, call insn to use): 27 28 small: addresses use 24 bits, use bl to make calls 29 medium: addresses use 32 bits, use bl to make calls (*1) 30 large: addresses use 32 bits, use seth/add3/jl to make calls (*2) 31 32 The fourth is "addresses use 24 bits, use seth/add3/jl to make calls" but 33 using this one doesn't make much sense. 34 35 (*1) The linker may eventually be able to relax seth/add3 -> ld24. 36 (*2) The linker may eventually be able to relax seth/add3/jl -> bl. 37 38 Internally these are recorded as TARGET_ADDR{24,32} and 39 TARGET_CALL{26,32}. 40 41 The __model__ attribute can be used to select the code model to use when 42 accessing particular objects. */ 43 44 enum m32r_model { M32R_MODEL_SMALL, M32R_MODEL_MEDIUM, M32R_MODEL_LARGE }; 45 46 #define TARGET_MODEL_SMALL (m32r_model_selected == M32R_MODEL_SMALL) 47 #define TARGET_MODEL_MEDIUM (m32r_model_selected == M32R_MODEL_MEDIUM) 48 #define TARGET_MODEL_LARGE (m32r_model_selected == M32R_MODEL_LARGE) 49 #define TARGET_ADDR24 (m32r_model_selected == M32R_MODEL_SMALL) 50 #define TARGET_ADDR32 (! TARGET_ADDR24) 51 #define TARGET_CALL26 (! TARGET_CALL32) 52 #define TARGET_CALL32 (m32r_model_selected == M32R_MODEL_LARGE) 53 54 /* The default is the small model. */ 55 #ifndef M32R_MODEL_DEFAULT 56 #define M32R_MODEL_DEFAULT M32R_MODEL_SMALL 57 #endif 58 59 /* Small Data Area 60 61 The SDA consists of sections .sdata, .sbss, and .scommon. 62 .scommon isn't a real section, symbols in it have their section index 63 set to SHN_M32R_SCOMMON, though support for it exists in the linker script. 64 65 Two switches control the SDA: 66 67 -G NNN - specifies the maximum size of variable to go in the SDA 68 69 -msdata=foo - specifies how such variables are handled 70 71 -msdata=none - small data area is disabled 72 73 -msdata=sdata - small data goes in the SDA, special code isn't 74 generated to use it, and special relocs aren't 75 generated 76 77 -msdata=use - small data goes in the SDA, special code is generated 78 to use the SDA and special relocs are generated 79 80 The SDA is not multilib'd, it isn't necessary. 81 MULTILIB_EXTRA_OPTS is set in tmake_file to -msdata=sdata so multilib'd 82 libraries have small data in .sdata/SHN_M32R_SCOMMON so programs that use 83 -msdata=use will successfully link with them (references in header files 84 will cause the compiler to emit code that refers to library objects in 85 .data). ??? There can be a problem if the user passes a -G value greater 86 than the default and a library object in a header file is that size. 87 The default is 8 so this should be rare - if it occurs the user 88 is required to rebuild the libraries or use a smaller value for -G. */ 89 90 /* Maximum size of variables that go in .sdata/.sbss. 91 The -msdata=foo switch also controls how small variables are handled. */ 92 #ifndef SDATA_DEFAULT_SIZE 93 #define SDATA_DEFAULT_SIZE 8 94 #endif 95 96 enum m32r_sdata { M32R_SDATA_NONE, M32R_SDATA_SDATA, M32R_SDATA_USE }; 97 98 #define TARGET_SDATA_NONE (m32r_sdata_selected == M32R_SDATA_NONE) 99 #define TARGET_SDATA_SDATA (m32r_sdata_selected == M32R_SDATA_SDATA) 100 #define TARGET_SDATA_USE (m32r_sdata_selected == M32R_SDATA_USE) 101 102 /* Default is to disable the SDA 103 [for upward compatibility with previous toolchains]. */ 104 #ifndef M32R_SDATA_DEFAULT 105 #define M32R_SDATA_DEFAULT M32R_SDATA_NONE 106 #endif 107 108 #endif 109