LCOV - code coverage report
Current view: top level - include/llvm/MC - MCInstrAnalysis.h (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 8 16 50.0 %
Date: 2017-09-14 15:23:50 Functions: 4 9 44.4 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===- llvm/MC/MCInstrAnalysis.h - InstrDesc target hooks -------*- C++ -*-===//
       2             : //
       3             : //                     The LLVM Compiler Infrastructure
       4             : //
       5             : // This file is distributed under the University of Illinois Open Source
       6             : // License. See LICENSE.TXT for details.
       7             : //
       8             : //===----------------------------------------------------------------------===//
       9             : //
      10             : // This file defines the MCInstrAnalysis class which the MCTargetDescs can
      11             : // derive from to give additional information to MC.
      12             : //
      13             : //===----------------------------------------------------------------------===//
      14             : 
      15             : #ifndef LLVM_MC_MCINSTRANALYSIS_H
      16             : #define LLVM_MC_MCINSTRANALYSIS_H
      17             : 
      18             : #include "llvm/MC/MCInst.h"
      19             : #include "llvm/MC/MCInstrDesc.h"
      20             : #include "llvm/MC/MCInstrInfo.h"
      21             : #include <cstdint>
      22             : 
      23             : namespace llvm {
      24             : 
      25             : class MCInstrAnalysis {
      26             : protected:
      27             :   friend class Target;
      28             : 
      29             :   const MCInstrInfo *Info;
      30             : 
      31             : public:
      32         574 :   MCInstrAnalysis(const MCInstrInfo *Info) : Info(Info) {}
      33         275 :   virtual ~MCInstrAnalysis() = default;
      34             : 
      35           0 :   virtual bool isBranch(const MCInst &Inst) const {
      36           0 :     return Info->get(Inst.getOpcode()).isBranch();
      37             :   }
      38             : 
      39      198823 :   virtual bool isConditionalBranch(const MCInst &Inst) const {
      40      638730 :     return Info->get(Inst.getOpcode()).isConditionalBranch();
      41             :   }
      42             : 
      43      203743 :   virtual bool isUnconditionalBranch(const MCInst &Inst) const {
      44      653754 :     return Info->get(Inst.getOpcode()).isUnconditionalBranch();
      45             :   }
      46             : 
      47           0 :   virtual bool isIndirectBranch(const MCInst &Inst) const {
      48           0 :     return Info->get(Inst.getOpcode()).isIndirectBranch();
      49             :   }
      50             : 
      51     3037265 :   virtual bool isCall(const MCInst &Inst) const {
      52     9111795 :     return Info->get(Inst.getOpcode()).isCall();
      53             :   }
      54             : 
      55           0 :   virtual bool isReturn(const MCInst &Inst) const {
      56           0 :     return Info->get(Inst.getOpcode()).isReturn();
      57             :   }
      58             : 
      59           0 :   virtual bool isTerminator(const MCInst &Inst) const {
      60           0 :     return Info->get(Inst.getOpcode()).isTerminator();
      61             :   }
      62             : 
      63             :   /// \brief Given a branch instruction try to get the address the branch
      64             :   /// targets. Return true on success, and the address in Target.
      65             :   virtual bool
      66             :   evaluateBranch(const MCInst &Inst, uint64_t Addr, uint64_t Size,
      67             :                  uint64_t &Target) const;
      68             : };
      69             : 
      70             : } // end namespace llvm
      71             : 
      72             : #endif // LLVM_MC_MCINSTRANALYSIS_H

Generated by: LCOV version 1.13