[PATCH] D83202: [Bitfields][NFC] Make sure bitfields are contiguous
Clement Courbet via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 6 23:26:29 PDT 2020
courbet added inline comments.
================
Comment at: llvm/include/llvm/IR/Instruction.h:69
+ template <unsigned Offset>
+ using BoolBitfieldElement = typename Bitfield::Element<bool, Offset, 1>;
+
----------------
The curretn naming does not make it immediately obvious what is a generic type (e.g. `AlignmentBitfieldElement`, `BoolBitfieldElement`) from an instantiation of this type with specific semantics (e.g. `AlignmentField`, `SwiftErrorField`). I think just appending a `T` or `Type` would make things more obvious: `AlignmentBitfieldElementT`, `BoolBitfieldElementT`.
================
Comment at: llvm/include/llvm/IR/Instructions.h:68
using AlignmentField = AlignmentBitfieldElement<0>; // Next bit:5
- using UsedWithInAllocaField = Bitfield::Element<bool, 5, 1>; // Next bit:6
- using SwiftErrorField = Bitfield::Element<bool, 6, 1>; // Next bit:7
+ using UsedWithInAllocaField = BoolBitfieldElement<5>; // Next bit:6
+ using SwiftErrorField = BoolBitfieldElement<6>; // Next bit:7
----------------
What would you think of:
```
using AlignmentField = AlignmentBitfieldElement<0>; // Next bit:5
using UsedWithInAllocaField = BoolBitfieldElement<AlignmentField::next>; // Next bit:6
using SwiftErrorField = BoolBitfieldElement<UsedWithInAllocaField::next>; // Next bit:7
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D83202/new/
https://reviews.llvm.org/D83202
More information about the llvm-commits
mailing list