<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Dear Irini,<br>
<br>
I wrote a pass for SAFECode that converts constant expressions
into instructions. It is the BreakConstantGEP pass in SAFECode
(<a class="moz-txt-link-freetext" href="http://llvm.org/viewvc/llvm-project/safecode/branches/release_32/lib/ArrayBoundChecks/BreakConstantGEPs.cpp?view=log">http://llvm.org/viewvc/llvm-project/safecode/branches/release_32/lib/ArrayBoundChecks/BreakConstantGEPs.cpp?view=log</a>).
SAFECode has to change these to instructions because it needs to
modify their results at run-time; you can update the code to a
newer version of LLVM and use it if you wish.<br>
<br>
That said, converting constant expressions into instructions is
almost always a bad idea. The compiler takes advantage of the
fact that constant expressions are, well, constant to generate
more efficient code. You should only convert constant expressions
into instructions if you're going to make the constant
non-constant (which is what SAFECode does). If you're trying to
analyze LLVM IR, you should enhance your pass to understand
constant expressions.<br>
<br>
Regards,<br>
<br>
John Criswell<br>
<br>
<br>
On 10/16/15 5:44 AM, Irini Stavrakantonaki via llvm-dev wrote:<br>
</div>
<blockquote cite="mid:5620C6EF.3000909@ics.forth.gr" type="cite">
<meta http-equiv="Context-Type" content="text/html; charset=utf-8">
<div class="post-text" itemprop="text">
<p>Is there any pass that breaks an expression out of an
instruction's operand into its own instruction, so that such
nested instructions become explicit and are thus easier to
work with in?</p>
<p>e.g Following<span class="Apple-converted-space"> </span><code>call</code><span
class="Apple-converted-space"> </span>instruction contains a<span
class="Apple-converted-space"> </span><code>GEP</code><span
class="Apple-converted-space"> </span>instruction as its
first operand. Is there any pass which allows me to break up
this:</p>
<pre><code> %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str4, i32 0, i32 0), i32 %tmp6)
</code></pre>
<p>into these:</p>
<pre><code>%tmp = i8* getelementptr inbounds ([4 x i8]* @.str4, i32 0, i32 0)
%call = call i32 (i8*, ...)* @printf(i8* %tmp, i32 %tmp6)
</code></pre>
<p>?</p>
</div>
Thank you in advance,<br>
<br>
--istavrak<br class="Apple-interchange-newline">
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-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>