From: Chris Lattner Date: Fri, 23 Jul 2004 18:39:12 +0000 (+0000) Subject: New helper method X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e6ad392802d8643ec7efad9bb80c0c429edda499;p=oota-llvm.git New helper method git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15138 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/CodeGen/LiveInterval.h b/include/llvm/CodeGen/LiveInterval.h index d25f7e31a34..7d4c23b2c85 100644 --- a/include/llvm/CodeGen/LiveInterval.h +++ b/include/llvm/CodeGen/LiveInterval.h @@ -36,13 +36,19 @@ namespace llvm { assert(S < E && "Cannot create empty or backwards range"); } + /// contains - Return true if the index is covered by this range. + /// + bool contains(unsigned I) const { + return start <= I && I < end; + } + bool operator<(const LiveRange &LR) const { return start < LR.start || (start == LR.start && end < LR.end); } bool operator==(const LiveRange &LR) const { return start == LR.start && end == LR.end; } - private: + private: LiveRange(); // DO NOT IMPLEMENT }; std::ostream& operator<<(std::ostream& os, const LiveRange &LR); diff --git a/lib/CodeGen/LiveInterval.h b/lib/CodeGen/LiveInterval.h index d25f7e31a34..7d4c23b2c85 100644 --- a/lib/CodeGen/LiveInterval.h +++ b/lib/CodeGen/LiveInterval.h @@ -36,13 +36,19 @@ namespace llvm { assert(S < E && "Cannot create empty or backwards range"); } + /// contains - Return true if the index is covered by this range. + /// + bool contains(unsigned I) const { + return start <= I && I < end; + } + bool operator<(const LiveRange &LR) const { return start < LR.start || (start == LR.start && end < LR.end); } bool operator==(const LiveRange &LR) const { return start == LR.start && end == LR.end; } - private: + private: LiveRange(); // DO NOT IMPLEMENT }; std::ostream& operator<<(std::ostream& os, const LiveRange &LR);