[llvm-commits] CVS: llvm/lib/CodeGen/RegAlloc/AllocInfo.h

Brian Gaeke gaeke at cs.uiuc.edu
Thu Oct 30 15:23:01 PST 2003


Changes in directory llvm/lib/CodeGen/RegAlloc:

AllocInfo.h updated: 1.2 -> 1.3

---
Log message:

Make AllocState an enum.
Move the stringifying method for that enum into class AllocInfo.


---
Diffs of the changes:  (+12 -2)

Index: llvm/lib/CodeGen/RegAlloc/AllocInfo.h
diff -u llvm/lib/CodeGen/RegAlloc/AllocInfo.h:1.2 llvm/lib/CodeGen/RegAlloc/AllocInfo.h:1.3
--- llvm/lib/CodeGen/RegAlloc/AllocInfo.h:1.2	Thu Oct 23 15:39:18 2003
+++ llvm/lib/CodeGen/RegAlloc/AllocInfo.h	Thu Oct 30 15:21:22 2003
@@ -26,10 +26,12 @@
 struct AllocInfo {
   unsigned Instruction;
   unsigned Operand;
-  unsigned AllocState;
+  enum AllocStateTy { NotAllocated = 0, Allocated, Spilled };
+  AllocStateTy AllocState;
   int Placement;
+
   AllocInfo (unsigned Instruction_, unsigned Operand_,
-             unsigned AllocState_, int Placement_) :
+             AllocStateTy AllocState_, int Placement_) :
     Instruction (Instruction_), Operand (Operand_),
        AllocState (AllocState_), Placement (Placement_) { }
 
@@ -65,6 +67,14 @@
     return (X.AllocState == AllocState) && (X.Placement == Placement);
   } 
   bool operator!= (const AllocInfo &X) const { return !(*this == X); } 
+
+  /// Returns a human-readable string representation of the AllocState member.
+  ///
+  const std::string allocStateToString () const {
+    static const char *AllocStateNames[] =
+      { "NotAllocated", "Allocated", "Spilled" };
+    return std::string (AllocStateNames[AllocState]);
+  }
 };
 
 #endif // ALLOCINFO_H





More information about the llvm-commits mailing list