I want to build a DFG from instructions in a basic block. I couldn’t find a function to find the depenencies between instructions. How can i do that ?
Look into ScheduleDAG. It's a part of the scheduling infrastructure, but you can use it to build a dependency graph.
I will look at it. Is there any class that I should look at it ? What about Dataflow.h ?
Since I am kind of new, I want to know which classes can help me quicker.
Phone : 82-42-860-1838
Fax : 82-42-860-6790
Cell Phone: 82-10-7599-1981
— On Sat, 11/3/12, Krzysztof Parzyszek firstname.lastname@example.org wrote:
> From: Krzysztof Parzyszek email@example.com
> Subject: Re: [LLVMdev] Building a data flow graph from instructions in BasicBlock
> To: firstname.lastname@example.org
> Date: Saturday, November 3, 2012, 5:25 PM
> On 11/3/2012 6:35 PM, janarbek wrote:
> > Hi All,
> > I want to build a DFG from instructions in a basic block. I couldn’t
> > find a function to find the depenencies between instructions. How can i
> > do that ?
> Look into ScheduleDAG. It’s a part of the scheduling infrastructure, but you can use it to build a dependency graph.
> – Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
> LLVM Developers mailing list
> LLVMdev@cs.uiuc.edu http://llvm.cs.uiuc.edu
There is a class ScheduleDAGInstrs, which contains function "buildSchedGraph". This is the one that will build a graph of SUnits (i.e. scheduling units), which correspond to machine instructions (at least in practice).
The way I've used it in the past for non-scheduling purposes was to create a fake scheduler, which didn't do any scheduling, but still built the dependency graph. I only used it in an experimental code and my code was quick-and-dirty, so there may be better ways of getting it.
Check the schedulers, for example MachineScheduler.cpp, for how ScheduleDAGInstrs is created and how it's used. ScheduleDAGMI is a subclass of ScheduleDAGInstrs and the member function "schedule" builds the graph.