diff options
| author | Alex Bradbury <asb@lowrisc.org> | 2019-03-13 09:22:57 +0000 | 
|---|---|---|
| committer | Alex Bradbury <asb@lowrisc.org> | 2019-03-13 09:22:57 +0000 | 
| commit | 18f95e6a6f1abf486f84ced59edebdc2227a9de2 (patch) | |
| tree | 044d50e96768db899aae0eb6d02d6f4d2e4d3422 | |
| parent | 3d8e289f711ada8bbec8d39a0def5bc5a2144cf7 (diff) | |
| download | bcm5719-llvm-18f95e6a6f1abf486f84ced59edebdc2227a9de2.tar.gz bcm5719-llvm-18f95e6a6f1abf486f84ced59edebdc2227a9de2.zip  | |
[RISCV] Replace incorrect use of sizeof with array_lengthof
RISCVDisassembler was incorrectly using sizeof(Arr) when it should have used
sizeof(Arr)/sizeof(Arr[0]). Update to use array_lengthof instead.
llvm-svn: 356035
| -rw-r--r-- | llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp | 6 | 
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp b/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp index a300de6ca04..26d5bca8de2 100644 --- a/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp +++ b/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp @@ -69,7 +69,7 @@ static const unsigned GPRDecoderTable[] = {  static DecodeStatus DecodeGPRRegisterClass(MCInst &Inst, uint64_t RegNo,                                             uint64_t Address,                                             const void *Decoder) { -  if (RegNo > sizeof(GPRDecoderTable)) +  if (RegNo > array_lengthof(GPRDecoderTable))      return MCDisassembler::Fail;    // We must define our own mapping from RegNo to register identifier. @@ -94,7 +94,7 @@ static const unsigned FPR32DecoderTable[] = {  static DecodeStatus DecodeFPR32RegisterClass(MCInst &Inst, uint64_t RegNo,                                               uint64_t Address,                                               const void *Decoder) { -  if (RegNo > sizeof(FPR32DecoderTable)) +  if (RegNo > array_lengthof(FPR32DecoderTable))      return MCDisassembler::Fail;    // We must define our own mapping from RegNo to register identifier. @@ -130,7 +130,7 @@ static const unsigned FPR64DecoderTable[] = {  static DecodeStatus DecodeFPR64RegisterClass(MCInst &Inst, uint64_t RegNo,                                               uint64_t Address,                                               const void *Decoder) { -  if (RegNo > sizeof(FPR64DecoderTable)) +  if (RegNo > array_lengthof(FPR64DecoderTable))      return MCDisassembler::Fail;    // We must define our own mapping from RegNo to register identifier.  | 

