1/* Extra properties for digraphs in SARIF property bags.
2 Copyright (C) 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 under
8the terms of the GNU General Public License as published by the Free
9Software Foundation; either version 3, or (at your option) any later
10version.
11
12GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13WARRANTY; without even the implied warranty of MERCHANTABILITY or
14FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15for 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#include "config.h"
22#include "system.h"
23#include "coretypes.h"
24#include "json.h"
25#include "custom-sarif-properties/cfg.h"
26
27namespace cfg = custom_sarif_properties::cfg;
28
29#define GRAPH_PREFIX "gcc/cfg/graph/"
30const json::string_property cfg::graph::pass_name
31 (GRAPH_PREFIX "pass_name");
32const json::integer_property cfg::graph::pass_number
33 (GRAPH_PREFIX "pass_number");
34#undef GRAPH_PREFIX
35
36#define NODE_PREFIX "gcc/cfg/node/"
37const json::string_property cfg::node::kind
38 (NODE_PREFIX "kind");
39#undef NODE_PREFIX
40
41// For node kind: "loop":
42#define LOOP_PREFIX "gcc/cfg/loop/"
43const json::integer_property cfg::loop::num (LOOP_PREFIX "num");
44const json::integer_property cfg::loop::depth (LOOP_PREFIX "depth");
45#undef LOOP_PREFIX
46
47// For node kind: "basic_block":
48#define BB_PREFIX "gcc/cfg/basic_block/"
49
50const json::string_property cfg::basic_block::kind (BB_PREFIX "kind");
51const json::integer_property cfg::basic_block::index (BB_PREFIX "index");
52const json::string_property cfg::basic_block::count (BB_PREFIX "count");
53
54const json::array_of_string_property cfg::basic_block::gimple::phis
55 (BB_PREFIX "gimple/phis");
56const json::array_of_string_property cfg::basic_block::gimple::stmts
57 (BB_PREFIX "gimple/stmts");
58
59const json::array_of_string_property cfg::basic_block::rtl::insns
60 (BB_PREFIX "rtl/insns");
61
62#undef BB_PREFIX
63
64#define EDGE_PREFIX "gcc/cfg/edge/"
65const json::array_of_string_property cfg::edge::flags
66 (EDGE_PREFIX "flags");
67const json::integer_property cfg::edge::probability_pc
68 (EDGE_PREFIX "probability_pc");
69#undef EDGE_PREFIX
70

source code of gcc/custom-sarif-properties/cfg.cc