diff options
| author | Chris Lattner <sabre@nondot.org> | 2002-03-29 05:49:37 +0000 | 
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2002-03-29 05:49:37 +0000 | 
| commit | 5c1f41eb97ffc553d2eb49f4d5cd23055a82c9a5 (patch) | |
| tree | 86e81b2f3b426860a695e20b32ec30600a679421 /llvm/lib/VMCore | |
| parent | 13ae72f1750a27ac4d3c0417d65ecd4ac8398c23 (diff) | |
| download | bcm5719-llvm-5c1f41eb97ffc553d2eb49f4d5cd23055a82c9a5.tar.gz bcm5719-llvm-5c1f41eb97ffc553d2eb49f4d5cd23055a82c9a5.zip  | |
Add an insert method to VAlueHolder to allow batch insertion
llvm-svn: 2038
Diffstat (limited to 'llvm/lib/VMCore')
| -rw-r--r-- | llvm/lib/VMCore/ValueHolderImpl.h | 30 | 
1 files changed, 30 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/ValueHolderImpl.h b/llvm/lib/VMCore/ValueHolderImpl.h index fff88fd53b9..411e2b44664 100644 --- a/llvm/lib/VMCore/ValueHolderImpl.h +++ b/llvm/lib/VMCore/ValueHolderImpl.h @@ -138,4 +138,34 @@ ValueHolder<ValueSubclass,ItemParentType,SymTabType>    return I;  } +// ValueHolder::insert - This method inserts the specified _range_ of values +// before the 'Pos' iterator, and returns an iterator to the first newly +// inserted element.  This currently only works for vector iterators... +// +// FIXME: This is not generic so that the code does not have to be around +// to be used... is this ok? +// +template<class ValueSubclass, class ItemParentType, class SymTabType> +void ValueHolder<ValueSubclass,ItemParentType,SymTabType> +::insert(iterator Pos,                     // Where to insert +         iterator First, iterator Last) {   // Vector to read insts from + +  // Check to make sure that the values are not already in some valueholder... +   +  for (iterator X = First; X != Last; ++X) { +    assert((*X)->getParent() == 0 && +           "Cannot insert into valueholder, value already has a parent!"); +    (*X)->setParent(ItemParent); +  } + +  // Add all of the values to the value holder... +  ValueList.insert(Pos, First, Last); + +  // Insert all of the instructions in the symbol table... +  if (Parent) +    for (;First != Last; ++First) +      if ((*First)->hasName()) +        Parent->getSymbolTableSure()->insert(*First); +} +  #endif  | 

