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

          Line data    Source code
       1             : //===-- LiveRangeUtils.h - Live Range modification utilities ----*- C++ -*-===//
       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 helper functions to modify live ranges.
      11             : //
      12             : //===----------------------------------------------------------------------===//
      13             : 
      14             : #ifndef LLVM_LIB_CODEGEN_LIVERANGEUTILS_H
      15             : #define LLVM_LIB_CODEGEN_LIVERANGEUTILS_H
      16             : 
      17             : #include "llvm/CodeGen/LiveInterval.h"
      18             : 
      19             : namespace llvm {
      20             : 
      21             : /// Helper function that distributes live range value numbers and the
      22             : /// corresponding segments of a master live range \p LR to a list of newly
      23             : /// created live ranges \p SplitLRs. \p VNIClasses maps each value number in \p
      24             : /// LR to 0 meaning it should stay or to 1..N meaning it should go to a specific
      25             : /// live range in the \p SplitLRs array.
      26             : template<typename LiveRangeT, typename EqClassesT>
      27        5110 : static void DistributeRange(LiveRangeT &LR, LiveRangeT *SplitLRs[],
      28             :                             EqClassesT VNIClasses) {
      29             :   // Move segments to new intervals.
      30       15330 :   typename LiveRangeT::iterator J = LR.begin(), E = LR.end();
      31       49199 :   while (J != E && VNIClasses[J->valno->id] == 0)
      32       13007 :     ++J;
      33       31370 :   for (typename LiveRangeT::iterator I = J; I != E; ++I) {
      34       52520 :     if (unsigned eq = VNIClasses[I->valno->id]) {
      35             :       assert((SplitLRs[eq-1]->empty() || SplitLRs[eq-1]->expiredAt(I->start)) &&
      36             :              "New intervals should be empty");
      37       23081 :       SplitLRs[eq-1]->segments.push_back(*I);
      38             :     } else
      39        3179 :       *J++ = *I;
      40             :   }
      41       10220 :   LR.segments.erase(J, E);
      42             : 
      43             :   // Transfer VNInfos to their new owners and renumber them.
      44       10220 :   unsigned j = 0, e = LR.getNumValNums();
      45       38471 :   while (j != e && VNIClasses[j] == 0)
      46        9431 :     ++j;
      47       46676 :   for (unsigned i = j; i != e; ++i) {
      48       36456 :     VNInfo *VNI = LR.getValNumInfo(i);
      49       18399 :     if (unsigned eq = VNIClasses[i]) {
      50       33040 :       VNI->id = SplitLRs[eq-1]->getNumValNums();
      51       16520 :       SplitLRs[eq-1]->valnos.push_back(VNI);
      52             :     } else {
      53        1708 :       VNI->id = j;
      54        3416 :       LR.valnos[j++] = VNI;
      55             :     }
      56             :   }
      57        5110 :   LR.valnos.resize(j);
      58        5110 : }
      59             : 
      60             : } // End llvm namespace
      61             : 
      62             : #endif

Generated by: LCOV version 1.13