Coverage for /Syzygy/block_graph/transform_policy.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    :  // Declares the interface for transform policy objects. The policy object is
  16    :  // used to configure and guide the behaviour of the transformation process
  17    :  // applied to a block-graph. The concepts in here are general for block-graphs,
  18    :  // regardless of the image format or machine format of the underlying data.
  19    :  
  20    :  #ifndef SYZYGY_BLOCK_GRAPH_TRANSFORM_POLICY_H_
  21    :  #define SYZYGY_BLOCK_GRAPH_TRANSFORM_POLICY_H_
  22    :  
  23    :  #include "syzygy/block_graph/block_graph.h"
  24    :  
  25    :  namespace block_graph {
  26    :  
  27    :  // The interface that guides image and basic-block decomposition decisions.
  28    :  class TransformPolicyInterface {
  29    :   public:
  30  E :    virtual ~TransformPolicyInterface() { }
  31    :  
  32    :    // This brings in a few types for the convenience of implementations of this
  33    :    // class.
  34    :    typedef block_graph::BlockGraph BlockGraph;
  35    :  
  36    :    // Determines if the given block is safe for basic-block decomposition.
  37    :    // @param block The block to evaluate.
  38    :    // @returns true if it is safe to basic block decompose the given block,
  39    :    //     false otherwise.
  40    :    virtual bool BlockIsSafeToBasicBlockDecompose(
  41    :        const BlockGraph::Block* block) const = 0;
  42    :  
  43    :    // Returns true if the given references @p ref from @p referrer may be safely
  44    :    // redirected. If both the referrer and the referenced blocks are irregular
  45    :    // in any way we cannot safely assume that @p reference has call semantics,
  46    :    // i.e., where a return address is at the top of stack at entry. For any
  47    :    // instrumentation or manipulation that uses return address swizzling,
  48    :    // instrumenting an unsafe reference generally leads to crashes.
  49    :    // @param referrer The block containing the reference.
  50    :    // @param reference The reference itself.
  51    :    // @returns true if the reference is safe and may be thunked, false otherwise.
  52    :    virtual bool ReferenceIsSafeToRedirect(
  53    :        const BlockGraph::Block* referrer,
  54    :        const BlockGraph::Reference& reference) const = 0;
  55    :  };
  56    :  
  57    :  }  // namespace block_graph
  58    :  
  59    :  #endif  // SYZYGY_BLOCK_GRAPH_TRANSFORM_POLICY_H_

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