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

CoverageLines executed / instrumented / missingexe / inst / missLanguageGroup
100.0%110.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    :  // Peephole optimization is a kind of optimization performed over a very small
  16    :  // set of instructions  called a "peephole". It works by recognizing patterns
  17    :  // of instructions that can be replaced by shorter or faster sets of
  18    :  // instructions.
  19    :  
  20    :  #ifndef SYZYGY_OPTIMIZE_TRANSFORMS_PEEPHOLE_TRANSFORM_H_
  21    :  #define SYZYGY_OPTIMIZE_TRANSFORMS_PEEPHOLE_TRANSFORM_H_
  22    :  
  23    :  #include "syzygy/block_graph/filterable.h"
  24    :  #include "syzygy/block_graph/transform_policy.h"
  25    :  #include "syzygy/optimize/application_profile.h"
  26    :  #include "syzygy/optimize/transforms/subgraph_transform.h"
  27    :  
  28    :  namespace optimize {
  29    :  namespace transforms {
  30    :  
  31    :  // This class implements the peephole transformation.
  32    :  class PeepholeTransform : public SubGraphTransformInterface {
  33    :   public:
  34    :    typedef block_graph::BasicBlock BasicBlock;
  35    :    typedef block_graph::BasicBlockSubGraph BasicBlockSubGraph;
  36    :    typedef block_graph::BlockGraph BlockGraph;
  37    :    typedef block_graph::TransformPolicyInterface TransformPolicyInterface;
  38    :  
  39    :    // Constructor.
  40  E :    PeepholeTransform() { }
  41    :  
  42    :    // @name SubGraphTransformInterface implementation.
  43    :    // @{
  44    :    // Apply the sequence of patterns to simplify the contents of a subgraph until
  45    :    // a fixed point is reached.
  46    :    virtual bool TransformBasicBlockSubGraph(
  47    :        const TransformPolicyInterface* policy,
  48    :        BlockGraph* block_graph,
  49    :        BasicBlockSubGraph* subgraph,
  50    :        ApplicationProfile* profile,
  51    :        SubGraphProfile* subgraph_profile) override;
  52    :    // @}
  53    :  
  54    :    // Apply a sequence of patterns to simplify the contents of a subgraph. The
  55    :    // sequence of patterns is applied once.
  56    :    // @param subgraph the subgraph to simplify.
  57    :    // @returns true if the subgraph has been simplified, false otherwise.
  58    :    static bool SimplifySubgraph(BasicBlockSubGraph* subgraph);
  59    :  
  60    :    // Remove dead instructions in the contents of a subgraph. The dead code
  61    :    // elimination is applied once.
  62    :    // @param subgraph the subgraph to simplify.
  63    :    // @returns true if the subgraph has been simplified, false otherwise.
  64    :    static bool RemoveDeadCodeSubgraph(BasicBlockSubGraph* subgraph);
  65    :  
  66    :   private:
  67    :    DISALLOW_COPY_AND_ASSIGN(PeepholeTransform);
  68    :  };
  69    :  
  70    :  }  // namespace transforms
  71    :  }  // namespace optimize
  72    :  
  73    :  #endif  // SYZYGY_OPTIMIZE_TRANSFORMS_PEEPHOLE_TRANSFORM_H_

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