comparison gcc/lto/lto-lang.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 /* Language-dependent hooks for LTO. 1 /* Language-dependent hooks for LTO.
2 Copyright (C) 2009-2018 Free Software Foundation, Inc. 2 Copyright (C) 2009-2020 Free Software Foundation, Inc.
3 Contributed by CodeSourcery, Inc. 3 Contributed by CodeSourcery, Inc.
4 4
5 This file is part of GCC. 5 This file is part of GCC.
6 6
7 GCC is free software; you can redistribute it and/or modify it under 7 GCC is free software; you can redistribute it and/or modify it under
32 #include "langhooks.h" 32 #include "langhooks.h"
33 #include "langhooks-def.h" 33 #include "langhooks-def.h"
34 #include "debug.h" 34 #include "debug.h"
35 #include "lto-tree.h" 35 #include "lto-tree.h"
36 #include "lto.h" 36 #include "lto.h"
37 #include "lto-common.h"
37 #include "stringpool.h" 38 #include "stringpool.h"
38 #include "attribs.h" 39 #include "attribs.h"
39 40
40 /* LTO specific dumps. */ 41 /* LTO specific dumps. */
41 int lto_link_dump_id, decl_merge_dump_id, partition_dump_id; 42 int lto_link_dump_id, decl_merge_dump_id, partition_dump_id;
244 245
245 /* Flags needed to process builtins.def. */ 246 /* Flags needed to process builtins.def. */
246 int flag_isoc94; 247 int flag_isoc94;
247 int flag_isoc99; 248 int flag_isoc99;
248 int flag_isoc11; 249 int flag_isoc11;
250 int flag_isoc2x;
249 251
250 /* Attribute handlers. */ 252 /* Attribute handlers. */
251 253
252 /* Handle a "noreturn" attribute; arguments as in 254 /* Handle a "noreturn" attribute; arguments as in
253 struct attribute_spec.handler. */ 255 struct attribute_spec.handler. */
301 static tree 303 static tree
302 handle_const_attribute (tree *node, tree ARG_UNUSED (name), 304 handle_const_attribute (tree *node, tree ARG_UNUSED (name),
303 tree ARG_UNUSED (args), int ARG_UNUSED (flags), 305 tree ARG_UNUSED (args), int ARG_UNUSED (flags),
304 bool * ARG_UNUSED (no_add_attrs)) 306 bool * ARG_UNUSED (no_add_attrs))
305 { 307 {
306 if (!fndecl_built_in_p (*node)) 308 if (TREE_CODE (*node) != FUNCTION_DECL
309 || !fndecl_built_in_p (*node))
307 inform (UNKNOWN_LOCATION, "%s:%s: %E: %E", __FILE__, __func__, *node, name); 310 inform (UNKNOWN_LOCATION, "%s:%s: %E: %E", __FILE__, __func__, *node, name);
308 311
309 tree type = TREE_TYPE (*node); 312 tree type = TREE_TYPE (*node);
310 313
311 /* See FIXME comment on noreturn in c_common_attribute_table. */ 314 /* See FIXME comment on noreturn in c_common_attribute_table. */
786 789
787 static GTY(()) tree registered_builtin_types; 790 static GTY(()) tree registered_builtin_types;
788 791
789 /* Language hooks. */ 792 /* Language hooks. */
790 793
791 static unsigned int
792 lto_option_lang_mask (void)
793 {
794 return CL_LTO;
795 }
796
797 static bool 794 static bool
798 lto_complain_wrong_lang_p (const struct cl_option *option ATTRIBUTE_UNUSED) 795 lto_complain_wrong_lang_p (const struct cl_option *option ATTRIBUTE_UNUSED)
799 { 796 {
800 /* The LTO front end inherits all the options from the first front 797 /* The LTO front end inherits all the options from the first front
801 end that was used. However, not all the original front end 798 end that was used. However, not all the original front end
862 static bool 859 static bool
863 lto_post_options (const char **pfilename ATTRIBUTE_UNUSED) 860 lto_post_options (const char **pfilename ATTRIBUTE_UNUSED)
864 { 861 {
865 /* -fltrans and -fwpa are mutually exclusive. Check for that here. */ 862 /* -fltrans and -fwpa are mutually exclusive. Check for that here. */
866 if (flag_wpa && flag_ltrans) 863 if (flag_wpa && flag_ltrans)
867 error ("-fwpa and -fltrans are mutually exclusive"); 864 error ("%<-fwpa%> and %<-fltrans%> are mutually exclusive");
868 865
869 if (flag_ltrans) 866 if (flag_ltrans)
870 { 867 {
871 flag_generate_lto = 0; 868 flag_generate_lto = 0;
872 869
896 way through the asm file. */ 893 way through the asm file. */
897 lang_hooks.lto.begin_section = lhd_begin_section; 894 lang_hooks.lto.begin_section = lhd_begin_section;
898 lang_hooks.lto.append_data = lhd_append_data; 895 lang_hooks.lto.append_data = lhd_append_data;
899 lang_hooks.lto.end_section = lhd_end_section; 896 lang_hooks.lto.end_section = lhd_end_section;
900 if (flag_ltrans) 897 if (flag_ltrans)
901 error ("-flinker-output=rel and -fltrans are mutually exclussive"); 898 error ("%<-flinker-output=rel%> and %<-fltrans%> are mutually "
899 "exclussive");
902 break; 900 break;
903 901
904 case LTO_LINKER_OUTPUT_NOLTOREL: /* .o: incremental link producing asm */ 902 case LTO_LINKER_OUTPUT_NOLTOREL: /* .o: incremental link producing asm */
905 flag_whole_program = 0; 903 flag_whole_program = 0;
906 flag_incremental_link = INCREMENTAL_LINK_NOLTO; 904 flag_incremental_link = INCREMENTAL_LINK_NOLTO;
929 break; 927 break;
930 } 928 }
931 929
932 /* Excess precision other than "fast" requires front-end 930 /* Excess precision other than "fast" requires front-end
933 support. */ 931 support. */
934 flag_excess_precision_cmdline = EXCESS_PRECISION_FAST; 932 if (flag_excess_precision == EXCESS_PRECISION_DEFAULT)
933 flag_excess_precision = EXCESS_PRECISION_FAST;
935 934
936 /* When partitioning, we can tear appart STRING_CSTs uses from the same 935 /* When partitioning, we can tear appart STRING_CSTs uses from the same
937 TU into multiple partitions. Without constant merging the constants 936 TU into multiple partitions. Without constant merging the constants
938 might not be equal at runtime. See PR50199. */ 937 might not be equal at runtime. See PR50199. */
939 if (!flag_merge_constants) 938 if (!flag_merge_constants)
1050 tree inner_type = lto_type_for_mode (inner_mode, unsigned_p); 1049 tree inner_type = lto_type_for_mode (inner_mode, unsigned_p);
1051 if (inner_type != NULL_TREE) 1050 if (inner_type != NULL_TREE)
1052 return build_vector_type_for_mode (inner_type, mode); 1051 return build_vector_type_for_mode (inner_type, mode);
1053 } 1052 }
1054 1053
1055 if (mode == TYPE_MODE (dfloat32_type_node)) 1054 if (dfloat32_type_node != NULL_TREE
1055 && mode == TYPE_MODE (dfloat32_type_node))
1056 return dfloat32_type_node; 1056 return dfloat32_type_node;
1057 if (mode == TYPE_MODE (dfloat64_type_node)) 1057 if (dfloat64_type_node != NULL_TREE
1058 && mode == TYPE_MODE (dfloat64_type_node))
1058 return dfloat64_type_node; 1059 return dfloat64_type_node;
1059 if (mode == TYPE_MODE (dfloat128_type_node)) 1060 if (dfloat128_type_node != NULL_TREE
1061 && mode == TYPE_MODE (dfloat128_type_node))
1060 return dfloat128_type_node; 1062 return dfloat128_type_node;
1061 1063
1062 if (ALL_SCALAR_FIXED_POINT_MODE_P (mode)) 1064 if (ALL_SCALAR_FIXED_POINT_MODE_P (mode))
1063 { 1065 {
1064 if (mode == TYPE_MODE (short_fract_type_node)) 1066 if (mode == TYPE_MODE (short_fract_type_node))
1261 1263
1262 signed_size_type_node = NULL_TREE; 1264 signed_size_type_node = NULL_TREE;
1263 for (i = 0; i < NUM_INT_N_ENTS; i++) 1265 for (i = 0; i < NUM_INT_N_ENTS; i++)
1264 if (int_n_enabled_p[i]) 1266 if (int_n_enabled_p[i])
1265 { 1267 {
1266 char name[50]; 1268 char name[50], altname[50];
1267 sprintf (name, "__int%d unsigned", int_n_data[i].bitsize); 1269 sprintf (name, "__int%d unsigned", int_n_data[i].bitsize);
1268 1270 sprintf (altname, "__int%d__ unsigned", int_n_data[i].bitsize);
1269 if (strcmp (name, SIZE_TYPE) == 0) 1271
1272 if (strcmp (name, SIZE_TYPE) == 0
1273 || strcmp (altname, SIZE_TYPE) == 0)
1270 { 1274 {
1271 intmax_type_node = int_n_trees[i].signed_type; 1275 intmax_type_node = int_n_trees[i].signed_type;
1272 uintmax_type_node = int_n_trees[i].unsigned_type; 1276 uintmax_type_node = int_n_trees[i].unsigned_type;
1273 signed_size_type_node = int_n_trees[i].signed_type; 1277 signed_size_type_node = int_n_trees[i].signed_type;
1274 } 1278 }