<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; ">Hi,<DIV><BR class="khtml-block-placeholder"></DIV><DIV>The patch seems pretty safe to me. The only thing I am not sure about is:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><BLOCKQUOTE type="cite"><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Index: lib/CodeGen/RegAllocLinearScan.cpp</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">===================================================================</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">RCS file: /var/cvs/llvm/llvm/lib/CodeGen/RegAllocLinearScan.cpp,v</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">retrieving revision 1.148</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">diff -u -r1.148 RegAllocLinearScan.cpp</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">--- lib/CodeGen/RegAllocLinearScan.cpp<SPAN class="Apple-tab-span" style="white-space:pre; color: rgb(0, 0, 221); ">        </SPAN>3 May 2007 01:11:53 -0000<SPAN class="Apple-tab-span" style="white-space:pre; color: rgb(0, 0, 221); ">  </SPAN>1.148</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+++ lib/CodeGen/RegAllocLinearScan.cpp<SPAN class="Apple-tab-span" style="white-space:pre; color: rgb(0, 0, 221); ">    </SPAN>6 May 2007 22:44:13 -0000</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">@@ -96,6 +96,7 @@</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR style=""></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">     virtual void getAnalysisUsage(AnalysisUsage &AU) const {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">       AU.addRequired<LiveIntervals>();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+      AU.addRequiredID(SimpleRegisterCoalescingID);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">       MachineFunctionPass::getAnalysisUsage(AU);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">     }</DIV></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV><DIV>and</DIV><DIV><BR class="khtml-block-placeholder"></DIV><BLOCKQUOTE type="cite">+  RegisterPass<SimpleRegisterCoalescing> <DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+  X("simple-register-coalescing",</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+    "Simple register coalescing to eliminate all possible register copies");</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+const PassInfo *llvm::SimpleRegisterCoalescingID = X.getPassInfo();</DIV></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV>It's not clear to me if this is the right way to model this pass. After all, this is not an analysis pass. Perhaps the right thing to do is to model this after the register allocator. Add a createRegisterCoalescer() to Passes.cpp which would allow us to choose the one we want. Then register the pass in LLVMTargetMachine.cpp. Chris? What do you say?<DIV><DIV><BR class="khtml-block-placeholder"></DIV>Evan<BR><DIV><BR><DIV><DIV>On May 6, 2007, at 5:11 PM, David A. Greene wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-----BEGIN PGP SIGNED MESSAGE-----</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Hash: SHA1</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">This patch splits LiveIntervalAnalysis into separate live interval</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">analysis and register coalescing phases to facilitate development</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">of new register allocators and coalescing schemes.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">It passes all tests that do not also fail in the official, unmodified</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">source tree.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">                                 </SPAN>-Dave</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-----BEGIN PGP SIGNATURE-----</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Version: GnuPG v1.4.6 (GNU/Linux)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Comment: Using GnuPG with Mozilla - <A href="http://enigmail.mozdev.org">http://enigmail.mozdev.org</A></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">iD8DBQFGPm6UgQsI8xjTYs8RAtTvAJ9efdVrb/trR4bjefy0WZr0X8fWkgCfTSuY</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">wxN0IVt8qNJLbhjloBxfZkU=</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">=sCDD</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-----END PGP SIGNATURE-----</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Index: include/llvm/CodeGen/LiveIntervalAnalysis.h</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">===================================================================</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">RCS file: /var/cvs/llvm/llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h,v</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">retrieving revision 1.84</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">diff -u -r1.84 LiveIntervalAnalysis.h</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">--- include/llvm/CodeGen/LiveIntervalAnalysis.h<SPAN class="Apple-tab-span" style="white-space:pre">   </SPAN>6 May 2007 13:37:16 -0000<SPAN class="Apple-tab-span" style="white-space:pre">   </SPAN>1.84</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+++ include/llvm/CodeGen/LiveIntervalAnalysis.h<SPAN class="Apple-tab-span" style="white-space:pre">     </SPAN>6 May 2007 22:44:12 -0000</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">@@ -44,7 +44,7 @@</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">     </SPAN>/// MBB2IdxMap - The index of the first instruction in the specified basic</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">     </SPAN>/// block.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">     </SPAN>std::vector<unsigned> MBB2IdxMap;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">     </SPAN>typedef std::map<MachineInstr*, unsigned> Mi2IndexMap;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">     </SPAN>Mi2IndexMap mi2iMap_;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">@@ -54,31 +54,12 @@</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">     </SPAN>typedef std::map<unsigned, LiveInterval> Reg2IntervalMap;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">     </SPAN>Reg2IntervalMap r2iMap_;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>typedef IndexedMap<unsigned> Reg2RegMap;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>Reg2RegMap r2rMap_;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">     </SPAN>BitVector allocatableRegs_;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>DenseMap<const TargetRegisterClass*, BitVector> allocatableRCRegs_;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>/// JoinedLIs - Keep track which register intervals have been coalesced</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>/// with other intervals.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>BitVector JoinedLIs;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">   </SPAN>public:</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">     </SPAN>static char ID; // Pass identification, replacement for typeid</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">     </SPAN>LiveIntervals() : MachineFunctionPass((intptr_t)&ID) {}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>struct CopyRec {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>MachineInstr *MI;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>unsigned SrcReg, DstReg;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>};</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>CopyRec getCopyRec(MachineInstr *MI, unsigned SrcReg, unsigned DstReg) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>CopyRec R;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>R.MI = MI;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>R.SrcReg = SrcReg;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>R.DstReg = DstReg;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>return R;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">     </SPAN>struct InstrSlots {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">       </SPAN>enum {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">         </SPAN>LOAD<SPAN class="Apple-converted-space">  </SPAN>= 0,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">@@ -158,29 +139,31 @@</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">              </SPAN>"index does not correspond to an instruction");</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">       </SPAN>return i2miMap_[index];</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">     </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>std::vector<LiveInterval*> addIntervalsForSpills(const LiveInterval& i,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">                                                    </SPAN>VirtRegMap& vrm,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">                                                    </SPAN>int slot);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// Interval creation</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>LiveInterval &getOrCreateInterval(unsigned reg) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>Reg2IntervalMap::iterator I = r2iMap_.find(reg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>if (I == r2iMap_.end())</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>I = r2iMap_.insert(I, std::make_pair(reg, createInterval(reg)));</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>return I->second;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">     </SPAN>/// CreateNewLiveInterval - Create a new live interval with the given live</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">     </SPAN>/// ranges. The new live interval will have an infinite spill weight.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">     </SPAN>LiveInterval &CreateNewLiveInterval(const LiveInterval *LI,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">                                         </SPAN>const std::vector<LiveRange> &LRs);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>virtual void getAnalysisUsage(AnalysisUsage &AU) const;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>virtual void releaseMemory();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>std::vector<LiveInterval*> addIntervalsForSpills(const LiveInterval& i,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">                                                    </SPAN>VirtRegMap& vrm,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">                                                    </SPAN>int slot);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>/// runOnMachineFunction - pass entry point</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>virtual bool runOnMachineFunction(MachineFunction&);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// Interval removal</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>/// print - Implement the dump method.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>virtual void print(std::ostream &O, const Module* = 0) const;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>void print(std::ostream *O, const Module* M = 0) const {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>if (O) print(*O, M);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>void removeInterval(unsigned Reg) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>r2iMap_.erase(Reg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">     </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>private:</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">     </SPAN>/// isRemoved - returns true if the specified machine instr has been</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">     </SPAN>/// removed.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">     </SPAN>bool isRemoved(MachineInstr* instr) const {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">@@ -198,40 +181,22 @@</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">         </SPAN>mi2iMap_.erase(mi2i);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">       </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">     </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">     </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>/// computeIntervals - Compute live intervals.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>void computeIntervals();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>/// joinIntervals - join compatible live intervals</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>void joinIntervals();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>virtual void getAnalysisUsage(AnalysisUsage &AU) const;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>virtual void releaseMemory();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>/// CopyCoallesceInMBB - Coallsece copies in the specified MBB, putting</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>/// copies that cannot yet be coallesced into the "TryAgain" list.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>void CopyCoallesceInMBB(MachineBasicBlock *MBB,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">                        </SPAN>std::vector<CopyRec> *TryAgain, bool PhysOnly = false);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>/// JoinCopy - Attempt to join intervals corresponding to SrcReg/DstReg,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>/// which are the src/dst of the copy instruction CopyMI.<SPAN class="Apple-converted-space">  </SPAN>This returns true</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>/// if the copy was successfully coallesced away, or if it is never possible</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>/// to coallesce these this copy, due to register constraints.<SPAN class="Apple-converted-space">  </SPAN>It returns</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>/// false if it is not currently possible to coallesce this interval, but</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>/// it may be possible if other things get coallesced.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>bool JoinCopy(MachineInstr *CopyMI, unsigned SrcReg, unsigned DstReg,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">                  </SPAN>bool PhysOnly = false);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>/// JoinIntervals - Attempt to join these two intervals.<SPAN class="Apple-converted-space">  </SPAN>On failure, this</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>/// returns false.<SPAN class="Apple-converted-space">  </SPAN>Otherwise, if one of the intervals being joined is a</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>/// physreg, this method always canonicalizes DestInt to be it.<SPAN class="Apple-converted-space">  </SPAN>The output</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>/// "SrcInt" will not have been modified, so we can use this information</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>/// below to update aliases.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>bool JoinIntervals(LiveInterval &LHS, LiveInterval &RHS);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>/// SimpleJoin - Attempt to join the specified interval into this one. The</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>/// caller of this method must guarantee that the RHS only contains a single</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>/// value number and that the RHS is not defined by a copy from this</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>/// interval.<SPAN class="Apple-converted-space">  </SPAN>This returns false if the intervals are not joinable, or it</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>/// joins them and returns true.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>bool SimpleJoin(LiveInterval &LHS, LiveInterval &RHS);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>/// runOnMachineFunction - pass entry point</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>virtual bool runOnMachineFunction(MachineFunction&);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>/// print - Implement the dump method.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>virtual void print(std::ostream &O, const Module* = 0) const;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>void print(std::ostream *O, const Module* M = 0) const {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>if (O) print(*O, M);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>private: <SPAN class="Apple-converted-space">     </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>/// computeIntervals - Compute live intervals.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>void computeIntervals();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">     </SPAN>/// handleRegisterDef - update intervals for a register def</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">     </SPAN>/// (calls handlePhysicalRegisterDef and</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">@@ -260,53 +225,8 @@</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">                               </SPAN>unsigned MIIdx,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">                               </SPAN>LiveInterval &interval, bool isAlias = false);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>/// Return true if the two specified registers belong to different</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>/// register classes.<SPAN class="Apple-converted-space">  </SPAN>The registers may be either phys or virt regs.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>bool differingRegisterClasses(unsigned RegA, unsigned RegB) const;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>bool AdjustCopiesBackFrom(LiveInterval &IntA, LiveInterval &IntB,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">                              </SPAN>MachineInstr *CopyMI);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>/// lastRegisterUse - Returns the last use of the specific register between</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>/// cycles Start and End. It also returns the use operand by reference. It</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>/// returns NULL if there are no uses.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>MachineInstr *lastRegisterUse(unsigned Reg, unsigned Start, unsigned End,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">                                  </SPAN>MachineOperand *&MOU);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>/// findDefOperand - Returns the MachineOperand that is a def of the specific</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>/// register. It returns NULL if the def is not found.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>MachineOperand *findDefOperand(MachineInstr *MI, unsigned Reg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>/// unsetRegisterKill - Unset IsKill property of all uses of the specific</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>/// register of the specific instruction.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>void unsetRegisterKill(MachineInstr *MI, unsigned Reg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>/// hasRegisterDef - True if the instruction defines the specific register.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>///</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>bool hasRegisterDef(MachineInstr *MI, unsigned Reg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">     </SPAN>static LiveInterval createInterval(unsigned Reg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>void removeInterval(unsigned Reg) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>r2iMap_.erase(Reg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>LiveInterval &getOrCreateInterval(unsigned reg) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>Reg2IntervalMap::iterator I = r2iMap_.find(reg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>if (I == r2iMap_.end())</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>I = r2iMap_.insert(I, std::make_pair(reg, createInterval(reg)));</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>return I->second;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>/// rep - returns the representative of this register</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>unsigned rep(unsigned Reg) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>unsigned Rep = r2rMap_[Reg];</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>if (Rep)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>return r2rMap_[Reg] = rep(Rep);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>return Reg;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">     </SPAN>void printRegName(unsigned reg) const;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">   </SPAN>};</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Index: include/llvm/CodeGen/Passes.h</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">===================================================================</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">RCS file: /var/cvs/llvm/llvm/include/llvm/CodeGen/Passes.h,v</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">retrieving revision 1.24</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">diff -u -r1.24 Passes.h</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">--- include/llvm/CodeGen/Passes.h<SPAN class="Apple-tab-span" style="white-space:pre">  </SPAN>29 Nov 2006 07:31:23 -0000<SPAN class="Apple-tab-span" style="white-space:pre">  </SPAN>1.24</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+++ include/llvm/CodeGen/Passes.h<SPAN class="Apple-tab-span" style="white-space:pre">   </SPAN>6 May 2007 22:44:13 -0000</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">@@ -44,6 +44,11 @@</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">   </SPAN>///</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">   </SPAN>extern const PassInfo *PHIEliminationID;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>/// SimpleRegisterCoalescing pass.<SPAN class="Apple-converted-space">  </SPAN>Aggressively coalesces every register</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>/// copy it can.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>///</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>extern const PassInfo *SimpleRegisterCoalescingID;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">   </SPAN>/// TwoAddressInstruction pass - This pass reduces two-address instructions to</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">   </SPAN>/// use two operands. This destroys SSA information but it is desired by</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">   </SPAN>/// register allocators.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Index: include/llvm/CodeGen/SimpleRegisterCoalescing.h</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">===================================================================</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">RCS file: include/llvm/CodeGen/SimpleRegisterCoalescing.h</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">diff -N include/llvm/CodeGen/SimpleRegisterCoalescing.h</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">--- /dev/null<SPAN class="Apple-tab-span" style="white-space:pre">      </SPAN>1 Jan 1970 00:00:00 -0000</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+++ include/llvm/CodeGen/SimpleRegisterCoalescing.h<SPAN class="Apple-tab-span" style="white-space:pre">    </SPAN>6 May 2007 22:44:13 -0000</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">@@ -0,0 +1,156 @@</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+//===-- SimpleRegisterCoalescing.h - Register Coalescing --------*- C++ -*-===//</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+//</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+// <SPAN class="Apple-converted-space">                    </SPAN>The LLVM Compiler Infrastructure</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+//</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+// This file was developed by the LLVM research group and is distributed under</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+// the University of Illinois Open Source License. See LICENSE.TXT for details.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+//</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+//===----------------------------------------------------------------------===//</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+//</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+// This file implements a simple register copy coalescing phase.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+//</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+//===----------------------------------------------------------------------===//</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+#ifndef LLVM_CODEGEN_SIMPLE_REGISTER_COALESCING_H</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+#define LLVM_CODEGEN_SIMPLE_REGISTER_COALESCING_H</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+#include "llvm/CodeGen/MachineFunctionPass.h"</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+#include "llvm/CodeGen/LiveInterval.h"</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+#include "llvm/CodeGen/LiveIntervalAnalysis.h"</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+#include "llvm/ADT/BitVector.h"</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+#include "llvm/ADT/IndexedMap.h"</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+namespace llvm {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>class LiveVariables;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>class MRegisterInfo;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>class TargetInstrInfo;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>class VirtRegMap;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>class SimpleRegisterCoalescing : public MachineFunctionPass {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>MachineFunction* mf_;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>const TargetMachine* tm_;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>const MRegisterInfo* mri_;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>const TargetInstrInfo* tii_;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>LiveIntervals *li_;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>LiveVariables *lv_;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>typedef IndexedMap<unsigned> Reg2RegMap;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>Reg2RegMap r2rMap_;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>BitVector allocatableRegs_;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>DenseMap<const TargetRegisterClass*, BitVector> allocatableRCRegs_;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>/// JoinedLIs - Keep track which register intervals have been coalesced</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>/// with other intervals.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>BitVector JoinedLIs;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>public:</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>static char ID; // Pass identifcation, replacement for typeid</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>SimpleRegisterCoalescing() : MachineFunctionPass((intptr_t)&ID) {};</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>struct CopyRec {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>MachineInstr *MI;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>unsigned SrcReg, DstReg;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>};</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>CopyRec getCopyRec(MachineInstr *MI, unsigned SrcReg, unsigned DstReg) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>CopyRec R;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>R.MI = MI;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>R.SrcReg = SrcReg;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>R.DstReg = DstReg;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>return R;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>struct InstrSlots {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>enum {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>LOAD<SPAN class="Apple-converted-space">  </SPAN>= 0,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>USE <SPAN class="Apple-converted-space">  </SPAN>= 1,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>DEF <SPAN class="Apple-converted-space">  </SPAN>= 2,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>STORE = 3,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>NUM <SPAN class="Apple-converted-space">  </SPAN>= 4</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>};</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>};</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>virtual void getAnalysisUsage(AnalysisUsage &AU) const;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>virtual void releaseMemory();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>/// runOnMachineFunction - pass entry point</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>virtual bool runOnMachineFunction(MachineFunction&);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>/// print - Implement the dump method.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>virtual void print(std::ostream &O, const Module* = 0) const;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>void print(std::ostream *O, const Module* M = 0) const {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>if (O) print(*O, M);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>private: <SPAN class="Apple-converted-space">     </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>/// joinIntervals - join compatible live intervals</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>void joinIntervals();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>/// CopyCoallesceInMBB - Coallsece copies in the specified MBB, putting</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>/// copies that cannot yet be coallesced into the "TryAgain" list.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>void CopyCoallesceInMBB(MachineBasicBlock *MBB,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">                        </SPAN>std::vector<CopyRec> *TryAgain, bool PhysOnly = false);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>/// JoinCopy - Attempt to join intervals corresponding to SrcReg/DstReg,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>/// which are the src/dst of the copy instruction CopyMI.<SPAN class="Apple-converted-space">  </SPAN>This returns true</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>/// if the copy was successfully coallesced away, or if it is never possible</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>/// to coallesce these this copy, due to register constraints.<SPAN class="Apple-converted-space">  </SPAN>It returns</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>/// false if it is not currently possible to coallesce this interval, but</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>/// it may be possible if other things get coallesced.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>bool JoinCopy(MachineInstr *CopyMI, unsigned SrcReg, unsigned DstReg,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">                  </SPAN>bool PhysOnly = false);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>/// JoinIntervals - Attempt to join these two intervals.<SPAN class="Apple-converted-space">  </SPAN>On failure, this</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>/// returns false.<SPAN class="Apple-converted-space">  </SPAN>Otherwise, if one of the intervals being joined is a</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>/// physreg, this method always canonicalizes DestInt to be it.<SPAN class="Apple-converted-space">  </SPAN>The output</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>/// "SrcInt" will not have been modified, so we can use this information</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>/// below to update aliases.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>bool JoinIntervals(LiveInterval &LHS, LiveInterval &RHS);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>/// SimpleJoin - Attempt to join the specified interval into this one. The</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>/// caller of this method must guarantee that the RHS only contains a single</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>/// value number and that the RHS is not defined by a copy from this</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>/// interval.<SPAN class="Apple-converted-space">  </SPAN>This returns false if the intervals are not joinable, or it</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>/// joins them and returns true.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>bool SimpleJoin(LiveInterval &LHS, LiveInterval &RHS);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>/// Return true if the two specified registers belong to different</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>/// register classes.<SPAN class="Apple-converted-space">  </SPAN>The registers may be either phys or virt regs.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>bool differingRegisterClasses(unsigned RegA, unsigned RegB) const;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>bool AdjustCopiesBackFrom(LiveInterval &IntA, LiveInterval &IntB,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">                              </SPAN>MachineInstr *CopyMI);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>/// lastRegisterUse - Returns the last use of the specific register between</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>/// cycles Start and End. It also returns the use operand by reference. It</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>/// returns NULL if there are no uses.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>MachineInstr *lastRegisterUse(unsigned Reg, unsigned Start, unsigned End,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">                                  </SPAN>MachineOperand *&MOU);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>/// findDefOperand - Returns the MachineOperand that is a def of the specific</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>/// register. It returns NULL if the def is not found.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>MachineOperand *findDefOperand(MachineInstr *MI, unsigned Reg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>/// unsetRegisterKill - Unset IsKill property of all uses of the specific</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>/// register of the specific instruction.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>void unsetRegisterKill(MachineInstr *MI, unsigned Reg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>/// hasRegisterDef - True if the instruction defines the specific register.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>///</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>bool hasRegisterDef(MachineInstr *MI, unsigned Reg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>/// rep - returns the representative of this register</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>unsigned rep(unsigned Reg) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>unsigned Rep = r2rMap_[Reg];</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>if (Rep)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>return r2rMap_[Reg] = rep(Rep);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>return Reg;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>void printRegName(unsigned reg) const;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>};</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+} // End llvm namespace</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+#endif</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Index: lib/CodeGen/LiveIntervalAnalysis.cpp</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">===================================================================</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">RCS file: /var/cvs/llvm/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp,v</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">retrieving revision 1.243</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">diff -u -r1.243 LiveIntervalAnalysis.cpp</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">--- lib/CodeGen/LiveIntervalAnalysis.cpp<SPAN class="Apple-tab-span" style="white-space:pre">   </SPAN>3 May 2007 01:11:53 -0000<SPAN class="Apple-tab-span" style="white-space:pre">   </SPAN>1.243</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+++ lib/CodeGen/LiveIntervalAnalysis.cpp<SPAN class="Apple-tab-span" style="white-space:pre">   </SPAN>6 May 2007 22:44:13 -0000</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">@@ -39,22 +39,15 @@</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space"> </SPAN>STATISTIC(numIntervals, "Number of original intervals");</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space"> </SPAN>STATISTIC(numIntervalsAfter, "Number of intervals after coalescing");</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-STATISTIC(numJoins<SPAN class="Apple-converted-space">    </SPAN>, "Number of interval joins performed");</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-STATISTIC(numPeep <SPAN class="Apple-converted-space">    </SPAN>, "Number of identity moves eliminated after coalescing");</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space"> </SPAN>STATISTIC(numFolded <SPAN class="Apple-converted-space">  </SPAN>, "Number of loads/stores folded into instructions");</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-STATISTIC(numAborts <SPAN class="Apple-converted-space">  </SPAN>, "Number of times interval joining aborted");</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space"> </SPAN>char LiveIntervals::ID = 0;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space"> </SPAN>namespace {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">   </SPAN>RegisterPass<LiveIntervals> X("liveintervals", "Live Interval Analysis");</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>static cl::opt<bool></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>EnableJoining("join-liveintervals",</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">                </SPAN>cl::desc("Coallesce copies (default=true)"),</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">                </SPAN>cl::init(true));</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space"> </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space"> </SPAN>void LiveIntervals::getAnalysisUsage(AnalysisUsage &AU) const {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>AU.addPreserved<LiveVariables>();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">   </SPAN>AU.addRequired<LiveVariables>();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">   </SPAN>AU.addPreservedID(PHIEliminationID);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">   </SPAN>AU.addRequiredID(PHIEliminationID);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">@@ -67,20 +60,8 @@</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">   </SPAN>mi2iMap_.clear();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">   </SPAN>i2miMap_.clear();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">   </SPAN>r2iMap_.clear();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>r2rMap_.clear();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>JoinedLIs.clear();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-static bool isZeroLengthInterval(LiveInterval *li) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>for (LiveInterval::Ranges::const_iterator</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">        </SPAN>i = li->ranges.begin(), e = li->ranges.end(); i != e; ++i)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>if (i->end - i->start > LiveIntervals::InstrSlots::NUM)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>return false;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>return true;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space"> </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space"> </SPAN>/// runOnMachineFunction - Register allocate the whole function</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space"> </SPAN>///</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space"> </SPAN>bool LiveIntervals::runOnMachineFunction(MachineFunction &fn) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">@@ -89,11 +70,7 @@</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">   </SPAN>mri_ = tm_->getRegisterInfo();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">   </SPAN>tii_ = tm_->getInstrInfo();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">   </SPAN>lv_ = &getAnalysis<LiveVariables>();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>r2rMap_.grow(mf_->getSSARegMap()->getLastVirtReg());</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">   </SPAN>allocatableRegs_ = mri_->getAllocatableSet(fn);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>for (MRegisterInfo::regclass_iterator I = mri_->regclass_begin(),</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">        </SPAN>E = mri_->regclass_end(); I != E; ++I)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>allocatableRCRegs_.insert(std::make_pair(*I,mri_->getAllocatableSet(fn, *I)));</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">   </SPAN>// Number MachineInstrs and MachineBasicBlocks.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">   </SPAN>// Initialize MBB indexes to a sentinal.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">@@ -124,99 +101,7 @@</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">     </SPAN>DOUT << "\n";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">   </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// Join (coallesce) intervals if requested.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>if (EnableJoining) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>joinIntervals();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>DOUT << "********** INTERVALS POST JOINING **********\n";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>for (iterator I = begin(), E = end(); I != E; ++I) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>I->second.print(DOUT, mri_);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>DOUT << "\n";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">   </SPAN>numIntervalsAfter += getNumIntervals();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// perform a final pass over the instructions and compute spill</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// weights, coalesce virtual registers and remove identity moves.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>const LoopInfo &loopInfo = getAnalysis<LoopInfo>();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>for (MachineFunction::iterator mbbi = mf_->begin(), mbbe = mf_->end();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">      </SPAN>mbbi != mbbe; ++mbbi) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>MachineBasicBlock* mbb = mbbi;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>unsigned loopDepth = loopInfo.getLoopDepth(mbb->getBasicBlock());</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>for (MachineBasicBlock::iterator mii = mbb->begin(), mie = mbb->end();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">        </SPAN>mii != mie; ) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>// if the move will be an identity move delete it</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>unsigned srcReg, dstReg, RegRep;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>if (tii_->isMoveInstr(*mii, srcReg, dstReg) &&</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">          </SPAN>(RegRep = rep(srcReg)) == rep(dstReg)) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>// remove from def list</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>LiveInterval &RegInt = getOrCreateInterval(RegRep);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>MachineOperand *MO = mii->findRegisterDefOperand(dstReg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>// If def of this move instruction is dead, remove its live range from</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>// the dstination register's live interval.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>if (MO->isDead()) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">          </SPAN>unsigned MoveIdx = getDefIndex(getInstructionIndex(mii));</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">          </SPAN>LiveInterval::iterator MLR = RegInt.FindLiveRangeContaining(MoveIdx);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">          </SPAN>RegInt.removeRange(MLR->start, MoveIdx+1);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">          </SPAN>if (RegInt.empty())</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">            </SPAN>removeInterval(RegRep);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>RemoveMachineInstrFromMaps(mii);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>mii = mbbi->erase(mii);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>++numPeep;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>} else {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>SmallSet<unsigned, 4> UniqueUses;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>for (unsigned i = 0, e = mii->getNumOperands(); i != e; ++i) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">          </SPAN>const MachineOperand &mop = mii->getOperand(i);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">          </SPAN>if (mop.isRegister() && mop.getReg() &&</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">              </SPAN>MRegisterInfo::isVirtualRegister(mop.getReg())) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">            </SPAN>// replace register with representative register</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">            </SPAN>unsigned reg = rep(mop.getReg());</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">            </SPAN>mii->getOperand(i).setReg(reg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">            </SPAN>// Multiple uses of reg by the same instruction. It should not</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">            </SPAN>// contribute to spill weight again.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">            </SPAN>if (UniqueUses.count(reg) != 0)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">              </SPAN>continue;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">            </SPAN>LiveInterval &RegInt = getInterval(reg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">            </SPAN>float w = (mop.isUse()+mop.isDef()) * powf(10.0F, (float)loopDepth);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">            </SPAN>// If the definition instruction is re-materializable, its spill</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">            </SPAN>// weight is half of what it would have been normally unless it's</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">            </SPAN>// a load from fixed stack slot.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">            </SPAN>int Dummy;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">            </SPAN>if (RegInt.remat && !tii_->isLoadFromStackSlot(RegInt.remat, Dummy))</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">              </SPAN>w /= 2;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">            </SPAN>RegInt.weight += w;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">            </SPAN>UniqueUses.insert(reg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">          </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>++mii;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>for (iterator I = begin(), E = end(); I != E; ++I) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>LiveInterval &LI = I->second;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>if (MRegisterInfo::isVirtualRegister(LI.reg)) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>// If the live interval length is essentially zero, i.e. in every live</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>// range the use follows def immediately, it doesn't make sense to spill</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>// it and hope it will be easier to allocate for this li.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>if (isZeroLengthInterval(&LI))</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>LI.weight = HUGE_VALF;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>// Slightly prefer live interval that has been assigned a preferred reg.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>if (LI.preference)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>LI.weight *= 1.01F;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>// Divide the weight of the interval by its size.<SPAN class="Apple-converted-space">  </SPAN>This encourages<SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>// spilling of intervals that are large and have few uses, and</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>// discourages spilling of small intervals with many uses.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>LI.weight /= LI.getSize();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">   </SPAN>DEBUG(dump());</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">   </SPAN>return true;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space"> </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">@@ -240,6 +125,7 @@</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">   </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space"> </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+// Not called?</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space"> </SPAN>/// CreateNewLiveInterval - Create a new live interval with the given live</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space"> </SPAN>/// ranges. The new live interval will have an infinite spill weight.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space"> </SPAN>LiveInterval&</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">@@ -268,7 +154,7 @@</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">       </SPAN>for (unsigned J = 0, e = MI->getNumOperands(); J != e; ++J) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">         </SPAN>MachineOperand &MOp = MI->getOperand(J);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>if (MOp.isRegister() && rep(MOp.getReg()) == LI->reg)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>if (MOp.isRegister() && MOp.getReg() == LI->reg)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">           </SPAN>MOp.setReg(NewVReg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">       </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">     </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">@@ -794,909 +680,6 @@</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">   </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space"> </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// AdjustCopiesBackFrom - We found a non-trivially-coallescable copy with IntA</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// being the source and IntB being the dest, thus this defines a value number</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// in IntB.<SPAN class="Apple-converted-space">  </SPAN>If the source value number (in IntA) is defined by a copy from B,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// see if we can merge these two pieces of B into a single value number,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// eliminating a copy.<SPAN class="Apple-converted-space">  </SPAN>For example:</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-///</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-///<SPAN class="Apple-converted-space">  </SPAN>A3 = B0</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-///<SPAN class="Apple-converted-space">    </SPAN>...</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-///<SPAN class="Apple-converted-space">  </SPAN>B1 = A3<SPAN class="Apple-converted-space">      </SPAN><- this copy</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-///</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// In this case, B0 can be extended to where the B1 copy lives, allowing the B1</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// value number to be replaced with B0 (which simplifies the B liveinterval).</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-///</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// This returns true if an interval was modified.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-///</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-bool LiveIntervals::AdjustCopiesBackFrom(LiveInterval &IntA, LiveInterval &IntB,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">                                        </SPAN>MachineInstr *CopyMI) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>unsigned CopyIdx = getDefIndex(getInstructionIndex(CopyMI));</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// BValNo is a value number in B that is defined by a copy from A.<SPAN class="Apple-converted-space">  </SPAN>'B3' in</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// the example above.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>LiveInterval::iterator BLR = IntB.FindLiveRangeContaining(CopyIdx);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>unsigned BValNo = BLR->ValId;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// Get the location that B is defined at.<SPAN class="Apple-converted-space">  </SPAN>Two options: either this value has</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// an unknown definition point or it is defined at CopyIdx.<SPAN class="Apple-converted-space">  </SPAN>If unknown, we<SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// can't process it.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>unsigned BValNoDefIdx = IntB.getInstForValNum(BValNo);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>if (BValNoDefIdx == ~0U) return false;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>assert(BValNoDefIdx == CopyIdx &&</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">        </SPAN>"Copy doesn't define the value?");</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// AValNo is the value number in A that defines the copy, A0 in the example.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>LiveInterval::iterator AValLR = IntA.FindLiveRangeContaining(CopyIdx-1);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>unsigned AValNo = AValLR->ValId;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// If AValNo is defined as a copy from IntB, we can potentially process this.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// Get the instruction that defines this value number.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>unsigned SrcReg = IntA.getSrcRegForValNum(AValNo);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>if (!SrcReg) return false;<SPAN class="Apple-converted-space">  </SPAN>// Not defined by a copy.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// If the value number is not defined by a copy instruction, ignore it.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// If the source register comes from an interval other than IntB, we can't</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// handle this.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>if (rep(SrcReg) != IntB.reg) return false;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// Get the LiveRange in IntB that this value number starts with.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>unsigned AValNoInstIdx = IntA.getInstForValNum(AValNo);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>LiveInterval::iterator ValLR = IntB.FindLiveRangeContaining(AValNoInstIdx-1);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// Make sure that the end of the live range is inside the same block as</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// CopyMI.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>MachineInstr *ValLREndInst = getInstructionFromIndex(ValLR->end-1);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>if (!ValLREndInst ||<SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>ValLREndInst->getParent() != CopyMI->getParent()) return false;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// Okay, we now know that ValLR ends in the same block that the CopyMI</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// live-range starts.<SPAN class="Apple-converted-space">  </SPAN>If there are no intervening live ranges between them in</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// IntB, we can merge them.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>if (ValLR+1 != BLR) return false;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>DOUT << "\nExtending: "; IntB.print(DOUT, mri_);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// We are about to delete CopyMI, so need to remove it as the 'instruction</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// that defines this value #'.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>IntB.setValueNumberInfo(BValNo, std::make_pair(~0U, 0));</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// Okay, we can merge them.<SPAN class="Apple-converted-space">  </SPAN>We need to insert a new liverange:</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// [ValLR.end, BLR.begin) of either value number, then we merge the</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// two value numbers.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>unsigned FillerStart = ValLR->end, FillerEnd = BLR->start;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>IntB.addRange(LiveRange(FillerStart, FillerEnd, BValNo));</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// If the IntB live range is assigned to a physical register, and if that</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// physreg has aliases,<SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>if (MRegisterInfo::isPhysicalRegister(IntB.reg)) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// Update the liveintervals of sub-registers.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>for (const unsigned *AS = mri_->getSubRegisters(IntB.reg); *AS; ++AS) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>LiveInterval &AliasLI = getInterval(*AS);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>AliasLI.addRange(LiveRange(FillerStart, FillerEnd,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">                                </SPAN>AliasLI.getNextValue(~0U, 0)));</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// Okay, merge "B1" into the same value number as "B0".</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>if (BValNo != ValLR->ValId)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>IntB.MergeValueNumberInto(BValNo, ValLR->ValId);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>DOUT << " <SPAN class="Apple-converted-space">  </SPAN>result = "; IntB.print(DOUT, mri_);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>DOUT << "\n";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// If the source instruction was killing the source register before the</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// merge, unset the isKill marker given the live range has been extended.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>int UIdx = ValLREndInst->findRegisterUseOperandIdx(IntB.reg, true);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>if (UIdx != -1)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>ValLREndInst->getOperand(UIdx).unsetIsKill();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// Finally, delete the copy instruction.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>RemoveMachineInstrFromMaps(CopyMI);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>CopyMI->eraseFromParent();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>++numPeep;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>return true;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// JoinCopy - Attempt to join intervals corresponding to SrcReg/DstReg,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// which are the src/dst of the copy instruction CopyMI.<SPAN class="Apple-converted-space">  </SPAN>This returns true</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// if the copy was successfully coallesced away, or if it is never possible</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// to coallesce this copy, due to register constraints.<SPAN class="Apple-converted-space">  </SPAN>It returns</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// false if it is not currently possible to coallesce this interval, but</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// it may be possible if other things get coallesced.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-bool LiveIntervals::JoinCopy(MachineInstr *CopyMI,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">                            </SPAN>unsigned SrcReg, unsigned DstReg, bool PhysOnly) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>DOUT << getInstructionIndex(CopyMI) << '\t' << *CopyMI;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// Get representative registers.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>unsigned repSrcReg = rep(SrcReg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>unsigned repDstReg = rep(DstReg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// If they are already joined we continue.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>if (repSrcReg == repDstReg) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>DOUT << "\tCopy already coallesced.\n";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>return true;<SPAN class="Apple-converted-space">  </SPAN>// Not coallescable.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>bool SrcIsPhys = MRegisterInfo::isPhysicalRegister(repSrcReg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>bool DstIsPhys = MRegisterInfo::isPhysicalRegister(repDstReg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>if (PhysOnly && !SrcIsPhys && !DstIsPhys)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// Only joining physical registers with virtual registers in this round.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>return true;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// If they are both physical registers, we cannot join them.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>if (SrcIsPhys && DstIsPhys) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>DOUT << "\tCan not coallesce physregs.\n";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>return true;<SPAN class="Apple-converted-space">  </SPAN>// Not coallescable.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// We only join virtual registers with allocatable physical registers.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>if (SrcIsPhys && !allocatableRegs_[repSrcReg]) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>DOUT << "\tSrc reg is unallocatable physreg.\n";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>return true;<SPAN class="Apple-converted-space">  </SPAN>// Not coallescable.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>if (DstIsPhys && !allocatableRegs_[repDstReg]) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>DOUT << "\tDst reg is unallocatable physreg.\n";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>return true;<SPAN class="Apple-converted-space">  </SPAN>// Not coallescable.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// If they are not of the same register class, we cannot join them.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>if (differingRegisterClasses(repSrcReg, repDstReg)) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>DOUT << "\tSrc/Dest are different register classes.\n";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>return true;<SPAN class="Apple-converted-space">  </SPAN>// Not coallescable.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>LiveInterval &SrcInt = getInterval(repSrcReg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>LiveInterval &DstInt = getInterval(repDstReg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>assert(SrcInt.reg == repSrcReg && DstInt.reg == repDstReg &&</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">        </SPAN>"Register mapping is horribly broken!");</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>DOUT << "\t\tInspecting "; SrcInt.print(DOUT, mri_);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>DOUT << " and "; DstInt.print(DOUT, mri_);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>DOUT << ": ";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// Check if it is necessary to propagate "isDead" property before intervals</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// are joined.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>MachineOperand *mopd = CopyMI->findRegisterDefOperand(DstReg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>bool isDead = mopd->isDead();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>bool isShorten = false;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>unsigned SrcStart = 0, RemoveStart = 0;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>unsigned SrcEnd = 0, RemoveEnd = 0;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>if (isDead) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>unsigned CopyIdx = getInstructionIndex(CopyMI);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>LiveInterval::iterator SrcLR =</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>SrcInt.FindLiveRangeContaining(getUseIndex(CopyIdx));</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>RemoveStart = SrcStart = SrcLR->start;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>RemoveEnd <SPAN class="Apple-converted-space">  </SPAN>= SrcEnd <SPAN class="Apple-converted-space">  </SPAN>= SrcLR->end;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// The instruction which defines the src is only truly dead if there are</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// no intermediate uses and there isn't a use beyond the copy.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// FIXME: find the last use, mark is kill and shorten the live range.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>if (SrcEnd > getDefIndex(CopyIdx)) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>isDead = false;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>} else {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>MachineOperand *MOU;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>MachineInstr *LastUse= lastRegisterUse(repSrcReg, SrcStart, CopyIdx, MOU);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>if (LastUse) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>// Shorten the liveinterval to the end of last use.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>MOU->setIsKill();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>isDead = false;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>isShorten = true;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>RemoveStart = getDefIndex(getInstructionIndex(LastUse));</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>RemoveEnd <SPAN class="Apple-converted-space">  </SPAN>= SrcEnd;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>} else {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>MachineInstr *SrcMI = getInstructionFromIndex(SrcStart);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>if (SrcMI) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">          </SPAN>MachineOperand *mops = findDefOperand(SrcMI, repSrcReg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">          </SPAN>if (mops)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">            </SPAN>// A dead def should have a single cycle interval.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">            </SPAN>++RemoveStart;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// We need to be careful about coalescing a source physical register with a</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// virtual register. Once the coalescing is done, it cannot be broken and</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// these are not spillable! If the destination interval uses are far away,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// think twice about coalescing them!</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>if (!mopd->isDead() && (SrcIsPhys || DstIsPhys)) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>LiveInterval &JoinVInt = SrcIsPhys ? DstInt : SrcInt;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>unsigned JoinVReg = SrcIsPhys ? repDstReg : repSrcReg;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>unsigned JoinPReg = SrcIsPhys ? repSrcReg : repDstReg;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>const TargetRegisterClass *RC = mf_->getSSARegMap()->getRegClass(JoinVReg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>unsigned Threshold = allocatableRCRegs_[RC].count();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// If the virtual register live interval is long has it has low use desity,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// do not join them, instead mark the physical register as its allocation</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// preference.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>unsigned Length = JoinVInt.getSize() / InstrSlots::NUM;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>LiveVariables::VarInfo &vi = lv_->getVarInfo(JoinVReg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>if (Length > Threshold &&</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>(((float)vi.NumUses / Length) < (1.0 / Threshold))) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>JoinVInt.preference = JoinPReg;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>++numAborts;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>DOUT << "\tMay tie down a physical register, abort!\n";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>return false;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// Okay, attempt to join these two intervals.<SPAN class="Apple-converted-space">  </SPAN>On failure, this returns false.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// Otherwise, if one of the intervals being joined is a physreg, this method</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// always canonicalizes DstInt to be it.<SPAN class="Apple-converted-space">  </SPAN>The output "SrcInt" will not have</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// been modified, so we can use this information below to update aliases.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>if (JoinIntervals(DstInt, SrcInt)) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>if (isDead) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>// Result of the copy is dead. Propagate this property.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>if (SrcStart == 0) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>assert(MRegisterInfo::isPhysicalRegister(repSrcReg) &&</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">              </SPAN>"Live-in must be a physical register!");</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>// Live-in to the function but dead. Remove it from entry live-in set.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>// JoinIntervals may end up swapping the two intervals.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>mf_->begin()->removeLiveIn(repSrcReg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>} else {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>MachineInstr *SrcMI = getInstructionFromIndex(SrcStart);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>if (SrcMI) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">          </SPAN>MachineOperand *mops = findDefOperand(SrcMI, repSrcReg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">          </SPAN>if (mops)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">            </SPAN>mops->setIsDead();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>if (isShorten || isDead) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>// Shorten the live interval.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>LiveInterval &LiveInInt = (repSrcReg == DstInt.reg) ? DstInt : SrcInt;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>LiveInInt.removeRange(RemoveStart, RemoveEnd);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>} else {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// Coallescing failed.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// If we can eliminate the copy without merging the live ranges, do so now.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>if (AdjustCopiesBackFrom(SrcInt, DstInt, CopyMI))</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>return true;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// Otherwise, we are unable to join the intervals.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>DOUT << "Interference!\n";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>return false;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>bool Swapped = repSrcReg == DstInt.reg;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>if (Swapped)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>std::swap(repSrcReg, repDstReg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>assert(MRegisterInfo::isVirtualRegister(repSrcReg) &&</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">        </SPAN>"LiveInterval::join didn't work right!");</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">                               </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// If we're about to merge live ranges into a physical register live range,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// we have to update any aliased register's live ranges to indicate that they</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// have clobbered values for this range.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>if (MRegisterInfo::isPhysicalRegister(repDstReg)) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// Update the liveintervals of sub-registers.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>for (const unsigned *AS = mri_->getSubRegisters(repDstReg); *AS; ++AS)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>getInterval(*AS).MergeInClobberRanges(SrcInt);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>} else {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// Merge use info if the destination is a virtual register.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>LiveVariables::VarInfo& dVI = lv_->getVarInfo(repDstReg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>LiveVariables::VarInfo& sVI = lv_->getVarInfo(repSrcReg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>dVI.NumUses += sVI.NumUses;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>DOUT << "\n\t\tJoined.<SPAN class="Apple-converted-space">  </SPAN>Result = "; DstInt.print(DOUT, mri_);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>DOUT << "\n";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// Remember these liveintervals have been joined.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>JoinedLIs.set(repSrcReg - MRegisterInfo::FirstVirtualRegister);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>if (MRegisterInfo::isVirtualRegister(repDstReg))</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>JoinedLIs.set(repDstReg - MRegisterInfo::FirstVirtualRegister);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// If the intervals were swapped by Join, swap them back so that the register</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// mapping (in the r2i map) is correct.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>if (Swapped) SrcInt.swap(DstInt);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>removeInterval(repSrcReg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>r2rMap_[repSrcReg] = repDstReg;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// Finally, delete the copy instruction.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>RemoveMachineInstrFromMaps(CopyMI);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>CopyMI->eraseFromParent();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>++numPeep;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>++numJoins;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>return true;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// ComputeUltimateVN - Assuming we are going to join two live intervals,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// compute what the resultant value numbers for each value in the input two</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// ranges will be.<SPAN class="Apple-converted-space">  </SPAN>This is complicated by copies between the two which can</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// and will commonly cause multiple value numbers to be merged into one.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-///</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// VN is the value number that we're trying to resolve.<SPAN class="Apple-converted-space">  </SPAN>InstDefiningValue</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// keeps track of the new InstDefiningValue assignment for the result</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// LiveInterval.<SPAN class="Apple-converted-space">  </SPAN>ThisFromOther/OtherFromThis are sets that keep track of</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// whether a value in this or other is a copy from the opposite set.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// ThisValNoAssignments/OtherValNoAssignments keep track of value #'s that have</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// already been assigned.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-///</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// ThisFromOther[x] - If x is defined as a copy from the other interval, this</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// contains the value number the copy is from.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-///</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-static unsigned ComputeUltimateVN(unsigned VN,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">                                  </SPAN>SmallVector<std::pair<unsigned,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">                                                </SPAN>unsigned>, 16> &ValueNumberInfo,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">                                  </SPAN>SmallVector<int, 16> &ThisFromOther,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">                                  </SPAN>SmallVector<int, 16> &OtherFromThis,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">                                  </SPAN>SmallVector<int, 16> &ThisValNoAssignments,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">                                  </SPAN>SmallVector<int, 16> &OtherValNoAssignments,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">                                  </SPAN>LiveInterval &ThisLI, LiveInterval &OtherLI) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// If the VN has already been computed, just return it.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>if (ThisValNoAssignments[VN] >= 0)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>return ThisValNoAssignments[VN];</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-//<SPAN class="Apple-converted-space">  </SPAN>assert(ThisValNoAssignments[VN] != -2 && "Cyclic case?");</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// If this val is not a copy from the other val, then it must be a new value</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// number in the destination.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>int OtherValNo = ThisFromOther[VN];</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>if (OtherValNo == -1) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>ValueNumberInfo.push_back(ThisLI.getValNumInfo(VN));</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>return ThisValNoAssignments[VN] = ValueNumberInfo.size()-1;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// Otherwise, this *is* a copy from the RHS.<SPAN class="Apple-converted-space">  </SPAN>If the other side has already</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// been computed, return it.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>if (OtherValNoAssignments[OtherValNo] >= 0)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>return ThisValNoAssignments[VN] = OtherValNoAssignments[OtherValNo];</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// Mark this value number as currently being computed, then ask what the</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// ultimate value # of the other value is.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>ThisValNoAssignments[VN] = -2;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>unsigned UltimateVN =</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>ComputeUltimateVN(OtherValNo, ValueNumberInfo,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">                      </SPAN>OtherFromThis, ThisFromOther,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">                      </SPAN>OtherValNoAssignments, ThisValNoAssignments,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">                      </SPAN>OtherLI, ThisLI);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>return ThisValNoAssignments[VN] = UltimateVN;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-static bool InVector(unsigned Val, const SmallVector<unsigned, 8> &V) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>return std::find(V.begin(), V.end(), Val) != V.end();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// SimpleJoin - Attempt to joint the specified interval into this one. The</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// caller of this method must guarantee that the RHS only contains a single</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// value number and that the RHS is not defined by a copy from this</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// interval.<SPAN class="Apple-converted-space">  </SPAN>This returns false if the intervals are not joinable, or it</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// joins them and returns true.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-bool LiveIntervals::SimpleJoin(LiveInterval &LHS, LiveInterval &RHS) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>assert(RHS.containsOneValue());</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// Some number (potentially more than one) value numbers in the current</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// interval may be defined as copies from the RHS.<SPAN class="Apple-converted-space">  </SPAN>Scan the overlapping</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// portions of the LHS and RHS, keeping track of this and looking for</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// overlapping live ranges that are NOT defined as copies.<SPAN class="Apple-converted-space">  </SPAN>If these exist, we</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// cannot coallesce.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>LiveInterval::iterator LHSIt = LHS.begin(), LHSEnd = LHS.end();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>LiveInterval::iterator RHSIt = RHS.begin(), RHSEnd = RHS.end();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>if (LHSIt->start < RHSIt->start) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>LHSIt = std::upper_bound(LHSIt, LHSEnd, RHSIt->start);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>if (LHSIt != LHS.begin()) --LHSIt;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>} else if (RHSIt->start < LHSIt->start) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>RHSIt = std::upper_bound(RHSIt, RHSEnd, LHSIt->start);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>if (RHSIt != RHS.begin()) --RHSIt;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>SmallVector<unsigned, 8> EliminatedLHSVals;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>while (1) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// Determine if these live intervals overlap.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>bool Overlaps = false;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>if (LHSIt->start <= RHSIt->start)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>Overlaps = LHSIt->end > RHSIt->start;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>else</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>Overlaps = RHSIt->end > LHSIt->start;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// If the live intervals overlap, there are two interesting cases: if the</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// LHS interval is defined by a copy from the RHS, it's ok and we record</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// that the LHS value # is the same as the RHS.<SPAN class="Apple-converted-space">  </SPAN>If it's not, then we cannot</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// coallesce these live ranges and we bail out.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>if (Overlaps) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>// If we haven't already recorded that this value # is safe, check it.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>if (!InVector(LHSIt->ValId, EliminatedLHSVals)) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>// Copy from the RHS?</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>unsigned SrcReg = LHS.getSrcRegForValNum(LHSIt->ValId);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>if (rep(SrcReg) != RHS.reg)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">          </SPAN>return false;<SPAN class="Apple-converted-space">    </SPAN>// Nope, bail out.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">       </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>EliminatedLHSVals.push_back(LHSIt->ValId);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">     </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>// We know this entire LHS live range is okay, so skip it now.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>if (++LHSIt == LHSEnd) break;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>continue;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>if (LHSIt->end < RHSIt->end) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>if (++LHSIt == LHSEnd) break;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>} else {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>// One interesting case to check here.<SPAN class="Apple-converted-space">  </SPAN>It's possible that we have</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>// something like "X3 = Y" which defines a new value number in the LHS,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>// and is the last use of this liverange of the RHS.<SPAN class="Apple-converted-space">  </SPAN>In this case, we</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>// want to notice this copy (so that it gets coallesced away) even though</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>// the live ranges don't actually overlap.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>if (LHSIt->start == RHSIt->end) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>if (InVector(LHSIt->ValId, EliminatedLHSVals)) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">          </SPAN>// We already know that this value number is going to be merged in</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">          </SPAN>// if coallescing succeeds.<SPAN class="Apple-converted-space">  </SPAN>Just skip the liverange.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">          </SPAN>if (++LHSIt == LHSEnd) break;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>} else {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">          </SPAN>// Otherwise, if this is a copy from the RHS, mark it as being merged</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">          </SPAN>// in.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">          </SPAN>if (rep(LHS.getSrcRegForValNum(LHSIt->ValId)) == RHS.reg) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">            </SPAN>EliminatedLHSVals.push_back(LHSIt->ValId);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">            </SPAN>// We know this entire LHS live range is okay, so skip it now.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">            </SPAN>if (++LHSIt == LHSEnd) break;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">          </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">     </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>if (++RHSIt == RHSEnd) break;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// If we got here, we know that the coallescing will be successful and that</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// the value numbers in EliminatedLHSVals will all be merged together.<SPAN class="Apple-converted-space">  </SPAN>Since</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// the most common case is that EliminatedLHSVals has a single number, we</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// optimize for it: if there is more than one value, we merge them all into</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// the lowest numbered one, then handle the interval as if we were merging</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// with one value number.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>unsigned LHSValNo;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>if (EliminatedLHSVals.size() > 1) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// Loop through all the equal value numbers merging them into the smallest</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// one.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>unsigned Smallest = EliminatedLHSVals[0];</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>for (unsigned i = 1, e = EliminatedLHSVals.size(); i != e; ++i) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>if (EliminatedLHSVals[i] < Smallest) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>// Merge the current notion of the smallest into the smaller one.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>LHS.MergeValueNumberInto(Smallest, EliminatedLHSVals[i]);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>Smallest = EliminatedLHSVals[i];</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>} else {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>// Merge into the smallest.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>LHS.MergeValueNumberInto(EliminatedLHSVals[i], Smallest);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>LHSValNo = Smallest;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>} else {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>assert(!EliminatedLHSVals.empty() && "No copies from the RHS?");</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>LHSValNo = EliminatedLHSVals[0];</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// Okay, now that there is a single LHS value number that we're merging the</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// RHS into, update the value number info for the LHS to indicate that the</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// value number is defined where the RHS value number was.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>LHS.setValueNumberInfo(LHSValNo, RHS.getValNumInfo(0));</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// Okay, the final step is to loop over the RHS live intervals, adding them to</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// the LHS.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>LHS.MergeRangesInAsValue(RHS, LHSValNo);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>LHS.weight += RHS.weight;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>if (RHS.preference && !LHS.preference)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>LHS.preference = RHS.preference;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>return true;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// JoinIntervals - Attempt to join these two intervals.<SPAN class="Apple-converted-space">  </SPAN>On failure, this</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// returns false.<SPAN class="Apple-converted-space">  </SPAN>Otherwise, if one of the intervals being joined is a</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// physreg, this method always canonicalizes LHS to be it.<SPAN class="Apple-converted-space">  </SPAN>The output</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// "RHS" will not have been modified, so we can use this information</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// below to update aliases.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-bool LiveIntervals::JoinIntervals(LiveInterval &LHS, LiveInterval &RHS) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// Compute the final value assignment, assuming that the live ranges can be</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// coallesced.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>SmallVector<int, 16> LHSValNoAssignments;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>SmallVector<int, 16> RHSValNoAssignments;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>SmallVector<std::pair<unsigned,unsigned>, 16> ValueNumberInfo;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// If a live interval is a physical register, conservatively check if any</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// of its sub-registers is overlapping the live interval of the virtual</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// register. If so, do not coalesce.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>if (MRegisterInfo::isPhysicalRegister(LHS.reg) &&</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>*mri_->getSubRegisters(LHS.reg)) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>for (const unsigned* SR = mri_->getSubRegisters(LHS.reg); *SR; ++SR)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>if (hasInterval(*SR) && RHS.overlaps(getInterval(*SR))) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>DOUT << "Interfere with sub-register ";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>DEBUG(getInterval(*SR).print(DOUT, mri_));</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>return false;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>} else if (MRegisterInfo::isPhysicalRegister(RHS.reg) &&</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">            </SPAN>*mri_->getSubRegisters(RHS.reg)) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>for (const unsigned* SR = mri_->getSubRegisters(RHS.reg); *SR; ++SR)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>if (hasInterval(*SR) && LHS.overlaps(getInterval(*SR))) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>DOUT << "Interfere with sub-register ";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>DEBUG(getInterval(*SR).print(DOUT, mri_));</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>return false;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">                         </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// Compute ultimate value numbers for the LHS and RHS values.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>if (RHS.containsOneValue()) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// Copies from a liveinterval with a single value are simple to handle and</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// very common, handle the special case here.<SPAN class="Apple-converted-space">  </SPAN>This is important, because</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// often RHS is small and LHS is large (e.g. a physreg).</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// Find out if the RHS is defined as a copy from some value in the LHS.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>int RHSValID = -1;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>std::pair<unsigned,unsigned> RHSValNoInfo;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>unsigned RHSSrcReg = RHS.getSrcRegForValNum(0);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>if ((RHSSrcReg == 0 || rep(RHSSrcReg) != LHS.reg)) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>// If RHS is not defined as a copy from the LHS, we can use simpler and</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>// faster checks to see if the live ranges are coallescable.<SPAN class="Apple-converted-space">  </SPAN>This joiner</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>// can't swap the LHS/RHS intervals though.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>if (!MRegisterInfo::isPhysicalRegister(RHS.reg)) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>return SimpleJoin(LHS, RHS);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>} else {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>RHSValNoInfo = RHS.getValNumInfo(0);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>} else {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>// It was defined as a copy from the LHS, find out what value # it is.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>unsigned ValInst = RHS.getInstForValNum(0);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>RHSValID = LHS.getLiveRangeContaining(ValInst-1)->ValId;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>RHSValNoInfo = LHS.getValNumInfo(RHSValID);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>LHSValNoAssignments.resize(LHS.getNumValNums(), -1);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>RHSValNoAssignments.resize(RHS.getNumValNums(), -1);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>ValueNumberInfo.resize(LHS.getNumValNums());</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// Okay, *all* of the values in LHS that are defined as a copy from RHS</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// should now get updated.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>for (unsigned VN = 0, e = LHS.getNumValNums(); VN != e; ++VN) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>if (unsigned LHSSrcReg = LHS.getSrcRegForValNum(VN)) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>if (rep(LHSSrcReg) != RHS.reg) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">          </SPAN>// If this is not a copy from the RHS, its value number will be</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">          </SPAN>// unmodified by the coallescing.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">          </SPAN>ValueNumberInfo[VN] = LHS.getValNumInfo(VN);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">          </SPAN>LHSValNoAssignments[VN] = VN;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>} else if (RHSValID == -1) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">          </SPAN>// Otherwise, it is a copy from the RHS, and we don't already have a</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">          </SPAN>// value# for it.<SPAN class="Apple-converted-space">  </SPAN>Keep the current value number, but remember it.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">          </SPAN>LHSValNoAssignments[VN] = RHSValID = VN;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">          </SPAN>ValueNumberInfo[VN] = RHSValNoInfo;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>} else {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">          </SPAN>// Otherwise, use the specified value #.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">          </SPAN>LHSValNoAssignments[VN] = RHSValID;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">          </SPAN>if (VN != (unsigned)RHSValID)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">            </SPAN>ValueNumberInfo[VN].first = ~1U;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">          </SPAN>else</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">            </SPAN>ValueNumberInfo[VN] = RHSValNoInfo;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>} else {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>ValueNumberInfo[VN] = LHS.getValNumInfo(VN);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>LHSValNoAssignments[VN] = VN;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>assert(RHSValID != -1 && "Didn't find value #?");</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>RHSValNoAssignments[0] = RHSValID;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>} else {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// Loop over the value numbers of the LHS, seeing if any are defined from</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// the RHS.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>SmallVector<int, 16> LHSValsDefinedFromRHS;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>LHSValsDefinedFromRHS.resize(LHS.getNumValNums(), -1);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>for (unsigned VN = 0, e = LHS.getNumValNums(); VN != e; ++VN) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>unsigned ValSrcReg = LHS.getSrcRegForValNum(VN);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>if (ValSrcReg == 0)<SPAN class="Apple-converted-space">  </SPAN>// Src not defined by a copy?</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>continue;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">     </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>// DstReg is known to be a register in the LHS interval.<SPAN class="Apple-converted-space">  </SPAN>If the src is</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>// from the RHS interval, we can use its value #.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>if (rep(ValSrcReg) != RHS.reg)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>continue;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">     </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>// Figure out the value # from the RHS.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>unsigned ValInst = LHS.getInstForValNum(VN);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>LHSValsDefinedFromRHS[VN] = RHS.getLiveRangeContaining(ValInst-1)->ValId;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// Loop over the value numbers of the RHS, seeing if any are defined from</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// the LHS.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>SmallVector<int, 16> RHSValsDefinedFromLHS;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>RHSValsDefinedFromLHS.resize(RHS.getNumValNums(), -1);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>for (unsigned VN = 0, e = RHS.getNumValNums(); VN != e; ++VN) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>unsigned ValSrcReg = RHS.getSrcRegForValNum(VN);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>if (ValSrcReg == 0)<SPAN class="Apple-converted-space">  </SPAN>// Src not defined by a copy?</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>continue;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">     </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>// DstReg is known to be a register in the RHS interval.<SPAN class="Apple-converted-space">  </SPAN>If the src is</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>// from the LHS interval, we can use its value #.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>if (rep(ValSrcReg) != LHS.reg)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>continue;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">     </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>// Figure out the value # from the LHS.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>unsigned ValInst = RHS.getInstForValNum(VN);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>RHSValsDefinedFromLHS[VN] = LHS.getLiveRangeContaining(ValInst-1)->ValId;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>LHSValNoAssignments.resize(LHS.getNumValNums(), -1);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>RHSValNoAssignments.resize(RHS.getNumValNums(), -1);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>ValueNumberInfo.reserve(LHS.getNumValNums() + RHS.getNumValNums());</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>for (unsigned VN = 0, e = LHS.getNumValNums(); VN != e; ++VN) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>if (LHSValNoAssignments[VN] >= 0 || LHS.getInstForValNum(VN) == ~2U)<SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>continue;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>ComputeUltimateVN(VN, ValueNumberInfo,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">                        </SPAN>LHSValsDefinedFromRHS, RHSValsDefinedFromLHS,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">                        </SPAN>LHSValNoAssignments, RHSValNoAssignments, LHS, RHS);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>for (unsigned VN = 0, e = RHS.getNumValNums(); VN != e; ++VN) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>if (RHSValNoAssignments[VN] >= 0 || RHS.getInstForValNum(VN) == ~2U)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>continue;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>// If this value number isn't a copy from the LHS, it's a new number.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>if (RHSValsDefinedFromLHS[VN] == -1) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>ValueNumberInfo.push_back(RHS.getValNumInfo(VN));</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>RHSValNoAssignments[VN] = ValueNumberInfo.size()-1;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>continue;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">     </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>ComputeUltimateVN(VN, ValueNumberInfo,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">                        </SPAN>RHSValsDefinedFromLHS, LHSValsDefinedFromRHS,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">                        </SPAN>RHSValNoAssignments, LHSValNoAssignments, RHS, LHS);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// Armed with the mappings of LHS/RHS values to ultimate values, walk the</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// interval lists to see if these intervals are coallescable.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>LiveInterval::const_iterator I = LHS.begin();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>LiveInterval::const_iterator IE = LHS.end();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>LiveInterval::const_iterator J = RHS.begin();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>LiveInterval::const_iterator JE = RHS.end();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// Skip ahead until the first place of potential sharing.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>if (I->start < J->start) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>I = std::upper_bound(I, IE, J->start);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>if (I != LHS.begin()) --I;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>} else if (J->start < I->start) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>J = std::upper_bound(J, JE, I->start);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>if (J != RHS.begin()) --J;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>while (1) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// Determine if these two live ranges overlap.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>bool Overlaps;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>if (I->start < J->start) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>Overlaps = I->end > J->start;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>} else {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>Overlaps = J->end > I->start;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// If so, check value # info to determine if they are really different.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>if (Overlaps) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>// If the live range overlap will map to the same value number in the</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>// result liverange, we can still coallesce them.<SPAN class="Apple-converted-space">  </SPAN>If not, we can't.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>if (LHSValNoAssignments[I->ValId] != RHSValNoAssignments[J->ValId])</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>return false;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>if (I->end < J->end) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>++I;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>if (I == IE) break;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>} else {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>++J;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>if (J == JE) break;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// If we get here, we know that we can coallesce the live ranges.<SPAN class="Apple-converted-space">  </SPAN>Ask the</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// intervals to coallesce themselves now.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>LHS.join(RHS, &LHSValNoAssignments[0], &RHSValNoAssignments[0],</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">          </SPAN>ValueNumberInfo);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>return true;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-namespace {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// DepthMBBCompare - Comparison predicate that sort first based on the loop</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// depth of the basic block (the unsigned), and then on the MBB number.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>struct DepthMBBCompare {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>typedef std::pair<unsigned, MachineBasicBlock*> DepthMBBPair;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>bool operator()(const DepthMBBPair &LHS, const DepthMBBPair &RHS) const {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>if (LHS.first > RHS.first) return true; <SPAN class="Apple-converted-space">  </SPAN>// Deeper loops first</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>return LHS.first == RHS.first &&</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>LHS.second->getNumber() < RHS.second->getNumber();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>};</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-void LiveIntervals::CopyCoallesceInMBB(MachineBasicBlock *MBB,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">                                </SPAN>std::vector<CopyRec> *TryAgain, bool PhysOnly) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>DOUT << ((Value*)MBB->getBasicBlock())->getName() << ":\n";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>for (MachineBasicBlock::iterator MII = MBB->begin(), E = MBB->end();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">      </SPAN>MII != E;) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>MachineInstr *Inst = MII++;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// If this isn't a copy, we can't join intervals.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>unsigned SrcReg, DstReg;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>if (!tii_->isMoveInstr(*Inst, SrcReg, DstReg)) continue;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>if (TryAgain && !JoinCopy(Inst, SrcReg, DstReg, PhysOnly))</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>TryAgain->push_back(getCopyRec(Inst, SrcReg, DstReg));</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-void LiveIntervals::joinIntervals() {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>DOUT << "********** JOINING INTERVALS ***********\n";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>JoinedLIs.resize(getNumIntervals());</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>JoinedLIs.reset();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>std::vector<CopyRec> TryAgainList;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>const LoopInfo &LI = getAnalysis<LoopInfo>();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>if (LI.begin() == LI.end()) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// If there are no loops in the function, join intervals in function order.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>for (MachineFunction::iterator I = mf_->begin(), E = mf_->end();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">        </SPAN>I != E; ++I)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>CopyCoallesceInMBB(I, &TryAgainList);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>} else {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// Otherwise, join intervals in inner loops before other intervals.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// Unfortunately we can't just iterate over loop hierarchy here because</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// there may be more MBB's than BB's.<SPAN class="Apple-converted-space">  </SPAN>Collect MBB's for sorting.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// Join intervals in the function prolog first. We want to join physical</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// registers with virtual registers before the intervals got too long.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>std::vector<std::pair<unsigned, MachineBasicBlock*> > MBBs;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>for (MachineFunction::iterator I = mf_->begin(), E = mf_->end(); I != E;++I)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>MBBs.push_back(std::make_pair(LI.getLoopDepth(I->getBasicBlock()), I));</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// Sort by loop depth.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>std::sort(MBBs.begin(), MBBs.end(), DepthMBBCompare());</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// Finally, join intervals in loop nest order.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>for (unsigned i = 0, e = MBBs.size(); i != e; ++i)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>CopyCoallesceInMBB(MBBs[i].second, NULL, true);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>for (unsigned i = 0, e = MBBs.size(); i != e; ++i)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>CopyCoallesceInMBB(MBBs[i].second, &TryAgainList, false);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// Joining intervals can allow other intervals to be joined.<SPAN class="Apple-converted-space">  </SPAN>Iteratively join</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// until we make no progress.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>bool ProgressMade = true;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>while (ProgressMade) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>ProgressMade = false;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>for (unsigned i = 0, e = TryAgainList.size(); i != e; ++i) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>CopyRec &TheCopy = TryAgainList[i];</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>if (TheCopy.MI &&</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">          </SPAN>JoinCopy(TheCopy.MI, TheCopy.SrcReg, TheCopy.DstReg)) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>TheCopy.MI = 0; <SPAN class="Apple-converted-space">  </SPAN>// Mark this one as done.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>ProgressMade = true;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// Some live range has been lengthened due to colaescing, eliminate the</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// unnecessary kills.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>int RegNum = JoinedLIs.find_first();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>while (RegNum != -1) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>unsigned Reg = RegNum + MRegisterInfo::FirstVirtualRegister;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>unsigned repReg = rep(Reg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>LiveInterval &LI = getInterval(repReg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>LiveVariables::VarInfo& svi = lv_->getVarInfo(Reg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>for (unsigned i = 0, e = svi.Kills.size(); i != e; ++i) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>MachineInstr *Kill = svi.Kills[i];</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>// Suppose vr1 = op vr2, x</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>// and vr1 and vr2 are coalesced. vr2 should still be marked kill</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>// unless it is a two-address operand.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>if (isRemoved(Kill) || hasRegisterDef(Kill, repReg))</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>continue;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>if (LI.liveAt(getInstructionIndex(Kill) + InstrSlots::NUM))</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>unsetRegisterKill(Kill, repReg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>RegNum = JoinedLIs.find_next(RegNum);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>DOUT << "*** Register mapping ***\n";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>for (int i = 0, e = r2rMap_.size(); i != e; ++i)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>if (r2rMap_[i]) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>DOUT << "<SPAN class="Apple-converted-space">  </SPAN>reg " << i << " -> ";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>DEBUG(printRegName(r2rMap_[i]));</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>DOUT << "\n";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// Return true if the two specified registers belong to different register</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// classes.<SPAN class="Apple-converted-space">  </SPAN>The registers may be either phys or virt regs.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-bool LiveIntervals::differingRegisterClasses(unsigned RegA,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">                                            </SPAN>unsigned RegB) const {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// Get the register classes for the first reg.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>if (MRegisterInfo::isPhysicalRegister(RegA)) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>assert(MRegisterInfo::isVirtualRegister(RegB) &&</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">          </SPAN>"Shouldn't consider two physregs!");</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>return !mf_->getSSARegMap()->getRegClass(RegB)->contains(RegA);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>// Compare against the regclass for the second reg.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>const TargetRegisterClass *RegClass = mf_->getSSARegMap()->getRegClass(RegA);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>if (MRegisterInfo::isVirtualRegister(RegB))</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>return RegClass != mf_->getSSARegMap()->getRegClass(RegB);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>else</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>return !RegClass->contains(RegB);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// lastRegisterUse - Returns the last use of the specific register between</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// cycles Start and End. It also returns the use operand by reference. It</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// returns NULL if there are no uses.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-MachineInstr *</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-LiveIntervals::lastRegisterUse(unsigned Reg, unsigned Start, unsigned End,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- <SPAN class="Apple-converted-space">                              </SPAN>MachineOperand *&MOU) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>int e = (End-1) / InstrSlots::NUM * InstrSlots::NUM;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>int s = Start;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>while (e >= s) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>// Skip deleted instructions</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>MachineInstr *MI = getInstructionFromIndex(e);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>while ((e - InstrSlots::NUM) >= s && !MI) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>e -= InstrSlots::NUM;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>MI = getInstructionFromIndex(e);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>if (e < s || MI == NULL)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>return NULL;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>for (unsigned i = 0, NumOps = MI->getNumOperands(); i != NumOps; ++i) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>MachineOperand &MO = MI->getOperand(i);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>if (MO.isReg() && MO.isUse() && MO.getReg() &&</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">          </SPAN>mri_->regsOverlap(rep(MO.getReg()), Reg)) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>MOU = &MO;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>return MI;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>e -= InstrSlots::NUM;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>return NULL;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// findDefOperand - Returns the MachineOperand that is a def of the specific</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// register. It returns NULL if the def is not found.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-MachineOperand *LiveIntervals::findDefOperand(MachineInstr *MI, unsigned Reg) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>MachineOperand &MO = MI->getOperand(i);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>if (MO.isReg() && MO.isDef() &&</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>mri_->regsOverlap(rep(MO.getReg()), Reg))</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>return &MO;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>return NULL;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// unsetRegisterKill - Unset IsKill property of all uses of specific register</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// of the specific instruction.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-void LiveIntervals::unsetRegisterKill(MachineInstr *MI, unsigned Reg) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>MachineOperand &MO = MI->getOperand(i);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>if (MO.isReg() && MO.isUse() && MO.isKill() && MO.getReg() &&</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>mri_->regsOverlap(rep(MO.getReg()), Reg))</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>MO.unsetIsKill();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-/// hasRegisterDef - True if the instruction defines the specific register.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-///</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-bool LiveIntervals::hasRegisterDef(MachineInstr *MI, unsigned Reg) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>MachineOperand &MO = MI->getOperand(i);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">    </SPAN>if (MO.isReg() && MO.isDef() &&</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">        </SPAN>mri_->regsOverlap(rep(MO.getReg()), Reg))</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">      </SPAN>return true;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-<SPAN class="Apple-converted-space">  </SPAN>return false;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space"> </SPAN>LiveInterval LiveIntervals::createInterval(unsigned reg) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">   </SPAN>float Weight = MRegisterInfo::isPhysicalRegister(reg) ?</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">                        </SPAN>HUGE_VALF : 0.0F;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Index: lib/CodeGen/RegAllocLinearScan.cpp</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">===================================================================</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">RCS file: /var/cvs/llvm/llvm/lib/CodeGen/RegAllocLinearScan.cpp,v</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">retrieving revision 1.148</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">diff -u -r1.148 RegAllocLinearScan.cpp</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">--- lib/CodeGen/RegAllocLinearScan.cpp<SPAN class="Apple-tab-span" style="white-space:pre">  </SPAN>3 May 2007 01:11:53 -0000<SPAN class="Apple-tab-span" style="white-space:pre">   </SPAN>1.148</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+++ lib/CodeGen/RegAllocLinearScan.cpp<SPAN class="Apple-tab-span" style="white-space:pre">     </SPAN>6 May 2007 22:44:13 -0000</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">@@ -96,6 +96,7 @@</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">     </SPAN>virtual void getAnalysisUsage(AnalysisUsage &AU) const {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">       </SPAN>AU.addRequired<LiveIntervals>();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>AU.addRequiredID(SimpleRegisterCoalescingID);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">       </SPAN>MachineFunctionPass::getAnalysisUsage(AU);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">     </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Index: lib/CodeGen/SimpleRegisterCoalescing.cpp</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">===================================================================</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">RCS file: lib/CodeGen/SimpleRegisterCoalescing.cpp</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">diff -N lib/CodeGen/SimpleRegisterCoalescing.cpp</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">--- /dev/null<SPAN class="Apple-tab-span" style="white-space:pre">       </SPAN>1 Jan 1970 00:00:00 -0000</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+++ lib/CodeGen/SimpleRegisterCoalescing.cpp<SPAN class="Apple-tab-span" style="white-space:pre">   </SPAN>6 May 2007 22:44:55 -0000</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">@@ -0,0 +1,1103 @@</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+//===-- SimpleRegisterCoalescing.cpp - Register Coalescing ----------------===//</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+//</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+// <SPAN class="Apple-converted-space">                    </SPAN>The LLVM Compiler Infrastructure</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+//</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+// This file was developed by the LLVM research group and is distributed under</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+// the University of Illinois Open Source License. See LICENSE.TXT for details.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+//</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+//===----------------------------------------------------------------------===//</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+//</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+// This file implements a simple register coalescing pass that attempts to</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+// aggressively coalesce every register copy that it can.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+//</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+//===----------------------------------------------------------------------===//</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+#define DEBUG_TYPE "simpleregistercoalescing"</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+#include "llvm/CodeGen/SimpleRegisterCoalescing.h"</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+#include "llvm/CodeGen/LiveIntervalAnalysis.h"</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+#include "VirtRegMap.h"</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+#include "llvm/Value.h"</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+#include "llvm/Analysis/LoopInfo.h"</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+#include "llvm/CodeGen/LiveVariables.h"</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+#include "llvm/CodeGen/MachineFrameInfo.h"</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+#include "llvm/CodeGen/MachineInstr.h"</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+#include "llvm/CodeGen/Passes.h"</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+#include "llvm/CodeGen/SSARegMap.h"</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+#include "llvm/Target/MRegisterInfo.h"</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+#include "llvm/Target/TargetInstrInfo.h"</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+#include "llvm/Target/TargetMachine.h"</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+#include "llvm/Support/CommandLine.h"</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+#include "llvm/Support/Debug.h"</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+#include "llvm/ADT/SmallSet.h"</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+#include "llvm/ADT/Statistic.h"</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+#include "llvm/ADT/STLExtras.h"</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+#include <algorithm></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+#include <cmath></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+using namespace llvm;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+STATISTIC(numJoins<SPAN class="Apple-converted-space">    </SPAN>, "Number of interval joins performed");</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+STATISTIC(numPeep <SPAN class="Apple-converted-space">    </SPAN>, "Number of identity moves eliminated after coalescing");</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+STATISTIC(numAborts <SPAN class="Apple-converted-space">  </SPAN>, "Number of times interval joining aborted");</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+char SimpleRegisterCoalescing::ID = 0;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+namespace {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>static cl::opt<bool></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>EnableJoining("join-liveintervals",</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">                </SPAN>cl::desc("Coallesce copies (default=true)"),</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">                </SPAN>cl::init(true));</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>RegisterPass<SimpleRegisterCoalescing><SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>X("simple-register-coalescing",</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>"Simple register coalescing to eliminate all possible register copies");</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+const PassInfo *llvm::SimpleRegisterCoalescingID = X.getPassInfo();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+void SimpleRegisterCoalescing::getAnalysisUsage(AnalysisUsage &AU) const {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">  </SPAN>//AU.addPreserved<LiveVariables>();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>AU.addPreserved<LiveIntervals>();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>AU.addPreservedID(PHIEliminationID);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>AU.addPreservedID(TwoAddressInstructionPassID);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>AU.addRequired<LiveVariables>();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>AU.addRequired<LiveIntervals>();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>AU.addRequired<LoopInfo>();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>MachineFunctionPass::getAnalysisUsage(AU);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// AdjustCopiesBackFrom - We found a non-trivially-coallescable copy with IntA</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// being the source and IntB being the dest, thus this defines a value number</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// in IntB.<SPAN class="Apple-converted-space">  </SPAN>If the source value number (in IntA) is defined by a copy from B,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// see if we can merge these two pieces of B into a single value number,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// eliminating a copy.<SPAN class="Apple-converted-space">  </SPAN>For example:</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+///</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+///<SPAN class="Apple-converted-space">  </SPAN>A3 = B0</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+///<SPAN class="Apple-converted-space">    </SPAN>...</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+///<SPAN class="Apple-converted-space">  </SPAN>B1 = A3<SPAN class="Apple-converted-space">      </SPAN><- this copy</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+///</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// In this case, B0 can be extended to where the B1 copy lives, allowing the B1</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// value number to be replaced with B0 (which simplifies the B liveinterval).</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+///</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// This returns true if an interval was modified.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+///</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+bool SimpleRegisterCoalescing::AdjustCopiesBackFrom(LiveInterval &IntA, LiveInterval &IntB,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">                                        </SPAN>MachineInstr *CopyMI) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>unsigned CopyIdx = li_->getDefIndex(li_->getInstructionIndex(CopyMI));</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// BValNo is a value number in B that is defined by a copy from A.<SPAN class="Apple-converted-space">  </SPAN>'B3' in</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// the example above.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>LiveInterval::iterator BLR = IntB.FindLiveRangeContaining(CopyIdx);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>unsigned BValNo = BLR->ValId;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// Get the location that B is defined at.<SPAN class="Apple-converted-space">  </SPAN>Two options: either this value has</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// an unknown definition point or it is defined at CopyIdx.<SPAN class="Apple-converted-space">  </SPAN>If unknown, we<SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// can't process it.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>unsigned BValNoDefIdx = IntB.getInstForValNum(BValNo);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>if (BValNoDefIdx == ~0U) return false;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>assert(BValNoDefIdx == CopyIdx &&</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">        </SPAN>"Copy doesn't define the value?");</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// AValNo is the value number in A that defines the copy, A0 in the example.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>LiveInterval::iterator AValLR = IntA.FindLiveRangeContaining(CopyIdx-1);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>unsigned AValNo = AValLR->ValId;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// If AValNo is defined as a copy from IntB, we can potentially process this.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// Get the instruction that defines this value number.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>unsigned SrcReg = IntA.getSrcRegForValNum(AValNo);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>if (!SrcReg) return false;<SPAN class="Apple-converted-space">  </SPAN>// Not defined by a copy.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// If the value number is not defined by a copy instruction, ignore it.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// If the source register comes from an interval other than IntB, we can't</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// handle this.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>if (rep(SrcReg) != IntB.reg) return false;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// Get the LiveRange in IntB that this value number starts with.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>unsigned AValNoInstIdx = IntA.getInstForValNum(AValNo);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>LiveInterval::iterator ValLR = IntB.FindLiveRangeContaining(AValNoInstIdx-1);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// Make sure that the end of the live range is inside the same block as</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// CopyMI.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>MachineInstr *ValLREndInst = li_->getInstructionFromIndex(ValLR->end-1);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>if (!ValLREndInst ||<SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>ValLREndInst->getParent() != CopyMI->getParent()) return false;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// Okay, we now know that ValLR ends in the same block that the CopyMI</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// live-range starts.<SPAN class="Apple-converted-space">  </SPAN>If there are no intervening live ranges between them in</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// IntB, we can merge them.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>if (ValLR+1 != BLR) return false;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>DOUT << "\nExtending: "; IntB.print(DOUT, mri_);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// We are about to delete CopyMI, so need to remove it as the 'instruction</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// that defines this value #'.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>IntB.setValueNumberInfo(BValNo, std::make_pair(~0U, 0));</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// Okay, we can merge them.<SPAN class="Apple-converted-space">  </SPAN>We need to insert a new liverange:</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// [ValLR.end, BLR.begin) of either value number, then we merge the</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// two value numbers.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>unsigned FillerStart = ValLR->end, FillerEnd = BLR->start;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>IntB.addRange(LiveRange(FillerStart, FillerEnd, BValNo));</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// If the IntB live range is assigned to a physical register, and if that</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// physreg has aliases,<SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>if (MRegisterInfo::isPhysicalRegister(IntB.reg)) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// Update the liveintervals of sub-registers.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>for (const unsigned *AS = mri_->getSubRegisters(IntB.reg); *AS; ++AS) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>LiveInterval &AliasLI = li_->getInterval(*AS);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>AliasLI.addRange(LiveRange(FillerStart, FillerEnd,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">                                </SPAN>AliasLI.getNextValue(~0U, 0)));</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// Okay, merge "B1" into the same value number as "B0".</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>if (BValNo != ValLR->ValId)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>IntB.MergeValueNumberInto(BValNo, ValLR->ValId);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>DOUT << " <SPAN class="Apple-converted-space">  </SPAN>result = "; IntB.print(DOUT, mri_);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>DOUT << "\n";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// If the source instruction was killing the source register before the</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// merge, unset the isKill marker given the live range has been extended.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>int UIdx = ValLREndInst->findRegisterUseOperandIdx(IntB.reg, true);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>if (UIdx != -1)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>ValLREndInst->getOperand(UIdx).unsetIsKill();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// Finally, delete the copy instruction.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>li_->RemoveMachineInstrFromMaps(CopyMI);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>CopyMI->eraseFromParent();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>++numPeep;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>return true;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// JoinCopy - Attempt to join intervals corresponding to SrcReg/DstReg,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// which are the src/dst of the copy instruction CopyMI.<SPAN class="Apple-converted-space">  </SPAN>This returns true</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// if the copy was successfully coallesced away, or if it is never possible</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// to coallesce this copy, due to register constraints.<SPAN class="Apple-converted-space">  </SPAN>It returns</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// false if it is not currently possible to coallesce this interval, but</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// it may be possible if other things get coallesced.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+bool SimpleRegisterCoalescing::JoinCopy(MachineInstr *CopyMI,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">                            </SPAN>unsigned SrcReg, unsigned DstReg, bool PhysOnly) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>DOUT << li_->getInstructionIndex(CopyMI) << '\t' << *CopyMI;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// Get representative registers.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>unsigned repSrcReg = rep(SrcReg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>unsigned repDstReg = rep(DstReg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// If they are already joined we continue.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>if (repSrcReg == repDstReg) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>DOUT << "\tCopy already coallesced.\n";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>return true;<SPAN class="Apple-converted-space">  </SPAN>// Not coallescable.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>bool SrcIsPhys = MRegisterInfo::isPhysicalRegister(repSrcReg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>bool DstIsPhys = MRegisterInfo::isPhysicalRegister(repDstReg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>if (PhysOnly && !SrcIsPhys && !DstIsPhys)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// Only joining physical registers with virtual registers in this round.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>return true;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// If they are both physical registers, we cannot join them.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>if (SrcIsPhys && DstIsPhys) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>DOUT << "\tCan not coallesce physregs.\n";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>return true;<SPAN class="Apple-converted-space">  </SPAN>// Not coallescable.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// We only join virtual registers with allocatable physical registers.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>if (SrcIsPhys && !allocatableRegs_[repSrcReg]) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>DOUT << "\tSrc reg is unallocatable physreg.\n";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>return true;<SPAN class="Apple-converted-space">  </SPAN>// Not coallescable.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>if (DstIsPhys && !allocatableRegs_[repDstReg]) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>DOUT << "\tDst reg is unallocatable physreg.\n";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>return true;<SPAN class="Apple-converted-space">  </SPAN>// Not coallescable.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// If they are not of the same register class, we cannot join them.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>if (differingRegisterClasses(repSrcReg, repDstReg)) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>DOUT << "\tSrc/Dest are different register classes.\n";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>return true;<SPAN class="Apple-converted-space">  </SPAN>// Not coallescable.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>LiveInterval &SrcInt = li_->getInterval(repSrcReg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>LiveInterval &DstInt = li_->getInterval(repDstReg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>assert(SrcInt.reg == repSrcReg && DstInt.reg == repDstReg &&</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">        </SPAN>"Register mapping is horribly broken!");</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>DOUT << "\t\tInspecting "; SrcInt.print(DOUT, mri_);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>DOUT << " and "; DstInt.print(DOUT, mri_);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>DOUT << ": ";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// Check if it is necessary to propagate "isDead" property before intervals</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// are joined.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>MachineOperand *mopd = CopyMI->findRegisterDefOperand(DstReg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>bool isDead = mopd->isDead();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>bool isShorten = false;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>unsigned SrcStart = 0, RemoveStart = 0;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>unsigned SrcEnd = 0, RemoveEnd = 0;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>if (isDead) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>unsigned CopyIdx = li_->getInstructionIndex(CopyMI);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>LiveInterval::iterator SrcLR =</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>SrcInt.FindLiveRangeContaining(li_->getUseIndex(CopyIdx));</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>RemoveStart = SrcStart = SrcLR->start;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>RemoveEnd <SPAN class="Apple-converted-space">  </SPAN>= SrcEnd <SPAN class="Apple-converted-space">  </SPAN>= SrcLR->end;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// The instruction which defines the src is only truly dead if there are</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// no intermediate uses and there isn't a use beyond the copy.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// FIXME: find the last use, mark is kill and shorten the live range.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>if (SrcEnd > li_->getDefIndex(CopyIdx)) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>isDead = false;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>} else {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>MachineOperand *MOU;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>MachineInstr *LastUse= lastRegisterUse(repSrcReg, SrcStart, CopyIdx, MOU);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>if (LastUse) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>// Shorten the liveinterval to the end of last use.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>MOU->setIsKill();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>isDead = false;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>isShorten = true;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>RemoveStart = li_->getDefIndex(li_->getInstructionIndex(LastUse));</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>RemoveEnd <SPAN class="Apple-converted-space">  </SPAN>= SrcEnd;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>} else {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>MachineInstr *SrcMI = li_->getInstructionFromIndex(SrcStart);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>if (SrcMI) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">          </SPAN>MachineOperand *mops = findDefOperand(SrcMI, repSrcReg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">          </SPAN>if (mops)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">            </SPAN>// A dead def should have a single cycle interval.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">            </SPAN>++RemoveStart;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// We need to be careful about coalescing a source physical register with a</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// virtual register. Once the coalescing is done, it cannot be broken and</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// these are not spillable! If the destination interval uses are far away,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// think twice about coalescing them!</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>if (!mopd->isDead() && (SrcIsPhys || DstIsPhys)) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>LiveInterval &JoinVInt = SrcIsPhys ? DstInt : SrcInt;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>unsigned JoinVReg = SrcIsPhys ? repDstReg : repSrcReg;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>unsigned JoinPReg = SrcIsPhys ? repSrcReg : repDstReg;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>const TargetRegisterClass *RC = mf_->getSSARegMap()->getRegClass(JoinVReg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>unsigned Threshold = allocatableRCRegs_[RC].count();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// If the virtual register live interval is long has it has low use desity,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// do not join them, instead mark the physical register as its allocation</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// preference.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>unsigned Length = JoinVInt.getSize() / InstrSlots::NUM;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>LiveVariables::VarInfo &vi = lv_->getVarInfo(JoinVReg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>if (Length > Threshold &&</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>(((float)vi.NumUses / Length) < (1.0 / Threshold))) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>JoinVInt.preference = JoinPReg;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>++numAborts;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>DOUT << "\tMay tie down a physical register, abort!\n";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>return false;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// Okay, attempt to join these two intervals.<SPAN class="Apple-converted-space">  </SPAN>On failure, this returns false.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// Otherwise, if one of the intervals being joined is a physreg, this method</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// always canonicalizes DstInt to be it.<SPAN class="Apple-converted-space">  </SPAN>The output "SrcInt" will not have</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// been modified, so we can use this information below to update aliases.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>if (JoinIntervals(DstInt, SrcInt)) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>if (isDead) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>// Result of the copy is dead. Propagate this property.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>if (SrcStart == 0) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>assert(MRegisterInfo::isPhysicalRegister(repSrcReg) &&</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">              </SPAN>"Live-in must be a physical register!");</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>// Live-in to the function but dead. Remove it from entry live-in set.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>// JoinIntervals may end up swapping the two intervals.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>mf_->begin()->removeLiveIn(repSrcReg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>} else {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>MachineInstr *SrcMI = li_->getInstructionFromIndex(SrcStart);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>if (SrcMI) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">          </SPAN>MachineOperand *mops = findDefOperand(SrcMI, repSrcReg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">          </SPAN>if (mops)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">            </SPAN>mops->setIsDead();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>if (isShorten || isDead) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>// Shorten the live interval.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>LiveInterval &LiveInInt = (repSrcReg == DstInt.reg) ? DstInt : SrcInt;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>LiveInInt.removeRange(RemoveStart, RemoveEnd);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>} else {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// Coallescing failed.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// If we can eliminate the copy without merging the live ranges, do so now.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>if (AdjustCopiesBackFrom(SrcInt, DstInt, CopyMI))</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>return true;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// Otherwise, we are unable to join the intervals.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>DOUT << "Interference!\n";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>return false;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>bool Swapped = repSrcReg == DstInt.reg;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>if (Swapped)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>std::swap(repSrcReg, repDstReg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>assert(MRegisterInfo::isVirtualRegister(repSrcReg) &&</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">        </SPAN>"LiveInterval::join didn't work right!");</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">                               </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// If we're about to merge live ranges into a physical register live range,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// we have to update any aliased register's live ranges to indicate that they</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// have clobbered values for this range.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>if (MRegisterInfo::isPhysicalRegister(repDstReg)) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// Update the liveintervals of sub-registers.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>for (const unsigned *AS = mri_->getSubRegisters(repDstReg); *AS; ++AS)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>li_->getInterval(*AS).MergeInClobberRanges(SrcInt);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>} else {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// Merge use info if the destination is a virtual register.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>LiveVariables::VarInfo& dVI = lv_->getVarInfo(repDstReg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>LiveVariables::VarInfo& sVI = lv_->getVarInfo(repSrcReg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>dVI.NumUses += sVI.NumUses;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>DOUT << "\n\t\tJoined.<SPAN class="Apple-converted-space">  </SPAN>Result = "; DstInt.print(DOUT, mri_);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>DOUT << "\n";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// Remember these liveintervals have been joined.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>JoinedLIs.set(repSrcReg - MRegisterInfo::FirstVirtualRegister);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>if (MRegisterInfo::isVirtualRegister(repDstReg))</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>JoinedLIs.set(repDstReg - MRegisterInfo::FirstVirtualRegister);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// If the intervals were swapped by Join, swap them back so that the register</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// mapping (in the r2i map) is correct.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>if (Swapped) SrcInt.swap(DstInt);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>li_->removeInterval(repSrcReg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>r2rMap_[repSrcReg] = repDstReg;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// Finally, delete the copy instruction.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>li_->RemoveMachineInstrFromMaps(CopyMI);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>CopyMI->eraseFromParent();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>++numPeep;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>++numJoins;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>return true;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// ComputeUltimateVN - Assuming we are going to join two live intervals,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// compute what the resultant value numbers for each value in the input two</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// ranges will be.<SPAN class="Apple-converted-space">  </SPAN>This is complicated by copies between the two which can</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// and will commonly cause multiple value numbers to be merged into one.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+///</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// VN is the value number that we're trying to resolve.<SPAN class="Apple-converted-space">  </SPAN>InstDefiningValue</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// keeps track of the new InstDefiningValue assignment for the result</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// LiveInterval.<SPAN class="Apple-converted-space">  </SPAN>ThisFromOther/OtherFromThis are sets that keep track of</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// whether a value in this or other is a copy from the opposite set.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// ThisValNoAssignments/OtherValNoAssignments keep track of value #'s that have</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// already been assigned.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+///</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// ThisFromOther[x] - If x is defined as a copy from the other interval, this</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// contains the value number the copy is from.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+///</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+static unsigned ComputeUltimateVN(unsigned VN,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">                                  </SPAN>SmallVector<std::pair<unsigned,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">                                                </SPAN>unsigned>, 16> &ValueNumberInfo,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">                                  </SPAN>SmallVector<int, 16> &ThisFromOther,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">                                  </SPAN>SmallVector<int, 16> &OtherFromThis,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">                                  </SPAN>SmallVector<int, 16> &ThisValNoAssignments,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">                                  </SPAN>SmallVector<int, 16> &OtherValNoAssignments,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">                                  </SPAN>LiveInterval &ThisLI, LiveInterval &OtherLI) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// If the VN has already been computed, just return it.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>if (ThisValNoAssignments[VN] >= 0)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>return ThisValNoAssignments[VN];</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+//<SPAN class="Apple-converted-space">  </SPAN>assert(ThisValNoAssignments[VN] != -2 && "Cyclic case?");</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// If this val is not a copy from the other val, then it must be a new value</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// number in the destination.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>int OtherValNo = ThisFromOther[VN];</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>if (OtherValNo == -1) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>ValueNumberInfo.push_back(ThisLI.getValNumInfo(VN));</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>return ThisValNoAssignments[VN] = ValueNumberInfo.size()-1;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// Otherwise, this *is* a copy from the RHS.<SPAN class="Apple-converted-space">  </SPAN>If the other side has already</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// been computed, return it.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>if (OtherValNoAssignments[OtherValNo] >= 0)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>return ThisValNoAssignments[VN] = OtherValNoAssignments[OtherValNo];</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// Mark this value number as currently being computed, then ask what the</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// ultimate value # of the other value is.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>ThisValNoAssignments[VN] = -2;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>unsigned UltimateVN =</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>ComputeUltimateVN(OtherValNo, ValueNumberInfo,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">                      </SPAN>OtherFromThis, ThisFromOther,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">                      </SPAN>OtherValNoAssignments, ThisValNoAssignments,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">                      </SPAN>OtherLI, ThisLI);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>return ThisValNoAssignments[VN] = UltimateVN;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+static bool InVector(unsigned Val, const SmallVector<unsigned, 8> &V) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>return std::find(V.begin(), V.end(), Val) != V.end();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// SimpleJoin - Attempt to joint the specified interval into this one. The</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// caller of this method must guarantee that the RHS only contains a single</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// value number and that the RHS is not defined by a copy from this</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// interval.<SPAN class="Apple-converted-space">  </SPAN>This returns false if the intervals are not joinable, or it</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// joins them and returns true.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+bool SimpleRegisterCoalescing::SimpleJoin(LiveInterval &LHS, LiveInterval &RHS) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>assert(RHS.containsOneValue());</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// Some number (potentially more than one) value numbers in the current</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// interval may be defined as copies from the RHS.<SPAN class="Apple-converted-space">  </SPAN>Scan the overlapping</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// portions of the LHS and RHS, keeping track of this and looking for</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// overlapping live ranges that are NOT defined as copies.<SPAN class="Apple-converted-space">  </SPAN>If these exist, we</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// cannot coallesce.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>LiveInterval::iterator LHSIt = LHS.begin(), LHSEnd = LHS.end();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>LiveInterval::iterator RHSIt = RHS.begin(), RHSEnd = RHS.end();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>if (LHSIt->start < RHSIt->start) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>LHSIt = std::upper_bound(LHSIt, LHSEnd, RHSIt->start);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>if (LHSIt != LHS.begin()) --LHSIt;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>} else if (RHSIt->start < LHSIt->start) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>RHSIt = std::upper_bound(RHSIt, RHSEnd, LHSIt->start);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>if (RHSIt != RHS.begin()) --RHSIt;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>SmallVector<unsigned, 8> EliminatedLHSVals;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>while (1) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// Determine if these live intervals overlap.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>bool Overlaps = false;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>if (LHSIt->start <= RHSIt->start)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>Overlaps = LHSIt->end > RHSIt->start;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>else</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>Overlaps = RHSIt->end > LHSIt->start;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// If the live intervals overlap, there are two interesting cases: if the</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// LHS interval is defined by a copy from the RHS, it's ok and we record</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// that the LHS value # is the same as the RHS.<SPAN class="Apple-converted-space">  </SPAN>If it's not, then we cannot</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// coallesce these live ranges and we bail out.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>if (Overlaps) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>// If we haven't already recorded that this value # is safe, check it.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>if (!InVector(LHSIt->ValId, EliminatedLHSVals)) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>// Copy from the RHS?</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>unsigned SrcReg = LHS.getSrcRegForValNum(LHSIt->ValId);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>if (rep(SrcReg) != RHS.reg)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">          </SPAN>return false;<SPAN class="Apple-converted-space">    </SPAN>// Nope, bail out.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">       </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>EliminatedLHSVals.push_back(LHSIt->ValId);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">     </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>// We know this entire LHS live range is okay, so skip it now.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>if (++LHSIt == LHSEnd) break;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>continue;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>if (LHSIt->end < RHSIt->end) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>if (++LHSIt == LHSEnd) break;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>} else {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>// One interesting case to check here.<SPAN class="Apple-converted-space">  </SPAN>It's possible that we have</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>// something like "X3 = Y" which defines a new value number in the LHS,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>// and is the last use of this liverange of the RHS.<SPAN class="Apple-converted-space">  </SPAN>In this case, we</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>// want to notice this copy (so that it gets coallesced away) even though</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>// the live ranges don't actually overlap.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>if (LHSIt->start == RHSIt->end) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>if (InVector(LHSIt->ValId, EliminatedLHSVals)) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">          </SPAN>// We already know that this value number is going to be merged in</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">          </SPAN>// if coallescing succeeds.<SPAN class="Apple-converted-space">  </SPAN>Just skip the liverange.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">          </SPAN>if (++LHSIt == LHSEnd) break;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>} else {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">          </SPAN>// Otherwise, if this is a copy from the RHS, mark it as being merged</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">          </SPAN>// in.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">          </SPAN>if (rep(LHS.getSrcRegForValNum(LHSIt->ValId)) == RHS.reg) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">            </SPAN>EliminatedLHSVals.push_back(LHSIt->ValId);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">            </SPAN>// We know this entire LHS live range is okay, so skip it now.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">            </SPAN>if (++LHSIt == LHSEnd) break;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">          </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">     </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>if (++RHSIt == RHSEnd) break;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// If we got here, we know that the coallescing will be successful and that</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// the value numbers in EliminatedLHSVals will all be merged together.<SPAN class="Apple-converted-space">  </SPAN>Since</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// the most common case is that EliminatedLHSVals has a single number, we</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// optimize for it: if there is more than one value, we merge them all into</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// the lowest numbered one, then handle the interval as if we were merging</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// with one value number.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>unsigned LHSValNo;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>if (EliminatedLHSVals.size() > 1) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// Loop through all the equal value numbers merging them into the smallest</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// one.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>unsigned Smallest = EliminatedLHSVals[0];</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>for (unsigned i = 1, e = EliminatedLHSVals.size(); i != e; ++i) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>if (EliminatedLHSVals[i] < Smallest) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>// Merge the current notion of the smallest into the smaller one.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>LHS.MergeValueNumberInto(Smallest, EliminatedLHSVals[i]);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>Smallest = EliminatedLHSVals[i];</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>} else {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>// Merge into the smallest.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>LHS.MergeValueNumberInto(EliminatedLHSVals[i], Smallest);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>LHSValNo = Smallest;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>} else {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>assert(!EliminatedLHSVals.empty() && "No copies from the RHS?");</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>LHSValNo = EliminatedLHSVals[0];</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// Okay, now that there is a single LHS value number that we're merging the</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// RHS into, update the value number info for the LHS to indicate that the</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// value number is defined where the RHS value number was.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>LHS.setValueNumberInfo(LHSValNo, RHS.getValNumInfo(0));</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// Okay, the final step is to loop over the RHS live intervals, adding them to</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// the LHS.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>LHS.MergeRangesInAsValue(RHS, LHSValNo);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>LHS.weight += RHS.weight;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>if (RHS.preference && !LHS.preference)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>LHS.preference = RHS.preference;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>return true;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// JoinIntervals - Attempt to join these two intervals.<SPAN class="Apple-converted-space">  </SPAN>On failure, this</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// returns false.<SPAN class="Apple-converted-space">  </SPAN>Otherwise, if one of the intervals being joined is a</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// physreg, this method always canonicalizes LHS to be it.<SPAN class="Apple-converted-space">  </SPAN>The output</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// "RHS" will not have been modified, so we can use this information</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// below to update aliases.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+bool SimpleRegisterCoalescing::JoinIntervals(LiveInterval &LHS, LiveInterval &RHS) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// Compute the final value assignment, assuming that the live ranges can be</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// coallesced.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>SmallVector<int, 16> LHSValNoAssignments;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>SmallVector<int, 16> RHSValNoAssignments;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>SmallVector<std::pair<unsigned,unsigned>, 16> ValueNumberInfo;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">                         </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// If a live interval is a physical register, conservatively check if any</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// of its sub-registers is overlapping the live interval of the virtual</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// register. If so, do not coalesce.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>if (MRegisterInfo::isPhysicalRegister(LHS.reg) &&</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>*mri_->getSubRegisters(LHS.reg)) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>for (const unsigned* SR = mri_->getSubRegisters(LHS.reg); *SR; ++SR)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>if (li_->hasInterval(*SR) && RHS.overlaps(li_->getInterval(*SR))) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>DOUT << "Interfere with sub-register ";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>DEBUG(li_->getInterval(*SR).print(DOUT, mri_));</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>return false;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>} else if (MRegisterInfo::isPhysicalRegister(RHS.reg) &&</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">            </SPAN>*mri_->getSubRegisters(RHS.reg)) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>for (const unsigned* SR = mri_->getSubRegisters(RHS.reg); *SR; ++SR)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>if (li_->hasInterval(*SR) && LHS.overlaps(li_->getInterval(*SR))) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>DOUT << "Interfere with sub-register ";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>DEBUG(li_->getInterval(*SR).print(DOUT, mri_));</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>return false;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">                         </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// Compute ultimate value numbers for the LHS and RHS values.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>if (RHS.containsOneValue()) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// Copies from a liveinterval with a single value are simple to handle and</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// very common, handle the special case here.<SPAN class="Apple-converted-space">  </SPAN>This is important, because</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// often RHS is small and LHS is large (e.g. a physreg).</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// Find out if the RHS is defined as a copy from some value in the LHS.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>int RHSValID = -1;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>std::pair<unsigned,unsigned> RHSValNoInfo;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>unsigned RHSSrcReg = RHS.getSrcRegForValNum(0);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>if ((RHSSrcReg == 0 || rep(RHSSrcReg) != LHS.reg)) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>// If RHS is not defined as a copy from the LHS, we can use simpler and</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>// faster checks to see if the live ranges are coallescable.<SPAN class="Apple-converted-space">  </SPAN>This joiner</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>// can't swap the LHS/RHS intervals though.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>if (!MRegisterInfo::isPhysicalRegister(RHS.reg)) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>return SimpleJoin(LHS, RHS);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>} else {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>RHSValNoInfo = RHS.getValNumInfo(0);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>} else {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>// It was defined as a copy from the LHS, find out what value # it is.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>unsigned ValInst = RHS.getInstForValNum(0);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>RHSValID = LHS.getLiveRangeContaining(ValInst-1)->ValId;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>RHSValNoInfo = LHS.getValNumInfo(RHSValID);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>LHSValNoAssignments.resize(LHS.getNumValNums(), -1);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>RHSValNoAssignments.resize(RHS.getNumValNums(), -1);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>ValueNumberInfo.resize(LHS.getNumValNums());</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// Okay, *all* of the values in LHS that are defined as a copy from RHS</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// should now get updated.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>for (unsigned VN = 0, e = LHS.getNumValNums(); VN != e; ++VN) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>if (unsigned LHSSrcReg = LHS.getSrcRegForValNum(VN)) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>if (rep(LHSSrcReg) != RHS.reg) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">          </SPAN>// If this is not a copy from the RHS, its value number will be</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">          </SPAN>// unmodified by the coallescing.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">          </SPAN>ValueNumberInfo[VN] = LHS.getValNumInfo(VN);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">          </SPAN>LHSValNoAssignments[VN] = VN;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>} else if (RHSValID == -1) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">          </SPAN>// Otherwise, it is a copy from the RHS, and we don't already have a</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">          </SPAN>// value# for it.<SPAN class="Apple-converted-space">  </SPAN>Keep the current value number, but remember it.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">          </SPAN>LHSValNoAssignments[VN] = RHSValID = VN;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">          </SPAN>ValueNumberInfo[VN] = RHSValNoInfo;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>} else {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">          </SPAN>// Otherwise, use the specified value #.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">          </SPAN>LHSValNoAssignments[VN] = RHSValID;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">          </SPAN>if (VN != (unsigned)RHSValID)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">            </SPAN>ValueNumberInfo[VN].first = ~1U;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">          </SPAN>else</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">            </SPAN>ValueNumberInfo[VN] = RHSValNoInfo;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>} else {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>ValueNumberInfo[VN] = LHS.getValNumInfo(VN);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>LHSValNoAssignments[VN] = VN;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>assert(RHSValID != -1 && "Didn't find value #?");</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>RHSValNoAssignments[0] = RHSValID;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>} else {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// Loop over the value numbers of the LHS, seeing if any are defined from</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// the RHS.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>SmallVector<int, 16> LHSValsDefinedFromRHS;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>LHSValsDefinedFromRHS.resize(LHS.getNumValNums(), -1);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>for (unsigned VN = 0, e = LHS.getNumValNums(); VN != e; ++VN) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>unsigned ValSrcReg = LHS.getSrcRegForValNum(VN);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>if (ValSrcReg == 0)<SPAN class="Apple-converted-space">  </SPAN>// Src not defined by a copy?</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>continue;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">     </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>// DstReg is known to be a register in the LHS interval.<SPAN class="Apple-converted-space">  </SPAN>If the src is</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>// from the RHS interval, we can use its value #.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>if (rep(ValSrcReg) != RHS.reg)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>continue;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">     </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>// Figure out the value # from the RHS.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>unsigned ValInst = LHS.getInstForValNum(VN);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>LHSValsDefinedFromRHS[VN] = RHS.getLiveRangeContaining(ValInst-1)->ValId;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// Loop over the value numbers of the RHS, seeing if any are defined from</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// the LHS.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>SmallVector<int, 16> RHSValsDefinedFromLHS;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>RHSValsDefinedFromLHS.resize(RHS.getNumValNums(), -1);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>for (unsigned VN = 0, e = RHS.getNumValNums(); VN != e; ++VN) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>unsigned ValSrcReg = RHS.getSrcRegForValNum(VN);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>if (ValSrcReg == 0)<SPAN class="Apple-converted-space">  </SPAN>// Src not defined by a copy?</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>continue;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">     </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>// DstReg is known to be a register in the RHS interval.<SPAN class="Apple-converted-space">  </SPAN>If the src is</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>// from the LHS interval, we can use its value #.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>if (rep(ValSrcReg) != LHS.reg)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>continue;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">     </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>// Figure out the value # from the LHS.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>unsigned ValInst = RHS.getInstForValNum(VN);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>RHSValsDefinedFromLHS[VN] = LHS.getLiveRangeContaining(ValInst-1)->ValId;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>LHSValNoAssignments.resize(LHS.getNumValNums(), -1);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>RHSValNoAssignments.resize(RHS.getNumValNums(), -1);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>ValueNumberInfo.reserve(LHS.getNumValNums() + RHS.getNumValNums());</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>for (unsigned VN = 0, e = LHS.getNumValNums(); VN != e; ++VN) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>if (LHSValNoAssignments[VN] >= 0 || LHS.getInstForValNum(VN) == ~2U)<SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>continue;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>ComputeUltimateVN(VN, ValueNumberInfo,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">                        </SPAN>LHSValsDefinedFromRHS, RHSValsDefinedFromLHS,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">                        </SPAN>LHSValNoAssignments, RHSValNoAssignments, LHS, RHS);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>for (unsigned VN = 0, e = RHS.getNumValNums(); VN != e; ++VN) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>if (RHSValNoAssignments[VN] >= 0 || RHS.getInstForValNum(VN) == ~2U)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>continue;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>// If this value number isn't a copy from the LHS, it's a new number.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>if (RHSValsDefinedFromLHS[VN] == -1) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>ValueNumberInfo.push_back(RHS.getValNumInfo(VN));</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>RHSValNoAssignments[VN] = ValueNumberInfo.size()-1;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>continue;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">     </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>ComputeUltimateVN(VN, ValueNumberInfo,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">                        </SPAN>RHSValsDefinedFromLHS, LHSValsDefinedFromRHS,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">                        </SPAN>RHSValNoAssignments, LHSValNoAssignments, RHS, LHS);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// Armed with the mappings of LHS/RHS values to ultimate values, walk the</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// interval lists to see if these intervals are coallescable.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>LiveInterval::const_iterator I = LHS.begin();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>LiveInterval::const_iterator IE = LHS.end();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>LiveInterval::const_iterator J = RHS.begin();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>LiveInterval::const_iterator JE = RHS.end();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// Skip ahead until the first place of potential sharing.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>if (I->start < J->start) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>I = std::upper_bound(I, IE, J->start);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>if (I != LHS.begin()) --I;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>} else if (J->start < I->start) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>J = std::upper_bound(J, JE, I->start);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>if (J != RHS.begin()) --J;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>while (1) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// Determine if these two live ranges overlap.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>bool Overlaps;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>if (I->start < J->start) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>Overlaps = I->end > J->start;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>} else {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>Overlaps = J->end > I->start;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// If so, check value # info to determine if they are really different.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>if (Overlaps) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>// If the live range overlap will map to the same value number in the</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>// result liverange, we can still coallesce them.<SPAN class="Apple-converted-space">  </SPAN>If not, we can't.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>if (LHSValNoAssignments[I->ValId] != RHSValNoAssignments[J->ValId])</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>return false;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>if (I->end < J->end) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>++I;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>if (I == IE) break;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>} else {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>++J;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>if (J == JE) break;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// If we get here, we know that we can coallesce the live ranges.<SPAN class="Apple-converted-space">  </SPAN>Ask the</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// intervals to coallesce themselves now.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>LHS.join(RHS, &LHSValNoAssignments[0], &RHSValNoAssignments[0],</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">          </SPAN>ValueNumberInfo);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>return true;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+namespace {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// DepthMBBCompare - Comparison predicate that sort first based on the loop</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// depth of the basic block (the unsigned), and then on the MBB number.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>struct DepthMBBCompare {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>typedef std::pair<unsigned, MachineBasicBlock*> DepthMBBPair;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>bool operator()(const DepthMBBPair &LHS, const DepthMBBPair &RHS) const {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>if (LHS.first > RHS.first) return true; <SPAN class="Apple-converted-space">  </SPAN>// Deeper loops first</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>return LHS.first == RHS.first &&</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>LHS.second->getNumber() < RHS.second->getNumber();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>};</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+void SimpleRegisterCoalescing::CopyCoallesceInMBB(MachineBasicBlock *MBB,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">                                </SPAN>std::vector<CopyRec> *TryAgain, bool PhysOnly) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>DOUT << ((Value*)MBB->getBasicBlock())->getName() << ":\n";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>for (MachineBasicBlock::iterator MII = MBB->begin(), E = MBB->end();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">      </SPAN>MII != E;) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>MachineInstr *Inst = MII++;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// If this isn't a copy, we can't join intervals.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>unsigned SrcReg, DstReg;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>if (!tii_->isMoveInstr(*Inst, SrcReg, DstReg)) continue;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">   </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>if (TryAgain && !JoinCopy(Inst, SrcReg, DstReg, PhysOnly))</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>TryAgain->push_back(getCopyRec(Inst, SrcReg, DstReg));</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+void SimpleRegisterCoalescing::joinIntervals() {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>DOUT << "********** JOINING INTERVALS ***********\n";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>JoinedLIs.resize(li_->getNumIntervals());</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>JoinedLIs.reset();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>std::vector<CopyRec> TryAgainList;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>const LoopInfo &LI = getAnalysis<LoopInfo>();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>if (LI.begin() == LI.end()) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// If there are no loops in the function, join intervals in function order.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>for (MachineFunction::iterator I = mf_->begin(), E = mf_->end();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">        </SPAN>I != E; ++I)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>CopyCoallesceInMBB(I, &TryAgainList);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>} else {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// Otherwise, join intervals in inner loops before other intervals.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// Unfortunately we can't just iterate over loop hierarchy here because</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// there may be more MBB's than BB's.<SPAN class="Apple-converted-space">  </SPAN>Collect MBB's for sorting.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// Join intervals in the function prolog first. We want to join physical</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// registers with virtual registers before the intervals got too long.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>std::vector<std::pair<unsigned, MachineBasicBlock*> > MBBs;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>for (MachineFunction::iterator I = mf_->begin(), E = mf_->end(); I != E;++I)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>MBBs.push_back(std::make_pair(LI.getLoopDepth(I->getBasicBlock()), I));</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// Sort by loop depth.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>std::sort(MBBs.begin(), MBBs.end(), DepthMBBCompare());</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// Finally, join intervals in loop nest order.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>for (unsigned i = 0, e = MBBs.size(); i != e; ++i)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>CopyCoallesceInMBB(MBBs[i].second, NULL, true);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>for (unsigned i = 0, e = MBBs.size(); i != e; ++i)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>CopyCoallesceInMBB(MBBs[i].second, &TryAgainList, false);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// Joining intervals can allow other intervals to be joined.<SPAN class="Apple-converted-space">  </SPAN>Iteratively join</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// until we make no progress.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>bool ProgressMade = true;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>while (ProgressMade) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>ProgressMade = false;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>for (unsigned i = 0, e = TryAgainList.size(); i != e; ++i) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>CopyRec &TheCopy = TryAgainList[i];</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>if (TheCopy.MI &&</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">          </SPAN>JoinCopy(TheCopy.MI, TheCopy.SrcReg, TheCopy.DstReg)) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>TheCopy.MI = 0; <SPAN class="Apple-converted-space">  </SPAN>// Mark this one as done.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>ProgressMade = true;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// Some live range has been lengthened due to colaescing, eliminate the</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// unnecessary kills.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>int RegNum = JoinedLIs.find_first();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>while (RegNum != -1) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>unsigned Reg = RegNum + MRegisterInfo::FirstVirtualRegister;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>unsigned repReg = rep(Reg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>LiveInterval &LI = li_->getInterval(repReg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>LiveVariables::VarInfo& svi = lv_->getVarInfo(Reg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>for (unsigned i = 0, e = svi.Kills.size(); i != e; ++i) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>MachineInstr *Kill = svi.Kills[i];</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>// Suppose vr1 = op vr2, x</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>// and vr1 and vr2 are coalesced. vr2 should still be marked kill</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>// unless it is a two-address operand.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>if (li_->isRemoved(Kill) || hasRegisterDef(Kill, repReg))</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>continue;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>if (LI.liveAt(li_->getInstructionIndex(Kill) + InstrSlots::NUM))</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>unsetRegisterKill(Kill, repReg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>RegNum = JoinedLIs.find_next(RegNum);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>DOUT << "*** Register mapping ***\n";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>for (int i = 0, e = r2rMap_.size(); i != e; ++i)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>if (r2rMap_[i]) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>DOUT << "<SPAN class="Apple-converted-space">  </SPAN>reg " << i << " -> ";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>DEBUG(printRegName(r2rMap_[i]));</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>DOUT << "\n";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// Return true if the two specified registers belong to different register</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// classes.<SPAN class="Apple-converted-space">  </SPAN>The registers may be either phys or virt regs.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+bool SimpleRegisterCoalescing::differingRegisterClasses(unsigned RegA,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">                                            </SPAN>unsigned RegB) const {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// Get the register classes for the first reg.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>if (MRegisterInfo::isPhysicalRegister(RegA)) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>assert(MRegisterInfo::isVirtualRegister(RegB) &&</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">          </SPAN>"Shouldn't consider two physregs!");</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>return !mf_->getSSARegMap()->getRegClass(RegB)->contains(RegA);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// Compare against the regclass for the second reg.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>const TargetRegisterClass *RegClass = mf_->getSSARegMap()->getRegClass(RegA);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>if (MRegisterInfo::isVirtualRegister(RegB))</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>return RegClass != mf_->getSSARegMap()->getRegClass(RegB);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>else</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>return !RegClass->contains(RegB);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// lastRegisterUse - Returns the last use of the specific register between</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// cycles Start and End. It also returns the use operand by reference. It</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// returns NULL if there are no uses.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+MachineInstr *</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+SimpleRegisterCoalescing::lastRegisterUse(unsigned Reg, unsigned Start, unsigned End,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">                              </SPAN>MachineOperand *&MOU) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>int e = (End-1) / InstrSlots::NUM * InstrSlots::NUM;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>int s = Start;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>while (e >= s) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>// Skip deleted instructions</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>MachineInstr *MI = li_->getInstructionFromIndex(e);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>while ((e - InstrSlots::NUM) >= s && !MI) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>e -= InstrSlots::NUM;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>MI = li_->getInstructionFromIndex(e);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>if (e < s || MI == NULL)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>return NULL;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>for (unsigned i = 0, NumOps = MI->getNumOperands(); i != NumOps; ++i) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>MachineOperand &MO = MI->getOperand(i);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>if (MO.isReg() && MO.isUse() && MO.getReg() &&</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">          </SPAN>mri_->regsOverlap(rep(MO.getReg()), Reg)) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>MOU = &MO;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>return MI;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>e -= InstrSlots::NUM;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>return NULL;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// findDefOperand - Returns the MachineOperand that is a def of the specific</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// register. It returns NULL if the def is not found.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+MachineOperand *SimpleRegisterCoalescing::findDefOperand(MachineInstr *MI, unsigned Reg) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>MachineOperand &MO = MI->getOperand(i);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>if (MO.isReg() && MO.isDef() &&</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>mri_->regsOverlap(rep(MO.getReg()), Reg))</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>return &MO;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>return NULL;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// unsetRegisterKill - Unset IsKill property of all uses of specific register</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// of the specific instruction.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+void SimpleRegisterCoalescing::unsetRegisterKill(MachineInstr *MI, unsigned Reg) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>MachineOperand &MO = MI->getOperand(i);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>if (MO.isReg() && MO.isUse() && MO.isKill() && MO.getReg() &&</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>mri_->regsOverlap(rep(MO.getReg()), Reg))</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>MO.unsetIsKill();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// hasRegisterDef - True if the instruction defines the specific register.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+///</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+bool SimpleRegisterCoalescing::hasRegisterDef(MachineInstr *MI, unsigned Reg) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>MachineOperand &MO = MI->getOperand(i);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>if (MO.isReg() && MO.isDef() &&</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>mri_->regsOverlap(rep(MO.getReg()), Reg))</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>return true;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>return false;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+void SimpleRegisterCoalescing::printRegName(unsigned reg) const {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>if (MRegisterInfo::isPhysicalRegister(reg))</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>cerr << mri_->getName(reg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>else</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>cerr << "%reg" << reg;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+void SimpleRegisterCoalescing::releaseMemory() {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">  </SPAN>r2rMap_.clear();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">  </SPAN>JoinedLIs.clear();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+static bool isZeroLengthInterval(LiveInterval *li) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>for (LiveInterval::Ranges::const_iterator</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">        </SPAN>i = li->ranges.begin(), e = li->ranges.end(); i != e; ++i)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>if (i->end - i->start > LiveIntervals::InstrSlots::NUM)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>return false;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>return true;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+bool SimpleRegisterCoalescing::runOnMachineFunction(MachineFunction &fn) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>mf_ = &fn;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>tm_ = &fn.getTarget();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>mri_ = tm_->getRegisterInfo();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>tii_ = tm_->getInstrInfo();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>li_ = &getAnalysis<LiveIntervals>();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>lv_ = &getAnalysis<LiveVariables>();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>DOUT << "********** SIMPLE REGISTER COALESCING **********\n"</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">      </SPAN><< "********** Function: "</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">      </SPAN><< ((Value*)mf_->getFunction())->getName() << '\n';</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>allocatableRegs_ = mri_->getAllocatableSet(fn);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>for (MRegisterInfo::regclass_iterator I = mri_->regclass_begin(),</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">        </SPAN>E = mri_->regclass_end(); I != E; ++I)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>allocatableRCRegs_.insert(std::make_pair(*I,mri_->getAllocatableSet(fn, *I)));</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>r2rMap_.grow(mf_->getSSARegMap()->getLastVirtReg());</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// Join (coallesce) intervals if requested.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>if (EnableJoining) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>joinIntervals();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>DOUT << "********** INTERVALS POST JOINING **********\n";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>for (LiveIntervals::iterator I = li_->begin(), E = li_->end(); I != E; ++I) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>I->second.print(DOUT, mri_);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>DOUT << "\n";</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// perform a final pass over the instructions and compute spill</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>// weights, coalesce virtual registers and remove identity moves.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>const LoopInfo &loopInfo = getAnalysis<LoopInfo>();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>for (MachineFunction::iterator mbbi = mf_->begin(), mbbe = mf_->end();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">      </SPAN>mbbi != mbbe; ++mbbi) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>MachineBasicBlock* mbb = mbbi;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>unsigned loopDepth = loopInfo.getLoopDepth(mbb->getBasicBlock());</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>for (MachineBasicBlock::iterator mii = mbb->begin(), mie = mbb->end();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">        </SPAN>mii != mie; ) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>// if the move will be an identity move delete it</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>unsigned srcReg, dstReg, RegRep;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>if (tii_->isMoveInstr(*mii, srcReg, dstReg) &&</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">          </SPAN>(RegRep = rep(srcReg)) == rep(dstReg)) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>// remove from def list</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>LiveInterval &RegInt = li_->getOrCreateInterval(RegRep);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>MachineOperand *MO = mii->findRegisterDefOperand(dstReg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>// If def of this move instruction is dead, remove its live range from</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>// the dstination register's live interval.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>if (MO->isDead()) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">          </SPAN>unsigned MoveIdx = li_->getDefIndex(li_->getInstructionIndex(mii));</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">          </SPAN>LiveInterval::iterator MLR = RegInt.FindLiveRangeContaining(MoveIdx);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">          </SPAN>RegInt.removeRange(MLR->start, MoveIdx+1);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">          </SPAN>if (RegInt.empty())</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">            </SPAN>li_->removeInterval(RegRep);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>li_->RemoveMachineInstrFromMaps(mii);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>mii = mbbi->erase(mii);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>++numPeep;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>} else {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>SmallSet<unsigned, 4> UniqueUses;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>for (unsigned i = 0, e = mii->getNumOperands(); i != e; ++i) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">          </SPAN>const MachineOperand &mop = mii->getOperand(i);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">          </SPAN>if (mop.isRegister() && mop.getReg() &&</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">              </SPAN>MRegisterInfo::isVirtualRegister(mop.getReg())) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">            </SPAN>// replace register with representative register</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">            </SPAN>unsigned reg = rep(mop.getReg());</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">            </SPAN>mii->getOperand(i).setReg(reg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">            </SPAN>// Multiple uses of reg by the same instruction. It should not</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">            </SPAN>// contribute to spill weight again.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">            </SPAN>if (UniqueUses.count(reg) != 0)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">              </SPAN>continue;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">            </SPAN>LiveInterval &RegInt = li_->getInterval(reg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">            </SPAN>float w = (mop.isUse()+mop.isDef()) * powf(10.0F, (float)loopDepth);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">            </SPAN>// If the definition instruction is re-materializable, its spill</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">            </SPAN>// weight is half of what it would have been normally unless it's</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">            </SPAN>// a load from fixed stack slot.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">            </SPAN>int Dummy;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">            </SPAN>if (RegInt.remat && !tii_->isLoadFromStackSlot(RegInt.remat, Dummy))</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">              </SPAN>w /= 2;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">            </SPAN>RegInt.weight += w;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">            </SPAN>UniqueUses.insert(reg);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">          </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>++mii;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>for (LiveIntervals::iterator I = li_->begin(), E = li_->end(); I != E; ++I) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>LiveInterval &LI = I->second;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>if (MRegisterInfo::isVirtualRegister(LI.reg)) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>// If the live interval length is essentially zero, i.e. in every live</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>// range the use follows def immediately, it doesn't make sense to spill</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>// it and hope it will be easier to allocate for this li.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>if (isZeroLengthInterval(&LI))</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>LI.weight = HUGE_VALF;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>// Slightly prefer live interval that has been assigned a preferred reg.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>if (LI.preference)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">        </SPAN>LI.weight *= 1.01F;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>// Divide the weight of the interval by its size.<SPAN class="Apple-converted-space">  </SPAN>This encourages<SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>// spilling of intervals that are large and have few uses, and</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>// discourages spilling of small intervals with many uses.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">      </SPAN>LI.weight /= LI.getSize();</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">    </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>DEBUG(dump());</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+<SPAN class="Apple-converted-space">  </SPAN>return true;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+/// print - Implement the dump method.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+void SimpleRegisterCoalescing::print(std::ostream &O, const Module* m) const {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+ <SPAN class="Apple-converted-space">  </SPAN>li_->print(O, m);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">+}</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">_______________________________________________</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">llvm-commits mailing list</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</A></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</A></DIV> </BLOCKQUOTE></DIV><BR></DIV></DIV></BODY></HTML>