annotate gcc/target-globals.c @ 16:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents 561a7518be6b
children 84e7813d76e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 /* Target-dependent globals.
16
kono
parents: 15
diff changeset
2 Copyright (C) 2010-2017 Free Software Foundation, Inc.
15
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"
16
kono
parents: 15
diff changeset
23 #include "backend.h"
kono
parents: 15
diff changeset
24 #include "rtl.h"
kono
parents: 15
diff changeset
25 #include "tree.h"
kono
parents: 15
diff changeset
26 #include "expmed.h"
kono
parents: 15
diff changeset
27 #include "optabs-query.h"
15
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 #include "insn-config.h"
16
kono
parents: 15
diff changeset
29 #include "regs.h"
kono
parents: 15
diff changeset
30 #include "memmodel.h"
kono
parents: 15
diff changeset
31 #include "ira.h"
kono
parents: 15
diff changeset
32 #include "ira-int.h"
15
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"
16
kono
parents: 15
diff changeset
42 #include "lower-subreg.h"
15
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
43
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 #if SWITCHABLE_TARGET
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 struct target_globals default_target_globals = {
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 &default_target_flag_state,
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 &default_target_regs,
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 &default_target_rtl,
16
kono
parents: 15
diff changeset
49 &default_target_recog,
15
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 &default_target_hard_regs,
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 &default_target_reload,
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 &default_target_expmed,
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 &default_target_optabs,
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 &default_target_libfuncs,
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 &default_target_cfgloop,
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 &default_target_ira,
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
57 &default_target_ira_int,
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
58 &default_target_builtins,
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
59 &default_target_gcse,
16
kono
parents: 15
diff changeset
60 &default_target_bb_reorder,
kono
parents: 15
diff changeset
61 &default_target_lower_subreg
15
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
62 };
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
63
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
64 struct target_globals *
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
65 save_target_globals (void)
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 {
16
kono
parents: 15
diff changeset
67 struct target_globals *g = ggc_cleared_alloc <target_globals> ();
15
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
68 g->flag_state = XCNEW (struct target_flag_state);
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
69 g->regs = XCNEW (struct target_regs);
16
kono
parents: 15
diff changeset
70 g->rtl = ggc_cleared_alloc<target_rtl> ();
kono
parents: 15
diff changeset
71 g->recog = XCNEW (struct target_recog);
15
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
72 g->hard_regs = XCNEW (struct target_hard_regs);
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
73 g->reload = XCNEW (struct target_reload);
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
74 g->expmed = XCNEW (struct target_expmed);
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
75 g->optabs = XCNEW (struct target_optabs);
16
kono
parents: 15
diff changeset
76 g->libfuncs = ggc_cleared_alloc<target_libfuncs> ();
15
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 g->cfgloop = XCNEW (struct target_cfgloop);
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
78 g->ira = XCNEW (struct target_ira);
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
79 g->ira_int = XCNEW (struct target_ira_int);
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
80 g->builtins = XCNEW (struct target_builtins);
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
81 g->gcse = XCNEW (struct target_gcse);
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
82 g->bb_reorder = XCNEW (struct target_bb_reorder);
16
kono
parents: 15
diff changeset
83 g->lower_subreg = XCNEW (struct target_lower_subreg);
15
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
84 restore_target_globals (g);
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 init_reg_sets ();
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 target_reinit ();
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
87 return g;
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
88 }
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
89
16
kono
parents: 15
diff changeset
90 /* Like save_target_globals() above, but set *this_target_optabs
kono
parents: 15
diff changeset
91 correctly when a previous function has changed
kono
parents: 15
diff changeset
92 *this_target_optabs. */
kono
parents: 15
diff changeset
93
kono
parents: 15
diff changeset
94 struct target_globals *
kono
parents: 15
diff changeset
95 save_target_globals_default_opts ()
kono
parents: 15
diff changeset
96 {
kono
parents: 15
diff changeset
97 struct target_globals *globals;
kono
parents: 15
diff changeset
98
kono
parents: 15
diff changeset
99 if (optimization_current_node != optimization_default_node)
kono
parents: 15
diff changeset
100 {
kono
parents: 15
diff changeset
101 tree opts = optimization_current_node;
kono
parents: 15
diff changeset
102 /* Temporarily switch to the default optimization node, so that
kono
parents: 15
diff changeset
103 *this_target_optabs is set to the default, not reflecting
kono
parents: 15
diff changeset
104 whatever a previous function used for the optimize
kono
parents: 15
diff changeset
105 attribute. */
kono
parents: 15
diff changeset
106 optimization_current_node = optimization_default_node;
kono
parents: 15
diff changeset
107 cl_optimization_restore
kono
parents: 15
diff changeset
108 (&global_options,
kono
parents: 15
diff changeset
109 TREE_OPTIMIZATION (optimization_default_node));
kono
parents: 15
diff changeset
110 globals = save_target_globals ();
kono
parents: 15
diff changeset
111 optimization_current_node = opts;
kono
parents: 15
diff changeset
112 cl_optimization_restore (&global_options,
kono
parents: 15
diff changeset
113 TREE_OPTIMIZATION (opts));
kono
parents: 15
diff changeset
114 return globals;
kono
parents: 15
diff changeset
115 }
kono
parents: 15
diff changeset
116 return save_target_globals ();
kono
parents: 15
diff changeset
117 }
kono
parents: 15
diff changeset
118
kono
parents: 15
diff changeset
119 target_globals::~target_globals ()
kono
parents: 15
diff changeset
120 {
kono
parents: 15
diff changeset
121 /* default_target_globals points to static data so shouldn't be freed. */
kono
parents: 15
diff changeset
122 if (this != &default_target_globals)
kono
parents: 15
diff changeset
123 {
kono
parents: 15
diff changeset
124 ira_int->~target_ira_int ();
kono
parents: 15
diff changeset
125 hard_regs->finalize ();
kono
parents: 15
diff changeset
126 XDELETE (flag_state);
kono
parents: 15
diff changeset
127 XDELETE (regs);
kono
parents: 15
diff changeset
128 XDELETE (recog);
kono
parents: 15
diff changeset
129 XDELETE (hard_regs);
kono
parents: 15
diff changeset
130 XDELETE (reload);
kono
parents: 15
diff changeset
131 XDELETE (expmed);
kono
parents: 15
diff changeset
132 XDELETE (optabs);
kono
parents: 15
diff changeset
133 XDELETE (cfgloop);
kono
parents: 15
diff changeset
134 XDELETE (ira);
kono
parents: 15
diff changeset
135 XDELETE (ira_int);
kono
parents: 15
diff changeset
136 XDELETE (builtins);
kono
parents: 15
diff changeset
137 XDELETE (gcse);
kono
parents: 15
diff changeset
138 XDELETE (bb_reorder);
kono
parents: 15
diff changeset
139 XDELETE (lower_subreg);
kono
parents: 15
diff changeset
140 }
kono
parents: 15
diff changeset
141 }
kono
parents: 15
diff changeset
142
15
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
143 #endif