blob: 8223f3a5c66fd2dd59db74f9f3af160faf076fcc [file] [log] [blame]
Eugene Zelenkoa700a602017-02-11 00:27:28 +00001//===- MCInstrAnalysis.cpp - InstrDesc target hooks -----------------------===//
Benjamin Kramer41ab14b2011-08-08 18:56:44 +00002//
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"
Andrea Di Biagio9fc96b82018-06-20 10:08:11 +000011
12#include "llvm/ADT/APInt.h"
Chandler Carruthe3e43d92017-06-06 11:49:48 +000013#include "llvm/MC/MCInst.h"
Eugene Zelenkoa700a602017-02-11 00:27:28 +000014#include "llvm/MC/MCInstrDesc.h"
15#include "llvm/MC/MCInstrInfo.h"
16#include <cstdint>
17
Benjamin Kramer41ab14b2011-08-08 18:56:44 +000018using namespace llvm;
19
Andrea Di Biagio9fc96b82018-06-20 10:08:11 +000020bool MCInstrAnalysis::clearsSuperRegisters(const MCRegisterInfo &MRI,
21 const MCInst &Inst,
22 APInt &Writes) const {
23 Writes.clearAllBits();
24 return false;
25}
26
Ahmed Bougachaef993562013-05-24 01:07:04 +000027bool MCInstrAnalysis::evaluateBranch(const MCInst &Inst, uint64_t Addr,
28 uint64_t Size, uint64_t &Target) const {
Benjamin Kramera182be92011-09-19 17:56:00 +000029 if (Inst.getNumOperands() == 0 ||
30 Info->get(Inst.getOpcode()).OpInfo[0].OperandType != MCOI::OPERAND_PCREL)
Ahmed Bougachaef993562013-05-24 01:07:04 +000031 return false;
Benjamin Kramer41ab14b2011-08-08 18:56:44 +000032
33 int64_t Imm = Inst.getOperand(0).getImm();
Ahmed Bougachaef993562013-05-24 01:07:04 +000034 Target = Addr+Size+Imm;
35 return true;
Benjamin Kramer41ab14b2011-08-08 18:56:44 +000036}