LLVM  7.0.0
MCInstrAnalysis.cpp
Go to the documentation of this file.
1 //===- MCInstrAnalysis.cpp - InstrDesc target hooks -----------------------===//
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 
11 
12 #include "llvm/ADT/APInt.h"
13 #include "llvm/MC/MCInst.h"
14 #include "llvm/MC/MCInstrDesc.h"
15 #include "llvm/MC/MCInstrInfo.h"
16 #include <cstdint>
17 
18 using namespace llvm;
19 
21  const MCInst &Inst,
22  APInt &Writes) const {
23  Writes.clearAllBits();
24  return false;
25 }
26 
28  const MCInst &Inst) const {
29  return false;
30 }
31 
32 bool MCInstrAnalysis::evaluateBranch(const MCInst &Inst, uint64_t Addr,
33  uint64_t Size, uint64_t &Target) const {
34  if (Inst.getNumOperands() == 0 ||
35  Info->get(Inst.getOpcode()).OpInfo[0].OperandType != MCOI::OPERAND_PCREL)
36  return false;
37 
38  int64_t Imm = Inst.getOperand(0).getImm();
39  Target = Addr+Size+Imm;
40  return true;
41 }
void clearAllBits()
Set every bit to 0.
Definition: APInt.h:1445
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
virtual bool evaluateBranch(const MCInst &Inst, uint64_t Addr, uint64_t Size, uint64_t &Target) const
Given a branch instruction try to get the address the branch targets.
This file implements a class to represent arbitrary precision integral constant values and operations...
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:161
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
int64_t getImm() const
Definition: MCInst.h:76
virtual bool clearsSuperRegisters(const MCRegisterInfo &MRI, const MCInst &Inst, APInt &Writes) const
Returns true if at least one of the register writes performed by.
unsigned const MachineRegisterInfo * MRI
const MCInstrInfo * Info
unsigned getNumOperands() const
Definition: MCInst.h:184
const MCOperand & getOperand(unsigned i) const
Definition: MCInst.h:182
Target - Wrapper for Target specific information.
Class for arbitrary precision integers.
Definition: APInt.h:69
OperandType
Operands are tagged with one of the values of this enum.
Definition: MCInstrDesc.h:44
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode...
Definition: MCInstrInfo.h:45
Generic base class for all target subtargets.
virtual bool isDependencyBreaking(const MCSubtargetInfo &STI, const MCInst &Inst) const
Returns true if.
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
unsigned getOpcode() const
Definition: MCInst.h:174