LCOV - code coverage report
Current view: top level - lib/IR - MetadataImpl.h (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 14 16 87.5 %
Date: 2017-09-14 15:23:50 Functions: 25 25 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===- MetadataImpl.h - Helpers for implementing metadata -----------------===//
       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 has private helpers for implementing metadata types.
      11             : //
      12             : //===----------------------------------------------------------------------===//
      13             : 
      14             : #ifndef LLVM_IR_METADATAIMPL_H
      15             : #define LLVM_IR_METADATAIMPL_H
      16             : 
      17             : #include "llvm/ADT/DenseSet.h"
      18             : #include "llvm/IR/Metadata.h"
      19             : 
      20             : namespace llvm {
      21             : 
      22             : template <class T, class InfoT>
      23             : static T *getUniqued(DenseSet<T *, InfoT> &Store,
      24             :                      const typename InfoT::KeyTy &Key) {
      25     5461848 :   auto I = Store.find_as(Key);
      26    12736072 :   return I == Store.end() ? nullptr : *I;
      27             : }
      28             : 
      29             : template <class T> T *MDNode::storeImpl(T *N, StorageType Storage) {
      30        2545 :   switch (Storage) {
      31           0 :   case Uniqued:
      32           0 :     llvm_unreachable("Cannot unique without a uniquing-store");
      33        2339 :   case Distinct:
      34        2339 :     N->storeDistinctInContext();
      35             :     break;
      36             :   case Temporary:
      37             :     break;
      38             :   }
      39             :   return N;
      40             : }
      41             : 
      42             : template <class T, class StoreT>
      43     1180476 : T *MDNode::storeImpl(T *N, StorageType Storage, StoreT &Store) {
      44     1180476 :   switch (Storage) {
      45      886608 :   case Uniqued:
      46     1773216 :     Store.insert(N);
      47      886608 :     break;
      48      178392 :   case Distinct:
      49      178392 :     N->storeDistinctInContext();
      50      178392 :     break;
      51             :   case Temporary:
      52             :     break;
      53             :   }
      54     1180476 :   return N;
      55             : }
      56             : 
      57             : } // end namespace llvm
      58             : 
      59             : #endif

Generated by: LCOV version 1.13