gcc/gcc/lto-section-names.h

42 lines
1.6 KiB
C
Raw Normal View History

/* Definitions for LTO section names.
Copyright (C) 2013-2016 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#ifndef GCC_LTO_SECTION_NAMES_H
#define GCC_LTO_SECTION_NAMES_H
/* The string that is the prefix on the section names we make for lto.
For decls the DECL_ASSEMBLER_NAME is appended to make the section
name for the functions and static_initializers. For other types of
sections a '.' and the section type are appended. */
#define LTO_SECTION_NAME_PREFIX ".gnu.lto_"
[PATCH 2/7] OpenMP 4.0 offloading infrastructure: LTO streaming. gcc/ * cgraph.c: Include context.h. (cgraph_node::create): Set node->offloadable and g->have_offload if decl have "omp declare target" attribute. * cgraph.h (symtab_node): Add need_lto_streaming and offloadable flags. * cgraphunit.c: Include lto-section-names.h. (ipa_passes): Call ipa_write_summaries if there is something to write to OFFLOAD_SECTION_NAME_PREFIX sections. (symbol_table::compile): Set flag_generate_lto if there is something to offload. Replace flag_lto with flag_generate_lto before lto_streamer_hooks_init. * context.c (gcc::context::context): Initialize have_offload with false. * context.h (class context): Add have_offload flag. * ipa-inline-analysis.c (inline_generate_summary): Do not exit under flag_generate_lto. (inline_free_summary): Always remove hooks. * lto-cgraph.c (referenced_from_other_partition_p): Ignore references from non-offloadable nodes while streaming a node into offload section. (reachable_from_other_partition_p): Likewise. (select_what_to_stream): New function. (compute_ltrans_boundary): Do not call lto_set_symtab_encoder_in_partition if the node should not be streamed. * lto-section-names.h (OFFLOAD_SECTION_NAME_PREFIX): Define. (section_name_prefix): Declare. * lto-streamer.c (section_name_prefix): New variable. (lto_get_section_name): Use section_name_prefix instead of LTO_SECTION_NAME_PREFIX. * lto-streamer.h (select_what_to_stream): Declare. * omp-low.c: Include context.h. (is_targetreg_ctx): New function. (scan_sharing_clauses): Use offloadable flag, instead of an attribute. (create_omp_child_function, check_omp_nesting_restrictions): Use new is_targetreg_ctx function. Replace usage of "omp declare target" attribute with a cgraph_node flag offloadable. (expand_omp_target): Set mark_force_output for offloadable functions. (lower_omp_critical): Set offloadable flag for omp critical symbol. * passes.c (ipa_write_summaries): New argument offload_lto_mode. Call select_what_to_stream. Do not call lto_set_symtab_encoder_in_partition if the node should not be streamed out. * tree-pass.h (ipa_write_summaries): New bool argument. * varpool.c: Include context.h. (varpool_node::get_create): Set node->offloadable and g->have_offload if decl have "omp declare target" attribute. gcc/lto/ * lto-object.c (lto_obj_add_section): Use section_name_prefix instead of LTO_SECTION_NAME_PREFIX. * lto-partition.c (lto_promote_cross_file_statics): Call select_what_to_stream. * lto.c (lto_section_with_id): Use section_name_prefix instead of LTO_SECTION_NAME_PREFIX. (read_cgraph_and_symbols): Read OFFLOAD_SECTION_NAME_PREFIX sections, if being built as an offload compiler. Co-Authored-By: Andrey Turetskiy <andrey.turetskiy@intel.com> Co-Authored-By: Bernd Schmidt <bernds@codesourcery.com> Co-Authored-By: Michael Zolotukhin <michael.v.zolotukhin@intel.com> From-SVN: r217486
2014-11-13 14:37:38 +01:00
#define OFFLOAD_SECTION_NAME_PREFIX ".gnu.offload_lto_"
/* Can be either OFFLOAD_SECTION_NAME_PREFIX when we stream IR for offload
compiler, or LTO_SECTION_NAME_PREFIX for LTO case. */
extern const char *section_name_prefix;
/* Segment name for LTO sections. This is only used for Mach-O. */
#define LTO_SEGMENT_NAME "__GNU_LTO"
[PATCH 3/7] OpenMP 4.0 offloading infrastructure: Offload tables. gcc/ * Makefile.in (GTFILES): Add omp-low.h to list of GC files. * cgraphunit.c: Include omp-low.h. * doc/tm.texi: Regenerate. * doc/tm.texi.in (TARGET_RECORD_OFFLOAD_SYMBOL): Document. * gengtype.c (open_base_files): Add omp-low.h to ifiles. * lto-cgraph.c (output_offload_tables): New function. (input_offload_tables): Likewise. * lto-section-in.c (lto_section_name): Add "offload_table". * lto-section-names.h (OFFLOAD_VAR_TABLE_SECTION_NAME): Define. (OFFLOAD_FUNC_TABLE_SECTION_NAME): Likewise. * lto-streamer-out.c (lto_output): Call output_offload_tables. * lto-streamer.h (lto_section_type): Add LTO_section_offload_table. (output_offload_tables, input_offload_tables): Declare. * omp-low.c: Include common/common-target.h and lto-section-names.h. (offload_funcs, offload_vars): New global <tree, va_gc> vectors. (expand_omp_target): Add child_fn into offload_funcs vector. (add_decls_addresses_to_decl_constructor): New function. (omp_finish_file): Likewise. * omp-low.h (omp_finish_file, offload_funcs, offload_vars): Declare. * target.def (record_offload_symbol): New DEFHOOK. * toplev.c: Include omp-low.h. (compile_file): Call omp_finish_file. * varpool.c: Include omp-low.h. (varpool_node::get_create): Add decl into offload_vars vector. gcc/lto/ * lto/lto.c (read_cgraph_and_symbols): Call input_offload_tables. Co-Authored-By: Andrey Turetskiy <andrey.turetskiy@intel.com> Co-Authored-By: Bernd Schmidt <bernds@codesourcery.com> Co-Authored-By: Ilya Tocar <ilya.tocar@intel.com> Co-Authored-By: Michael Zolotukhin <michael.v.zolotukhin@intel.com> From-SVN: r217489
2014-11-13 14:44:04 +01:00
#define OFFLOAD_VAR_TABLE_SECTION_NAME ".gnu.offload_vars"
#define OFFLOAD_FUNC_TABLE_SECTION_NAME ".gnu.offload_funcs"
#endif /* GCC_LTO_SECTION_NAMES_H */