Eugene Zelenko | d3a6c89 | 2017-02-11 00:27:28 +0000 | [diff] [blame] | 1 | //===- MCInstrAnalysis.cpp - InstrDesc target hooks -----------------------===// |
Benjamin Kramer | c22d50e | 2011-08-08 18:56:44 +0000 | [diff] [blame] | 2 | // |
Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 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 |
Benjamin Kramer | c22d50e | 2011-08-08 18:56:44 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "llvm/MC/MCInstrAnalysis.h" |
Reid Kleckner | 5565d36 | 2019-11-13 16:36:21 -0800 | [diff] [blame] | 10 | |
Andrea Di Biagio | 2145b13 | 2018-06-20 10:08:11 +0000 | [diff] [blame] | 11 | #include "llvm/ADT/APInt.h" |
Chandler Carruth | 6bda14b | 2017-06-06 11:49:48 +0000 | [diff] [blame] | 12 | #include "llvm/MC/MCInst.h" |
Eugene Zelenko | d3a6c89 | 2017-02-11 00:27:28 +0000 | [diff] [blame] | 13 | #include "llvm/MC/MCInstrDesc.h" |
| 14 | #include "llvm/MC/MCInstrInfo.h" |
| 15 | #include <cstdint> |
| 16 | |
Benjamin Kramer | c22d50e | 2011-08-08 18:56:44 +0000 | [diff] [blame] | 17 | using namespace llvm; |
| 18 | |
Andrea Di Biagio | 2145b13 | 2018-06-20 10:08:11 +0000 | [diff] [blame] | 19 | bool MCInstrAnalysis::clearsSuperRegisters(const MCRegisterInfo &MRI, |
| 20 | const MCInst &Inst, |
| 21 | APInt &Writes) const { |
| 22 | Writes.clearAllBits(); |
| 23 | return false; |
| 24 | } |
| 25 | |
Ahmed Bougacha | aa79068 | 2013-05-24 01:07:04 +0000 | [diff] [blame] | 26 | bool MCInstrAnalysis::evaluateBranch(const MCInst &Inst, uint64_t Addr, |
| 27 | uint64_t Size, uint64_t &Target) const { |
Benjamin Kramer | 1223416 | 2011-09-19 17:56:00 +0000 | [diff] [blame] | 28 | if (Inst.getNumOperands() == 0 || |
| 29 | Info->get(Inst.getOpcode()).OpInfo[0].OperandType != MCOI::OPERAND_PCREL) |
Ahmed Bougacha | aa79068 | 2013-05-24 01:07:04 +0000 | [diff] [blame] | 30 | return false; |
Benjamin Kramer | c22d50e | 2011-08-08 18:56:44 +0000 | [diff] [blame] | 31 | |
| 32 | int64_t Imm = Inst.getOperand(0).getImm(); |
Ahmed Bougacha | aa79068 | 2013-05-24 01:07:04 +0000 | [diff] [blame] | 33 | Target = Addr+Size+Imm; |
| 34 | return true; |
Benjamin Kramer | c22d50e | 2011-08-08 18:56:44 +0000 | [diff] [blame] | 35 | } |
Seiya Nuta | 21277e3 | 2019-07-25 06:57:09 +0000 | [diff] [blame] | 36 | |
| 37 | Optional<uint64_t> |
| 38 | MCInstrAnalysis::evaluateMemoryOperandAddress(const MCInst &Inst, uint64_t Addr, |
| 39 | uint64_t Size) const { |
| 40 | return None; |
| 41 | } |