Coverage for /Syzygy/assm/cond.h

CoverageLines executed / instrumented / missingexe / inst / missLanguageGroup
100.0%440.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    :  // This file declares implementation classes to generate assembly code.
  16    :  // The API to the assembler is intentionally very close to the API exposed
  17    :  // by the V8 assembler (see src/ia32/assembler-ia32.* in V8 repository).
  18    :  
  19    :  #ifndef SYZYGY_ASSM_COND_H_
  20    :  #define SYZYGY_ASSM_COND_H_
  21    :  
  22    :  #include "syzygy/assm/register.h"
  23    :  
  24    :  namespace assm {
  25    :  
  26    :  // The condition codes by which conditional branches are determined. This enum
  27    :  // is taken from the V8 project, and has the property that the conditions are
  28    :  // defined to be bit-wise ORed into the base conditional branch opcode, and
  29    :  // they can be easily negated/inverted.
  30    :  //
  31    :  // See:
  32    :  //     http://code.google.com/p/v8/source/browse/trunk/src/ia32/assembler-ia32.h
  33    :  enum ConditionCode {
  34    :    // Any value < 0 is considered no_condition
  35    :    kNoCondition  = -1,
  36    :  
  37    :    kOverflow =  0,
  38    :    kNoOverflow =  1,
  39    :    kBelow =  2,
  40    :    kAboveEqual =  3,
  41    :    kEqual =  4,
  42    :    kNotEqual =  5,
  43    :    kBelowEqual =  6,
  44    :    kAbove =  7,
  45    :    kNegative =  8,
  46    :    kPositive =  9,
  47    :    kParityEven = 10,
  48    :    kParityOdd = 11,
  49    :    kLess = 12,
  50    :    kGreaterEqual = 13,
  51    :    kLessEqual = 14,
  52    :    kGreater = 15,
  53    :  
  54    :    // Aliases.
  55    :    kCarry = kBelow,
  56    :    kNotCarry = kAboveEqual,
  57    :    kZero = kEqual,
  58    :    kNotZero = kNotEqual,
  59    :    kSign = kNegative,
  60    :    kNotSign = kPositive,
  61    :  
  62    :    // Extents.
  63    :    kMinConditionCode = 0,
  64    :    kMaxConditionCode = 15
  65    :  };
  66    :  
  67    :  // The conditions on which a loop instruction should branch. These are modeled
  68    :  // in the same manner as ConditionCode (above).
  69    :  enum LoopCode {
  70    :    kLoopOnCounterAndNotZeroFlag = 0,  // LOOPNE and LOOPNZ
  71    :    kLoopOnCounterAndZeroFlag = 1,  // LOOPE and NOOPZ.
  72    :    kLoopOnCounter = 2,  // LOOP.
  73    :  };
  74    :  
  75  E :  inline ConditionCode NegateConditionCode(ConditionCode cc) {
  76  E :    DCHECK_GT(16, cc);
  77  E :    return static_cast<ConditionCode>(cc ^ 1);
  78  E :  }
  79    :  
  80    :  }  // namespace assm
  81    :  
  82    :  #endif  // SYZYGY_ASSM_COND_H_

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