X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FADT%2FEquivalenceClasses.h;h=7d305cb74416a19ddde29a61787e4ef376bcff5e;hb=a727d5502c8e23c090da658bf14c5ebc1169a070;hp=f1882fb046d881f4943b954168b8b0205b6bf68b;hpb=1f377fefb745002a7aacb1ec87a4beb7bd87856e;p=oota-llvm.git diff --git a/include/llvm/ADT/EquivalenceClasses.h b/include/llvm/ADT/EquivalenceClasses.h index f1882fb046d..7d305cb7441 100644 --- a/include/llvm/ADT/EquivalenceClasses.h +++ b/include/llvm/ADT/EquivalenceClasses.h @@ -1,21 +1,22 @@ //===-- llvm/ADT/EquivalenceClasses.h - Generic Equiv. Classes --*- C++ -*-===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// -// +// // Generic implementation of equivalence classes through the use Tarjan's // efficient union-find algorithm. -// +// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_EQUIVALENCECLASSES_H #define LLVM_ADT_EQUIVALENCECLASSES_H #include "llvm/ADT/iterator" +#include "llvm/Support/DataTypes.h" #include namespace llvm { @@ -42,8 +43,8 @@ namespace llvm { /// if (!I->isLeader()) continue; // Ignore non-leader sets. /// for (EquivalenceClasses::member_iterator MI = EC.member_begin(I); /// MI != EC.member_end(); ++MI) // Loop over members in this set. -/// std::cerr << *MI << " "; // Print member. -/// std::cerr << "\n"; // Finish set. +/// cerr << *MI << " "; // Print member. +/// cerr << "\n"; // Finish set. /// } /// /// This example prints: @@ -84,8 +85,7 @@ class EquivalenceClasses { void setNext(const ECValue *NewNext) const { assert(getNext() == 0 && "Already has a next pointer!"); - bool isL = isLeader(); - Next = (const ECValue*)((intptr_t)NewNext | isLeader()); + Next = (const ECValue*)((intptr_t)NewNext | (intptr_t)isLeader()); } public: ECValue(const ECValue &RHS) : Leader(this), Next((ECValue*)(intptr_t)1), @@ -128,7 +128,7 @@ public: } return *this; } - + //===--------------------------------------------------------------------===// // Inspection methods // @@ -138,6 +138,8 @@ public: iterator begin() const { return TheMapping.begin(); } iterator end() const { return TheMapping.end(); } + bool empty() const { return TheMapping.empty(); } + /// member_* Iterate over the members of an equivalence class. /// class member_iterator; @@ -220,7 +222,7 @@ public: // point to the L2 leader node. const ECValue &L1LV = *L1.Node, &L2LV = *L2.Node; L1LV.getEndOfList()->setNext(&L2LV); - + // Update L1LV's end of list pointer. L1LV.Leader = L2LV.getEndOfList();