]>
git.proxmox.com Git - rustc.git/blob - src/llvm/include/llvm/MC/MCInstrAnalysis.h
1 //===-- llvm/MC/MCInstrAnalysis.h - InstrDesc target hooks ------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines the MCInstrAnalysis class which the MCTargetDescs can
11 // derive from to give additional information to MC.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_MC_MCINSTRANALYSIS_H
16 #define LLVM_MC_MCINSTRANALYSIS_H
18 #include "llvm/MC/MCInst.h"
19 #include "llvm/MC/MCInstrDesc.h"
20 #include "llvm/MC/MCInstrInfo.h"
24 class MCInstrAnalysis
{
27 const MCInstrInfo
*Info
;
30 MCInstrAnalysis(const MCInstrInfo
*Info
) : Info(Info
) {}
32 virtual ~MCInstrAnalysis() {}
34 virtual bool isBranch(const MCInst
&Inst
) const {
35 return Info
->get(Inst
.getOpcode()).isBranch();
38 virtual bool isConditionalBranch(const MCInst
&Inst
) const {
39 return Info
->get(Inst
.getOpcode()).isConditionalBranch();
42 virtual bool isUnconditionalBranch(const MCInst
&Inst
) const {
43 return Info
->get(Inst
.getOpcode()).isUnconditionalBranch();
46 virtual bool isIndirectBranch(const MCInst
&Inst
) const {
47 return Info
->get(Inst
.getOpcode()).isIndirectBranch();
50 virtual bool isCall(const MCInst
&Inst
) const {
51 return Info
->get(Inst
.getOpcode()).isCall();
54 virtual bool isReturn(const MCInst
&Inst
) const {
55 return Info
->get(Inst
.getOpcode()).isReturn();
58 virtual bool isTerminator(const MCInst
&Inst
) const {
59 return Info
->get(Inst
.getOpcode()).isTerminator();
62 /// evaluateBranch - Given a branch instruction try to get the address the
63 /// branch targets. Return true on success, and the address in Target.
65 evaluateBranch(const MCInst
&Inst
, uint64_t Addr
, uint64_t Size
,
66 uint64_t &Target
) const;
69 } // End llvm namespace