diff options
author | Amaury de la Vieuville <amaury.dlv@gmail.com> | 2013-06-11 08:14:14 +0000 |
---|---|---|
committer | Amaury de la Vieuville <amaury.dlv@gmail.com> | 2013-06-11 08:14:14 +0000 |
commit | aa8003712e8b28bc4f263aeb79d8851146273a05 (patch) | |
tree | 90af51db12355d18761c1d9e9f63aa3f7f262555 /lib/Target/ARM/Disassembler/ARMDisassembler.cpp | |
parent | 3862709058ecfe809c9d4b32e3bff0efe8ebe646 (diff) | |
download | external_llvm-aa8003712e8b28bc4f263aeb79d8851146273a05.zip external_llvm-aa8003712e8b28bc4f263aeb79d8851146273a05.tar.gz external_llvm-aa8003712e8b28bc4f263aeb79d8851146273a05.tar.bz2 |
ARM: Enforce decoding rules for VLDn instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183731 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/Disassembler/ARMDisassembler.cpp')
-rw-r--r-- | lib/Target/ARM/Disassembler/ARMDisassembler.cpp | 64 |
1 files changed, 36 insertions, 28 deletions
diff --git a/lib/Target/ARM/Disassembler/ARMDisassembler.cpp b/lib/Target/ARM/Disassembler/ARMDisassembler.cpp index b1a1230..a6eab33 100644 --- a/lib/Target/ARM/Disassembler/ARMDisassembler.cpp +++ b/lib/Target/ARM/Disassembler/ARMDisassembler.cpp @@ -241,15 +241,15 @@ static DecodeStatus DecodeBranchImmInstruction(MCInst &Inst,unsigned Insn, uint64_t Address, const void *Decoder); static DecodeStatus DecodeAddrMode6Operand(MCInst &Inst, unsigned Val, uint64_t Address, const void *Decoder); -static DecodeStatus DecodeVLDInstruction(MCInst &Inst, unsigned Val, +static DecodeStatus DecodeVLDST1Instruction(MCInst &Inst, unsigned Val, uint64_t Address, const void *Decoder); -static DecodeStatus DecodeVST1Instruction(MCInst &Inst, unsigned Val, +static DecodeStatus DecodeVLDST2Instruction(MCInst &Inst, unsigned Val, uint64_t Address, const void *Decoder); -static DecodeStatus DecodeVST2Instruction(MCInst &Inst, unsigned Val, +static DecodeStatus DecodeVLDST3Instruction(MCInst &Inst, unsigned Val, uint64_t Address, const void *Decoder); -static DecodeStatus DecodeVST3Instruction(MCInst &Inst, unsigned Val, +static DecodeStatus DecodeVLDST4Instruction(MCInst &Inst, unsigned Val, uint64_t Address, const void *Decoder); -static DecodeStatus DecodeVST4Instruction(MCInst &Inst, unsigned Val, +static DecodeStatus DecodeVLDInstruction(MCInst &Inst, unsigned Val, uint64_t Address, const void *Decoder); static DecodeStatus DecodeVSTInstruction(MCInst &Inst, unsigned Val, uint64_t Address, const void *Decoder); @@ -2430,47 +2430,55 @@ static DecodeStatus DecodeVLDInstruction(MCInst &Inst, unsigned Insn, return S; } -static DecodeStatus DecodeVST1Instruction(MCInst& Inst, unsigned Insn, - uint64_t Addr, const void* Decoder) { +static DecodeStatus DecodeVLDST1Instruction(MCInst &Inst, unsigned Insn, + uint64_t Address, const void *Decoder) { unsigned type = fieldFromInstruction(Insn, 8, 4); unsigned align = fieldFromInstruction(Insn, 4, 2); - if(type == 7 && (align & 2)) return MCDisassembler::Fail; - if(type == 10 && align == 3) return MCDisassembler::Fail; - if(type == 6 && (align & 2)) return MCDisassembler::Fail; - - return DecodeVSTInstruction(Inst, Insn, Addr, Decoder); + if (type == 6 && (align & 2)) return MCDisassembler::Fail; + if (type == 7 && (align & 2)) return MCDisassembler::Fail; + if (type == 10 && align == 3) return MCDisassembler::Fail; + + unsigned load = fieldFromInstruction(Insn, 21, 1); + return load ? DecodeVLDInstruction(Inst, Insn, Address, Decoder) + : DecodeVSTInstruction(Inst, Insn, Address, Decoder); } -static DecodeStatus DecodeVST2Instruction(MCInst& Inst, unsigned Insn, - uint64_t Addr, const void* Decoder) { +static DecodeStatus DecodeVLDST2Instruction(MCInst &Inst, unsigned Insn, + uint64_t Address, const void *Decoder) { unsigned size = fieldFromInstruction(Insn, 6, 2); - if(size == 3) return MCDisassembler::Fail; + if (size == 3) return MCDisassembler::Fail; unsigned type = fieldFromInstruction(Insn, 8, 4); unsigned align = fieldFromInstruction(Insn, 4, 2); - if(type == 8 && align == 3) return MCDisassembler::Fail; - if(type == 9 && align == 3) return MCDisassembler::Fail; - - return DecodeVSTInstruction(Inst, Insn, Addr, Decoder); + if (type == 8 && align == 3) return MCDisassembler::Fail; + if (type == 9 && align == 3) return MCDisassembler::Fail; + + unsigned load = fieldFromInstruction(Insn, 21, 1); + return load ? DecodeVLDInstruction(Inst, Insn, Address, Decoder) + : DecodeVSTInstruction(Inst, Insn, Address, Decoder); } -static DecodeStatus DecodeVST3Instruction(MCInst& Inst, unsigned Insn, - uint64_t Addr, const void* Decoder) { +static DecodeStatus DecodeVLDST3Instruction(MCInst &Inst, unsigned Insn, + uint64_t Address, const void *Decoder) { unsigned size = fieldFromInstruction(Insn, 6, 2); - if(size == 3) return MCDisassembler::Fail; + if (size == 3) return MCDisassembler::Fail; unsigned align = fieldFromInstruction(Insn, 4, 2); - if(align & 2) return MCDisassembler::Fail; + if (align & 2) return MCDisassembler::Fail; - return DecodeVSTInstruction(Inst, Insn, Addr, Decoder); + unsigned load = fieldFromInstruction(Insn, 21, 1); + return load ? DecodeVLDInstruction(Inst, Insn, Address, Decoder) + : DecodeVSTInstruction(Inst, Insn, Address, Decoder); } -static DecodeStatus DecodeVST4Instruction(MCInst& Inst, unsigned Insn, - uint64_t Addr, const void* Decoder) { +static DecodeStatus DecodeVLDST4Instruction(MCInst &Inst, unsigned Insn, + uint64_t Address, const void *Decoder) { unsigned size = fieldFromInstruction(Insn, 6, 2); - if(size == 3) return MCDisassembler::Fail; + if (size == 3) return MCDisassembler::Fail; - return DecodeVSTInstruction(Inst, Insn, Addr, Decoder); + unsigned load = fieldFromInstruction(Insn, 21, 1); + return load ? DecodeVLDInstruction(Inst, Insn, Address, Decoder) + : DecodeVSTInstruction(Inst, Insn, Address, Decoder); } static DecodeStatus DecodeVSTInstruction(MCInst &Inst, unsigned Insn, |