[LLVMdev] Basic instructions for LLVM and Control Flow graph extraction
Micah Villmow
micah.villmow at smachines.com
Tue Jul 9 14:06:19 PDT 2013
This isn't by itself too difficult, as I have done something similar recently, but does require some modifications of LLVM.
The basic algorithm is simple:
For each ISA instruction, create a new MachineInstr and add it to the current MachineBasicBlock.
At each branch instruction, add it to the current MBB and add it to a list and create a new MBB.
After creating your list of MBB, iterate through them and reconnect the successors based on branches and fall throughs.
The problem is that what you are producing has no connection to the IR, and there are parts of LLVM that expect that link, specifically the printing/CFG dumping functions.
From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Clay J
Sent: Tuesday, July 09, 2013 10:36 AM
To: llvmdev at cs.uiuc.edu
Subject: [LLVMdev] Basic instructions for LLVM and Control Flow graph extraction
I am currently attempting to learn how to use LLVM for control flow graph extraction on linux (Ubuntu). Basically, I need to be able to break down specific basic functions blocks from assembly code, and use it to make a CFG.
Do any of you upstanding human beings have any knowledge or resources that could possibly assist me in this task?
I apologize if this is a very basic question. I have already installed the proper files/programs.
Thank you in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130709/7eb90f70/attachment.html>
More information about the llvm-dev
mailing list