diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2021-07-07 22:29:43 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2021-07-15 18:04:26 +0200 |
commit | c191035f421b5dc69873cba8885fee41e984cc5d (patch) | |
tree | a005ea28a289f84bc40a272c5001a8cfae98e4d5 /llvm/lib/IR/Attributes.cpp | |
parent | 1fd23a065bf729836dd52ef1ad3c84c449735a56 (diff) | |
download | llvm-c191035f421b5dc69873cba8885fee41e984cc5d.zip llvm-c191035f421b5dc69873cba8885fee41e984cc5d.tar.gz llvm-c191035f421b5dc69873cba8885fee41e984cc5d.tar.bz2 |
[IR] Add elementtype attribute
This implements the elementtype attribute specified in D105407. It
just adds the attribute and the specified verifier rules, but
doesn't yet make use of it anywhere.
Differential Revision: https://reviews.llvm.org/D106008
Diffstat (limited to 'llvm/lib/IR/Attributes.cpp')
-rw-r--r-- | llvm/lib/IR/Attributes.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp index 368fc87..4ef61c7 100644 --- a/llvm/lib/IR/Attributes.cpp +++ b/llvm/lib/IR/Attributes.cpp @@ -708,6 +708,10 @@ Type *AttributeSet::getInAllocaType() const { return SetNode ? SetNode->getAttributeType(Attribute::InAlloca) : nullptr; } +Type *AttributeSet::getElementType() const { + return SetNode ? SetNode->getAttributeType(Attribute::ElementType) : nullptr; +} + std::pair<unsigned, Optional<unsigned>> AttributeSet::getAllocSizeArgs() const { return SetNode ? SetNode->getAllocSizeArgs() : std::pair<unsigned, Optional<unsigned>>(0, 0); @@ -1909,7 +1913,8 @@ AttrBuilder AttributeFuncs::typeIncompatible(Type *Ty) { .addInAllocaAttr(Ty) .addByValAttr(Ty) .addStructRetAttr(Ty) - .addByRefAttr(Ty); + .addByRefAttr(Ty) + .addTypeAttr(Attribute::ElementType, Ty); // Some attributes can apply to all "values" but there are no `void` values. if (Ty->isVoidTy()) |