for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I!=E;++I){
for (User::const_op_iterator OI = I->op_begin(), E = I->op_end();
OI != E; ++OI)
- EnumerateType((*OI)->getType());
+ EnumerateOperandType(*OI);
EnumerateType(I->getType());
}
}
EnumerateParamAttrs(FTy->getParamAttrs());
}
+// Enumerate the types for the specified value. If the value is a constant,
+// walk through it, enumerating the types of the constant.
+void ValueEnumerator::EnumerateOperandType(const Value *V) {
+ EnumerateType(V->getType());
+ if (const Constant *C = dyn_cast<Constant>(V)) {
+ // If this constant is already enumerated, ignore it, we know its type must
+ // be enumerated.
+ if (ValueMap.count(V)) return;
+
+ // This constant may have operands, make sure to enumerate the types in
+ // them.
+ for (unsigned i = 0, e = C->getNumOperands(); i != e; ++i)
+ EnumerateOperandType(C->getOperand(i));
+ }
+}
+
void ValueEnumerator::EnumerateParamAttrs(const ParamAttrsList *PAL) {
if (PAL == 0) return; // null is always 0.
// Do a lookup.
void EnumerateValue(const Value *V);
void EnumerateType(const Type *T);
+ void EnumerateOperandType(const Value *V);
void EnumerateParamAttrs(const ParamAttrsList *PAL);
void EnumerateTypeSymbolTable(const TypeSymbolTable &ST);