[llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp RegAllocLinearScan.cpp

Jim Laskey jlaskey at apple.com
Wed Nov 8 08:30:32 PST 2006


John,

Both are defined on Darwin, FLT_MAX in float.h and HUGE_VALF in  
math.h.  However, neither header seems to be based on a BSD header.   
I choose HUGE_VALF because it was also defined in the LINUX and  
FREEBSD math.h headers (seemed like confirmation to me.)  I'll wait  
for Chris to make the call. (might uses a #ifndef HUGE_VALF thingame.)

Cheers,

-- Jim





On Nov 8, 2006, at 12:03 PM, John Criswell wrote:

> Dear Mr. Laskey,
>
> This change broke the LLVM build on OpenBSD.  Would it be possible to
> use FLT_MAX instead of HUGE_VALF?  FLT_MAX from float.h looks more  
> portable.
>
> -- John T.
>
> Jim Laskey wrote:
>> Changes in directory llvm/lib/CodeGen:
>>
>> LiveIntervalAnalysis.cpp updated: 1.190 -> 1.191
>> RegAllocLinearScan.cpp updated: 1.129 -> 1.130
>> ---
>> Log message:
>>
>> Use correct value for float HUGH_VAL.
>>
>> ---
>> Diffs of the changes:  (+6 -6)
>>
>>  LiveIntervalAnalysis.cpp |    8 ++++----
>>  RegAllocLinearScan.cpp   |    4 ++--
>>  2 files changed, 6 insertions(+), 6 deletions(-)
>>
>>
>> Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
>> diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.190 llvm/lib/ 
>> CodeGen/LiveIntervalAnalysis.cpp:1.191
>> --- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.190	Tue Nov  7  
>> 01:18:40 2006
>> +++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp	Tue Nov  7 06:25:45  
>> 2006
>> @@ -219,7 +219,7 @@
>>        // range the use follows def immediately, it doesn't make  
>> sense to spill
>>        // it and hope it will be easier to allocate for this li.
>>        if (isZeroLengthInterval(&LI))
>> -        LI.weight = float(HUGE_VAL);
>> +        LI.weight = HUGE_VALF;
>>
>>        if (EnableReweight) {
>>          // Divide the weight of the interval by its size.  This  
>> encourages
>> @@ -265,7 +265,7 @@
>>
>>    std::vector<LiveInterval*> added;
>>
>> -  assert(li.weight != HUGE_VAL &&
>> +  assert(li.weight != HUGE_VALF &&
>>           "attempt to spill already spilled interval!");
>>
>>    DEBUG(std::cerr << "\t\t\t\tadding intervals for spills for  
>> interval: ";
>> @@ -340,7 +340,7 @@
>>
>>              // the spill weight is now infinity as it
>>              // cannot be spilled again
>> -            nI.weight = float(HUGE_VAL);
>> +            nI.weight = HUGE_VALF;
>>
>>              if (HasUse) {
>>                LiveRange LR(getLoadIndex(index), getUseIndex(index),
>> @@ -1362,6 +1362,6 @@
>>
>>  LiveInterval LiveIntervals::createInterval(unsigned reg) {
>>    float Weight = MRegisterInfo::isPhysicalRegister(reg) ?
>> -                       (float)HUGE_VAL : 0.0F;
>> +                       HUGE_VALF : 0.0F;
>>    return LiveInterval(reg, Weight);
>>  }
>>
>>
>> Index: llvm/lib/CodeGen/RegAllocLinearScan.cpp
>> diff -u llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.129 llvm/lib/ 
>> CodeGen/RegAllocLinearScan.cpp:1.130
>> --- llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.129	Tue Oct 24  
>> 09:35:25 2006
>> +++ llvm/lib/CodeGen/RegAllocLinearScan.cpp	Tue Nov  7 06:25:45 2006
>> @@ -545,7 +545,7 @@
>>    DEBUG(std::cerr << "\tassigning stack slot at interval "<< *cur  
>> << ":\n");
>>
>>    // Find a register to spill.
>> -  float minWeight = float(HUGE_VAL);
>> +  float minWeight = HUGE_VALF;
>>    unsigned minReg = 0;
>>    for (TargetRegisterClass::iterator i = RC- 
>> >allocation_order_begin(*mf_),
>>         e = RC->allocation_order_end(*mf_); i != e; ++i) {
>> @@ -582,7 +582,7 @@
>>    // if the current has the minimum weight, we need to spill it and
>>    // add any added intervals back to unhandled, and restart
>>    // linearscan.
>> -  if (cur->weight != float(HUGE_VAL) && cur->weight <= minWeight) {
>> +  if (cur->weight != HUGE_VALF && cur->weight <= minWeight) {
>>      DEBUG(std::cerr << "\t\t\tspilling(c): " << *cur << '\n';);
>>      int slot = vrm_->assignVirt2StackSlot(cur->reg);
>>      std::vector<LiveInterval*> added =
>>
>>
>>
>> _______________________________________________
>> 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/20061108/218a11fc/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2417 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20061108/218a11fc/attachment.bin>


More information about the llvm-commits mailing list