diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2004-05-25 19:03:21 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2004-05-25 19:03:21 +0000 |
commit | 3751bd607b4136c6f69769ecd3d346fe8e1d63b0 (patch) | |
tree | d999a30f430f5be36d45491708a17118e4631206 /lib/Support | |
parent | 293a55f9f0afc03e44fcea59ebcdde84902b7520 (diff) | |
download | external_llvm-3751bd607b4136c6f69769ecd3d346fe8e1d63b0.zip external_llvm-3751bd607b4136c6f69769ecd3d346fe8e1d63b0.tar.gz external_llvm-3751bd607b4136c6f69769ecd3d346fe8e1d63b0.tar.bz2 |
Make some improvements suggested by Chris.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13765 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support')
-rw-r--r-- | lib/Support/SlotTable.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/Support/SlotTable.cpp b/lib/Support/SlotTable.cpp index 56c47b2..1cf0432 100644 --- a/lib/Support/SlotTable.cpp +++ b/lib/Support/SlotTable.cpp @@ -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 @@ SlotTable::SlotNum SlotTable::insert( const Value* Val, PlaneNum plane ) { 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; |