Eugene Zelenko | a700a60 | 2017-02-11 00:27:28 +0000 | [diff] [blame] | 1 | //===- MCInstrAnalysis.cpp - InstrDesc target hooks -----------------------===// |
Benjamin Kramer | 41ab14b | 2011-08-08 18:56:44 +0000 | [diff] [blame] | 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" |
Andrea Di Biagio | 9fc96b8 | 2018-06-20 10:08:11 +0000 | [diff] [blame] | 11 | |
| 12 | #include "llvm/ADT/APInt.h" |
Chandler Carruth | e3e43d9 | 2017-06-06 11:49:48 +0000 | [diff] [blame] | 13 | #include "llvm/MC/MCInst.h" |
Eugene Zelenko | a700a60 | 2017-02-11 00:27:28 +0000 | [diff] [blame] | 14 | #include "llvm/MC/MCInstrDesc.h" |
| 15 | #include "llvm/MC/MCInstrInfo.h" |
| 16 | #include <cstdint> |
| 17 | |
Benjamin Kramer | 41ab14b | 2011-08-08 18:56:44 +0000 | [diff] [blame] | 18 | using namespace llvm; |
| 19 | |
Andrea Di Biagio | 9fc96b8 | 2018-06-20 10:08:11 +0000 | [diff] [blame] | 20 | bool MCInstrAnalysis::clearsSuperRegisters(const MCRegisterInfo &MRI, |
| 21 | const MCInst &Inst, |
| 22 | APInt &Writes) const { |
| 23 | Writes.clearAllBits(); |
| 24 | return false; |
| 25 | } |
| 26 | |
Ahmed Bougacha | ef99356 | 2013-05-24 01:07:04 +0000 | [diff] [blame] | 27 | bool MCInstrAnalysis::evaluateBranch(const MCInst &Inst, uint64_t Addr, |
| 28 | uint64_t Size, uint64_t &Target) const { |
Benjamin Kramer | a182be9 | 2011-09-19 17:56:00 +0000 | [diff] [blame] | 29 | if (Inst.getNumOperands() == 0 || |
| 30 | Info->get(Inst.getOpcode()).OpInfo[0].OperandType != MCOI::OPERAND_PCREL) |
Ahmed Bougacha | ef99356 | 2013-05-24 01:07:04 +0000 | [diff] [blame] | 31 | return false; |
Benjamin Kramer | 41ab14b | 2011-08-08 18:56:44 +0000 | [diff] [blame] | 32 | |
| 33 | int64_t Imm = Inst.getOperand(0).getImm(); |
Ahmed Bougacha | ef99356 | 2013-05-24 01:07:04 +0000 | [diff] [blame] | 34 | Target = Addr+Size+Imm; |
| 35 | return true; |
Benjamin Kramer | 41ab14b | 2011-08-08 18:56:44 +0000 | [diff] [blame] | 36 | } |