}
}
+/* Return a new json::array of per-snode SCC ids. */
+
+json::array *
+strongly_connected_components::to_json () const
+{
+ json::array *scc_arr = new json::array ();
+ for (int i = 0; i < m_sg.num_nodes (); i++)
+ scc_arr->append (new json::integer_number (get_scc_id (i)));
+ return scc_arr;
+}
+
/* Subroutine of strongly_connected_components's ctor, part of Tarjan's
SCC algorithm. */
return ka.m_enode->m_index - kb.m_enode->m_index;
}
+/* Return a new json::object of the form
+ {"scc" : [per-snode-IDs]}, */
+
+json::object *
+worklist::to_json () const
+{
+ json::object *worklist_obj = new json::object ();
+
+ worklist_obj->set ("scc", m_scc.to_json ());
+
+ /* The following field isn't yet being JSONified:
+ queue_t m_queue; */
+
+ return worklist_obj;
+}
+
/* exploded_graph's ctor. */
exploded_graph::exploded_graph (const supergraph &sg, logger *logger,
/* m_sg is JSONified at the top-level. */
egraph_obj->set ("ext_state", m_ext_state.to_json ());
+ egraph_obj->set ("worklist", m_worklist.to_json ());
egraph_obj->set ("diagnostic_manager", m_diagnostic_manager.to_json ());
/* The following fields aren't yet being JSONified:
- worklist m_worklist;
const state_purge_map *const m_purge_map;
const analysis_plan &m_plan;
stats m_global_stats;
void dump () const;
+ json::array *to_json () const;
+
private:
struct per_node_data
{
return m_scc.get_scc_id (snode.m_index);
}
+ json::object *to_json () const;
+
private:
class key_t
{
{PARENT_REGION_DESC: {BASE_REGION_DESC: object for binding_map,
... for each cluster within parent region},
...for each parent region,
- "called_unknown_function": true/false}. */
+ "called_unknown_fn": true/false}. */
json::object *
store::to_json () const
/* Return a new json::object of the form
{"idx": int,
+ "fun": optional str
"bb_idx": int,
- "m_returning_call": optional str,
+ "returning_call": optional str,
"phis": [str],
"stmts" : [str]}. */
snode_obj->set ("idx", new json::integer_number (m_index));
snode_obj->set ("bb_idx", new json::integer_number (m_bb->index));
+ if (function *fun = get_function ())
+ snode_obj->set ("fun", new json::string (function_name (fun)));
if (m_returning_call)
{
gcc_unreachable ();
}
+/* Get a string for PK. */
+
+static const char *
+edge_kind_to_string (enum edge_kind kind)
+{
+ switch (kind)
+ {
+ default:
+ gcc_unreachable ();
+ case SUPEREDGE_CFG_EDGE:
+ return "SUPEREDGE_CFG_EDGE";
+ case SUPEREDGE_CALL:
+ return "SUPEREDGE_CALL";
+ case SUPEREDGE_RETURN:
+ return "SUPEREDGE_RETURN";
+ case SUPEREDGE_INTRAPROCEDURAL_CALL:
+ return "SUPEREDGE_INTRAPROCEDURAL_CALL";
+ }
+};
+
/* Dump this superedge to PP. */
void
}
/* Return a new json::object of the form
- {"src_idx": int, the index of the source supernode,
+ {"kind" : str,
+ "src_idx": int, the index of the source supernode,
"dst_idx": int, the index of the destination supernode,
"desc" : str. */
superedge::to_json () const
{
json::object *sedge_obj = new json::object ();
+ sedge_obj->set ("kind", new json::string (edge_kind_to_string (m_kind)));
sedge_obj->set ("src_idx", new json::integer_number (m_src->m_index));
sedge_obj->set ("dst_idx", new json::integer_number (m_dest->m_index));