RISC-V: Make stack_save_restore tests more robust
[official-gcc.git] / gcc / symtab-clones.cc
blob5454b4f2ac9ae3815e164ddcd0f922cca2e93af8
1 /* Support for virtual clones in symbol table.
2 Copyright (C) 2003-2023 Free Software Foundation, Inc.
3 Contributed by Jan Hubicka
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
10 version.
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
21 #include "config.h"
22 #include "system.h"
23 #include "coretypes.h"
24 #include "backend.h"
25 #include "tree.h"
26 #include "gimple.h"
27 #include "predict.h"
28 #include "target.h"
29 #include "rtl.h"
30 #include "alloc-pool.h"
31 #include "cgraph.h"
32 #include "symbol-summary.h"
33 #include "symtab-clones.h"
34 #include "lto-streamer.h"
35 #include "data-streamer.h"
37 namespace {
39 /* Function summary for clone_infos. */
40 class GTY((user)) clone_infos_t: public function_summary <clone_info *>
42 public:
43 clone_infos_t (symbol_table *table, bool ggc):
44 function_summary<clone_info *> (table, ggc) { }
47 } /* anon namespace */
49 /* Return thunk_info possibly creating new one. */
50 clone_info *
51 clone_info::get_create (cgraph_node *node)
53 if (!symtab->m_clones)
55 symtab->m_clones
56 = new (ggc_alloc_no_dtor <function_summary <clone_info *>> ())
57 function_summary <clone_info *> (symtab, true);
58 symtab->m_clones->disable_insertion_hook ();
59 symtab->m_clones->disable_duplication_hook ();
61 return symtab->m_clones->get_create (node);