Index: include/llvm/IR/Function.h =================================================================== --- include/llvm/IR/Function.h +++ include/llvm/IR/Function.h @@ -61,10 +61,11 @@ /* * Value::SubclassData * - * bit 0 : HasLazyArguments - * bit 1 : HasPrefixData - * bit 2 : HasPrologueData - * bit 3-6: CallingConvention + * bit 0 : HasLazyArguments + * bit 1 : HasPrefixData + * bit 2 : HasPrologueData + * bits 3-12 : CallingConvention + * bits 13-15 : [reserved] */ /// Bits from GlobalObject::GlobalObjectSubclassData. @@ -158,11 +159,12 @@ /// calling convention of this function. The enum values for the known /// calling conventions are defined in CallingConv.h. CallingConv::ID getCallingConv() const { - return static_cast(getSubclassDataFromValue() >> 3); + return static_cast((getSubclassDataFromValue() >> 3) & + 0x3ff); } void setCallingConv(CallingConv::ID CC) { - setValueSubclassData((getSubclassDataFromValue() & 7) | - (static_cast(CC) << 3)); + setValueSubclassData((getSubclassDataFromValue() & 0x7) | + ((static_cast(CC) & 0x3ff) << 3)); } /// @brief Return the attribute list for this Function. Index: test/Bitcode/compatibility-3.6.ll =================================================================== --- test/Bitcode/compatibility-3.6.ll +++ test/Bitcode/compatibility-3.6.ll @@ -174,51 +174,51 @@ ; [unnamed_addr] alias @ ; Aliases -- Linkage -@a.private = private alias i32, i32* @g.private +@a.private = private alias i32* @g.private ; CHECK: @a.private = private alias i32, i32* @g.private -@a.internal = internal alias i32, i32* @g.internal +@a.internal = internal alias i32* @g.internal ; CHECK: @a.internal = internal alias i32, i32* @g.internal -@a.linkonce = linkonce alias i32, i32* @g.linkonce +@a.linkonce = linkonce alias i32* @g.linkonce ; CHECK: @a.linkonce = linkonce alias i32, i32* @g.linkonce -@a.weak = weak alias i32, i32* @g.weak +@a.weak = weak alias i32* @g.weak ; CHECK: @a.weak = weak alias i32, i32* @g.weak -@a.linkonce_odr = linkonce_odr alias i32, i32* @g.linkonce_odr +@a.linkonce_odr = linkonce_odr alias i32* @g.linkonce_odr ; CHECK: @a.linkonce_odr = linkonce_odr alias i32, i32* @g.linkonce_odr -@a.weak_odr = weak_odr alias i32, i32* @g.weak_odr +@a.weak_odr = weak_odr alias i32* @g.weak_odr ; CHECK: @a.weak_odr = weak_odr alias i32, i32* @g.weak_odr -@a.external = external alias i32, i32* @g1 +@a.external = external alias i32* @g1 ; CHECK: @a.external = alias i32, i32* @g1 ; Aliases -- Visibility -@a.default = default alias i32, i32* @g.default +@a.default = default alias i32* @g.default ; CHECK: @a.default = alias i32, i32* @g.default -@a.hidden = hidden alias i32, i32* @g.hidden +@a.hidden = hidden alias i32* @g.hidden ; CHECK: @a.hidden = hidden alias i32, i32* @g.hidden -@a.protected = protected alias i32, i32* @g.protected +@a.protected = protected alias i32* @g.protected ; CHECK: @a.protected = protected alias i32, i32* @g.protected ; Aliases -- DLLStorageClass -@a.dlldefault = default alias i32, i32* @g.dlldefault +@a.dlldefault = default alias i32* @g.dlldefault ; CHECK: @a.dlldefault = alias i32, i32* @g.dlldefault -@a.dllimport = dllimport alias i32, i32* @g1 +@a.dllimport = dllimport alias i32* @g1 ; CHECK: @a.dllimport = dllimport alias i32, i32* @g1 -@a.dllexport = dllexport alias i32, i32* @g.dllexport +@a.dllexport = dllexport alias i32* @g.dllexport ; CHECK: @a.dllexport = dllexport alias i32, i32* @g.dllexport ; Aliases -- ThreadLocal -@a.notthreadlocal = alias i32, i32* @g.notthreadlocal +@a.notthreadlocal = alias i32* @g.notthreadlocal ; CHECK: @a.notthreadlocal = alias i32, i32* @g.notthreadlocal -@a.generaldynamic = thread_local alias i32, i32* @g.generaldynamic +@a.generaldynamic = thread_local alias i32* @g.generaldynamic ; CHECK: @a.generaldynamic = thread_local alias i32, i32* @g.generaldynamic -@a.localdynamic = thread_local(localdynamic) alias i32, i32* @g.localdynamic +@a.localdynamic = thread_local(localdynamic) alias i32* @g.localdynamic ; CHECK: @a.localdynamic = thread_local(localdynamic) alias i32, i32* @g.localdynamic -@a.initialexec = thread_local(initialexec) alias i32, i32* @g.initialexec +@a.initialexec = thread_local(initialexec) alias i32* @g.initialexec ; CHECK: @a.initialexec = thread_local(initialexec) alias i32, i32* @g.initialexec -@a.localexec = thread_local(localexec) alias i32, i32* @g.localexec +@a.localexec = thread_local(localexec) alias i32* @g.localexec ; CHECK: @a.localexec = thread_local(localexec) alias i32, i32* @g.localexec ; Aliases -- unnamed_addr -@a.unnamed_addr = unnamed_addr alias i32, i32* @g.unnamed_addr +@a.unnamed_addr = unnamed_addr alias i32* @g.unnamed_addr ; CHECK: @a.unnamed_addr = unnamed_addr alias i32, i32* @g.unnamed_addr ;; Functions @@ -375,8 +375,8 @@ ; CHECK: declare x86_vectorcallcc void @f.cc80() declare x86_vectorcallcc void @f.x86_vectorcallcc() ; CHECK: declare x86_vectorcallcc void @f.x86_vectorcallcc() -declare cc8191 void @f.cc8191() -; CHECK: declare cc8191 void @f.cc8191() +declare cc1023 void @f.cc1023() +; CHECK: declare cc1023 void @f.cc1023() ; Functions -- ret attrs (Return attributes) declare zeroext i64 @f.zeroext() Index: test/Bitcode/compatibility-3.7.ll =================================================================== --- test/Bitcode/compatibility-3.7.ll +++ test/Bitcode/compatibility-3.7.ll @@ -174,51 +174,51 @@ ; [unnamed_addr] alias @ ; Aliases -- Linkage -@a.private = private alias i32, i32* @g.private +@a.private = private alias i32* @g.private ; CHECK: @a.private = private alias i32, i32* @g.private -@a.internal = internal alias i32, i32* @g.internal +@a.internal = internal alias i32* @g.internal ; CHECK: @a.internal = internal alias i32, i32* @g.internal -@a.linkonce = linkonce alias i32, i32* @g.linkonce +@a.linkonce = linkonce alias i32* @g.linkonce ; CHECK: @a.linkonce = linkonce alias i32, i32* @g.linkonce -@a.weak = weak alias i32, i32* @g.weak +@a.weak = weak alias i32* @g.weak ; CHECK: @a.weak = weak alias i32, i32* @g.weak -@a.linkonce_odr = linkonce_odr alias i32, i32* @g.linkonce_odr +@a.linkonce_odr = linkonce_odr alias i32* @g.linkonce_odr ; CHECK: @a.linkonce_odr = linkonce_odr alias i32, i32* @g.linkonce_odr -@a.weak_odr = weak_odr alias i32, i32* @g.weak_odr +@a.weak_odr = weak_odr alias i32* @g.weak_odr ; CHECK: @a.weak_odr = weak_odr alias i32, i32* @g.weak_odr -@a.external = external alias i32, i32* @g1 +@a.external = external alias i32* @g1 ; CHECK: @a.external = alias i32, i32* @g1 ; Aliases -- Visibility -@a.default = default alias i32, i32* @g.default +@a.default = default alias i32* @g.default ; CHECK: @a.default = alias i32, i32* @g.default -@a.hidden = hidden alias i32, i32* @g.hidden +@a.hidden = hidden alias i32* @g.hidden ; CHECK: @a.hidden = hidden alias i32, i32* @g.hidden -@a.protected = protected alias i32, i32* @g.protected +@a.protected = protected alias i32* @g.protected ; CHECK: @a.protected = protected alias i32, i32* @g.protected ; Aliases -- DLLStorageClass -@a.dlldefault = default alias i32, i32* @g.dlldefault +@a.dlldefault = default alias i32* @g.dlldefault ; CHECK: @a.dlldefault = alias i32, i32* @g.dlldefault -@a.dllimport = dllimport alias i32, i32* @g1 +@a.dllimport = dllimport alias i32* @g1 ; CHECK: @a.dllimport = dllimport alias i32, i32* @g1 -@a.dllexport = dllexport alias i32, i32* @g.dllexport +@a.dllexport = dllexport alias i32* @g.dllexport ; CHECK: @a.dllexport = dllexport alias i32, i32* @g.dllexport ; Aliases -- ThreadLocal -@a.notthreadlocal = alias i32, i32* @g.notthreadlocal +@a.notthreadlocal = alias i32* @g.notthreadlocal ; CHECK: @a.notthreadlocal = alias i32, i32* @g.notthreadlocal -@a.generaldynamic = thread_local alias i32, i32* @g.generaldynamic +@a.generaldynamic = thread_local alias i32* @g.generaldynamic ; CHECK: @a.generaldynamic = thread_local alias i32, i32* @g.generaldynamic -@a.localdynamic = thread_local(localdynamic) alias i32, i32* @g.localdynamic +@a.localdynamic = thread_local(localdynamic) alias i32* @g.localdynamic ; CHECK: @a.localdynamic = thread_local(localdynamic) alias i32, i32* @g.localdynamic -@a.initialexec = thread_local(initialexec) alias i32, i32* @g.initialexec +@a.initialexec = thread_local(initialexec) alias i32* @g.initialexec ; CHECK: @a.initialexec = thread_local(initialexec) alias i32, i32* @g.initialexec -@a.localexec = thread_local(localexec) alias i32, i32* @g.localexec +@a.localexec = thread_local(localexec) alias i32* @g.localexec ; CHECK: @a.localexec = thread_local(localexec) alias i32, i32* @g.localexec ; Aliases -- unnamed_addr -@a.unnamed_addr = unnamed_addr alias i32, i32* @g.unnamed_addr +@a.unnamed_addr = unnamed_addr alias i32* @g.unnamed_addr ; CHECK: @a.unnamed_addr = unnamed_addr alias i32, i32* @g.unnamed_addr ;; Functions @@ -375,8 +375,8 @@ ; CHECK: declare x86_vectorcallcc void @f.cc80() declare x86_vectorcallcc void @f.x86_vectorcallcc() ; CHECK: declare x86_vectorcallcc void @f.x86_vectorcallcc() -declare cc8191 void @f.cc8191() -; CHECK: declare cc8191 void @f.cc8191() +declare cc1023 void @f.cc1023() +; CHECK: declare cc1023 void @f.cc1023() ; Functions -- ret attrs (Return attributes) declare zeroext i64 @f.zeroext() Index: test/Bitcode/compatibility.ll =================================================================== --- test/Bitcode/compatibility.ll +++ test/Bitcode/compatibility.ll @@ -377,8 +377,8 @@ ; CHECK: declare x86_vectorcallcc void @f.cc80() declare x86_vectorcallcc void @f.x86_vectorcallcc() ; CHECK: declare x86_vectorcallcc void @f.x86_vectorcallcc() -declare cc8191 void @f.cc8191() -; CHECK: declare cc8191 void @f.cc8191() +declare cc1023 void @f.cc1023() +; CHECK: declare cc1023 void @f.cc1023() ; Functions -- ret attrs (Return attributes) declare zeroext i64 @f.zeroext() Index: test/Bitcode/tailcall.ll =================================================================== --- test/Bitcode/tailcall.ll +++ test/Bitcode/tailcall.ll @@ -3,16 +3,16 @@ ; Check that musttail and tail roundtrip. -declare cc8191 void @t1_callee() -define cc8191 void @t1() { -; CHECK: tail call cc8191 void @t1_callee() - tail call cc8191 void @t1_callee() +declare cc1023 void @t1_callee() +define cc1023 void @t1() { +; CHECK: tail call cc1023 void @t1_callee() + tail call cc1023 void @t1_callee() ret void } -declare cc8191 void @t2_callee() -define cc8191 void @t2() { -; CHECK: musttail call cc8191 void @t2_callee() - musttail call cc8191 void @t2_callee() +declare cc1023 void @t2_callee() +define cc1023 void @t2() { +; CHECK: musttail call cc1023 void @t2_callee() + musttail call cc1023 void @t2_callee() ret void }