[llvm-commits] [llvm] r56384 - in /llvm/trunk/lib/CodeGen: RegAllocLinearScan.cpp SimpleRegisterCoalescing.cpp

Dale Johannesen dalej at apple.com
Tue Sep 23 15:17:28 PDT 2008


On Sep 22, 2008, at 10:46 AMPDT, Evan Cheng wrote:

>
> On Sep 22, 2008, at 10:38 AM, Chris Lattner wrote:
>
>> On Sep 22, 2008, at 10:28 AM, Evan Cheng wrote:
>>>> Can you give me an example?  It sounds like these sorts of
>>>> assumptions
>>>> are exactly what we want: you can only coalesce a def/use of a copy
>>>> if
>>>> the live ranges exactly line up.  Overlapping by one slot is a
>>>> *good*
>>>> thing because we want to prevent coalescing.
>>>
>>> e.g.
>>>     // Figure out the value # from the RHS.
>>>     LHSValsDefinedFromRHS[VNI]=RHS.getLiveRangeContaining(VNI-
>>>> def-1)->valno;
>>>
>>> Ok, so most of the assertions are for copies:
>>> But it is possible modeling the def this way will *just work*. I
>>> doubt
>>> it, but it's worth experimenting.
>>
>> I would strongly prefer this.  Even if there are cases that don't
>> "just work", I think this is the correct way to model it, and the
>> right long-term answer.
>
> Ok fine. Sorry for being overly careful when it comes to the
> coalescer.

This did basically Just Work (I haven't run the gcc testsuite yet, but  
it doesn't break anything in
the llvm testsuite and fixes all the examples in our bug reports.)   
Unfortunately, this approach
only works in the linear scan RA, while we use a different RA with - 
O0.... I guess I need to fix
that before turning it on.

> Owen, can your liveintervals renumbering work be impacted?
> i.e. Does it assume def must be one cycle before use?
>
>>
>>
>>>> Can earlyclobber operands be used to model the armv4 "mul" register
>>>> weirdness where the input and output regs can't be the same?
>>>
>>> We could, but the correct way to model it is to push the use down  
>>> one
>>> cycle, not def up one cycle. The problem with early clobber is the
>>> def
>>> cannot overlap any of the uses (both Rm and Rs). In the ARM mul  
>>> case,
>>> the def cannot overlap Rm only.
>>
>> Sure, I agree with that.  This is also true of most inline asms with
>> multiple instructions (like the example I gave).  Using earlyclobber
>> should be a conservative but correct solution (and much better than
>> using the 'multiply fixer' pass that used to exist).
>>
>> This would also make it easier to test that earlyclobber is working
>> right (multiplies are more frequent than & in asms), which is why I
>> brought it up. :)
>
> That will require some minor tblgen and TargetInstrDesc changes. If
> someone want to do that, sure.
>
> Evan
>
>>
>>
>> -Chris
>>
>> _______________________________________________
>> 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




More information about the llvm-commits mailing list