llvm.org GIT mirror llvm / 2a7d3a9
Fix a few more places in the ARM disassembler so that branches get symbolic operands added when using the C disassembler API. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154628 91177308-0d34-0410-b5e6-96231b3b80d8 Kevin Enderby 8 years ago
2 changed file(s) with 30 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
31963196 let Inst{13} = target{17};
31973197 let Inst{21-16} = target{16-11};
31983198 let Inst{10-0} = target{10-0};
3199 let DecoderMethod = "DecodeT2BInstruction";
31993200 }
32003201
32013202 let isNotDuplicable = 1, isIndirectBranch = 1 in {
179179 static DecodeStatus DecodeAddrMode5Operand(MCInst &Inst, unsigned Val,
180180 uint64_t Address, const void *Decoder);
181181 static DecodeStatus DecodeAddrMode7Operand(MCInst &Inst, unsigned Val,
182 uint64_t Address, const void *Decoder);
183 static DecodeStatus DecodeT2BInstruction(MCInst &Inst, unsigned Insn,
182184 uint64_t Address, const void *Decoder);
183185 static DecodeStatus DecodeBranchImmInstruction(MCInst &Inst,unsigned Insn,
184186 uint64_t Address, const void *Decoder);
20262028 static DecodeStatus DecodeAddrMode7Operand(MCInst &Inst, unsigned Val,
20272029 uint64_t Address, const void *Decoder) {
20282030 return DecodeGPRRegisterClass(Inst, Val, Address, Decoder);
2031 }
2032
2033 static DecodeStatus
2034 DecodeT2BInstruction(MCInst &Inst, unsigned Insn,
2035 uint64_t Address, const void *Decoder) {
2036 DecodeStatus S = MCDisassembler::Success;
2037 unsigned imm = (fieldFromInstruction32(Insn, 0, 11) << 0) |
2038 (fieldFromInstruction32(Insn, 11, 1) << 18) |
2039 (fieldFromInstruction32(Insn, 13, 1) << 17) |
2040 (fieldFromInstruction32(Insn, 16, 6) << 11) |
2041 (fieldFromInstruction32(Insn, 26, 1) << 19);
2042 if (!tryAddingSymbolicOperand(Address, Address + SignExtend32<20>(imm<<1) + 4,
2043 true, 4, Inst, Decoder))
2044 Inst.addOperand(MCOperand::CreateImm(SignExtend32<20>(imm << 1)));
2045 return S;
20292046 }
20302047
20312048 static DecodeStatus
29542971
29552972 static DecodeStatus DecodeThumbBROperand(MCInst &Inst, unsigned Val,
29562973 uint64_t Address, const void *Decoder) {
2957 Inst.addOperand(MCOperand::CreateImm(SignExtend32<12>(Val << 1)));
2974 if (!tryAddingSymbolicOperand(Address, Address + SignExtend32<12>(Val<<1) + 4,
2975 true, 2, Inst, Decoder))
2976 Inst.addOperand(MCOperand::CreateImm(SignExtend32<12>(Val << 1)));
29582977 return MCDisassembler::Success;
29592978 }
29602979
29612980 static DecodeStatus DecodeT2BROperand(MCInst &Inst, unsigned Val,
29622981 uint64_t Address, const void *Decoder) {
2963 Inst.addOperand(MCOperand::CreateImm(SignExtend32<21>(Val)));
2982 if (!tryAddingSymbolicOperand(Address, Address + SignExtend32<22>(Val<<1) + 4,
2983 true, 4, Inst, Decoder))
2984 Inst.addOperand(MCOperand::CreateImm(SignExtend32<21>(Val)));
29642985 return MCDisassembler::Success;
29652986 }
29662987
29672988 static DecodeStatus DecodeThumbCmpBROperand(MCInst &Inst, unsigned Val,
29682989 uint64_t Address, const void *Decoder) {
2969 Inst.addOperand(MCOperand::CreateImm(SignExtend32<7>(Val << 1)));
2990 if (!tryAddingSymbolicOperand(Address, Address + SignExtend32<7>(Val<<1) + 4,
2991 true, 2, Inst, Decoder))
2992 Inst.addOperand(MCOperand::CreateImm(SignExtend32<7>(Val << 1)));
29702993 return MCDisassembler::Success;
29712994 }
29722995
33883411 static DecodeStatus
33893412 DecodeThumbBCCTargetOperand(MCInst &Inst, unsigned Val,
33903413 uint64_t Address, const void *Decoder){
3391 Inst.addOperand(MCOperand::CreateImm(Val << 1));
3414 if (!tryAddingSymbolicOperand(Address, Address + SignExtend32<8>(Val<<1) + 4,
3415 true, 2, Inst, Decoder))
3416 Inst.addOperand(MCOperand::CreateImm(SignExtend32<8>(Val << 1)));
33923417 return MCDisassembler::Success;
33933418 }
33943419