[llvm-commits] CVS: llvm/lib/Support/SlotTable.cpp

LLVM llvm at cs.uiuc.edu
Tue May 25 14:06:04 PDT 2004


Changes in directory llvm/lib/Support:

SlotTable.cpp updated: 1.1 -> 1.2

---
Log message:

Make some improvements suggested by Chris. 


---
Diffs of the changes:  (+9 -8)

Index: llvm/lib/Support/SlotTable.cpp
diff -u llvm/lib/Support/SlotTable.cpp:1.1 llvm/lib/Support/SlotTable.cpp:1.2
--- llvm/lib/Support/SlotTable.cpp:1.1	Tue May 25 13:44:51 2004
+++ llvm/lib/Support/SlotTable.cpp	Tue May 25 14:03:21 2004
@@ -1,4 +1,4 @@
-//===-- SlotCalculator.cpp - Calculate what slots values land in ----------===//
+//===-- SlotTable.cpp - Abstract data type for slot numbers ---------------===//
 // 
 //                     The LLVM Compiler Infrastructure
 //
@@ -7,16 +7,15 @@
 // 
 //===----------------------------------------------------------------------===//
 //
-// This file implements a utility class for keeping track of slot numbers for
-// bytecode and assembly writing.
+// This file implements an abstract data type for keeping track of slot numbers 
+// for bytecode and assembly writing or any other purpose. 
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Internal/SlotTable.h"
+#include "llvm/Constants.h"
 #include "llvm/Type.h"
-#include "llvm/Value.h"
 #include "llvm/GlobalValue.h"
-#include "llvm/Constants.h"
+#include "llvm/Internal/SlotTable.h"
 
 using namespace llvm;
 
@@ -80,9 +79,11 @@
   return DestSlot;
 }
 
-// insert - insert a type into a specific plane
+// insert - insert a type 
 SlotTable::SlotNum SlotTable::insert( const Type* Typ ) {
-  // Insert node into table and map
+  // Insert node into table and map making sure that
+  // the same type isn't inserted twice.
+  assert(tMap.find(Typ) == tMap.end() && "Can't insert a Type multiple times");
   SlotNum DestSlot = tMap[Typ] = tPlane.size();
   tPlane.push_back(Typ);
   return DestSlot;





More information about the llvm-commits mailing list