[llvm-commits] [llvm] r81729 - /llvm/trunk/lib/VMCore/Verifier.cpp
Nick Lewycky
nicholas at mxc.ca
Sun Sep 13 16:45:39 PDT 2009
Author: nicholas
Date: Sun Sep 13 18:45:39 2009
New Revision: 81729
URL: http://llvm.org/viewvc/llvm-project?rev=81729&view=rev
Log:
Actually remove old types from the set.
Also break the type verification stuff into its own TypeSet to keep the
Verifier pass from becoming an AbstractTypeUser.
Modified:
llvm/trunk/lib/VMCore/Verifier.cpp
Modified: llvm/trunk/lib/VMCore/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=81729&r1=81728&r2=81729&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Verifier.cpp (original)
+++ llvm/trunk/lib/VMCore/Verifier.cpp Sun Sep 13 18:45:39 2009
@@ -107,8 +107,33 @@
static const PassInfo *const PreVerifyID = &PreVer;
namespace {
- struct Verifier : public FunctionPass, public InstVisitor<Verifier>,
- public AbstractTypeUser {
+ struct TypeSet : public AbstractTypeUser {
+ SmallSet<const Type *, 16> Types;
+
+ /// Insert a type into the set of types.
+ bool insert(const Type *Ty) {
+ bool Inserted = Types.insert(Ty);
+ if (!Inserted)
+ return false;
+
+ if (Ty->isAbstract())
+ Ty->addAbstractTypeUser(this);
+ return true;
+ }
+
+ // Abstract type user interface.
+
+ /// Remove types from the set when refined. Do not insert the type it was
+ /// refined to because that type hasn't been verified yet.
+ void refineAbstractType(const DerivedType *OldTy, const Type *NewTy) {
+ Types.erase(OldTy);
+ OldTy->removeAbstractTypeUser(this);
+ }
+ void typeBecameConcrete(const DerivedType *AbsTy) {}
+ void dump() const {}
+ };
+
+ struct Verifier : public FunctionPass, public InstVisitor<Verifier> {
static char ID; // Pass ID, replacement for typeid
bool Broken; // Is this module found to be broken?
bool RealPass; // Are we not being run by a PassManager?
@@ -126,8 +151,8 @@
/// an instruction in the same block.
SmallPtrSet<Instruction*, 16> InstsInThisBlock;
- /// CheckedTypes - keep track of the types that have been checked already.
- SmallSet<const Type *, 16> CheckedTypes;
+ /// Types - keep track of the types that have been checked already.
+ TypeSet Types;
Verifier()
: FunctionPass(&ID),
@@ -337,13 +362,6 @@
WriteType(T3);
Broken = true;
}
-
- // Abstract type user interface.
- void refineAbstractType(const DerivedType *OldTy, const Type *NewTy) {
- CheckedTypes.erase(OldTy);
- }
- void typeBecameConcrete(const DerivedType *AbsTy) {}
- void dump() const {}
};
} // End anonymous namespace
@@ -1467,7 +1485,7 @@
/// VerifyType - Verify that a type is well formed.
///
void Verifier::VerifyType(const Type *Ty) {
- if (!CheckedTypes.insert(Ty)) return;
+ if (!Types.insert(Ty)) return;
switch (Ty->getTypeID()) {
case Type::FunctionTyID: {
More information about the llvm-commits
mailing list