[LLVMdev] Building a data flow graph from instructions in BasicBlock

Krzysztof Parzyszek kparzysz at codeaurora.org
Sun Nov 4 08:18:10 PST 2012

On 11/4/2012 12:19 AM, janarbek wrote:
> 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.

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.


Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
hosted by The Linux Foundation

More information about the llvm-dev mailing list