MCInstrAnalysis.cpp 775 B

12345678910111213141516171819202122
  1. //===-- MCInstrAnalysis.cpp - 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. #include "llvm/MC/MCInstrAnalysis.h"
  10. using namespace llvm;
  11. bool MCInstrAnalysis::evaluateBranch(const MCInst &Inst, uint64_t Addr,
  12. uint64_t Size, uint64_t &Target) const {
  13. if (Inst.getNumOperands() == 0 ||
  14. Info->get(Inst.getOpcode()).OpInfo[0].OperandType != MCOI::OPERAND_PCREL)
  15. return false;
  16. int64_t Imm = Inst.getOperand(0).getImm();
  17. Target = Addr+Size+Imm;
  18. return true;
  19. }