summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2009-09-13 23:45:39 +0000
committerNick Lewycky <nicholas@mxc.ca>2009-09-13 23:45:39 +0000
commit64f18eceaff6bbca0fbdc009fe33021a717040b0 (patch)
treed2b27c73c487b3d988931b5537f117e09a68e8dd /llvm/lib/VMCore
parentd0a3f194a6e0d8186f4bccd69d5bce605cb7fbb8 (diff)
downloadbcm5719-llvm-64f18eceaff6bbca0fbdc009fe33021a717040b0.tar.gz
bcm5719-llvm-64f18eceaff6bbca0fbdc009fe33021a717040b0.zip
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. llvm-svn: 81729
Diffstat (limited to 'llvm/lib/VMCore')
-rw-r--r--llvm/lib/VMCore/Verifier.cpp42
1 files changed, 30 insertions, 12 deletions
diff --git a/llvm/lib/VMCore/Verifier.cpp b/llvm/lib/VMCore/Verifier.cpp
index 6b70008aba3..9f7be43b54a 100644
--- a/llvm/lib/VMCore/Verifier.cpp
+++ b/llvm/lib/VMCore/Verifier.cpp
@@ -107,8 +107,33 @@ PreVer("preverify", "Preliminary module verification");
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 @@ namespace {
/// 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 @@ namespace {
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 @@ void Verifier::visitInstruction(Instruction &I) {
/// 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: {
OpenPOWER on IntegriCloud