[PATCH] D107547: [CodeGen] Align calling convention bit-width to bitcode
Xinglong created this revision. Xinglong added reviewers: rudkx, rjmccall, rsmith. Xinglong added a project: clang. Xinglong requested review of this revision. Herald added a subscriber: cfe-commits. According to https://reveiws.llvm.org/D13826, bitcode use 10 bits to represent calling convention ID, but for clang codegen, we only have 8 bits. so if we use a calling convention ID greater than 255, clang will truncate it, and bitcode will get an error calling convention ID. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D107547 Files: clang/include/clang/CodeGen/CGFunctionInfo.h Index: clang/include/clang/CodeGen/CGFunctionInfo.h === --- clang/include/clang/CodeGen/CGFunctionInfo.h +++ clang/include/clang/CodeGen/CGFunctionInfo.h @@ -552,14 +552,14 @@ /// The LLVM::CallingConv to use for this function (as specified by the /// user). - unsigned CallingConvention : 8; + unsigned CallingConvention : 10; /// The LLVM::CallingConv to actually use for this function, which may /// depend on the ABI. - unsigned EffectiveCallingConvention : 8; + unsigned EffectiveCallingConvention : 10; /// The clang::CallingConv that this was originally created with. - unsigned ASTCallingConvention : 6; + unsigned ASTCallingConvention : 10; /// Whether this is an instance method. unsigned InstanceMethod : 1; Index: clang/include/clang/CodeGen/CGFunctionInfo.h === --- clang/include/clang/CodeGen/CGFunctionInfo.h +++ clang/include/clang/CodeGen/CGFunctionInfo.h @@ -552,14 +552,14 @@ /// The LLVM::CallingConv to use for this function (as specified by the /// user). - unsigned CallingConvention : 8; + unsigned CallingConvention : 10; /// The LLVM::CallingConv to actually use for this function, which may /// depend on the ABI. - unsigned EffectiveCallingConvention : 8; + unsigned EffectiveCallingConvention : 10; /// The clang::CallingConv that this was originally created with. - unsigned ASTCallingConvention : 6; + unsigned ASTCallingConvention : 10; /// Whether this is an instance method. unsigned InstanceMethod : 1; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D107547: [CodeGen] Align calling convention bit-width to bitcode
Xinglong added a comment. ping Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D107547/new/ https://reviews.llvm.org/D107547 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D107547: [CodeGen] More bits for calling convention
Xinglong updated this revision to Diff 370177. Xinglong retitled this revision from "[CodeGen] Align calling convention bit-width to bitcode" to "[CodeGen] More bits for calling convention". Xinglong edited the summary of this revision. Xinglong added a comment. Some patch broken the single 32-bit unit, so here use 16 bits is better. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D107547/new/ https://reviews.llvm.org/D107547 Files: clang/include/clang/CodeGen/CGFunctionInfo.h Index: clang/include/clang/CodeGen/CGFunctionInfo.h === --- clang/include/clang/CodeGen/CGFunctionInfo.h +++ clang/include/clang/CodeGen/CGFunctionInfo.h @@ -552,14 +552,14 @@ /// The LLVM::CallingConv to use for this function (as specified by the /// user). - unsigned CallingConvention : 8; + unsigned CallingConvention : 16; /// The LLVM::CallingConv to actually use for this function, which may /// depend on the ABI. - unsigned EffectiveCallingConvention : 8; + unsigned EffectiveCallingConvention : 16; /// The clang::CallingConv that this was originally created with. - unsigned ASTCallingConvention : 6; + unsigned ASTCallingConvention : 16; /// Whether this is an instance method. unsigned InstanceMethod : 1; Index: clang/include/clang/CodeGen/CGFunctionInfo.h === --- clang/include/clang/CodeGen/CGFunctionInfo.h +++ clang/include/clang/CodeGen/CGFunctionInfo.h @@ -552,14 +552,14 @@ /// The LLVM::CallingConv to use for this function (as specified by the /// user). - unsigned CallingConvention : 8; + unsigned CallingConvention : 16; /// The LLVM::CallingConv to actually use for this function, which may /// depend on the ABI. - unsigned EffectiveCallingConvention : 8; + unsigned EffectiveCallingConvention : 16; /// The clang::CallingConv that this was originally created with. - unsigned ASTCallingConvention : 6; + unsigned ASTCallingConvention : 16; /// Whether this is an instance method. unsigned InstanceMethod : 1; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D107547: [CodeGen] More bits for calling convention
Xinglong marked an inline comment as done. Xinglong added inline comments. Comment at: clang/include/clang/CodeGen/CGFunctionInfo.h:562 /// The clang::CallingConv that this was originally created with. - unsigned ASTCallingConvention : 6; + unsigned ASTCallingConvention : 10; rjmccall wrote: > At some point, these bit-fields fit into a single 32-bit unit. There's > currently 33 bits, so that hasn't been true for a while, and we might as well > make all three of these fields 16 bits. > > It doesn't look like there's a good opportunity to pack the struct because > we're at an odd number of 32-bit chunks overall, so that'll do for now. Yes, 32-bit unit is broken, here use 16 bits is better and llvm backend need a patch to align to 16 bits. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D107547/new/ https://reviews.llvm.org/D107547 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D107547: [CodeGen] More bits for calling convention
Xinglong updated this revision to Diff 370185. Xinglong marked an inline comment as done. Xinglong added a comment. rebase CHANGES SINCE LAST ACTION https://reviews.llvm.org/D107547/new/ https://reviews.llvm.org/D107547 Files: clang/include/clang/CodeGen/CGFunctionInfo.h Index: clang/include/clang/CodeGen/CGFunctionInfo.h === --- clang/include/clang/CodeGen/CGFunctionInfo.h +++ clang/include/clang/CodeGen/CGFunctionInfo.h @@ -552,14 +552,14 @@ /// The LLVM::CallingConv to use for this function (as specified by the /// user). - unsigned CallingConvention : 8; + unsigned CallingConvention : 16; /// The LLVM::CallingConv to actually use for this function, which may /// depend on the ABI. - unsigned EffectiveCallingConvention : 8; + unsigned EffectiveCallingConvention : 16; /// The clang::CallingConv that this was originally created with. - unsigned ASTCallingConvention : 6; + unsigned ASTCallingConvention : 16; /// Whether this is an instance method. unsigned InstanceMethod : 1; Index: clang/include/clang/CodeGen/CGFunctionInfo.h === --- clang/include/clang/CodeGen/CGFunctionInfo.h +++ clang/include/clang/CodeGen/CGFunctionInfo.h @@ -552,14 +552,14 @@ /// The LLVM::CallingConv to use for this function (as specified by the /// user). - unsigned CallingConvention : 8; + unsigned CallingConvention : 16; /// The LLVM::CallingConv to actually use for this function, which may /// depend on the ABI. - unsigned EffectiveCallingConvention : 8; + unsigned EffectiveCallingConvention : 16; /// The clang::CallingConv that this was originally created with. - unsigned ASTCallingConvention : 6; + unsigned ASTCallingConvention : 16; /// Whether this is an instance method. unsigned InstanceMethod : 1; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits