| 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 | |
| 5 | This file is part of GCC. |
| 6 | |
| 7 | GCC is free software; you can redistribute it and/or modify it under |
| 8 | the terms of the GNU General Public License as published by the Free |
| 9 | Software Foundation; either version 3, or (at your option) any later |
| 10 | version. |
| 11 | |
| 12 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY |
| 13 | WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 14 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 15 | for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU General Public License |
| 18 | along 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 | |
| 27 | namespace cfg = custom_sarif_properties::cfg; |
| 28 | |
| 29 | #define GRAPH_PREFIX "gcc/cfg/graph/" |
| 30 | const json::string_property cfg::graph::pass_name |
| 31 | (GRAPH_PREFIX "pass_name"); |
| 32 | const json::integer_property cfg::graph::pass_number |
| 33 | (GRAPH_PREFIX "pass_number"); |
| 34 | #undef GRAPH_PREFIX |
| 35 | |
| 36 | #define NODE_PREFIX "gcc/cfg/node/" |
| 37 | const 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/" |
| 43 | const json::integer_property cfg::loop::num (LOOP_PREFIX "num"); |
| 44 | const 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 | |
| 50 | const json::string_property cfg::basic_block::kind (BB_PREFIX "kind"); |
| 51 | const json::integer_property cfg::basic_block::index (BB_PREFIX "index"); |
| 52 | const json::string_property cfg::basic_block::count (BB_PREFIX "count"); |
| 53 | |
| 54 | const json::array_of_string_property cfg::basic_block::gimple::phis |
| 55 | (BB_PREFIX "gimple/phis"); |
| 56 | const json::array_of_string_property cfg::basic_block::gimple::stmts |
| 57 | (BB_PREFIX "gimple/stmts"); |
| 58 | |
| 59 | const 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/" |
| 65 | const json::array_of_string_property cfg::edge::flags |
| 66 | (EDGE_PREFIX "flags"); |
| 67 | const json::integer_property cfg::edge::probability_pc |
| 68 | (EDGE_PREFIX "probability_pc"); |
| 69 | #undef EDGE_PREFIX |
| 70 |
