<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 2/15/16 8:57 PM, xiaohui chen via
cfe-dev wrote:<br>
</div>
<blockquote
cite="mid:CALpPt09h2d2TXC=uDy-0qOVRa2Zy8wDW9ZBn9kzoWJO-k+E3Rg@mail.gmail.com"
type="cite">
<meta http-equiv="Context-Type" content="text/html; charset=UTF-8">
<div dir="ltr">Dear All:
<div><br>
</div>
<div><span>I am working on Clang/LLVM and interested to know if
there is a programmatic way to extract the CFG of a specific</span></div>
<div><span>node in AST like a for loop? </span></div>
<div><span><br>
</span></div>
<div><span> I am aware of </span><code>-emit-llvm</code><span>option,
but it will apply on the whole TU.</span><span><br>
</span></div>
<div><span><br>
</span></div>
<div><span>For example,</span></div>
<div><span>we could use </span><span class="">CFG</span><span
class="">::</span><span class="">buildCFG to extract the
source level CFG of a specific node.</span></div>
<div><span class="">Is there a counterpart API to extract the
LLVM IR level CFG of a specific node?</span></div>
</div>
</blockquote>
<br>
The LLVM IR expresses each function as a set of basic blocks with an
explicit CFG. In other words, the LLVM IR encodes the CFG of each
function explicitly. If you have the LLVM IR of a function, you
already have the CFG.<br>
<br>
Regards,<br>
<br>
John Criswell<br>
<br>
<blockquote
cite="mid:CALpPt09h2d2TXC=uDy-0qOVRa2Zy8wDW9ZBn9kzoWJO-k+E3Rg@mail.gmail.com"
type="cite">
<div dir="ltr">
<div><span class=""><br>
</span></div>
<div><span class="">Sincerely</span></div>
<div><span class="">xiaohui</span></div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
cfe-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a>
</pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
<a class="moz-txt-link-freetext" href="http://www.cs.rochester.edu/u/criswell">http://www.cs.rochester.edu/u/criswell</a></pre>
</body>
</html>