LCOV - code coverage report
Current view: top level - lib/Analysis - PostDominators.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 21 23 91.3 %
Date: 2017-09-14 15:23:50 Functions: 8 9 88.9 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===- PostDominators.cpp - Post-Dominator Calculation --------------------===//
       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             : // This file implements the post-dominator construction algorithms.
      11             : //
      12             : //===----------------------------------------------------------------------===//
      13             : 
      14             : #include "llvm/Analysis/PostDominators.h"
      15             : #include "llvm/IR/Function.h"
      16             : #include "llvm/IR/PassManager.h"
      17             : #include "llvm/Pass.h"
      18             : #include "llvm/Support/raw_ostream.h"
      19             : 
      20             : using namespace llvm;
      21             : 
      22             : #define DEBUG_TYPE "postdomtree"
      23             : 
      24             : //===----------------------------------------------------------------------===//
      25             : //  PostDominatorTree Implementation
      26             : //===----------------------------------------------------------------------===//
      27             : 
      28             : char PostDominatorTreeWrapperPass::ID = 0;
      29             : 
      30      868631 : INITIALIZE_PASS(PostDominatorTreeWrapperPass, "postdomtree",
      31             :                 "Post-Dominator Tree Construction", true, true)
      32             : 
      33          78 : bool PostDominatorTree::invalidate(Function &F, const PreservedAnalyses &PA,
      34             :                                    FunctionAnalysisManager::Invalidator &) {
      35             :   // Check whether the analysis, all analyses on functions, or the function's
      36             :   // CFG have been preserved.
      37          78 :   auto PAC = PA.getChecker<PostDominatorTreeAnalysis>();
      38         155 :   return !(PAC.preserved() || PAC.preservedSet<AllAnalysesOn<Function>>() ||
      39         155 :            PAC.preservedSet<CFGAnalyses>());
      40             : }
      41             : 
      42       99337 : bool PostDominatorTreeWrapperPass::runOnFunction(Function &F) {
      43      198674 :   DT.recalculate(F);
      44       99337 :   return false;
      45             : }
      46             : 
      47           9 : void PostDominatorTreeWrapperPass::print(raw_ostream &OS, const Module *) const {
      48           9 :   DT.print(OS);
      49           9 : }
      50             : 
      51           0 : FunctionPass* llvm::createPostDomTree() {
      52           0 :   return new PostDominatorTreeWrapperPass();
      53             : }
      54             : 
      55             : AnalysisKey PostDominatorTreeAnalysis::Key;
      56             : 
      57         137 : PostDominatorTree PostDominatorTreeAnalysis::run(Function &F,
      58             :                                                  FunctionAnalysisManager &) {
      59         137 :   PostDominatorTree PDT;
      60         274 :   PDT.recalculate(F);
      61         137 :   return PDT;
      62             : }
      63             : 
      64           5 : PostDominatorTreePrinterPass::PostDominatorTreePrinterPass(raw_ostream &OS)
      65           5 :   : OS(OS) {}
      66             : 
      67             : PreservedAnalyses
      68           5 : PostDominatorTreePrinterPass::run(Function &F, FunctionAnalysisManager &AM) {
      69           5 :   OS << "PostDominatorTree for function: " << F.getName() << "\n";
      70           5 :   AM.getResult<PostDominatorTreeAnalysis>(F).print(OS);
      71             : 
      72           5 :   return PreservedAnalyses::all();
      73             : }

Generated by: LCOV version 1.13