1 //===- MCInstrAnalysis.cpp - InstrDesc target hooks -----------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "llvm/MC/MCInstrAnalysis.h"
11 #include "llvm/ADT/APInt.h"
12 #include "llvm/MC/MCInst.h"
13 #include "llvm/MC/MCInstrDesc.h"
14 #include "llvm/MC/MCInstrInfo.h"
19 bool MCInstrAnalysis::clearsSuperRegisters(const MCRegisterInfo &MRI,
21 APInt &Writes) const {
22 Writes.clearAllBits();
26 bool MCInstrAnalysis::evaluateBranch(const MCInst &Inst, uint64_t Addr,
27 uint64_t Size, uint64_t &Target) const {
28 if (Inst.getNumOperands() == 0 ||
29 Info->get(Inst.getOpcode()).OpInfo[0].OperandType != MCOI::OPERAND_PCREL)
32 int64_t Imm = Inst.getOperand(0).getImm();
33 Target = Addr+Size+Imm;