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

Chris Lattner lattner at cs.uiuc.edu
Thu May 6 11:26:03 PDT 2004


Changes in directory llvm/lib/CodeGen:

LiveIntervals.cpp updated: 1.71 -> 1.72
RegAllocLinearScan.cpp updated: 1.70 -> 1.71

---
Log message:

numeric_limits::infinity() apparently does not work on all systems.  As a 
workaround, use the C HUGE_VAL macro instead.


---
Diffs of the changes:  (+5 -7)

Index: llvm/lib/CodeGen/LiveIntervals.cpp
diff -u llvm/lib/CodeGen/LiveIntervals.cpp:1.71 llvm/lib/CodeGen/LiveIntervals.cpp:1.72
--- llvm/lib/CodeGen/LiveIntervals.cpp:1.71	Sat May  1 16:24:39 2004
+++ llvm/lib/CodeGen/LiveIntervals.cpp	Thu May  6 11:25:59 2004
@@ -196,7 +196,7 @@
                                           VirtRegMap& vrm,
                                           int slot)
 {
-    assert(li.weight != std::numeric_limits<float>::infinity() &&
+    assert(li.weight != HUGE_VAL &&
            "attempt to spill already spilled interval!");
     Interval::Ranges oldRanges;
     swap(oldRanges, li.ranges);
@@ -253,7 +253,7 @@
         }
     }
     // the new spill weight is now infinity as it cannot be spilled again
-    li.weight = std::numeric_limits<float>::infinity();
+    li.weight = HUGE_VAL;
     DEBUG(std::cerr << '\n');
     DEBUG(std::cerr << "\t\t\t\tupdated interval: " << li << '\n');
 }
@@ -556,15 +556,13 @@
 
 LiveIntervals::Interval::Interval(unsigned r)
     : reg(r),
-      weight((MRegisterInfo::isPhysicalRegister(r) ?
-              std::numeric_limits<float>::infinity() : 0.0F))
+      weight((MRegisterInfo::isPhysicalRegister(r) ?  HUGE_VAL : 0.0F))
 {
-
 }
 
 bool LiveIntervals::Interval::spilled() const
 {
-    return (weight == std::numeric_limits<float>::infinity() &&
+    return (weight == HUGE_VAL &&
             MRegisterInfo::isVirtualRegister(reg));
 }
 


Index: llvm/lib/CodeGen/RegAllocLinearScan.cpp
diff -u llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.70 llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.71
--- llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.70	Tue Mar 16 18:48:59 2004
+++ llvm/lib/CodeGen/RegAllocLinearScan.cpp	Thu May  6 11:25:59 2004
@@ -351,7 +351,7 @@
 
     DEBUG(std::cerr << "\tassigning stack slot at interval "<< *cur << ":\n");
 
-    float minWeight = std::numeric_limits<float>::infinity();
+    float minWeight = HUGE_VAL;
     unsigned minReg = 0;
     const TargetRegisterClass* rc = mf_->getSSARegMap()->getRegClass(cur->reg);
     for (TargetRegisterClass::iterator i = rc->allocation_order_begin(*mf_);





More information about the llvm-commits mailing list