annotate gcc/run-rtl-passes.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
111
kono
parents:
diff changeset
1 /* run-rtl-passes.c - Run RTL passes directly from frontend
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2 Copyright (C) 2016-2020 Free Software Foundation, Inc.
111
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 This file is part of GCC.
kono
parents:
diff changeset
5
kono
parents:
diff changeset
6 GCC is free software; you can redistribute it and/or modify it under
kono
parents:
diff changeset
7 the terms of the GNU General Public License as published by the Free
kono
parents:
diff changeset
8 Software Foundation; either version 3, or (at your option) any later
kono
parents:
diff changeset
9 version.
kono
parents:
diff changeset
10
kono
parents:
diff changeset
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
kono
parents:
diff changeset
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
kono
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
kono
parents:
diff changeset
14 for more details.
kono
parents:
diff changeset
15
kono
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
kono
parents:
diff changeset
17 along with GCC; see the file COPYING3. If not see
kono
parents:
diff changeset
18 <http://www.gnu.org/licenses/>. */
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 #include "config.h"
kono
parents:
diff changeset
21 #include "system.h"
kono
parents:
diff changeset
22 #include "coretypes.h"
kono
parents:
diff changeset
23 #include "target.h"
kono
parents:
diff changeset
24 #include "rtl.h"
kono
parents:
diff changeset
25 #include "function.h"
kono
parents:
diff changeset
26 #include "basic-block.h"
kono
parents:
diff changeset
27 #include "tree-pass.h"
kono
parents:
diff changeset
28 #include "context.h"
kono
parents:
diff changeset
29 #include "pass_manager.h"
kono
parents:
diff changeset
30 #include "bitmap.h"
kono
parents:
diff changeset
31 #include "df.h"
kono
parents:
diff changeset
32 #include "regs.h"
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
33 #include "output.h"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
34 #include "debug.h" /* for debug_hooks. */
111
kono
parents:
diff changeset
35 #include "insn-attr-common.h" /* for INSN_SCHEDULING. */
kono
parents:
diff changeset
36 #include "insn-attr.h" /* for init_sched_attrs. */
kono
parents:
diff changeset
37 #include "run-rtl-passes.h"
kono
parents:
diff changeset
38
kono
parents:
diff changeset
39 /* Run the backend passes, starting at the given pass.
kono
parents:
diff changeset
40 Take ownership of INITIAL_PASS_NAME. */
kono
parents:
diff changeset
41
kono
parents:
diff changeset
42 void
kono
parents:
diff changeset
43 run_rtl_passes (char *initial_pass_name)
kono
parents:
diff changeset
44 {
kono
parents:
diff changeset
45 cfun->pass_startwith = initial_pass_name;
kono
parents:
diff changeset
46 max_regno = max_reg_num ();
kono
parents:
diff changeset
47
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
48 /* cgraphunit.c normally handles this. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
49 switch_to_section (text_section);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
50 (*debug_hooks->assembly_start) ();
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
51
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
52 if (initial_pass_name)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
53 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
54 /* Pass "expand" normally sets this up. */
111
kono
parents:
diff changeset
55 #ifdef INSN_SCHEDULING
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
56 init_sched_attrs ();
111
kono
parents:
diff changeset
57 #endif
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
58 bitmap_obstack_initialize (NULL);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
59 bitmap_obstack_initialize (&reg_obstack);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
60 opt_pass *rest_of_compilation
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
61 = g->get_passes ()->get_rest_of_compilation ();
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
62 gcc_assert (rest_of_compilation);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
63 execute_pass_list (cfun, rest_of_compilation);
111
kono
parents:
diff changeset
64
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
65 opt_pass *clean_slate = g->get_passes ()->get_clean_slate ();
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
66 gcc_assert (clean_slate);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
67 execute_pass_list (cfun, clean_slate);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
68 bitmap_obstack_release (&reg_obstack);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
69 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
70 else
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
71 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
72 opt_pass *clean_slate = g->get_passes ()->get_clean_slate ();
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
73 gcc_assert (clean_slate);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
74 execute_pass_list (cfun, clean_slate);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
75 }
111
kono
parents:
diff changeset
76
kono
parents:
diff changeset
77 cfun->curr_properties |= PROP_rtl;
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
78 free (initial_pass_name);
111
kono
parents:
diff changeset
79 }