aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2022-10-10 14:33:13 +0200
committerNikita Popov <npopov@redhat.com>2022-10-21 12:11:25 +0200
commite9754f0211076bab34e5a070cb8eb392a21c0540 (patch)
treed4c30fa37bdf7959507d30a5184e3bc63c4cfb4f /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parent9d9de5a5df05df1abbd35351ded9c74cf4fc5ba6 (diff)
downloadllvm-e9754f0211076bab34e5a070cb8eb392a21c0540.zip
llvm-e9754f0211076bab34e5a070cb8eb392a21c0540.tar.gz
llvm-e9754f0211076bab34e5a070cb8eb392a21c0540.tar.bz2
[IR] Add support for memory attribute
This implements IR and bitcode support for the memory attribute, as specified in https://reviews.llvm.org/D135597. The new attribute is not used for anything yet (and as such, the old memory attributes are unaffected). Differential Revision: https://reviews.llvm.org/D135592
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 217c7db..338674c 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -55,6 +55,7 @@
#include "llvm/IR/IntrinsicsARM.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Metadata.h"
+#include "llvm/IR/ModRef.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/ModuleSummaryIndex.h"
#include "llvm/IR/Operator.h"
@@ -1878,6 +1879,8 @@ static Attribute::AttrKind getAttrFromCode(uint64_t Code) {
return Attribute::InReg;
case bitc::ATTR_KIND_JUMP_TABLE:
return Attribute::JumpTable;
+ case bitc::ATTR_KIND_MEMORY:
+ return Attribute::Memory;
case bitc::ATTR_KIND_MIN_SIZE:
return Attribute::MinSize;
case bitc::ATTR_KIND_NAKED:
@@ -2122,6 +2125,8 @@ Error BitcodeReader::parseAttributeGroupBlock() {
B.addUWTableAttr(UWTableKind(Record[++i]));
else if (Kind == Attribute::AllocKind)
B.addAllocKindAttr(static_cast<AllocFnKind>(Record[++i]));
+ else if (Kind == Attribute::Memory)
+ B.addMemoryAttr(MemoryEffects::createFromIntValue(Record[++i]));
} else if (Record[i] == 3 || Record[i] == 4) { // String attribute
bool HasValue = (Record[i++] == 4);
SmallString<64> KindStr;