summaryrefslogtreecommitdiff
path: root/lib/Bytecode/Writer
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2004-05-25 08:53:40 +0000
committerReid Spencer <rspencer@reidspencer.com>2004-05-25 08:53:40 +0000
commit9231ac8b6f2c3f9877bdb7a223f7392061258ab6 (patch)
tree9f97206d6e486301c3bfb513b1872e5b1d4f5b20 /lib/Bytecode/Writer
parentaf90b0d8b8071b4ddc9e5932abde7a1845defdba (diff)
downloadllvm-9231ac8b6f2c3f9877bdb7a223f7392061258ab6.tar.gz
llvm-9231ac8b6f2c3f9877bdb7a223f7392061258ab6.tar.bz2
llvm-9231ac8b6f2c3f9877bdb7a223f7392061258ab6.tar.xz
Convert to SymbolTable's new iteration interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13754 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bytecode/Writer')
-rw-r--r--lib/Bytecode/Writer/SlotCalculator.cpp50
1 files changed, 35 insertions, 15 deletions
diff --git a/lib/Bytecode/Writer/SlotCalculator.cpp b/lib/Bytecode/Writer/SlotCalculator.cpp
index 3549053279..ec5a837cf9 100644
--- a/lib/Bytecode/Writer/SlotCalculator.cpp
+++ b/lib/Bytecode/Writer/SlotCalculator.cpp
@@ -248,18 +248,32 @@ void SlotCalculator::processModule() {
// into the values table...
//
void SlotCalculator::processSymbolTable(const SymbolTable *ST) {
- for (SymbolTable::const_iterator I = ST->begin(), E = ST->end(); I != E; ++I)
- for (SymbolTable::type_const_iterator TI = I->second.begin(),
- TE = I->second.end(); TI != TE; ++TI)
- getOrCreateSlot(TI->second);
+ // Do the types first.
+ for (SymbolTable::type_const_iterator TI = ST->type_begin(),
+ TE = ST->type_end(); TI != TE; ++TI )
+ getOrCreateSlot(TI->second);
+
+ // Now do the values.
+ for (SymbolTable::plane_const_iterator PI = ST->plane_begin(),
+ PE = ST->plane_end(); PI != PE; ++PI)
+ for (SymbolTable::value_const_iterator VI = PI->second.begin(),
+ VE = PI->second.end(); VI != VE; ++VI)
+ getOrCreateSlot(VI->second);
}
void SlotCalculator::processSymbolTableConstants(const SymbolTable *ST) {
- for (SymbolTable::const_iterator I = ST->begin(), E = ST->end(); I != E; ++I)
- for (SymbolTable::type_const_iterator TI = I->second.begin(),
- TE = I->second.end(); TI != TE; ++TI)
- if (isa<Constant>(TI->second) || isa<Type>(TI->second))
- getOrCreateSlot(TI->second);
+ // Do the types first
+ for (SymbolTable::type_const_iterator TI = ST->type_begin(),
+ TE = ST->type_end(); TI != TE; ++TI )
+ getOrCreateSlot(TI->second);
+
+ // Now do the constant values in all planes
+ for (SymbolTable::plane_const_iterator PI = ST->plane_begin(),
+ PE = ST->plane_end(); PI != PE; ++PI)
+ for (SymbolTable::value_const_iterator VI = PI->second.begin(),
+ VE = PI->second.end(); VI != VE; ++VI)
+ if (isa<Constant>(VI->second))
+ getOrCreateSlot(VI->second);
}
@@ -452,13 +466,19 @@ void SlotCalculator::buildCompactionTable(const Function *F) {
getOrCreateCompactionTableSlot(VAN->getArgType());
}
+ // Do the types in the symbol table
const SymbolTable &ST = F->getSymbolTable();
- for (SymbolTable::const_iterator I = ST.begin(), E = ST.end(); I != E; ++I)
- for (SymbolTable::type_const_iterator TI = I->second.begin(),
- TE = I->second.end(); TI != TE; ++TI)
- if (isa<Constant>(TI->second) || isa<Type>(TI->second) ||
- isa<GlobalValue>(TI->second))
- getOrCreateCompactionTableSlot(TI->second);
+ for (SymbolTable::type_const_iterator TI = ST.type_begin(),
+ TE = ST.type_end(); TI != TE; ++TI)
+ getOrCreateCompactionTableSlot(TI->second);
+
+ // Now do the constants and global values
+ for (SymbolTable::plane_const_iterator PI = ST.plane_begin(),
+ PE = ST.plane_end(); PI != PE; ++PI)
+ for (SymbolTable::value_const_iterator VI = PI->second.begin(),
+ VE = PI->second.end(); VI != VE; ++VI)
+ if (isa<Constant>(VI->second) || isa<GlobalValue>(VI->second))
+ getOrCreateCompactionTableSlot(VI->second);
// Now that we have all of the values in the table, and know what types are
// referenced, make sure that there is at least the zero initializer in any