LCOV - code coverage report
Current view: top level - lib/CodeGen - MachineFunctionPass.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 27 27 100.0 %
Date: 2017-09-14 15:23:50 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===-- MachineFunctionPass.cpp -------------------------------------------===//
       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 contains the definitions of the MachineFunctionPass members.
      11             : //
      12             : //===----------------------------------------------------------------------===//
      13             : 
      14             : #include "llvm/CodeGen/MachineFunctionPass.h"
      15             : #include "llvm/Analysis/AliasAnalysis.h"
      16             : #include "llvm/Analysis/BasicAliasAnalysis.h"
      17             : #include "llvm/Analysis/DominanceFrontier.h"
      18             : #include "llvm/Analysis/GlobalsModRef.h"
      19             : #include "llvm/Analysis/IVUsers.h"
      20             : #include "llvm/Analysis/LoopInfo.h"
      21             : #include "llvm/Analysis/MemoryDependenceAnalysis.h"
      22             : #include "llvm/Analysis/ScalarEvolution.h"
      23             : #include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h"
      24             : #include "llvm/CodeGen/MachineFunction.h"
      25             : #include "llvm/CodeGen/MachineModuleInfo.h"
      26             : #include "llvm/CodeGen/Passes.h"
      27             : #include "llvm/CodeGen/StackProtector.h"
      28             : #include "llvm/IR/Dominators.h"
      29             : #include "llvm/IR/Function.h"
      30             : 
      31             : using namespace llvm;
      32             : 
      33         224 : Pass *MachineFunctionPass::createPrinterPass(raw_ostream &O,
      34             :                                              const std::string &Banner) const {
      35         224 :   return createMachineFunctionPrinterPass(O, Banner);
      36             : }
      37             : 
      38    14024313 : bool MachineFunctionPass::runOnFunction(Function &F) {
      39             :   // Do not codegen any 'available_externally' functions at all, they have
      40             :   // definitions outside the translation unit.
      41    28048626 :   if (F.hasAvailableExternallyLinkage())
      42             :     return false;
      43             : 
      44    14021592 :   MachineModuleInfo &MMI = getAnalysis<MachineModuleInfo>();
      45    14021592 :   MachineFunction &MF = MMI.getOrCreateMachineFunction(F);
      46             : 
      47    14021591 :   MachineFunctionProperties &MFProps = MF.getProperties();
      48             : 
      49             : #ifndef NDEBUG
      50             :   if (!MFProps.verifyRequiredProperties(RequiredProperties)) {
      51             :     errs() << "MachineFunctionProperties required by " << getPassName()
      52             :            << " pass are not met by function " << F.getName() << ".\n"
      53             :            << "Required properties: ";
      54             :     RequiredProperties.print(errs());
      55             :     errs() << "\nCurrent properties: ";
      56             :     MFProps.print(errs());
      57             :     errs() << "\n";
      58             :     llvm_unreachable("MachineFunctionProperties check failed");
      59             :   }
      60             : #endif
      61             : 
      62    14021591 :   bool RV = runOnMachineFunction(MF);
      63             : 
      64    28043000 :   MFProps.set(SetProperties);
      65    28043000 :   MFProps.reset(ClearedProperties);
      66    14021501 :   return RV;
      67             : }
      68             : 
      69     1594154 : void MachineFunctionPass::getAnalysisUsage(AnalysisUsage &AU) const {
      70     1594154 :   AU.addRequired<MachineModuleInfo>();
      71     1594154 :   AU.addPreserved<MachineModuleInfo>();
      72             : 
      73             :   // MachineFunctionPass preserves all LLVM IR passes, but there's no
      74             :   // high-level way to express this. Instead, just list a bunch of
      75             :   // passes explicitly. This does not include setPreservesCFG,
      76             :   // because CodeGen overloads that to mean preserving the MachineBasicBlock
      77             :   // CFG in addition to the LLVM IR CFG.
      78     1594154 :   AU.addPreserved<BasicAAWrapperPass>();
      79     1594152 :   AU.addPreserved<DominanceFrontierWrapperPass>();
      80     1594152 :   AU.addPreserved<DominatorTreeWrapperPass>();
      81     1594152 :   AU.addPreserved<AAResultsWrapperPass>();
      82     1594152 :   AU.addPreserved<GlobalsAAWrapperPass>();
      83     1594152 :   AU.addPreserved<IVUsersWrapperPass>();
      84     1594152 :   AU.addPreserved<LoopInfoWrapperPass>();
      85     1594152 :   AU.addPreserved<MemoryDependenceWrapperPass>();
      86     1594152 :   AU.addPreserved<ScalarEvolutionWrapperPass>();
      87     1594152 :   AU.addPreserved<SCEVAAWrapperPass>();
      88     1594154 :   AU.addPreserved<StackProtector>();
      89             : 
      90     1594154 :   FunctionPass::getAnalysisUsage(AU);
      91     1594154 : }

Generated by: LCOV version 1.13