Skip to content

Commit

Permalink
Reserve some constant values for the Swift calling convention.
Browse files Browse the repository at this point in the history
Swift has a custom calling convention that also requires some new flags
on arguments and one new attribute on alloca instructions. This patch
does not include the implementation of that calling convention - that
will be provided as part of the open-source release of Swift; this only
reserves the bitcode constant values so that they are not used for
other purposes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243379 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
bob-wilson committed Jul 28, 2015
1 parent d9408bc commit b25dcfd
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion include/llvm/Bitcode/LLVMBitCodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,9 @@ namespace bitc {
ATTR_KIND_DEREFERENCEABLE_OR_NULL = 42,
ATTR_KIND_CONVERGENT = 43,
ATTR_KIND_SAFESTACK = 44,
ATTR_KIND_ARGMEMONLY = 45
ATTR_KIND_ARGMEMONLY = 45,
ATTR_KIND_SWIFT_SELF = 46,
ATTR_KIND_SWIFT_ERROR = 47
};

enum ComdatSelectionKindCodes {
Expand Down
3 changes: 3 additions & 0 deletions include/llvm/IR/CallingConv.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ namespace CallingConv {
// (almost) all registers.
PreserveAll = 15,

// Swift - Calling convention for Swift.
Swift = 16,

// Target - This is the start of the target-specific calling conventions,
// e.g. fastcall and thiscall on X86.
FirstTargetCC = 64,
Expand Down
2 changes: 2 additions & 0 deletions lib/Bitcode/Reader/BitcodeReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4081,6 +4081,8 @@ std::error_code BitcodeReader::parseFunctionBody(Function *F) {
uint64_t AlignRecord = Record[3];
const uint64_t InAllocaMask = uint64_t(1) << 5;
const uint64_t ExplicitTypeMask = uint64_t(1) << 6;
// Reserve bit 7 for SwiftError flag.
// const uint64_t SwiftErrorMask = uint64_t(1) << 7;
const uint64_t FlagMask = InAllocaMask | ExplicitTypeMask;
bool InAlloca = AlignRecord & InAllocaMask;
Type *Ty = getTypeByID(Record[0]);
Expand Down
2 changes: 2 additions & 0 deletions lib/Bitcode/Writer/BitcodeWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1902,6 +1902,8 @@ 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;
Vals.push_back(AlignRecord);
break;
}
Expand Down

0 comments on commit b25dcfd

Please sign in to comment.