Exploring LLVM Bitcode interatively

Hello everyone,

Yesterday we open-sourced a tool that helps to explore bitcode in an interactive way using a graph database.
I use it primarily for debugging, but I thought some of you may find it useful for other purposes.

Here are some queries just to give an example of such exploration.

of functions: 71 019

of basic blocks: 172 621

of instructions: 1 212 322

3 biggest functions in the libLLVMCore:

g.V().hasLabel(‘function’).order().by(‘instructionCount’, desc).valueMap(‘name’, ‘instructionCount’).limit(3)
_ZN4llvm20UpgradeIntrinsicCallEPNS_8CallInstEPNS_8FunctionE 14033
_ZN4llvm9Intrinsic13getAttributesERNS_11LLVMContextE 8420
_ZL25ShouldUpgradeX86IntrinsicPN4llvm8FunctionENS_9StringRefE 3635

5 most used instructions:

g.V().hasLabel(‘instruction’).values(‘opcode’).groupCount().order(local).by(values, desc).unfold().limit(5)
call 290 495
load 214 769
store 167 640
alloca 154 922
br 96 848

The tool is available here: https://github.com/ShiftLeftSecurity/llvm2graphml
Here is a short write-up on the subject: https://lowlevelbits.org/exploring-llvm-bitcode-interactively/

We would love to hear any feedback and are also very happy to receive contributions!

Cheers,
Alex.