Hi Kameshwar, <br><br>You're best off sending emails such as this to the LLVM developers mailing list (<a href="mailto:llvmdev@cs.uiuc.edu">llvmdev@cs.uiuc.edu</a>). You'll reach a much wider audience.<br><br>The PBQPRegAlloc::buildInterferenceMatrix method constructs a PBQP cost matrix representing a single interference constraint, which doesn't sound like what you want. It is only used by the PBQP allocator (-regalloc=pbqp), whereas LLVM uses linear scan by default (-regalloc=linscan). That's why you're not seeing it called.<br>
<br>LLVM does not currently have an interference graph as such, because we do not have a graph coloring register allocator. You can get the same information from the LiveIntervals pass though. The LiveIntervals pass holds a set of LiveInterval objects, one for each register (both virtual and physical) that is live in the function. Each LiveInterval object describes the set of instructions for which its register is live. The LiveInterval::overlaps method will tell you whether or not two intervals overlap, which means the registers for those intervals interfere.<br>
(One caution: LiveInterval::overlaps currently triggers an assertion if the interval passed as a parameter is empty. You'll want to explicitly skip testing of empty intervals. They can just be treated as non-interfering.)<br>
<br>To sum up, you probably want something like this:<br><br><div><font class="Apple-style-span" face="'courier new', monospace">LiveIntervals *li_ = &getAnalysis<LiveIntervals>();</font><br><font class="Apple-style-span" face="'courier new', monospace">for (LiveIntervals::iterator liItr = li_->begin(), </font><span class="Apple-style-span" style="font-family: 'courier new', monospace; ">liEnd = li_->end(); liItr != liEnd; ++liItr) {</span></div>
<div><font class="Apple-style-span" face="'courier new', monospace">  LiveInterval *li = liItr->second;</font></div><div><font class="Apple-style-span" face="'courier new', monospace">  if (li->empty())</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">    continue;</font></div><div><font class="Apple-style-span" face="'courier new', monospace">  for (LiveIntervals::iterator li2Itr = llvm::next(liItr); li2Itr != liEnd; ++liItr) {</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">    LiveInterval *li2 = li2Itr->second;</font></div><div><font class="Apple-style-span" face="'courier new', monospace">    if (li2->empty())</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">      continue;</font></div><div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace">    if (li->overlaps(*li2)) {</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">      // li->reg interferes with li2->reg.</font></div><div><font class="Apple-style-span" face="'courier new', monospace">      // Handle this however you need to.</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">    }</font></div><div><font class="Apple-style-span" face="'courier new', monospace">  }<br>}<br></font><br>Cheers,<br>Lang.<br><br><br>
On Fri, May 7, 2010 at 9:59 PM, kameshwar nayak <<a href="mailto:kameshwar.snayak@gmail.com">kameshwar.snayak@gmail.com</a>> wrote:<br>> Dear Sir,<br>><br>> I am Kameshwar Nayak from India. I am in Final year Engineering.<br>
> We are working on Code-Optimization in a Compiler. We chose LLVM in order to<br>> test our approach. But we are finding it difficult to access the<br>> interference graph generated.<br>><br>> We initially assumed  PBQPRegAlloc::buildInterferenceMatrix() function<br>
> defined in "lib/CodeGen/RegAllocPBQP.cpp" builds interference graph. But we<br>> discovered that the function is not being called during the course of<br>> compilation<br>> Could you please help us to access the interference graph generated.?<br>
><br>> Waiting for your reply<br>><br>> --<br>> Regards,<br>><br>> Kameshwar<br>><br><br></div>