Swift Calling Convention: add swifterror attribute.

A ``swifterror`` attribute can be applied to a function parameter or an
AllocaInst.

This commit does not include any target-specific change. The target-specific
optimization will come as a follow-up patch.

Differential Revision: http://reviews.llvm.org/D18092

llvm-svn: 265189
This commit is contained in:
Manman Ren
2016-04-01 21:41:15 +00:00
parent a3d15f3a5e
commit 9bfd0d03e9
26 changed files with 236 additions and 11 deletions

View File

@@ -261,6 +261,8 @@ static uint64_t getAttrKindEncoding(Attribute::AttrKind Kind) {
return bitc::ATTR_KIND_SANITIZE_THREAD;
case Attribute::SanitizeMemory:
return bitc::ATTR_KIND_SANITIZE_MEMORY;
case Attribute::SwiftError:
return bitc::ATTR_KIND_SWIFT_ERROR;
case Attribute::SwiftSelf:
return bitc::ATTR_KIND_SWIFT_SELF;
case Attribute::UWTable:
@@ -2142,8 +2144,7 @@ static void WriteInstruction(const Instruction &I, unsigned InstID,
assert(AlignRecord < 1 << 5 && "alignment greater than 1 << 64");
AlignRecord |= AI.isUsedWithInAlloca() << 5;
AlignRecord |= 1 << 6;
// Reserve bit 7 for SwiftError flag.
// AlignRecord |= AI.isSwiftError() << 7;
AlignRecord |= AI.isSwiftError() << 7;
Vals.push_back(AlignRecord);
break;
}