mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-02 07:11:49 +00:00
7801136b95
from MC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138367 91177308-0d34-0410-b5e6-96231b3b80d8
62 lines
1.7 KiB
C++
62 lines
1.7 KiB
C++
//===-- llvm/MC/MCInstrAnalysis.h - InstrDesc target hooks ------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file defines the MCInstrAnalysis class which the MCTargetDescs can
|
|
// derive from to give additional information to MC.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "llvm/MC/MCInst.h"
|
|
#include "llvm/MC/MCInstrDesc.h"
|
|
#include "llvm/MC/MCInstrInfo.h"
|
|
|
|
namespace llvm {
|
|
|
|
class MCInstrAnalysis {
|
|
protected:
|
|
friend class Target;
|
|
const MCInstrInfo *Info;
|
|
|
|
public:
|
|
MCInstrAnalysis(const MCInstrInfo *Info) : Info(Info) {}
|
|
|
|
virtual ~MCInstrAnalysis() {}
|
|
|
|
virtual bool isBranch(const MCInst &Inst) const {
|
|
return Info->get(Inst.getOpcode()).isBranch();
|
|
}
|
|
|
|
virtual bool isConditionalBranch(const MCInst &Inst) const {
|
|
return Info->get(Inst.getOpcode()).isBranch();
|
|
}
|
|
|
|
virtual bool isUnconditionalBranch(const MCInst &Inst) const {
|
|
return Info->get(Inst.getOpcode()).isUnconditionalBranch();
|
|
}
|
|
|
|
virtual bool isIndirectBranch(const MCInst &Inst) const {
|
|
return Info->get(Inst.getOpcode()).isIndirectBranch();
|
|
}
|
|
|
|
virtual bool isCall(const MCInst &Inst) const {
|
|
return Info->get(Inst.getOpcode()).isCall();
|
|
}
|
|
|
|
virtual bool isReturn(const MCInst &Inst) const {
|
|
return Info->get(Inst.getOpcode()).isReturn();
|
|
}
|
|
|
|
/// evaluateBranch - Given a branch instruction try to get the address the
|
|
/// branch targets. Otherwise return -1.
|
|
virtual uint64_t
|
|
evaluateBranch(const MCInst &Inst, uint64_t Addr, uint64_t Size) const;
|
|
};
|
|
|
|
}
|