annotate gcc/target-globals.c @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 /* Target-dependent globals.
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2 Copyright (C) 2010-2020 Free Software Foundation, Inc.
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 This file is part of GCC.
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 GCC is free software; you can redistribute it and/or modify it under
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 the terms of the GNU General Public License as published by the Free
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 Software Foundation; either version 3, or (at your option) any later
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 version.
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 for more details.
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 along with GCC; see the file COPYING3. If not see
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 <http://www.gnu.org/licenses/>. */
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 #include "config.h"
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 #include "system.h"
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 #include "coretypes.h"
111
kono
parents: 68
diff changeset
23 #include "backend.h"
kono
parents: 68
diff changeset
24 #include "rtl.h"
kono
parents: 68
diff changeset
25 #include "tree.h"
kono
parents: 68
diff changeset
26 #include "expmed.h"
kono
parents: 68
diff changeset
27 #include "optabs-query.h"
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 #include "insn-config.h"
111
kono
parents: 68
diff changeset
29 #include "regs.h"
kono
parents: 68
diff changeset
30 #include "memmodel.h"
kono
parents: 68
diff changeset
31 #include "ira.h"
kono
parents: 68
diff changeset
32 #include "ira-int.h"
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 #include "toplev.h"
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 #include "target-globals.h"
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 #include "flags.h"
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 #include "reload.h"
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 #include "libfuncs.h"
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 #include "cfgloop.h"
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 #include "builtins.h"
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 #include "gcse.h"
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 #include "bb-reorder.h"
111
kono
parents: 68
diff changeset
42 #include "lower-subreg.h"
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
43 #include "function-abi.h"
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
44
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 #if SWITCHABLE_TARGET
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
46 class target_globals default_target_globals = {
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 &default_target_flag_state,
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 &default_target_regs,
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
49 &default_target_rtl,
111
kono
parents: 68
diff changeset
50 &default_target_recog,
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 &default_target_hard_regs,
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
52 &default_target_function_abi_info,
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 &default_target_reload,
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 &default_target_expmed,
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 &default_target_optabs,
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 &default_target_libfuncs,
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
57 &default_target_cfgloop,
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
58 &default_target_ira,
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
59 &default_target_ira_int,
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 &default_target_builtins,
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
61 &default_target_gcse,
111
kono
parents: 68
diff changeset
62 &default_target_bb_reorder,
kono
parents: 68
diff changeset
63 &default_target_lower_subreg
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
64 };
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
65
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
66 class target_globals *
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
67 save_target_globals (void)
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
68 {
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
69 class target_globals *g = ggc_cleared_alloc <target_globals> ();
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
70 g->flag_state = XCNEW (class target_flag_state);
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
71 g->regs = XCNEW (struct target_regs);
111
kono
parents: 68
diff changeset
72 g->rtl = ggc_cleared_alloc<target_rtl> ();
kono
parents: 68
diff changeset
73 g->recog = XCNEW (struct target_recog);
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
74 g->hard_regs = XCNEW (struct target_hard_regs);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
75 g->function_abi_info = XCNEW (struct target_function_abi_info);
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
76 g->reload = XCNEW (struct target_reload);
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 g->expmed = XCNEW (struct target_expmed);
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
78 g->optabs = XCNEW (struct target_optabs);
111
kono
parents: 68
diff changeset
79 g->libfuncs = ggc_cleared_alloc<target_libfuncs> ();
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
80 g->cfgloop = XCNEW (struct target_cfgloop);
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
81 g->ira = XCNEW (struct target_ira);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
82 g->ira_int = XCNEW (class target_ira_int);
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
83 g->builtins = XCNEW (struct target_builtins);
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
84 g->gcse = XCNEW (struct target_gcse);
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 g->bb_reorder = XCNEW (struct target_bb_reorder);
111
kono
parents: 68
diff changeset
86 g->lower_subreg = XCNEW (struct target_lower_subreg);
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
87 restore_target_globals (g);
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
88 init_reg_sets ();
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
89 target_reinit ();
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
90 return g;
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
91 }
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
92
111
kono
parents: 68
diff changeset
93 /* Like save_target_globals() above, but set *this_target_optabs
kono
parents: 68
diff changeset
94 correctly when a previous function has changed
kono
parents: 68
diff changeset
95 *this_target_optabs. */
kono
parents: 68
diff changeset
96
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
97 class target_globals *
111
kono
parents: 68
diff changeset
98 save_target_globals_default_opts ()
kono
parents: 68
diff changeset
99 {
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
100 class target_globals *globals;
111
kono
parents: 68
diff changeset
101
kono
parents: 68
diff changeset
102 if (optimization_current_node != optimization_default_node)
kono
parents: 68
diff changeset
103 {
kono
parents: 68
diff changeset
104 tree opts = optimization_current_node;
kono
parents: 68
diff changeset
105 /* Temporarily switch to the default optimization node, so that
kono
parents: 68
diff changeset
106 *this_target_optabs is set to the default, not reflecting
kono
parents: 68
diff changeset
107 whatever a previous function used for the optimize
kono
parents: 68
diff changeset
108 attribute. */
kono
parents: 68
diff changeset
109 optimization_current_node = optimization_default_node;
kono
parents: 68
diff changeset
110 cl_optimization_restore
kono
parents: 68
diff changeset
111 (&global_options,
kono
parents: 68
diff changeset
112 TREE_OPTIMIZATION (optimization_default_node));
kono
parents: 68
diff changeset
113 globals = save_target_globals ();
kono
parents: 68
diff changeset
114 optimization_current_node = opts;
kono
parents: 68
diff changeset
115 cl_optimization_restore (&global_options,
kono
parents: 68
diff changeset
116 TREE_OPTIMIZATION (opts));
kono
parents: 68
diff changeset
117 return globals;
kono
parents: 68
diff changeset
118 }
kono
parents: 68
diff changeset
119 return save_target_globals ();
kono
parents: 68
diff changeset
120 }
kono
parents: 68
diff changeset
121
kono
parents: 68
diff changeset
122 target_globals::~target_globals ()
kono
parents: 68
diff changeset
123 {
kono
parents: 68
diff changeset
124 /* default_target_globals points to static data so shouldn't be freed. */
kono
parents: 68
diff changeset
125 if (this != &default_target_globals)
kono
parents: 68
diff changeset
126 {
kono
parents: 68
diff changeset
127 ira_int->~target_ira_int ();
kono
parents: 68
diff changeset
128 hard_regs->finalize ();
kono
parents: 68
diff changeset
129 XDELETE (flag_state);
kono
parents: 68
diff changeset
130 XDELETE (regs);
kono
parents: 68
diff changeset
131 XDELETE (recog);
kono
parents: 68
diff changeset
132 XDELETE (hard_regs);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
133 XDELETE (function_abi_info);
111
kono
parents: 68
diff changeset
134 XDELETE (reload);
kono
parents: 68
diff changeset
135 XDELETE (expmed);
kono
parents: 68
diff changeset
136 XDELETE (optabs);
kono
parents: 68
diff changeset
137 XDELETE (cfgloop);
kono
parents: 68
diff changeset
138 XDELETE (ira);
kono
parents: 68
diff changeset
139 XDELETE (ira_int);
kono
parents: 68
diff changeset
140 XDELETE (builtins);
kono
parents: 68
diff changeset
141 XDELETE (gcse);
kono
parents: 68
diff changeset
142 XDELETE (bb_reorder);
kono
parents: 68
diff changeset
143 XDELETE (lower_subreg);
kono
parents: 68
diff changeset
144 }
kono
parents: 68
diff changeset
145 }
kono
parents: 68
diff changeset
146
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
147 #endif