aboutsummaryrefslogtreecommitdiff
path: root/lib/Bytecode
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2004-05-25 17:29:59 +0000
committerReid Spencer <rspencer@reidspencer.com>2004-05-25 17:29:59 +0000
commit94f2df295d8ac3589a9c753ebc5f5a25bd42f26b (patch)
treebb347229a0efc6b41fffca3c65b27cbd9abf4aab /lib/Bytecode
parentb152f9ff783eb8131d9a7c93b12ae497a4c9b598 (diff)
Changed to use SymbolTable's new iteration interfaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13759 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bytecode')
-rw-r--r--lib/Bytecode/Writer/Writer.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/lib/Bytecode/Writer/Writer.cpp b/lib/Bytecode/Writer/Writer.cpp
index 82fe40db18..2a6510c283 100644
--- a/lib/Bytecode/Writer/Writer.cpp
+++ b/lib/Bytecode/Writer/Writer.cpp
@@ -307,22 +307,34 @@ void BytecodeWriter::outputCompactionTable() {
void BytecodeWriter::outputSymbolTable(const SymbolTable &MST) {
// Do not output the Bytecode block for an empty symbol table, it just wastes
// space!
- if (MST.begin() == MST.end()) return;
+ if (MST.plane_begin() == MST.plane_end()) return;
BytecodeBlock SymTabBlock(BytecodeFormat::SymbolTable, Out,
true/* ElideIfEmpty*/);
- for (SymbolTable::const_iterator TI = MST.begin(); TI != MST.end(); ++TI) {
- SymbolTable::type_const_iterator I = MST.type_begin(TI->first);
- SymbolTable::type_const_iterator End = MST.type_end(TI->first);
+ //Symtab block header: [num entries][type id number]
+ output_vbr(MST.num_types(), Out);
+ output_vbr((unsigned)Table.getSlot(Type::TypeTy), Out);
+ for (SymbolTable::type_const_iterator TI = MST.type_begin(),
+ TE = MST.type_end(); TI != TE; ++TI ) {
+ //Symtab entry:[def slot #][name]
+ output_vbr((unsigned)Table.getSlot(TI->second), Out);
+ output(TI->first, Out, /*align=*/false);
+ }
+
+ // Now do each of the type planes in order.
+ for (SymbolTable::plane_const_iterator PI = MST.plane_begin(),
+ PE = MST.plane_end(); PI != PE; ++PI) {
+ SymbolTable::value_const_iterator I = MST.value_begin(PI->first);
+ SymbolTable::value_const_iterator End = MST.value_end(PI->first);
int Slot;
if (I == End) continue; // Don't mess with an absent type...
// Symtab block header: [num entries][type id number]
- output_vbr(MST.type_size(TI->first), Out);
+ output_vbr(MST.type_size(PI->first), Out);
- Slot = Table.getSlot(TI->first);
+ Slot = Table.getSlot(PI->first);
assert(Slot != -1 && "Type in symtab, but not in table!");
output_vbr((unsigned)Slot, Out);