GCC Middle and Back End API Reference
supergraph.h
Go to the documentation of this file.
1/* "Supergraph" classes that combine CFGs and callgraph into one digraph.
2 Copyright (C) 2019-2025 Free Software Foundation, Inc.
3 Contributed by David Malcolm <dmalcolm@redhat.com>.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it
8under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 3, or (at your option)
10any later version.
11
12GCC is distributed in the hope that it will be useful, but
13WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING3. If not see
19<http://www.gnu.org/licenses/>. */
20
21#ifndef GCC_ANALYZER_SUPERGRAPH_H
22#define GCC_ANALYZER_SUPERGRAPH_H
23
24#include "ordered-hash-map.h"
25#include "cfg.h"
26#include "basic-block.h"
27#include "gimple.h"
28#include "gimple-iterator.h"
29#include "digraph.h"
30#include "except.h"
31
32using namespace ana;
33
34namespace ana {
35
36/* Forward decls, using indentation to show inheritance. */
37
38class supergraph;
39class supernode;
40class superedge;
42 class call_superedge;
43 class return_superedge;
44 class cfg_superedge;
49class supercluster;
50class dot_annotator;
51
52class logger;
53
54/* An enum for discriminating between superedge subclasses. */
55
63
64/* Flags for controlling the appearance of .dot dumps. */
65
70
71/* A traits struct describing the family of node, edge and digraph
72 classes for supergraphs. */
73
75{
80 {
82 const dot_annotator *node_annotator)
83 : m_flags (flags),
84 m_node_annotator (node_annotator)
85 {}
86
89 };
90 typedef supercluster cluster_t;
91};
92
93/* A class to manage the setting and restoring of statement uids. */
94
96{
97public:
99 void restore_uids () const;
100
101private:
103};
104
105/* A "supergraph" is a directed graph formed by joining together all CFGs,
106 linking them via interprocedural call and return edges.
107
108 Basic blocks are split at callsites, so that a call statement occurs
109 twice: once at the end of a supernode, and a second instance at the
110 start of the next supernode (to handle the return). */
111
112class supergraph : public digraph<supergraph_traits>
113{
114public:
117
119 {
121 }
122
124 {
126 }
127
129 {
130 return *const_cast <bb_to_node_t &> (m_bb_to_initial_node).get (bb);
131 }
132
133 /* Get the supernode containing the second half of the gcall &
134 at an interprocedural call, within the caller. */
136 {
137 return (*const_cast <cgraph_edge_to_node_t &>
139 }
140
146
152
158
160 {
161 return (*const_cast <cfg_edge_to_cfg_superedge_t &>
163 }
164
166 {
167 return (*const_cast <stmt_to_node_t &>(m_stmt_to_node_t).get
168 (const_cast <gimple *> (stmt)));
169 }
170
171 void dump_dot_to_pp (pretty_printer *pp, const dump_args_t &) const;
172 void dump_dot_to_file (FILE *fp, const dump_args_t &) const;
173 void dump_dot (const char *path, const dump_args_t &) const;
174
175 std::unique_ptr<json::object> to_json () const;
176
177 int num_nodes () const { return m_nodes.length (); }
178 int num_edges () const { return m_edges.length (); }
179
181 {
182 return m_nodes[idx];
183 }
184
185 unsigned get_num_snodes (const function *fun) const
186 {
189 return *map.get (fun);
190 }
191
192private:
193 supernode *add_node (function *fun, basic_block bb, gcall *returning_call,
197 cgraph_edge *cedge);
199 cgraph_edge *cedge);
200
201 /* Data. */
202
206
210
214
218
222
226
229
232
234};
235
236/* A node within a supergraph. */
237
238class supernode : public dnode<supergraph_traits>
239{
240 public:
241 supernode (function *fun, basic_block bb, gcall *returning_call,
242 gimple_seq phi_nodes, int index)
243 : m_fun (fun), m_bb (bb), m_returning_call (returning_call),
244 m_phi_nodes (phi_nodes), m_index (index)
245 {}
246
247 function *get_function () const { return m_fun; }
248
249 bool entry_p () const
250 {
252 }
253
254 bool return_p () const
255 {
256 return m_bb == EXIT_BLOCK_PTR_FOR_FN (m_fun);
257 }
258
259 void dump_dot (graphviz_out *gv, const dump_args_t &args) const override;
260 void dump_dot_id (pretty_printer *pp) const;
261
262 std::unique_ptr<json::object> to_json () const;
263
264 location_t get_start_location () const;
265 location_t get_end_location () const;
266
267 /* Returns iterator at the start of the list of phi nodes, if any. */
269 {
270 gimple_seq *pseq = &m_phi_nodes;
271
272 /* Adapted from gsi_start_1. */
274
275 i.ptr = gimple_seq_first (*pseq);
276 i.seq = pseq;
277 i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
278
279 return i;
280 }
281
283 {
284 return m_returning_call;
285 }
286
288 {
289 if (m_stmts.length () == 0)
290 return NULL;
291 return m_stmts[m_stmts.length () - 1];
292 }
293
295 {
297 if (stmt == NULL)
298 return NULL;
299 return dyn_cast<gcall *> (stmt);
300 }
301
302 unsigned int get_stmt_index (const gimple *stmt) const;
303
304 tree get_label () const;
305
306 function * const m_fun; // alternatively could be stored as runs of indices within the supergraph
308 gcall * const m_returning_call; // for handling the result of a returned call
309 gimple_seq m_phi_nodes; // ptr to that of the underlying BB, for the first supernode for the BB
311 const int m_index; /* unique within the supergraph as a whole. */
312};
313
314/* An abstract base class encapsulating an edge within a supergraph.
315 Edges can be CFG edges, or calls/returns for callgraph edges. */
316
317class superedge : public dedge<supergraph_traits>
318{
319 public:
320 virtual ~superedge () {}
321
322 void dump (pretty_printer *pp) const;
323 void dump () const;
324 void dump_dot (graphviz_out *gv, const dump_args_t &args)
325 const final override;
326
328 bool user_facing) const = 0;
329
330 std::unique_ptr<json::object> to_json () const;
331
332 enum edge_kind get_kind () const { return m_kind; }
333
335 virtual const cfg_superedge *dyn_cast_cfg_superedge () const { return NULL; }
336 virtual const switch_cfg_superedge *dyn_cast_switch_cfg_superedge () const { return NULL; }
337 virtual const eh_dispatch_cfg_superedge *dyn_cast_eh_dispatch_cfg_superedge () const { return nullptr; }
341 virtual const callgraph_superedge *dyn_cast_callgraph_superedge () const { return NULL; }
343 virtual const call_superedge *dyn_cast_call_superedge () const { return NULL; }
345 virtual const return_superedge *dyn_cast_return_superedge () const { return NULL; }
346
349
350 label_text get_description (bool user_facing) const;
351
352 protected:
353 superedge (supernode *src, supernode *dest, enum edge_kind kind)
354 : dedge<supergraph_traits> (src, dest),
355 m_kind (kind)
356 {}
357
358 public:
359 const enum edge_kind m_kind;
360};
361
362/* An ID representing an expression at a callsite:
363 either a parameter index, or the return value (or unknown). */
364
366{
367 public:
368 callsite_expr () : m_val (-1) {}
369
371 {
372 return callsite_expr (idx + 1);
373 }
374
376 {
377 return callsite_expr (0);
378 }
379
380 bool param_p () const
381 {
382 return m_val > 0;
383 }
384
385 bool return_value_p () const
386 {
387 return m_val == 0;
388 }
389
390 private:
391 callsite_expr (int val) : m_val (val) {}
392
393 int m_val; /* 1-based parm, 0 for return value, or -1 for "unknown". */
394};
395
396/* A subclass of superedge with an associated callgraph edge (either a
397 call or a return). */
398
400{
401 public:
403 cgraph_edge *cedge)
404 : superedge (src, dst, kind),
405 m_cedge (cedge)
406 {}
407
408 void dump_label_to_pp (pretty_printer *pp, bool user_facing) const
409 final override;
410
412 {
413 return this;
414 }
416 final override
417 {
418 return this;
419 }
420
425 const gcall &get_call_stmt () const;
429 callsite_expr *out) const;
431 callsite_expr *out) const;
432
434};
435
436} // namespace ana
437
438template <>
439template <>
440inline bool
442{
443 return (sedge->get_kind () == SUPEREDGE_INTRAPROCEDURAL_CALL
444 || sedge->get_kind () == SUPEREDGE_CALL
445 || sedge->get_kind () == SUPEREDGE_RETURN);
446}
447
448namespace ana {
449
450/* A subclass of superedge representing an interprocedural call. */
451
453{
454 public:
456 : callgraph_superedge (src, dst, SUPEREDGE_CALL, cedge)
457 {}
458
460 {
461 return this;
462 }
464 {
465 return this;
466 }
467
469 {
470 return sg.get_edge_for_return (m_cedge);
471 }
472};
473
474} // namespace ana
475
476template <>
477template <>
478inline bool
480{
481 return sedge->get_kind () == SUPEREDGE_CALL;
482}
483
484namespace ana {
485
486/* A subclass of superedge represesnting an interprocedural return. */
487
489{
490 public:
492 : callgraph_superedge (src, dst, SUPEREDGE_RETURN, cedge)
493 {}
494
497 {
498 return this;
499 }
500
502 {
503 return sg.get_edge_for_call (m_cedge);
504 }
505};
506
507} // namespace ana
508
509template <>
510template <>
511inline bool
513{
514 return sedge->get_kind () == SUPEREDGE_RETURN;
515}
516
517namespace ana {
518
519/* A subclass of superedge that corresponds to a CFG edge. */
520
522{
523 public:
525 : superedge (src, dst, SUPEREDGE_CFG_EDGE),
526 m_cfg_edge (e)
527 {}
528
529 void dump_label_to_pp (pretty_printer *pp, bool user_facing) const override;
530 cfg_superedge *dyn_cast_cfg_superedge () final override { return this; }
531 const cfg_superedge *dyn_cast_cfg_superedge () const final override { return this; }
532
533 ::edge get_cfg_edge () const { return m_cfg_edge; }
534 int get_flags () const { return m_cfg_edge->flags; }
535 int true_value_p () const { return get_flags () & EDGE_TRUE_VALUE; }
536 int false_value_p () const { return get_flags () & EDGE_FALSE_VALUE; }
537 int back_edge_p () const { return get_flags () & EDGE_DFS_BACK; }
538
539 size_t get_phi_arg_idx () const;
540 tree get_phi_arg (const gphi *phi) const;
541
542 location_t get_goto_locus () const { return m_cfg_edge->goto_locus; }
543
544 private:
545 const ::edge m_cfg_edge;
546};
547
548} // namespace ana
549
550template <>
551template <>
552inline bool
554{
555 return sedge->get_kind () == SUPEREDGE_CFG_EDGE;
556}
557
558namespace ana {
559
560/* A subclass for edges from switch statements, retaining enough
561 information to identify the pertinent cases, and for adding labels
562 when rendering via graphviz. */
563
565 public:
567
569 final override
570 {
571 return this;
572 }
573
574 void dump_label_to_pp (pretty_printer *pp, bool user_facing) const
575 final override;
576
578 {
579 return as_a <gswitch *> (m_src->get_last_stmt ());
580 }
581
582 const vec<tree> &get_case_labels () const { return m_case_labels; }
583
585
586private:
588};
589
590} // namespace ana
591
592template <>
593template <>
594inline bool
596{
597 return sedge->dyn_cast_switch_cfg_superedge () != NULL;
598}
599
600namespace ana {
601
602/* A subclass for edges from eh_dispatch statements, retaining enough
603 information to identify the various types being caught, vs the
604 "unhandled type" case, and for adding labels when rendering
605 via graphviz.
606 This is abstract; there are concrete subclasses based on the type
607 of the eh_region. */
608
610{
611 public:
612 static std::unique_ptr<eh_dispatch_cfg_superedge>
614 supernode *dest,
615 ::edge e,
616 const geh_dispatch *eh_dispatch_stmt);
617
619 final override
620 {
621 return this;
622 }
623
624 const geh_dispatch *
626 {
627 return m_eh_dispatch_stmt;
628 }
629
630 const eh_status &get_eh_status () const;
632
633 virtual bool
636 tree exception_type,
637 std::unique_ptr<rejected_constraint> *out) const = 0;
638
639protected:
641 const geh_dispatch *eh_dispatch_stmt,
642 eh_region eh_reg);
643
644private:
647};
648
649} // namespace ana
650
651template <>
652template <>
653inline bool
655{
656 return sedge->dyn_cast_eh_dispatch_cfg_superedge () != NULL;
657}
658
659namespace ana {
660
661/* A concrete subclass for edges from an eh_dispatch statements
662 for ERT_TRY regions. */
663
665{
666 public:
668 const geh_dispatch *eh_dispatch_stmt,
669 eh_region eh_reg,
670 eh_catch ehc)
671 : eh_dispatch_cfg_superedge (src, dst, e, eh_dispatch_stmt, eh_reg),
672 m_eh_catch (ehc)
673 {
674 gcc_assert (eh_reg->type == ERT_TRY);
675 }
676
679 {
680 return this;
681 }
682
684 bool user_facing) const final override;
685
686 eh_catch get_eh_catch () const { return m_eh_catch; }
687
688 bool
691 tree exception_type,
692 std::unique_ptr<rejected_constraint> *out)
693 const final override;
694
695private:
697};
698
699} // namespace ana
700
701template <>
702template <>
703inline bool
705{
706 return sedge->dyn_cast_eh_dispatch_try_cfg_superedge () != NULL;
707}
708
709namespace ana {
710
711/* A concrete subclass for edges from an eh_dispatch statements
712 for ERT_ALLOWED_EXCEPTIONS regions. */
713
715{
716 public:
722
724 const geh_dispatch *eh_dispatch_stmt,
725 eh_region eh_reg);
726
729 {
730 return this;
731 }
732
734 bool user_facing) const final override;
735
736 bool
739 tree exception_type,
740 std::unique_ptr<rejected_constraint> *out)
741 const final override;
742
743 enum eh_kind get_eh_kind () const { return m_kind; }
744
745private:
747};
748
749} // namespace ana
750
751template <>
752template <>
753inline bool
755{
756 return sedge->dyn_cast_eh_dispatch_allowed_cfg_superedge () != NULL;
757}
758
759namespace ana {
760/* Base class for adding additional content to the .dot output
761 for a supergraph. */
762
764{
765 public:
766 virtual ~dot_annotator () {}
767 virtual bool add_node_annotations (graphviz_out *gv ATTRIBUTE_UNUSED,
768 const supernode &n ATTRIBUTE_UNUSED,
769 bool within_table ATTRIBUTE_UNUSED)
770 const
771 {
772 return false;
773 }
774 virtual void add_stmt_annotations (graphviz_out *gv ATTRIBUTE_UNUSED,
775 const gimple *stmt ATTRIBUTE_UNUSED,
776 bool within_row ATTRIBUTE_UNUSED)
777 const {}
778 virtual bool add_after_node_annotations (graphviz_out *gv ATTRIBUTE_UNUSED,
779 const supernode &n ATTRIBUTE_UNUSED)
780 const
781 {
782 return false;
783 }
784};
785
788
789} // namespace ana
790
791#endif /* GCC_ANALYZER_SUPERGRAPH_H */
#define ENTRY_BLOCK_PTR_FOR_FN(FN)
Definition basic-block.h:194
#define EXIT_BLOCK_PTR_FOR_FN(FN)
Definition basic-block.h:195
Definition supergraph.h:453
call_superedge * dyn_cast_call_superedge() final override
Definition supergraph.h:459
call_superedge(supernode *src, supernode *dst, cgraph_edge *cedge)
Definition supergraph.h:455
const call_superedge * dyn_cast_call_superedge() const final override
Definition supergraph.h:463
return_superedge * get_edge_for_return(const supergraph &sg) const
Definition supergraph.h:468
Definition supergraph.h:400
const gcall & get_call_stmt() const
tree map_expr_from_callee_to_caller(tree callee_expr, callsite_expr *out) const
tree get_arg_for_parm(tree parm, callsite_expr *out) const
function * get_caller_function() const
tree get_callee_decl() const
callgraph_superedge(supernode *src, supernode *dst, enum edge_kind kind, cgraph_edge *cedge)
Definition supergraph.h:402
cgraph_edge *const m_cedge
Definition supergraph.h:433
callgraph_superedge * dyn_cast_callgraph_superedge() final override
Definition supergraph.h:411
tree map_expr_from_caller_to_callee(tree caller_expr, callsite_expr *out) const
tree get_parm_for_arg(tree arg, callsite_expr *out) const
function * get_callee_function() const
tree get_caller_decl() const
void dump_label_to_pp(pretty_printer *pp, bool user_facing) const final override
const callgraph_superedge * dyn_cast_callgraph_superedge() const final override
Definition supergraph.h:415
Definition supergraph.h:366
static callsite_expr from_zero_based_param(int idx)
Definition supergraph.h:370
callsite_expr()
Definition supergraph.h:368
int m_val
Definition supergraph.h:393
static callsite_expr from_return_value()
Definition supergraph.h:375
bool return_value_p() const
Definition supergraph.h:385
callsite_expr(int val)
Definition supergraph.h:391
bool param_p() const
Definition supergraph.h:380
Definition supergraph.h:522
const ::edge m_cfg_edge
Definition supergraph.h:545
int true_value_p() const
Definition supergraph.h:535
location_t get_goto_locus() const
Definition supergraph.h:542
void dump_label_to_pp(pretty_printer *pp, bool user_facing) const override
size_t get_phi_arg_idx() const
cfg_superedge * dyn_cast_cfg_superedge() final override
Definition supergraph.h:530
int get_flags() const
Definition supergraph.h:534
int back_edge_p() const
Definition supergraph.h:537
cfg_superedge(supernode *src, supernode *dst, ::edge e)
Definition supergraph.h:524
const cfg_superedge * dyn_cast_cfg_superedge() const final override
Definition supergraph.h:531
tree get_phi_arg(const gphi *phi) const
::edge get_cfg_edge() const
Definition supergraph.h:533
int false_value_p() const
Definition supergraph.h:536
Definition supergraph.h:764
virtual bool add_node_annotations(graphviz_out *gv, const supernode &n, bool within_table) const
Definition supergraph.h:767
virtual void add_stmt_annotations(graphviz_out *gv, const gimple *stmt, bool within_row) const
Definition supergraph.h:774
virtual bool add_after_node_annotations(graphviz_out *gv, const supernode &n) const
Definition supergraph.h:778
virtual ~dot_annotator()
Definition supergraph.h:766
Definition supergraph.h:715
void dump_label_to_pp(pretty_printer *pp, bool user_facing) const final override
enum eh_kind m_kind
Definition supergraph.h:746
eh_kind
Definition supergraph.h:718
@ expected
Definition supergraph.h:719
@ unexpected
Definition supergraph.h:720
const eh_dispatch_allowed_cfg_superedge * dyn_cast_eh_dispatch_allowed_cfg_superedge() const final override
Definition supergraph.h:728
eh_dispatch_allowed_cfg_superedge(supernode *src, supernode *dst, ::edge e, const geh_dispatch *eh_dispatch_stmt, eh_region eh_reg)
enum eh_kind get_eh_kind() const
Definition supergraph.h:743
bool apply_constraints(region_model *model, region_model_context *ctxt, tree exception_type, std::unique_ptr< rejected_constraint > *out) const final override
Definition supergraph.h:610
const geh_dispatch * m_eh_dispatch_stmt
Definition supergraph.h:645
eh_region get_eh_region() const
Definition supergraph.h:631
eh_region m_eh_region
Definition supergraph.h:646
static std::unique_ptr< eh_dispatch_cfg_superedge > make(supernode *src, supernode *dest, ::edge e, const geh_dispatch *eh_dispatch_stmt)
const geh_dispatch * get_eh_dispatch_stmt() const
Definition supergraph.h:625
virtual bool apply_constraints(region_model *model, region_model_context *ctxt, tree exception_type, std::unique_ptr< rejected_constraint > *out) const =0
const eh_status & get_eh_status() const
eh_dispatch_cfg_superedge(supernode *src, supernode *dst, ::edge e, const geh_dispatch *eh_dispatch_stmt, eh_region eh_reg)
const eh_dispatch_cfg_superedge * dyn_cast_eh_dispatch_cfg_superedge() const final override
Definition supergraph.h:618
Definition supergraph.h:665
eh_catch get_eh_catch() const
Definition supergraph.h:686
eh_dispatch_try_cfg_superedge(supernode *src, supernode *dst, ::edge e, const geh_dispatch *eh_dispatch_stmt, eh_region eh_reg, eh_catch ehc)
Definition supergraph.h:667
void dump_label_to_pp(pretty_printer *pp, bool user_facing) const final override
const eh_dispatch_try_cfg_superedge * dyn_cast_eh_dispatch_try_cfg_superedge() const final override
Definition supergraph.h:678
eh_catch m_eh_catch
Definition supergraph.h:696
bool apply_constraints(region_model *model, region_model_context *ctxt, tree exception_type, std::unique_ptr< rejected_constraint > *out) const final override
Definition analyzer-logging.h:34
Definition region-model.h:815
Definition region-model.h:298
Definition supergraph.h:489
call_superedge * get_edge_for_call(const supergraph &sg) const
Definition supergraph.h:501
return_superedge * dyn_cast_return_superedge() final override
Definition supergraph.h:495
return_superedge(supernode *src, supernode *dst, cgraph_edge *cedge)
Definition supergraph.h:491
const return_superedge * dyn_cast_return_superedge() const final override
Definition supergraph.h:496
Definition supergraph.h:96
void restore_uids() const
void make_uid_unique(gimple *stmt)
auto_vec< std::pair< gimple *, unsigned > > m_old_stmt_uids
Definition supergraph.h:102
Definition supergraph.h:318
void dump_dot(graphviz_out *gv, const dump_args_t &args) const final override
cgraph_edge * get_any_callgraph_edge() const
enum edge_kind get_kind() const
Definition supergraph.h:332
void dump(pretty_printer *pp) const
virtual const eh_dispatch_try_cfg_superedge * dyn_cast_eh_dispatch_try_cfg_superedge() const
Definition supergraph.h:338
::edge get_any_cfg_edge() const
virtual return_superedge * dyn_cast_return_superedge()
Definition supergraph.h:344
virtual const callgraph_superedge * dyn_cast_callgraph_superedge() const
Definition supergraph.h:341
superedge(supernode *src, supernode *dest, enum edge_kind kind)
Definition supergraph.h:353
virtual const switch_cfg_superedge * dyn_cast_switch_cfg_superedge() const
Definition supergraph.h:336
virtual callgraph_superedge * dyn_cast_callgraph_superedge()
Definition supergraph.h:340
virtual cfg_superedge * dyn_cast_cfg_superedge()
Definition supergraph.h:334
virtual const cfg_superedge * dyn_cast_cfg_superedge() const
Definition supergraph.h:335
label_text get_description(bool user_facing) const
std::unique_ptr< json::object > to_json() const
enum edge_kind m_kind
Definition supergraph.h:359
virtual const eh_dispatch_allowed_cfg_superedge * dyn_cast_eh_dispatch_allowed_cfg_superedge() const
Definition supergraph.h:339
virtual ~superedge()
Definition supergraph.h:320
virtual const call_superedge * dyn_cast_call_superedge() const
Definition supergraph.h:343
void dump() const
virtual void dump_label_to_pp(pretty_printer *pp, bool user_facing) const =0
virtual call_superedge * dyn_cast_call_superedge()
Definition supergraph.h:342
virtual const return_superedge * dyn_cast_return_superedge() const
Definition supergraph.h:345
virtual const eh_dispatch_cfg_superedge * dyn_cast_eh_dispatch_cfg_superedge() const
Definition supergraph.h:337
Definition supergraph.h:113
ordered_hash_map< cgraph_edge *, return_superedge * > cgraph_edge_to_return_superedge_t
Definition supergraph.h:220
std::unique_ptr< json::object > to_json() const
cgraph_edge_to_call_superedge_t m_cgraph_edge_to_call_superedge
Definition supergraph.h:217
supernode * get_caller_next_node(cgraph_edge *edge) const
Definition supergraph.h:135
int num_edges() const
Definition supergraph.h:178
stmt_to_node_t m_stmt_to_node_t
Definition supergraph.h:228
supergraph(logger *logger)
ordered_hash_map< ::edge, cfg_superedge * > cfg_edge_to_cfg_superedge_t
Definition supergraph.h:212
unsigned get_num_snodes(const function *fun) const
Definition supergraph.h:185
cgraph_edge_to_intraproc_superedge_t m_cgraph_edge_to_intraproc_superedge
Definition supergraph.h:225
cgraph_edge_to_node_t m_cgraph_edge_to_caller_next_node
Definition supergraph.h:209
int num_nodes() const
Definition supergraph.h:177
supernode * get_node_for_function_exit(const function &fun) const
Definition supergraph.h:123
superedge * get_intraprocedural_edge_for_call(cgraph_edge *edge) const
Definition supergraph.h:153
bb_to_node_t m_bb_to_final_node
Definition supergraph.h:205
ordered_hash_map< cgraph_edge *, supernode * > cgraph_edge_to_node_t
Definition supergraph.h:207
ordered_hash_map< cgraph_edge *, superedge * > cgraph_edge_to_intraproc_superedge_t
Definition supergraph.h:224
supernode * get_node_for_block(basic_block bb) const
Definition supergraph.h:128
ordered_hash_map< cgraph_edge *, call_superedge * > cgraph_edge_to_call_superedge_t
Definition supergraph.h:216
cfg_superedge * add_cfg_edge(supernode *src, supernode *dest, ::edge e)
cfg_edge_to_cfg_superedge_t m_cfg_edge_to_cfg_superedge
Definition supergraph.h:213
supernode * get_node_by_index(int idx) const
Definition supergraph.h:180
return_superedge * add_return_superedge(supernode *src, supernode *dest, cgraph_edge *cedge)
void dump_dot_to_pp(pretty_printer *pp, const dump_args_t &) const
ordered_hash_map< basic_block, supernode * > bb_to_node_t
Definition supergraph.h:203
supernode * get_node_for_function_entry(const function &fun) const
Definition supergraph.h:118
function_to_num_snodes_t m_function_to_num_snodes
Definition supergraph.h:231
hash_map< const function *, unsigned > function_to_num_snodes_t
Definition supergraph.h:230
cfg_superedge * get_edge_for_cfg_edge(edge e) const
Definition supergraph.h:159
call_superedge * add_call_superedge(supernode *src, supernode *dest, cgraph_edge *cedge)
bb_to_node_t m_bb_to_initial_node
Definition supergraph.h:204
supernode * get_supernode_for_stmt(const gimple *stmt) const
Definition supergraph.h:165
ordered_hash_map< gimple *, supernode * > stmt_to_node_t
Definition supergraph.h:227
void dump_dot_to_file(FILE *fp, const dump_args_t &) const
cgraph_edge_to_return_superedge_t m_cgraph_edge_to_return_superedge
Definition supergraph.h:221
call_superedge * get_edge_for_call(cgraph_edge *edge) const
Definition supergraph.h:141
void dump_dot(const char *path, const dump_args_t &) const
return_superedge * get_edge_for_return(cgraph_edge *edge) const
Definition supergraph.h:147
supernode * add_node(function *fun, basic_block bb, gcall *returning_call, gimple_seq phi_nodes)
saved_uids m_stmt_uids
Definition supergraph.h:233
cgraph_edge_to_node_t m_cgraph_edge_to_caller_prev_node
Definition supergraph.h:208
Definition supergraph.h:239
bool entry_p() const
Definition supergraph.h:249
gimple * get_last_stmt() const
Definition supergraph.h:287
gcall * get_final_call() const
Definition supergraph.h:294
location_t get_end_location() const
gphi_iterator start_phis()
Definition supergraph.h:268
const basic_block m_bb
Definition supergraph.h:307
void dump_dot_id(pretty_printer *pp) const
gcall * get_returning_call() const
Definition supergraph.h:282
bool return_p() const
Definition supergraph.h:254
tree get_label() const
location_t get_start_location() const
void dump_dot(graphviz_out *gv, const dump_args_t &args) const override
gcall *const m_returning_call
Definition supergraph.h:308
unsigned int get_stmt_index(const gimple *stmt) const
std::unique_ptr< json::object > to_json() const
function * get_function() const
Definition supergraph.h:247
supernode(function *fun, basic_block bb, gcall *returning_call, gimple_seq phi_nodes, int index)
Definition supergraph.h:241
const int m_index
Definition supergraph.h:311
auto_vec< gimple * > m_stmts
Definition supergraph.h:310
gimple_seq m_phi_nodes
Definition supergraph.h:309
function *const m_fun
Definition supergraph.h:306
Definition supergraph.h:564
bool implicitly_created_default_p() const
const switch_cfg_superedge * dyn_cast_switch_cfg_superedge() const final override
Definition supergraph.h:568
const vec< tree > & get_case_labels() const
Definition supergraph.h:582
switch_cfg_superedge(supernode *src, supernode *dst, ::edge e)
void dump_label_to_pp(pretty_printer *pp, bool user_facing) const final override
gswitch * get_switch_stmt() const
Definition supergraph.h:577
auto_vec< tree > m_case_labels
Definition supergraph.h:587
Definition vec.h:1667
Definition cgraph.h:1702
node_t *const m_src
Definition digraph.h:71
dedge(node_t *src, node_t *dest)
Definition digraph.h:64
supergraph_traits::dump_args_t dump_args_t
Definition digraph.h:62
auto_delete_vec< edge_t > m_edges
Definition digraph.h:105
auto_delete_vec< node_t > m_nodes
Definition digraph.h:104
supergraph_traits::dump_args_t dump_args_t
Definition digraph.h:85
digraph()
Definition digraph.h:88
Definition digraph.h:43
supergraph_traits::dump_args_t dump_args_t
Definition digraph.h:46
Definition graphviz.h:29
Definition hash-map.h:40
Definition ordered-hash-map.h:35
Definition pretty-print.h:241
static struct path_prefix cpath path
Definition collect2.cc:514
struct basic_block_def * basic_block
Definition coretypes.h:355
class edge_def * edge
Definition coretypes.h:352
gimple * gimple_seq
Definition coretypes.h:100
union tree_node * tree
Definition coretypes.h:97
static struct string2counter_map map[debug_counter_number_of_counters]
Definition dbgcnt.cc:39
struct eh_catch_d * eh_catch
Definition except.h:183
@ ERT_TRY
Definition except.h:46
struct eh_region_d * eh_region
Definition except.h:184
void final(rtx_insn *first, FILE *file, int optimize_p)
Definition final.cc:2008
gimple_seq phi_nodes(const_basic_block bb)
Definition gimple.h:4678
basic_block gimple_bb(const gimple *g)
Definition gimple.h:1863
gimple_seq_node gimple_seq_first(gimple_seq s)
Definition gimple.h:1686
T as_a(U *p)
Definition is-a.h:253
T dyn_cast(U *p)
Definition is-a.h:280
Definition access-diagram.h:30
function * get_ultimate_function_for_cgraph_edge(cgraph_edge *edge)
@ stmt
Definition checker-event.h:37
supergraph_dot_flags
Definition supergraph.h:67
@ SUPERGRAPH_DOT_SHOW_BBS
Definition supergraph.h:68
cgraph_edge * supergraph_call_edge(function *fun, const gimple *stmt)
edge_kind
Definition supergraph.h:57
@ SUPEREDGE_RETURN
Definition supergraph.h:60
@ SUPEREDGE_CALL
Definition supergraph.h:59
@ SUPEREDGE_CFG_EDGE
Definition supergraph.h:58
@ SUPEREDGE_INTRAPROCEDURAL_CALL
Definition supergraph.h:61
i
Definition poly-int.h:776
dump_args_t(enum supergraph_dot_flags flags, const dot_annotator *node_annotator)
Definition supergraph.h:81
const dot_annotator * m_node_annotator
Definition supergraph.h:88
enum supergraph_dot_flags m_flags
Definition supergraph.h:87
Definition supergraph.h:75
supercluster cluster_t
Definition supergraph.h:90
supernode node_t
Definition supergraph.h:76
supergraph graph_t
Definition supergraph.h:78
superedge edge_t
Definition supergraph.h:77
enum eh_region_type type
Definition except.h:131
Definition except.h:192
Definition function.h:249
Definition gimple.h:352
Definition gimple.h:494
Definition gimple.h:221
Definition gimple-iterator.h:42
Definition gimple.h:461
Definition gimple.h:895
static bool test(U *p)
Definition vec.h:450
#define NULL
Definition system.h:50
#define gcc_assert(EXPR)
Definition system.h:814