Reserve some constant values for the Swift calling convention.
authorBob Wilson <bob.wilson@apple.com>
Tue, 28 Jul 2015 04:05:45 +0000 (04:05 +0000)
committerBob Wilson <bob.wilson@apple.com>
Tue, 28 Jul 2015 04:05:45 +0000 (04:05 +0000)
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

include/llvm/Bitcode/LLVMBitCodes.h
include/llvm/IR/CallingConv.h
lib/Bitcode/Reader/BitcodeReader.cpp
lib/Bitcode/Writer/BitcodeWriter.cpp

index 7130ee75523762fd7c7648fbd886c055e43b3fc4..53b6bd6f9bdf9cf6a7dd143c7be65aa8e85be5f5 100644 (file)
@@ -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 {
index 9872e6ec794d8ddd01f20323c3cd2bc2e39133aa..f7a45afc9ca6fac00de1d4095dd2e302efc07b42 100644 (file)
@@ -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,
index c04e8b9f1f37d2bec795a1199d7d69d1939aeef6..de91150c42460783954b4f10dc3408f2aa897d8b 100644 (file)
@@ -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]);
index 1a70ba5ac1275de6b59c798b0d0337b3f4e2c239..31ae0141ef832def60f782ff432ceb577deb71b0 100644 (file)
@@ -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;
   }