Vitaly Buka | 4493fe1 | 2018-11-26 21:57:47 +0000 | [diff] [blame^] | 1 | //===- StackSafetyAnalysis.cpp - Stack memory safety analysis -------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | //===----------------------------------------------------------------------===// |
| 11 | |
| 12 | #include "llvm/Analysis/StackSafetyAnalysis.h" |
| 13 | |
| 14 | #include "llvm/Analysis/ScalarEvolutionExpressions.h" |
| 15 | #include "llvm/Support/raw_ostream.h" |
| 16 | |
| 17 | using namespace llvm; |
| 18 | |
| 19 | #define DEBUG_TYPE "stack-safety" |
| 20 | |
| 21 | AnalysisKey StackSafetyAnalysis::Key; |
| 22 | |
| 23 | void StackSafetyInfo::print(raw_ostream &O) const { O << "Not Implemented\n"; } |
| 24 | |
| 25 | StackSafetyInfo StackSafetyAnalysis::run(Function &F, |
| 26 | FunctionAnalysisManager &AM) { |
| 27 | return StackSafetyInfo(); |
| 28 | } |
| 29 | |
| 30 | PreservedAnalyses StackSafetyPrinterPass::run(Function &F, |
| 31 | FunctionAnalysisManager &AM) { |
| 32 | OS << "'Stack Safety Local Analysis' for function '" << F.getName() << "'\n"; |
| 33 | AM.getResult<StackSafetyAnalysis>(F).print(OS); |
| 34 | return PreservedAnalyses::all(); |
| 35 | } |
| 36 | |
| 37 | char StackSafetyInfoWrapperPass::ID = 0; |
| 38 | |
| 39 | StackSafetyInfoWrapperPass::StackSafetyInfoWrapperPass() : FunctionPass(ID) { |
| 40 | initializeStackSafetyInfoWrapperPassPass(*PassRegistry::getPassRegistry()); |
| 41 | } |
| 42 | |
| 43 | void StackSafetyInfoWrapperPass::getAnalysisUsage(AnalysisUsage &AU) const { |
| 44 | AU.addRequired<ScalarEvolutionWrapperPass>(); |
| 45 | AU.setPreservesAll(); |
| 46 | } |
| 47 | |
| 48 | void StackSafetyInfoWrapperPass::print(raw_ostream &O, const Module *M) const { |
| 49 | SSI.print(O); |
| 50 | } |
| 51 | |
| 52 | bool StackSafetyInfoWrapperPass::runOnFunction(Function &F) { return false; } |
| 53 | |
| 54 | static const char LocalPassArg[] = "stack-safety-local"; |
| 55 | static const char LocalPassName[] = "Stack Safety Local Analysis"; |
| 56 | INITIALIZE_PASS_BEGIN(StackSafetyInfoWrapperPass, LocalPassArg, LocalPassName, |
| 57 | false, true) |
| 58 | INITIALIZE_PASS_DEPENDENCY(ScalarEvolutionWrapperPass) |
| 59 | INITIALIZE_PASS_END(StackSafetyInfoWrapperPass, LocalPassArg, LocalPassName, |
| 60 | false, true) |