blob: 2d8336d77ac7a7281854ab1b4e5d97006958cad2 [file] [log] [blame]
Benjamin Kramer41ab14b2011-08-08 18:56:44 +00001//===-- 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"
11using namespace llvm;
12
Ahmed Bougachaef993562013-05-24 01:07:04 +000013bool MCInstrAnalysis::evaluateBranch(const MCInst &Inst, uint64_t Addr,
14 uint64_t Size, uint64_t &Target) const {
Benjamin Kramera182be92011-09-19 17:56:00 +000015 if (Inst.getNumOperands() == 0 ||
16 Info->get(Inst.getOpcode()).OpInfo[0].OperandType != MCOI::OPERAND_PCREL)
Ahmed Bougachaef993562013-05-24 01:07:04 +000017 return false;
Benjamin Kramer41ab14b2011-08-08 18:56:44 +000018
19 int64_t Imm = Inst.getOperand(0).getImm();
Ahmed Bougachaef993562013-05-24 01:07:04 +000020 Target = Addr+Size+Imm;
21 return true;
Benjamin Kramer41ab14b2011-08-08 18:56:44 +000022}