LCOV - code coverage report
Current view: top level - lib/CodeGen - LiveRangeUtils.h (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 53 54 98.1 %
Date: 2018-10-20 13:21:21 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       15706 : static void DistributeRange(LiveRangeT &LR, LiveRangeT *SplitLRs[],
      28             :                             EqClassesT VNIClasses) {
      29             :   // Move segments to new intervals.
      30             :   typename LiveRangeT::iterator J = LR.begin(), E = LR.end();
      31       35657 :   while (J != E && VNIClasses[J->valno->id] == 0)
      32       19951 :     ++J;
      33       48853 :   for (typename LiveRangeT::iterator I = J; I != E; ++I) {
      34       66294 :     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       31467 :       SplitLRs[eq-1]->segments.push_back(*I);
      38             :     } else
      39        1680 :       *J++ = *I;
      40             :   }
      41             :   LR.segments.erase(J, E);
      42             : 
      43             :   // Transfer VNInfos to their new owners and renumber them.
      44             :   unsigned j = 0, e = LR.getNumValNums();
      45       33133 :   while (j != e && VNIClasses[j] == 0)
      46       17427 :     ++j;
      47       41974 :   for (unsigned i = j; i != e; ++i) {
      48       26268 :     VNInfo *VNI = LR.getValNumInfo(i);
      49       26268 :     if (unsigned eq = VNIClasses[i]) {
      50       25186 :       VNI->id = SplitLRs[eq-1]->getNumValNums();
      51       25186 :       SplitLRs[eq-1]->valnos.push_back(VNI);
      52             :     } else {
      53        1082 :       VNI->id = j;
      54        2164 :       LR.valnos[j++] = VNI;
      55             :     }
      56             :   }
      57       15706 :   LR.valnos.resize(j);
      58       15706 : }
      59       15504 : 
      60             : } // End llvm namespace
      61             : 
      62             : #endif

Generated by: LCOV version 1.13