summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Mips/Disassembler
diff options
context:
space:
mode:
authorDaniel Sanders <daniel.sanders@imgtec.com>2016-03-11 11:37:50 +0000
committerDaniel Sanders <daniel.sanders@imgtec.com>2016-03-11 11:37:50 +0000
commit78e8902097914db056954faa34df1a747c8a30bd (patch)
treedbcd50a88e90aec70feda55b9024ce77a89d1518 /llvm/lib/Target/Mips/Disassembler
parentb47f8010a95f461f995e30dc2b77391093183605 (diff)
downloadbcm5719-llvm-78e8902097914db056954faa34df1a747c8a30bd.tar.gz
bcm5719-llvm-78e8902097914db056954faa34df1a747c8a30bd.zip
[mips] Range check simm4.
Summary: Reviewers: vkalintiris Subscribers: dsanders, llvm-commits Differential Revision: http://reviews.llvm.org/D16811 llvm-svn: 263220
Diffstat (limited to 'llvm/lib/Target/Mips/Disassembler')
-rw-r--r--llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp b/llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp
index ca149a19d63..4c64fc812e7 100644
--- a/llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp
+++ b/llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp
@@ -377,11 +377,6 @@ static DecodeStatus DecodePOOL16BEncodedField(MCInst &Inst,
uint64_t Address,
const void *Decoder);
-static DecodeStatus DecodeSimm4(MCInst &Inst,
- unsigned Value,
- uint64_t Address,
- const void *Decoder);
-
static DecodeStatus DecodeSimm16(MCInst &Inst,
unsigned Insn,
uint64_t Address,
@@ -391,6 +386,10 @@ template <unsigned Bits, int Offset>
static DecodeStatus DecodeUImmWithOffset(MCInst &Inst, unsigned Value,
uint64_t Address, const void *Decoder);
+template <unsigned Bits, int Offset = 0>
+static DecodeStatus DecodeSImmWithOffset(MCInst &Inst, unsigned Value,
+ uint64_t Address, const void *Decoder);
+
static DecodeStatus DecodeInsSize(MCInst &Inst,
unsigned Insn,
uint64_t Address,
@@ -1924,14 +1923,6 @@ static DecodeStatus DecodePOOL16BEncodedField(MCInst &Inst,
return MCDisassembler::Success;
}
-static DecodeStatus DecodeSimm4(MCInst &Inst,
- unsigned Value,
- uint64_t Address,
- const void *Decoder) {
- Inst.addOperand(MCOperand::createImm(SignExtend32<4>(Value)));
- return MCDisassembler::Success;
-}
-
static DecodeStatus DecodeSimm16(MCInst &Inst,
unsigned Insn,
uint64_t Address,
@@ -1949,6 +1940,15 @@ static DecodeStatus DecodeUImmWithOffset(MCInst &Inst, unsigned Value,
return MCDisassembler::Success;
}
+template <unsigned Bits, int Offset>
+static DecodeStatus DecodeSImmWithOffset(MCInst &Inst, unsigned Value,
+ uint64_t Address,
+ const void *Decoder) {
+ int32_t Imm = SignExtend32<Bits>(Value);
+ Inst.addOperand(MCOperand::createImm(Imm + Offset));
+ return MCDisassembler::Success;
+}
+
static DecodeStatus DecodeInsSize(MCInst &Inst,
unsigned Insn,
uint64_t Address,
OpenPOWER on IntegriCloud