[llvm-commits] [llvm] r51950 - /llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp

Evan Cheng evan.cheng at apple.com
Wed Jun 4 15:30:00 PDT 2008


I'd like to see code like this being refactored out into a function.

Evan

>> +      LiveInterval& Interval = LI.getOrCreateInterval(I->first);
>> +      VNInfo* VN = Interval.getNextValue(
>> +          LI.getInstructionIndex(I->second) +
>> LiveIntervals::InstrSlots::DEF,
>> +                                         I->second,
>> LI.getVNInfoAllocator());
>> +      VN->hasPHIKill = true;
>> +      VN->kills.push_back(LI.getMBBEndIdx(I->second->getParent()));
>> +      LiveRange LR(LI.getInstructionIndex(I->second) +
>> +                      LiveIntervals::InstrSlots::DEF,
>> +                   LI.getMBBEndIdx(I->second->getParent()) + 1, VN);
>> +      Interval.addRange(LR);


On Jun 4, 2008, at 11:02 AM, Owen Anderson wrote:

> I don't follow.  What would this helper do?
>
> --Owen
>
> On Jun 4, 2008, at 10:59 AM, Evan Cheng wrote:
>
>> Hi Owen,
>>
>> While you are doing this and cleaning up liveintervals. Can you add
>> helper function to liveinterval for creating copy intervals etc.?
>>
>> Evan
>>
>> On Jun 4, 2008, at 10:55 AM, Owen Anderson wrote:
>>
>>>
>>> +
>>> +  // Renumber the instructions so that we can perform the index
>>> computations
>>> +  // needed to create new live intervals.
>>> +  LI.computeNumbering();
>>> +
>>> +  // For copies that we inserted at the ends of predecessors, we
>>> construct
>>> +  // live intervals.  This is pretty easy, since we know that the
>>> destination
>>> +  // register cannot have be in live at that point previously.  We
>>> just have
>>> +  // to make sure that, for registers that serve as inputs to more
>>> than one
>>> +  // PHI, we don't create multiple overlapping live intervals.
>>> +  std::set<unsigned> RegHandled;
>>> +  for (SmallVector<std::pair<unsigned, MachineInstr*>, 4>::iterator
>>> I =
>>> +       InsertedPHIDests.begin(), E = InsertedPHIDests.end(); I !=
>>> E; ++I) {
>>> +    if (!RegHandled.count(I->first)) {
>>> +      LiveInterval& Interval = LI.getOrCreateInterval(I->first);
>>> +      VNInfo* VN = Interval.getNextValue(
>>> +          LI.getInstructionIndex(I->second) +
>>> LiveIntervals::InstrSlots::DEF,
>>> +                                         I->second,
>>> LI.getVNInfoAllocator());
>>> +      VN->hasPHIKill = true;
>>> +      VN->kills.push_back(LI.getMBBEndIdx(I->second->getParent()));
>>> +      LiveRange LR(LI.getInstructionIndex(I->second) +
>>> +                      LiveIntervals::InstrSlots::DEF,
>>> +                   LI.getMBBEndIdx(I->second->getParent()) + 1,  
>>> VN);
>>> +      Interval.addRange(LR);
>>> +
>>> +      RegHandled.insert(I->first);
>>> +    }
>>> +  }
>>> }
>>>
>>> /// InsertCopies - insert copies into MBB and all of its successors
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20080604/026bdd7b/attachment.html>


More information about the llvm-commits mailing list