[llvm] Add the 'initializes' attribute langref and support (PR #84803)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed May 29 07:43:24 PDT 2024
================
@@ -222,6 +241,37 @@ class ConstantRangeAttributeImpl : public EnumAttributeImpl {
const ConstantRange &getConstantRangeValue() const { return CR; }
};
+class ConstantRangeListAttributeImpl final
+ : public EnumAttributeImpl,
+ private TrailingObjects<ConstantRangeListAttributeImpl, ConstantRange> {
+ friend TrailingObjects;
+
+ unsigned Size;
+ size_t numTrailingObjects(OverloadToken<ConstantRange>) const { return Size; }
+
+public:
+ ConstantRangeListAttributeImpl(Attribute::AttrKind Kind,
+ ArrayRef<ConstantRange> Val)
+ : EnumAttributeImpl(ConstantRangeListAttrEntry, Kind), Size(Val.size()) {
+ ConstantRange *TrailingCR = getTrailingObjects<ConstantRange>();
+ assert(Size > 0);
+ unsigned BitWidth = Val.front().getLower().getBitWidth();
----------------
nikic wrote:
```suggestion
unsigned BitWidth = Val.front().getBitWidth();
```
https://github.com/llvm/llvm-project/pull/84803
More information about the llvm-commits
mailing list