LCOV - code coverage report
Current view: top level - lib/CodeGen - LiveRangeUtils.h (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 18 18 100.0 %
Date: 2018-06-17 00:07:59 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        9430 : 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       62674 :   while (J != E && VNIClasses[J->valno->id] == 0)
      32       14621 :     ++J;
      33       66422 :   for (typename LiveRangeT::iterator I = J; I != E; ++I) {
      34       56992 :     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       26893 :       SplitLRs[eq-1]->segments.push_back(*I);
      38             :     } else
      39        1603 :       *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       55150 :   while (j != e && VNIClasses[j] == 0)
      46       12113 :     ++j;
      47       54098 :   for (unsigned i = j; i != e; ++i) {
      48       22334 :     VNInfo *VNI = LR.getValNumInfo(i);
      49       22334 :     if (unsigned eq = VNIClasses[i]) {
      50       42820 :       VNI->id = SplitLRs[eq-1]->getNumValNums();
      51       21410 :       SplitLRs[eq-1]->valnos.push_back(VNI);
      52             :     } else {
      53         924 :       VNI->id = j;
      54        1848 :       LR.valnos[j++] = VNI;
      55             :     }
      56             :   }
      57        9430 :   LR.valnos.resize(j);
      58        9430 : }
      59             : 
      60             : } // End llvm namespace
      61             : 
      62             : #endif

Generated by: LCOV version 1.13