[cfe-dev] Exploring LLVM Bitcode interatively

Alex Denisov via cfe-dev cfe-dev at lists.llvm.org
Fri Feb 28 02:05:58 PST 2020

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 <https://github.com/ShiftLeftSecurity/llvm2graphml>
Here is a short write-up on the subject: https://lowlevelbits.org/exploring-llvm-bitcode-interactively/ <https://lowlevelbits.org/exploring-llvm-bitcode-interactively/>

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20200228/5934f91e/attachment.html>

More information about the cfe-dev mailing list