<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:st1="urn:schemas-microsoft-com:office:smarttags" 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]--><o:SmartTagType
namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="City"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
name="place"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
name="Street"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
name="address"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</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'>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. <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>Dale Johannesen<br>
<b><span style='font-weight:bold'>Sent:</span></b> Monday, October 13, 2008
5:28 PM<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 13, 2008, at 5:14 PMPDT, 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>
<div>
<div>
<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:black'>As stated in an earlier email, I am
working on getting break/continue to work correctly for my backend, but I ran
into another issue with codegen and the CFG. It seems that code gen is not done
based on the CFG, but rather on the block numbers, and the function call
MachineFunction::RenumberBlocks doesn’t renumber the blocks based on the
CFG. So how can I modify the CFG so that when codegen occurs, it follows the
graph and not just does a linear scan over the MachineBasicBlock vector?</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>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>It's not intended to work that way. The BranchFolding pass, which
runs later, is responsible for rearranging things into a more reasonable order.<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>
<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt' type=cite><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>
<div>
<div>
<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:black'>In the attached dot file, block 2 gets
printed before block 3 and 5 and block 4 gets printed between blocks 3 and 5.
This obviously is not what the CFG is saying it should be done. The code
I’m using to do this transformation, which takes 2 & 4 and places
them after block 5 is:<u1:p></u1:p></span></font><font color=black><span
style='color:black'><o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal style='text-indent:.5in'><font size=2 color=black
face=Arial><span style='font-size:10.0pt;font-family:Arial;color:black'>
MachineBasicBlock* newExitPath = findLowestNumSuccBB(root);<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:black'>
pHigh->addSuccessor(newExitPath);<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:black'>
root->removeSuccessor(newExitPath);<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:black'>
root->CorrectExtraCFGEdges(*root->succ_begin(), NULL, false);<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:black'>
pHigh->CorrectExtraCFGEdges(*pHigh->succ_begin(), newExitPath, false);<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:black'>
newExitPath->moveAfter(pHigh);<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:black'>
root->getParent()->RenumberBlocks();<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:black'><u1:p> </u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:black'>So what am I doing wrong?<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:black'><u1:p> </u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:black'>Thanks,<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:black'><u1:p> </u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:black'><u1:p> </u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:black'>Micah Villmow<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:black'>Systems Engineer<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:black'>Advanced Technology & Performance<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:black'>Advanced Micro Devices Inc.<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><ns0:street u2:insauthor="Micah Villmow" u2:insdate="2008-10-13T17:09:00Z" u2:endinsauthor="Micah Villmow" u2:endinsdate="2008-10-13T17:09:00Z"><ns0:address u2:insauthor="Micah Villmow" u2:insdate="2008-10-13T17:09:00Z" u2:endinsauthor="Micah Villmow" u2:endinsdate="2008-10-13T17:09:00Z"><st1:street u2:st="on"><st1:address u2:st="on"><st1:Street
w:st="on"><st1:address w:st="on"><font size=2 color=black face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:black'>4555 Great America Pkwy</st1:address></st1:street></ns0:address></ns0:street></span></font></st1:address></st1:Street><font
size=2 color=black face=Arial><span style='font-size:10.0pt;font-family:Arial;
color:black'>,<u1:p></u1:p></span></font><font color=black><span
style='color:black'><o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><ns0:place u2:insauthor="Micah Villmow" u2:insdate="2008-10-13T17:09:00Z" u2:endinsauthor="Micah Villmow" u2:endinsdate="2008-10-13T17:09:00Z"><ns0:city u2:insauthor="Micah Villmow" u2:insdate="2008-10-13T17:09:00Z" u2:endinsauthor="Micah Villmow" u2:endinsdate="2008-10-13T17:09:00Z"><st1:city u2:st="on"><st1:place u2:st="on"><st1:City
w:st="on"><st1:place w:st="on"><font size=2 color=black face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:black'>Santa Clara</st1:place></st1:city></ns0:city></ns0:place></span></font></st1:place></st1:City><font
size=2 color=black face=Arial><span style='font-size:10.0pt;font-family:Arial;
color:black'>, CA. 95054<u1:p></u1:p></span></font><font color=black><span
style='color:black'><o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:black'>P: 408-572-6219<u1:p></u1:p></span></font><font
color=black><span style='color:black'><o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:black'>F: 408-572-6596</span></font><font
color=black><span style='color:black'><u1:p></u1:p><o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt;color:black'><u1:p> </u1:p><o:p></o:p></span></font></p>
</div>
</div>
</div>
</blockquote>
</div>
</span></u1:smarttagtype></u1:smarttagtype></u1:smarttagtype></u1:smarttagtype></div>
</body>
</html>