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 | 064546cbfe7387a359808f6f1b73211cadc2aca8 (patch) | |
tree | 6909085bd4f979a2b4b047e12a48c187e991b8fa /llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp | |
parent | c8e736476365254800f741b46c230b11b95b2128 (diff) | |
download | bcm5719-llvm-064546cbfe7387a359808f6f1b73211cadc2aca8.tar.gz bcm5719-llvm-064546cbfe7387a359808f6f1b73211cadc2aca8.zip |
ARM: Enforce decoding rules for VLDn instructions
llvm-svn: 183731
Diffstat (limited to 'llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp')
-rw-r--r-- | llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp | 64 |
1 files changed, 36 insertions, 28 deletions
diff --git a/llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp b/llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp index b1a12306f53..a6eab33af37 100644 --- a/llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp +++ b/llvm/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, |