aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/Hexagon/Disassembler/HexagonDisassembler.cpp
diff options
context:
space:
mode:
authorJoe Loser <joeloser@fastmail.com>2022-09-06 18:06:58 -0600
committerJoe Loser <joeloser@fastmail.com>2022-09-08 09:01:53 -0600
commit5e96cea1db0623a833d5376c9ea2ce4528771f97 (patch)
tree7949b48788ad2e39d81d601464cdd2bb6f5c9e20 /llvm/lib/Target/Hexagon/Disassembler/HexagonDisassembler.cpp
parent7aec9ddcfd20dc241a37f862b20dddbb8a4efb2f (diff)
downloadllvm-5e96cea1db0623a833d5376c9ea2ce4528771f97.zip
llvm-5e96cea1db0623a833d5376c9ea2ce4528771f97.tar.gz
llvm-5e96cea1db0623a833d5376c9ea2ce4528771f97.tar.bz2
[llvm] Use std::size instead of llvm::array_lengthof
LLVM contains a helpful function for getting the size of a C-style array: `llvm::array_lengthof`. This is useful prior to C++17, but not as helpful for C++17 or later: `std::size` already has support for C-style arrays. Change call sites to use `std::size` instead. Differential Revision: https://reviews.llvm.org/D133429
Diffstat (limited to 'llvm/lib/Target/Hexagon/Disassembler/HexagonDisassembler.cpp')
-rw-r--r--llvm/lib/Target/Hexagon/Disassembler/HexagonDisassembler.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Target/Hexagon/Disassembler/HexagonDisassembler.cpp b/llvm/lib/Target/Hexagon/Disassembler/HexagonDisassembler.cpp
index 58d5df4..8792ce3 100644
--- a/llvm/lib/Target/Hexagon/Disassembler/HexagonDisassembler.cpp
+++ b/llvm/lib/Target/Hexagon/Disassembler/HexagonDisassembler.cpp
@@ -680,7 +680,7 @@ static DecodeStatus DecodeCtrRegsRegisterClass(MCInst &Inst, unsigned RegNo,
/* 28 */ 0, 0, UTIMERLO, UTIMERHI
};
- if (RegNo >= array_lengthof(CtrlRegDecoderTable))
+ if (RegNo >= std::size(CtrlRegDecoderTable))
return MCDisassembler::Fail;
static_assert(NoRegister == 0, "Expecting NoRegister to be 0");
@@ -708,7 +708,7 @@ DecodeCtrRegs64RegisterClass(MCInst &Inst, unsigned RegNo, uint64_t /*Address*/,
/* 28 */ 0, 0, UTIMER, 0
};
- if (RegNo >= array_lengthof(CtrlReg64DecoderTable))
+ if (RegNo >= std::size(CtrlReg64DecoderTable))
return MCDisassembler::Fail;
static_assert(NoRegister == 0, "Expecting NoRegister to be 0");
@@ -862,7 +862,7 @@ DecodeGuestRegsRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t /*Address*/,
/* 28 */ GPMUCNT2, GPMUCNT3, G30, G31
};
- if (RegNo >= array_lengthof(GuestRegDecoderTable))
+ if (RegNo >= std::size(GuestRegDecoderTable))
return MCDisassembler::Fail;
if (GuestRegDecoderTable[RegNo] == Hexagon::NoRegister)
return MCDisassembler::Fail;
@@ -889,7 +889,7 @@ DecodeGuestRegs64RegisterClass(MCInst &Inst, unsigned RegNo,
/* 28 */ G29_28, 0, G31_30, 0
};
- if (RegNo >= array_lengthof(GuestReg64DecoderTable))
+ if (RegNo >= std::size(GuestReg64DecoderTable))
return MCDisassembler::Fail;
if (GuestReg64DecoderTable[RegNo] == Hexagon::NoRegister)
return MCDisassembler::Fail;