<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:"MS Mincho";
        panose-1:2 2 6 9 4 2 5 8 3 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"\@MS Mincho";
        panose-1:2 2 6 9 4 2 5 8 3 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=purple style='word-wrap: break-word;
-webkit-nbsp-mode: space;-webkit-line-break: after-white-space'>

<div class=Section1>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Chris,<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> I took a look at AnalyzeBranch and I
don’t see how it can solve my problem. The issue itself isn’t with
branching, as I can handle branches fairly well in my custom pass(see the
before and after dot files attached). I can take a bunch of branches and construct
high level control flow for my backend since I have no ability to do goto/jump,
only whileloop and ifs. So analyzing the branch’s isn’t the
problem. The problem comes with emit’ing the code. Even though I’ve
renumbered the blocks and re-ordered the CFG into a more sane control flow. The
code emitter still processes the blocks in the old order. So instead of going
from 0-5, it prints out the instructions in the order, 0, 1, 2, 5, 3, 4. This
is the order that the old CFG is in, not the new one after this pass is done.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>I’ve added this analysis pass as a
PreEmitPass, is this the correct location to implement this? Or should I be
implementing it earlier? Later?<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Thanks for any advice,<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>

<div>

<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>

<hr size=2 width="100%" align=center tabindex=-1>

</span></font></div>

<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>
llvmdev-bounces@cs.uiuc.edu [mailto:llvmdev-bounces@cs.uiuc.edu] <b><span
style='font-weight:bold'>On Behalf Of </span></b>Chris Lattner<br>
<b><span style='font-weight:bold'>Sent:</span></b> Tuesday, October 14, 2008
9:50 AM<br>
<b><span style='font-weight:bold'>To:</span></b> LLVM Developers Mailing List<br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [LLVMdev] CFG
modifcations and code gen</span></font><o:p></o:p></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>

<div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>On Oct 14, 2008, at 9:16 AM, Villmow, Micah wrote:<o:p></o:p></span></font></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><br>
<br>
<o:p></o:p></span></font></p>

<span style='orphans: 2;text-align:auto;widows: 2;-webkit-border-horizontal-spacing: 0px;
-webkit-border-vertical-spacing: 0px;-webkit-text-decorations-in-effect: none;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0;word-spacing:0px'><u1:smarttagtype namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="City"><u1:smarttagtype namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="place"><u1:smarttagtype namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="Street"><u1:smarttagtype namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="address">

<div link=blue vlink=purple style='word-wrap: break-word;-webkit-nbsp-mode: space;
-webkit-line-break: after-white-space'>

<div>

<div>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>But, the branch folding pass, or whatever
passes are supposed to reorder the blocks based on the CFG, are not doing so in
this case. Otherwise there is no way that blocks 2 and 4 should be printing out
before blocks 3 & 5. Renumber blocks just seems to reorder the values based
on their pre-set block number, but when the CFG is modified these number should
modified also to follow the new ordering, which is not occurring.</span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>

</div>

</div>

</div>

</span></u1:smarttagtype></u1:smarttagtype></u1:smarttagtype></u1:smarttagtype>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>

</div>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Did you implement TargetInstrInfo::AnalyzeBranch for your target?
 Check out the large comment above it in TargetInstrInfo.h<o:p></o:p></span></font></p>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>

</div>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>-Chris<o:p></o:p></span></font></p>

</div>

</div>

</body>

</html>