<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:m="http://schemas.microsoft.com/office/2004/12/omml" 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 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","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.apple-converted-space
        {mso-style-name:apple-converted-space;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@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]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Hello Nadav,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Thanks, once again, for your attentiveness!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I had added the documentation just ahead of each function body, using X86PadShortFunction.cpp and X86VZeroUpper.cpp as models.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I will move the comments for the functions in X86FixupLEAs.cpp to precede the initial declarations.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Preston<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Nadav Rotem [mailto:nrotem@apple.com]
<br>
<b>Sent:</b> Thursday, April 25, 2013 4:51 PM<br>
<b>To:</b> Gurd, Preston<br>
<b>Cc:</b> llvm-commits@cs.uiuc.edu<br>
<b>Subject:</b> Re: [llvm] r180573 - This patch adds the X86FixupLEAs pass, which will reduce instruction<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">+<br>
+    virtual const char *getPassName() const { return "X86 Atom LEA Fixup";}<br>
+    void  seekLEAFixup(MachineOperand& p, MachineBasicBlock::iterator& I,<br>
+                      MachineFunction::iterator MFI);<br>
+    void processInstruction(MachineBasicBlock::iterator& I,<br>
+                            MachineFunction::iterator MFI);<br>
+    RegUsageState usesRegister(MachineOperand& p,<br>
+                               MachineBasicBlock::iterator I);<br>
+    MachineBasicBlock::iterator searchBackwards(MachineOperand& p,<br>
+                                                MachineBasicBlock::iterator& I,<br>
+                                                MachineFunction::iterator MFI);<br>
+    MachineInstr* postRAConvertToLEA(MachineFunction::iterator &MFI,<br>
+                                     MachineBasicBlock::iterator &MBBI,<br>
+                                     LiveVariables *LV) const;<br>
+<o:p></o:p></p>
</div>
</blockquote>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Can you please document the declarations of these functions ?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">( see <a href="http://llvm.org/docs/CodingStandards.html#doxygen-use-in-documentation-comments">
http://llvm.org/docs/CodingStandards.html#doxygen-use-in-documentation-comments</a> )<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal"><br>
+<br>
+/// postRAConvertToLEA - if an instruction can be converted to an<span class="apple-converted-space"> </span><br>
+/// equivalent LEA, insert the new instruction into the basic block<br>
+/// and return a pointer to it. Otherwise, return zero.<br>
+MachineInstr *<br>
+FixupLEAPass::postRAConvertToLEA(MachineFunction::iterator &MFI,<br>
+                                 MachineBasicBlock::iterator &MBBI,<br>
+                                 LiveVariables *LV) const {<o:p></o:p></p>
</div>
</blockquote>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Preston,  LiveVariables are not available in this phase and it is only confusing.  Please remove them from the code. <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">+  LV = getAnalysisIfAvailable<LiveVariables>();  <----- this will always return 0.  Did you ever get a LiveVariable instance ?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">+  // Process all basic blocks.<br>
+  for (MachineFunction::iterator I = Func.begin(), E = Func.end(); I != E; ++I)<br>
+    processBasicBlock(Func, I);<br>
+  DEBUG(dbgs() << "End X86FixupLEAs\n";);<br>
+<br>
+  return true;<br>
+}<o:p></o:p></p>
</div>
</blockquote>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">This function always returns true.  You probably only want to return true of the code changed. <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
<div>
<p class="MsoNormal">Can you reduce the size of the test cases ?  Ideally I would like to see a single-basic block function. You only need 5-instructions or so. Why did you include such long tests ?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</body>
</html>