summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCInstrAnalysis.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2011-08-08 18:56:44 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2011-08-08 18:56:44 +0000
commitc22d50e5c3756a5e270b71e59bac9b7c3db572d8 (patch)
treead619b069a04c0edad72a9063c34d197545389e4 /llvm/lib/MC/MCInstrAnalysis.cpp
parent4c0423bc8fd8e1c98a56de9c644300d1e30c9a70 (diff)
downloadbcm5719-llvm-c22d50e5c3756a5e270b71e59bac9b7c3db572d8.tar.gz
bcm5719-llvm-c22d50e5c3756a5e270b71e59bac9b7c3db572d8.zip
Add MCInstrAnalysis class. This allows the targets to specify own versions of MCInstrDescs functions.
- Add overrides for ARM. - Teach llvm-objdump to use this instead of plain MCInstrDesc. llvm-svn: 137059
Diffstat (limited to 'llvm/lib/MC/MCInstrAnalysis.cpp')
-rw-r--r--llvm/lib/MC/MCInstrAnalysis.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCInstrAnalysis.cpp b/llvm/lib/MC/MCInstrAnalysis.cpp
new file mode 100644
index 00000000000..03a35c597be
--- /dev/null
+++ b/llvm/lib/MC/MCInstrAnalysis.cpp
@@ -0,0 +1,20 @@
+//===-- MCInstrAnalysis.cpp - InstrDesc target hooks ------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/MC/MCInstrAnalysis.h"
+using namespace llvm;
+
+uint64_t MCInstrAnalysis::evaluateBranch(const MCInst &Inst, uint64_t Addr,
+ uint64_t Size) const {
+ if (Info->get(Inst.getOpcode()).OpInfo[0].OperandType != MCOI::OPERAND_PCREL)
+ return -1ULL;
+
+ int64_t Imm = Inst.getOperand(0).getImm();
+ return Addr+Size+Imm;
+}
OpenPOWER on IntegriCloud