Building a data flow graph from instructions in BasicBlock

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.

-Krzysztof

Thanks Kryzstof,


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 kparzysz@codeaurora.org wrote:


> From: Krzysztof Parzyszek kparzysz@codeaurora.org
> Subject: Re: [LLVMdev] Building a data flow graph from instructions in BasicBlock
> To: llvmdev@cs.uiuc.edu
> 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.
>
> -Krzysztof
>
> – 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
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev


|

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.

-Krzysztof