diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2018-07-30 16:33:32 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2018-07-30 16:33:32 +0000 | 
| commit | 51315c45ff5643a27f9c84b816db54ee870ba29b (patch) | |
| tree | 1d87443fa0e53d3e6b315ce25787e64be0906bf7 /contrib/llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp | |
| parent | 6dfd050075216be8538ae375a22d30db72916f7e (diff) | |
| parent | eb11fae6d08f479c0799db45860a98af528fa6e7 (diff) | |
Notes
Diffstat (limited to 'contrib/llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp')
| -rw-r--r-- | contrib/llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp | 30 | 
1 files changed, 18 insertions, 12 deletions
diff --git a/contrib/llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp b/contrib/llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp index 53c635877675..4733cf49827e 100644 --- a/contrib/llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp +++ b/contrib/llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp @@ -158,6 +158,8 @@ static DecodeStatus DecoderGPRRegisterClass(MCInst &Inst, unsigned RegNo,                                     uint64_t Address, const void *Decoder);  static DecodeStatus DecodeGPRPairRegisterClass(MCInst &Inst, unsigned RegNo,                                     uint64_t Address, const void *Decoder); +static DecodeStatus DecodeHPRRegisterClass(MCInst &Inst, unsigned RegNo, +                                   uint64_t Address, const void *Decoder);  static DecodeStatus DecodeSPRRegisterClass(MCInst &Inst, unsigned RegNo,                                     uint64_t Address, const void *Decoder);  static DecodeStatus DecodeDPRRegisterClass(MCInst &Inst, unsigned RegNo, @@ -657,6 +659,8 @@ ThumbDisassembler::AddThumbPredicate(MCInst &MI) const {  void ThumbDisassembler::UpdateThumbVFPPredicate(MCInst &MI) const {    unsigned CC;    CC = ITBlock.getITCC(); +  if (CC == 0xF) +    CC = ARMCC::AL;    if (ITBlock.instrInITBlock())      ITBlock.advanceITState(); @@ -727,10 +731,13 @@ DecodeStatus ThumbDisassembler::getInstruction(MCInst &MI, uint64_t &Size,      // code and mask operands so that we can apply them correctly      // to the subsequent instructions.      if (MI.getOpcode() == ARM::t2IT) { -        unsigned Firstcond = MI.getOperand(0).getImm();        unsigned Mask = MI.getOperand(1).getImm();        ITBlock.setITState(Firstcond, Mask); + +      // An IT instruction that would give a 'NV' predicate is unpredictable. +      if (Firstcond == ARMCC::AL && !isPowerOf2_32(Mask)) +        CS << "unpredictable IT predicate sequence";      }      return Result; @@ -996,6 +1003,11 @@ static DecodeStatus DecodeSPRRegisterClass(MCInst &Inst, unsigned RegNo,    return MCDisassembler::Success;  } +static DecodeStatus DecodeHPRRegisterClass(MCInst &Inst, unsigned RegNo, +                                   uint64_t Address, const void *Decoder) { +  return DecodeSPRRegisterClass(Inst, RegNo, Address, Decoder); +} +  static const uint16_t DPRDecoderTable[] = {       ARM::D0,  ARM::D1,  ARM::D2,  ARM::D3,       ARM::D4,  ARM::D5,  ARM::D6,  ARM::D7, @@ -4142,7 +4154,6 @@ static DecodeStatus DecodeMSRMask(MCInst &Inst, unsigned Val,      case 0x8a: // msplim_ns      case 0x8b: // psplim_ns      case 0x91: // basepri_ns -    case 0x92: // basepri_max_ns      case 0x93: // faultmask_ns        if (!(FeatureBits[ARM::HasV8MMainlineOps]))          return MCDisassembler::Fail; @@ -4158,7 +4169,9 @@ static DecodeStatus DecodeMSRMask(MCInst &Inst, unsigned Val,          return MCDisassembler::Fail;        break;      default: -      return MCDisassembler::Fail; +      // Architecturally defined as unpredictable +      S = MCDisassembler::SoftFail; +      break;      }      if (Inst.getOpcode() == ARM::t2MSR_M) { @@ -4198,15 +4211,8 @@ static DecodeStatus DecodeBankedReg(MCInst &Inst, unsigned Val,    // The table of encodings for these banked registers comes from B9.2.3 of the    // ARM ARM. There are patterns, but nothing regular enough to make this logic    // neater. So by fiat, these values are UNPREDICTABLE: -  if (!R) { -    if (SysM == 0x7 || SysM == 0xf || SysM == 0x18 || SysM == 0x19 || -        SysM == 0x1a || SysM == 0x1b) -      return MCDisassembler::SoftFail; -  } else { -    if (SysM != 0xe && SysM != 0x10 && SysM != 0x12 && SysM != 0x14 && -        SysM != 0x16 && SysM != 0x1c && SysM != 0x1e) -      return MCDisassembler::SoftFail; -  } +  if (!ARMBankedReg::lookupBankedRegByEncoding((R << 5) | SysM)) +    return MCDisassembler::Fail;    Inst.addOperand(MCOperand::createImm(Val));    return MCDisassembler::Success;  | 
