[IR] Add vscale_range IR function attribute

This attribute represents the minimum and maximum values vscale can
take. For now this attribute is not hooked up to anything during
codegen, this will be added in the future when such codegen is
considered stable.

Additionally hook up the -msve-vector-bits=<x> clang option to emit this
attribute.

Differential Revision: https://reviews.llvm.org/D98030
This commit is contained in:
Bradley Smith
2021-03-03 13:53:30 +00:00
parent 2bbc9bccf0
commit 48f5a392cb
20 changed files with 250 additions and 2 deletions

View File

@@ -1526,6 +1526,8 @@ static Attribute::AttrKind getAttrFromCode(uint64_t Code) {
return Attribute::SwiftSelf;
case bitc::ATTR_KIND_UW_TABLE:
return Attribute::UWTable;
case bitc::ATTR_KIND_VSCALE_RANGE:
return Attribute::VScaleRange;
case bitc::ATTR_KIND_WILLRETURN:
return Attribute::WillReturn;
case bitc::ATTR_KIND_WRITEONLY:
@@ -1638,6 +1640,8 @@ Error BitcodeReader::parseAttributeGroupBlock() {
B.addDereferenceableOrNullAttr(Record[++i]);
else if (Kind == Attribute::AllocSize)
B.addAllocSizeAttrFromRawRepr(Record[++i]);
else if (Kind == Attribute::VScaleRange)
B.addVScaleRangeAttrFromRawRepr(Record[++i]);
} else if (Record[i] == 3 || Record[i] == 4) { // String attribute
bool HasValue = (Record[i++] == 4);
SmallString<64> KindStr;