LCOV - code coverage report
Current view: top level - include/llvm/Transforms/IPO - GlobalDCE.h (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 1 1 100.0 %
Date: 2017-09-14 15:23:50 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===-- GlobalDCE.h - DCE unreachable internal functions ------------------===//
       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 transform is designed to eliminate unreachable internal globals from the
      11             : // program.  It uses an aggressive algorithm, searching out globals that are
      12             : // known to be alive.  After it finds all of the globals which are needed, it
      13             : // deletes whatever is left over.  This allows it to delete recursive chunks of
      14             : // the program which are unreachable.
      15             : //
      16             : //===----------------------------------------------------------------------===//
      17             : 
      18             : #ifndef LLVM_TRANSFORMS_IPO_GLOBALDCE_H
      19             : #define LLVM_TRANSFORMS_IPO_GLOBALDCE_H
      20             : 
      21             : #include "llvm/ADT/DenseMap.h"
      22             : #include "llvm/ADT/SmallSet.h"
      23             : #include "llvm/IR/Module.h"
      24             : #include "llvm/IR/PassManager.h"
      25             : #include <unordered_map>
      26             : 
      27             : namespace llvm {
      28             : 
      29             : /// Pass to remove unused function declarations.
      30       16910 : class GlobalDCEPass : public PassInfoMixin<GlobalDCEPass> {
      31             : public:
      32             :   PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
      33             : 
      34             : private:
      35             :   SmallPtrSet<GlobalValue*, 32> AliveGlobals;
      36             : 
      37             :   /// Global -> Global that uses this global.
      38             :   std::unordered_multimap<GlobalValue *, GlobalValue *> GVDependencies;
      39             : 
      40             :   /// Constant -> Globals that use this global cache.
      41             :   std::unordered_map<Constant *, SmallPtrSet<GlobalValue *, 8>>
      42             :       ConstantDependenciesCache;
      43             : 
      44             :   /// Comdat -> Globals in that Comdat section.
      45             :   std::unordered_multimap<Comdat *, GlobalValue *> ComdatMembers;
      46             : 
      47             :   void UpdateGVDependencies(GlobalValue &GV);
      48             :   void MarkLive(GlobalValue &GV,
      49             :                 SmallVectorImpl<GlobalValue *> *Updates = nullptr);
      50             :   bool RemoveUnusedGlobalValue(GlobalValue &GV);
      51             : 
      52             :   void ComputeDependencies(Value *V, SmallPtrSetImpl<GlobalValue *> &U);
      53             : };
      54             : 
      55             : }
      56             : 
      57             : #endif // LLVM_TRANSFORMS_IPO_GLOBALDCE_H

Generated by: LCOV version 1.13