Coverage for /Syzygy/optimize/transforms/basic_block_reordering_transform.cc

CoverageLines executed / instrumented / missingexe / inst / missLanguageGroup
0.0%0190.C++source

Line-by-line coverage:

   1    :  // Copyright 2013 Google Inc. All Rights Reserved.
   2    :  //
   3    :  // Licensed under the Apache License, Version 2.0 (the "License");
   4    :  // you may not use this file except in compliance with the License.
   5    :  // You may obtain a copy of the License at
   6    :  //
   7    :  //     http://www.apache.org/licenses/LICENSE-2.0
   8    :  //
   9    :  // Unless required by applicable law or agreed to in writing, software
  10    :  // distributed under the License is distributed on an "AS IS" BASIS,
  11    :  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12    :  // See the License for the specific language governing permissions and
  13    :  // limitations under the License.
  14    :  
  15    :  #include "syzygy/optimize/transforms/basic_block_reordering_transform.h"
  16    :  
  17    :  #include "syzygy/block_graph/block_graph.h"
  18    :  
  19    :  namespace optimize {
  20    :  namespace transforms {
  21    :  
  22    :  namespace {
  23    :    using block_graph::BasicBlock;
  24    :    using block_graph::BasicCodeBlock;
  25    :  }  // namespace
  26    :  
  27    :  bool BasicBlockReorderingTransform::TransformBasicBlockSubGraph(
  28    :      const TransformPolicyInterface* policy,
  29    :      BlockGraph* block_graph,
  30    :      BasicBlockSubGraph* subgraph,
  31    :      ApplicationProfile* profile,
  32  i :      SubGraphProfile* subgraph_profile) {
  33  i :    DCHECK_NE(reinterpret_cast<TransformPolicyInterface*>(NULL), policy);
  34  i :    DCHECK_NE(reinterpret_cast<BlockGraph*>(NULL), block_graph);
  35  i :    DCHECK_NE(reinterpret_cast<BasicBlockSubGraph*>(NULL), subgraph);
  36  i :    DCHECK_NE(reinterpret_cast<ApplicationProfile*>(NULL), profile);
  37  i :    DCHECK_NE(reinterpret_cast<SubGraphProfile*>(NULL), subgraph_profile);
  38    :  
  39    :    // Do not reorder cold code.
  40  i :    const BlockGraph::Block* block = subgraph->original_block();
  41  i :    DCHECK_NE(reinterpret_cast<const BlockGraph::Block*>(NULL), block);
  42    :    const ApplicationProfile::BlockProfile* block_profile =
  43  i :        profile->GetBlockProfile(block);
  44  i :    if (block_profile == NULL || block_profile->count() == 0)
  45  i :      return true;
  46    :  
  47    :    // Avoid reordering a block with a jump table or data block.
  48    :    // TODO(etienneb): Add support for jump table reordering.
  49    :    BasicBlockSubGraph::BBCollection::iterator bb_iter =
  50  i :        subgraph->basic_blocks().begin();
  51  i :    for (; bb_iter != subgraph->basic_blocks().end(); ++bb_iter) {
  52  i :      BasicCodeBlock* bb = BasicCodeBlock::Cast(*bb_iter);
  53  i :      if (bb == NULL)
  54  i :        return true;
  55  i :    }
  56    :  
  57    :    // TODO(etienneb): Implement the Pettis algorithm here.
  58    :  
  59  i :    return true;
  60  i :  }
  61    :  
  62    :  }  // namespace transforms
  63    :  }  // namespace optimize

Coverage information generated Wed Dec 11 11:34:16 2013.