summaryrefslogtreecommitdiff
path: root/include/llvm/CodeGen/SlotIndexes.h
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2010-02-09 00:41:23 +0000
committerLang Hames <lhames@gmail.com>2010-02-09 00:41:23 +0000
commite0710472c84e61acf085f101abb4213c6cb1f545 (patch)
treef2a64b31dcd6f04649ab0acfca3c45ccd4f7d713 /include/llvm/CodeGen/SlotIndexes.h
parent8a872d0215b04e13f0c63274d385ebc5ad9f167e (diff)
downloadllvm-e0710472c84e61acf085f101abb4213c6cb1f545.tar.gz
llvm-e0710472c84e61acf085f101abb4213c6cb1f545.tar.bz2
llvm-e0710472c84e61acf085f101abb4213c6cb1f545.tar.xz
Changed the definition of an "invalid" slot to include the empty & tombstone values, but not zero.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95631 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/SlotIndexes.h')
-rw-r--r--include/llvm/CodeGen/SlotIndexes.h20
1 files changed, 10 insertions, 10 deletions
diff --git a/include/llvm/CodeGen/SlotIndexes.h b/include/llvm/CodeGen/SlotIndexes.h
index 163642a1be..dd4caba1e5 100644
--- a/include/llvm/CodeGen/SlotIndexes.h
+++ b/include/llvm/CodeGen/SlotIndexes.h
@@ -72,10 +72,13 @@ namespace llvm {
}
}
+ bool isValid() const {
+ return (index != EMPTY_KEY_INDEX && index != TOMBSTONE_KEY_INDEX);
+ }
+
MachineInstr* getInstr() const { return mi; }
void setInstr(MachineInstr *mi) {
- assert(index != EMPTY_KEY_INDEX && index != TOMBSTONE_KEY_INDEX &&
- "Attempt to modify reserved index.");
+ assert(isValid() && "Attempt to modify reserved index.");
this->mi = mi;
}
@@ -83,25 +86,21 @@ namespace llvm {
void setIndex(unsigned index) {
assert(index != EMPTY_KEY_INDEX && index != TOMBSTONE_KEY_INDEX &&
"Attempt to set index to invalid value.");
- assert(this->index != EMPTY_KEY_INDEX &&
- this->index != TOMBSTONE_KEY_INDEX &&
- "Attempt to reset reserved index value.");
+ assert(isValid() && "Attempt to reset reserved index value.");
this->index = index;
}
IndexListEntry* getNext() { return next; }
const IndexListEntry* getNext() const { return next; }
void setNext(IndexListEntry *next) {
- assert(index != EMPTY_KEY_INDEX && index != TOMBSTONE_KEY_INDEX &&
- "Attempt to modify reserved index.");
+ assert(isValid() && "Attempt to modify reserved index.");
this->next = next;
}
IndexListEntry* getPrev() { return prev; }
const IndexListEntry* getPrev() const { return prev; }
void setPrev(IndexListEntry *prev) {
- assert(index != EMPTY_KEY_INDEX && index != TOMBSTONE_KEY_INDEX &&
- "Attempt to modify reserved index.");
+ assert(isValid() && "Attempt to modify reserved index.");
this->prev = prev;
}
@@ -192,7 +191,8 @@ namespace llvm {
/// Returns true if this is a valid index. Invalid indicies do
/// not point into an index table, and cannot be compared.
bool isValid() const {
- return (lie.getPointer() != 0) && (lie.getPointer()->getIndex() != 0);
+ IndexListEntry *entry = lie.getPointer();
+ return ((entry!= 0) && (entry->isValid()));
}
/// Print this index to the given raw_ostream.