ml4ai / automates

AutoMATES: Automated Model Assembly from Text, Equations, and Software
https://ml4ai.github.io/automates
Other
25 stars 9 forks source link

[PA]: gcc AST basic blocks to networkx digraph #280

Closed rsulli55 closed 2 years ago

rsulli55 commented 2 years ago

Added code to convert the basic blocks obtained from the gcc AST json to a networkx digraph. Nodes are represented by a data class BBNode which currently has one member variable index. Edges are built into the graph following the edges field of the basic block json, and each edge in the digraph contains an EdgeData object which includes the edges gcc flags and human readable type obtained from the flags. The main functionality is provided by the function basic_blocks_to_digraph() which takes a list of basic blocks e.g. the basic blocks of a function and returns the digraph representing the flow of control between these basic blocks.