LLVM API Documentation

MCInstrAnalysis.cpp
Go to the documentation of this file.
00001 //===-- MCInstrAnalysis.cpp - InstrDesc target hooks ------------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 
00010 #include "llvm/MC/MCInstrAnalysis.h"
00011 using namespace llvm;
00012 
00013 bool MCInstrAnalysis::evaluateBranch(const MCInst &Inst, uint64_t Addr,
00014                                      uint64_t Size, uint64_t &Target) const {
00015   if (Inst.getNumOperands() == 0 ||
00016       Info->get(Inst.getOpcode()).OpInfo[0].OperandType != MCOI::OPERAND_PCREL)
00017     return false;
00018 
00019   int64_t Imm = Inst.getOperand(0).getImm();
00020   Target = Addr+Size+Imm;
00021   return true;
00022 }