//
// The LLVM Compiler Infrastructure
//
-// This file was developed by the LLVM research group and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
#include "llvm/TypeSymbolTable.h"
#include "llvm/DerivedTypes.h"
#include "llvm/ADT/Statistic.h"
+#include "llvm/Support/Compiler.h"
using namespace llvm;
STATISTIC(NumKilled, "Number of unused typenames removed from symtab");
namespace {
- struct DTE : public ModulePass {
+ struct VISIBILITY_HIDDEN DTE : public ModulePass {
+ static char ID; // Pass identification, replacement for typeid
+ DTE() : ModulePass((intptr_t)&ID) {}
+
// doPassInitialization - For this pass, it removes global symbol table
// entries for primitive types. These are never used for linking in GCC and
// they make the output uglier to look at, so we nuke them.
AU.addRequired<FindUsedTypes>();
}
};
+ char DTE::ID = 0;
RegisterPass<DTE> X("deadtypeelim", "Dead Type Elimination");
}
//
static inline bool ShouldNukeSymtabEntry(const Type *Ty){
// Nuke all names for primitive types!
- if (Ty->isPrimitiveType()) return true;
+ if (Ty->isPrimitiveType() || Ty->isInteger())
+ return true;
// Nuke all pointers to primitive types as well...
if (const PointerType *PT = dyn_cast<PointerType>(Ty))
- if (PT->getElementType()->isPrimitiveType()) return true;
+ if (PT->getElementType()->isPrimitiveType() ||
+ PT->getElementType()->isInteger())
+ return true;
return false;
}