From: Chris Lattner Date: Mon, 24 Oct 2005 02:35:43 +0000 (+0000) Subject: Remove this pass, it is not useful X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=f941a0fe6c31642585149220efd7cc45a7f479a8;p=oota-llvm.git Remove this pass, it is not useful git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23949 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/IPA/FindUnsafePointerTypes.cpp b/lib/Analysis/IPA/FindUnsafePointerTypes.cpp deleted file mode 100644 index 934931b2e9c..00000000000 --- a/lib/Analysis/IPA/FindUnsafePointerTypes.cpp +++ /dev/null @@ -1,106 +0,0 @@ -//===- FindUnsafePointerTypes.cpp - Check pointer usage safety ------------===// -// -// 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 defines a pass that can be used to determine, interprocedurally, -// which pointer types are accessed unsafely in a program. If there is an -// "unsafe" access to a specific pointer type, transformations that depend on -// type safety cannot be permitted. -// -// The result of running this analysis over a program is a set of unsafe pointer -// types that cannot be transformed. Safe pointer types are not tracked. -// -// Additionally, this analysis exports a hidden command line argument that (when -// enabled) prints out the reasons a type was determined to be unsafe. -// -// Currently, the only allowed operations on pointer types are: -// alloca, malloc, free, getelementptr, load, and store -// -//===----------------------------------------------------------------------===// - -#include "llvm/Analysis/FindUnsafePointerTypes.h" -#include "llvm/Assembly/CachedWriter.h" -#include "llvm/DerivedTypes.h" -#include "llvm/Module.h" -#include "llvm/Support/InstIterator.h" -#include "llvm/Support/CommandLine.h" -using namespace llvm; - -static RegisterAnalysis -X("unsafepointertypes", "Find Unsafe Pointer Types"); - -// Provide a command line option to turn on printing of which instructions cause -// a type to become invalid -// -static cl::opt -PrintFailures("printunsafeptrinst", cl::Hidden, - cl::desc("Print Unsafe Pointer Access Instructions")); - -static inline bool isSafeInstruction(const Instruction &I) { - switch (I.getOpcode()) { - case Instruction::Alloca: - case Instruction::Malloc: - case Instruction::Free: - case Instruction::Load: - case Instruction::Store: - case Instruction::GetElementPtr: - case Instruction::Call: - case Instruction::Invoke: - case Instruction::PHI: - return true; - } - return false; -} - - -bool FindUnsafePointerTypes::runOnModule(Module &Mod) { - for (Module::iterator FI = Mod.begin(), E = Mod.end(); - FI != E; ++FI) { - const Function *F = FI; // We don't need/want write access - for (const_inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I) { - const Type *ITy = I->getType(); - if (isa(ITy) && !UnsafeTypes.count((PointerType*)ITy)) - if (!isSafeInstruction(*I)) { - UnsafeTypes.insert((PointerType*)ITy); - - if (PrintFailures) { - CachedWriter CW(F->getParent(), std::cerr); - std::cerr << "FindUnsafePointerTypes: Type '"; - CW << *ITy; - std::cerr << "' marked unsafe in '" << F->getName() << "' by:\n"; - CW << *I; - } - } - } - } - - return false; -} - - -// printResults - Loop over the results of the analysis, printing out unsafe -// types. -// -void FindUnsafePointerTypes::print(std::ostream &o, const Module *M) const { - if (UnsafeTypes.empty()) { - o << "SafePointerAccess Analysis: No unsafe types found!\n"; - return; - } - - CachedWriter CW(M, o); - - o << "SafePointerAccess Analysis: Found these unsafe types:\n"; - unsigned Counter = 1; - for (std::set::const_iterator I = getUnsafeTypes().begin(), - E = getUnsafeTypes().end(); I != E; ++I, ++Counter) { - - o << " #" << Counter << ". "; - CW << **I << "\n"; - } -} -