<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 8/19/11 12:58 PM, Kodakara, Sreekumar V wrote:
<blockquote
cite="mid:16E8F37F0444C34FB5098B0061DFF0321F70D753@rrsmsx502.amr.corp.intel.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<meta name="Generator" content="Microsoft Word 12 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal">Hi All,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I am creating an instrumentation pass using
LLVM libraries. I am using clang++ (version 2.9) to compile
cpp code into LLVM bit code. When I generate the llvm bit code
using clang++ using –O3, I get many instances of instructions
that look like the following.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">br i1 icmp ne (i8* bitcast (i32 (i32)*
@pthread_cancel to i8*), i8* null), label %bb23, label %bb25<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Here three LLVM instructions are used in
one instruction, namely br, icmp and bitcast. Is there a way
to tell clang++ to break the operand of br into 3 separate
instructions or a pass that exists that does it. Ideally, I
would like to see the following</p>
</div>
</blockquote>
<br>
There is a pass in SAFECode that breaks constant expression GEPs
into GEP instructions. Since some constant expression GEPs are
casted using constant expression casts, it will also convert cast
constant expressions into cast instructions as needed. You should
be able to easily modify the code to do what you need.<br>
<br>
You can find the code at
<a class="moz-txt-link-freetext" href="http://llvm.org/viewvc/llvm-project/safecode/trunk/lib/ArrayBoundChecks/BreakConstantGEPs.cpp?view=log">http://llvm.org/viewvc/llvm-project/safecode/trunk/lib/ArrayBoundChecks/BreakConstantGEPs.cpp?view=log</a>
(i.e., lib/ArrayBoundsChecks/BreakConstantGEPs.cpp in the SAFECode
project). The code written for LLVM 2.7 and may need minor changes
to compile against mainline LLVM, but that should not be too hard.<br>
<br>
-- John T.<br>
<br>
<blockquote
cite="mid:16E8F37F0444C34FB5098B0061DFF0321F70D753@rrsmsx502.amr.corp.intel.com"
type="cite">
<div class="WordSection1">
<p class="MsoNormal"><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I8* tmp0 = i8* bitcast (i32 (i32)*
@pthread_cancel to i8*<o:p></o:p></p>
<p class="MsoNormal">I1 tmp = icmp ne i8* tmp0, i8* null <o:p></o:p></p>
<p class="MsoNormal">br i1 tmp, label %bb23, label %bb25<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks<o:p></o:p></p>
<p class="MsoNormal">Sreekumar<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a class="moz-txt-link-freetext" href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
</pre>
</blockquote>
<br>
</body>
</html>