Coverage for /Syzygy/optimize/transforms/unreachable_block_transform.h

CoverageLines executed / instrumented / missingexe / inst / missLanguageGroup
100.0%550.C++source

Line-by-line coverage:

   1    :  // Copyright 2014 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    :  // The unreachable block transform finds blocks that are not used and removes
  16    :  // them from the block_graph. The goal of the transform is to decrease the image
  17    :  // size. This algorithm is greedy and does not take decisions which increase the
  18    :  // image size.
  19    :  //
  20    :  // The transform operates in two phases. It marks every reachable blocks
  21    :  // starting from the roots. Afterwards, it removes every blocks not marked as
  22    :  // they cannot be used.
  23    :  //
  24    :  // The algorithm consider blocks marked with the attribute PE_PARSED as roots.
  25    :  
  26    :  #ifndef SYZYGY_OPTIMIZE_TRANSFORMS_UNREACHABLE_BLOCK_TRANSFORM_H_
  27    :  #define SYZYGY_OPTIMIZE_TRANSFORMS_UNREACHABLE_BLOCK_TRANSFORM_H_
  28    :  
  29    :  #include "syzygy/block_graph/block_graph.h"
  30    :  #include "syzygy/block_graph/transforms/named_transform.h"
  31    :  
  32    :  namespace optimize {
  33    :  namespace transforms {
  34    :  
  35    :  class UnreachableBlockTransform
  36    :      : public block_graph::transforms::
  37    :            NamedBlockGraphTransformImpl<UnreachableBlockTransform> {
  38    :   public:
  39    :    typedef block_graph::BlockGraph BlockGraph;
  40    :    typedef block_graph::TransformPolicyInterface TransformPolicyInterface;
  41    :  
  42    :    // Constructor.
  43  E :    UnreachableBlockTransform() {
  44  E :    }
  45    :  
  46    :    // Apply the transform on a given block graph.
  47    :    //
  48    :    // @param policy The policy object restricting how the transform is applied.
  49    :    // @param block_graph the block graph being transformed.
  50    :    // @param block the block to process.
  51    :    // @returns true on success, false otherwise.
  52    :    virtual bool TransformBlockGraph(const TransformPolicyInterface* policy,
  53    :                                     BlockGraph* block_graph,
  54    :                                     BlockGraph::Block* header_block) override;
  55    :  
  56    :    // The transform name.
  57    :    static const char kTransformName[];
  58    :  
  59    :    // Set the path to dump the unreachable graph.
  60    :    // @param path the path to the graph to generate.
  61  E :    void set_unreachable_graph_path(const base::FilePath& path) {
  62  E :      unreachable_graph_path_ = path;
  63  E :    }
  64    :  
  65    :   private:
  66    :    // The path to dump a cachegrind file of the unreachable blocks.
  67    :    base::FilePath unreachable_graph_path_;
  68    :  
  69    :    DISALLOW_COPY_AND_ASSIGN(UnreachableBlockTransform);
  70    :  };
  71    :  
  72    :  }  // namespace transforms
  73    :  }  // namespace optimize
  74    :  
  75    :  #endif  // SYZYGY_OPTIMIZE_TRANSFORMS_UNREACHABLE_BLOCK_TRANSFORM_H_

Coverage information generated Thu Jan 14 17:40:38 2016.