Benjamin Kramer | 41ab14b | 2011-08-08 18:56:44 +0000 | [diff] [blame] | 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 | |
| 10 | #include "llvm/MC/MCInstrAnalysis.h" |
| 11 | using namespace llvm; |
| 12 | |
| 13 | uint64_t MCInstrAnalysis::evaluateBranch(const MCInst &Inst, uint64_t Addr, |
| 14 | uint64_t Size) const { |
Benjamin Kramer | a182be9 | 2011-09-19 17:56:00 +0000 | [diff] [blame] | 15 | if (Inst.getNumOperands() == 0 || |
| 16 | Info->get(Inst.getOpcode()).OpInfo[0].OperandType != MCOI::OPERAND_PCREL) |
Benjamin Kramer | 41ab14b | 2011-08-08 18:56:44 +0000 | [diff] [blame] | 17 | return -1ULL; |
| 18 | |
| 19 | int64_t Imm = Inst.getOperand(0).getImm(); |
| 20 | return Addr+Size+Imm; |
| 21 | } |