LCOV - code coverage report
Current view: top level - lib/CodeGen/GlobalISel - LegalizeMutations.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 13 18 72.2 %
Date: 2018-06-17 00:07:59 Functions: 5 6 83.3 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===- lib/CodeGen/GlobalISel/LegalizerMutations.cpp - Mutations ----------===//
       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             : // A library of mutation factories to use for LegalityMutation.
      11             : //
      12             : //===----------------------------------------------------------------------===//
      13             : 
      14             : #include "llvm/CodeGen/GlobalISel/LegalizerInfo.h"
      15             : 
      16             : using namespace llvm;
      17             : 
      18      156008 : LegalizeMutation LegalizeMutations::changeTo(unsigned TypeIdx, LLT Ty) {
      19             :   return
      20      312253 :       [=](const LegalityQuery &Query) { return std::make_pair(TypeIdx, Ty); };
      21             : }
      22             : 
      23        2870 : LegalizeMutation LegalizeMutations::changeTo(unsigned TypeIdx,
      24             :                                              unsigned FromTypeIdx) {
      25             :   return [=](const LegalityQuery &Query) {
      26           5 :     return std::make_pair(TypeIdx, Query.Types[FromTypeIdx]);
      27        2875 :   };
      28             : }
      29             : 
      30       46371 : LegalizeMutation LegalizeMutations::widenScalarToNextPow2(unsigned TypeIdx,
      31             :                                                           unsigned Min) {
      32           4 :   return [=](const LegalityQuery &Query) {
      33             :     unsigned NewSizeInBits =
      34          12 :         1 << Log2_32_Ceil(Query.Types[TypeIdx].getSizeInBits());
      35           4 :     if (NewSizeInBits < Min)
      36             :       NewSizeInBits = Min;
      37           4 :     return std::make_pair(TypeIdx, LLT::scalar(NewSizeInBits));
      38       46371 :   };
      39             : }
      40             : 
      41        1435 : LegalizeMutation LegalizeMutations::moreElementsToNextPow2(unsigned TypeIdx,
      42             :                                                            unsigned Min) {
      43           0 :   return [=](const LegalityQuery &Query) {
      44           0 :     const LLT &VecTy = Query.Types[TypeIdx];
      45           0 :     unsigned NewNumElements = 1 << Log2_32_Ceil(VecTy.getNumElements());
      46           0 :     if (NewNumElements < Min)
      47             :       NewNumElements = Min;
      48             :     return std::make_pair(
      49           0 :         TypeIdx, LLT::vector(NewNumElements, VecTy.getScalarSizeInBits()));
      50        1435 :   };
      51             : }

Generated by: LCOV version 1.13