[PATCH] D42351: Emit DWARF "constructor" calling convention for every supported Clang CC

2018-03-22 Thread Jonas Devlieghere via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL328196: [CodeGen] Emit DWARF "constructor" calling 
convention (authored by JDevlieghere, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D42351?vs=133745&id=139436#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D42351

Files:
  cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
  cfe/trunk/test/CodeGen/debug-info-cc.c

Index: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
===
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
@@ -1000,20 +1000,28 @@
 return llvm::dwarf::DW_CC_LLVM_vectorcall;
   case CC_X86Pascal:
 return llvm::dwarf::DW_CC_BORLAND_pascal;
-
-  // FIXME: Create new DW_CC_ codes for these calling conventions.
   case CC_Win64:
+return llvm::dwarf::DW_CC_LLVM_Win64;
   case CC_X86_64SysV:
+return llvm::dwarf::DW_CC_LLVM_X86_64SysV;
   case CC_AAPCS:
+return llvm::dwarf::DW_CC_LLVM_AAPCS;
   case CC_AAPCS_VFP:
+return llvm::dwarf::DW_CC_LLVM_AAPCS_VFP;
   case CC_IntelOclBicc:
+return llvm::dwarf::DW_CC_LLVM_IntelOclBicc;
   case CC_SpirFunction:
+return llvm::dwarf::DW_CC_LLVM_SpirFunction;
   case CC_OpenCLKernel:
+return llvm::dwarf::DW_CC_LLVM_OpenCLKernel;
   case CC_Swift:
+return llvm::dwarf::DW_CC_LLVM_Swift;
   case CC_PreserveMost:
+return llvm::dwarf::DW_CC_LLVM_PreserveMost;
   case CC_PreserveAll:
+return llvm::dwarf::DW_CC_LLVM_PreserveAll;
   case CC_X86RegCall:
-return 0;
+return llvm::dwarf::DW_CC_LLVM_X86RegCall;
   }
   return 0;
 }
Index: cfe/trunk/test/CodeGen/debug-info-cc.c
===
--- cfe/trunk/test/CodeGen/debug-info-cc.c
+++ cfe/trunk/test/CodeGen/debug-info-cc.c
@@ -0,0 +1,120 @@
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s --check-prefix=LINUX
+// RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s --check-prefix=WINDOWS
+// RUN: %clang_cc1 -triple i386-pc-linux-gnu -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s --check-prefix=LINUX32
+// RUN: %clang_cc1 -triple armv7--linux-gnueabihf -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s --check-prefix=ARM
+
+//  enum CallingConv {
+//CC_C,   // __attribute__((cdecl))
+//CC_X86StdCall,  // __attribute__((stdcall))
+//CC_X86FastCall, // __attribute__((fastcall))
+//CC_X86ThisCall, // __attribute__((thiscall))
+//CC_X86VectorCall, // __attribute__((vectorcall))
+//CC_X86Pascal,   // __attribute__((pascal))
+//CC_Win64,   // __attribute__((ms_abi))
+//CC_X86_64SysV,  // __attribute__((sysv_abi))
+//CC_X86RegCall, // __attribute__((regcall))
+//CC_AAPCS,   // __attribute__((pcs("aapcs")))
+//CC_AAPCS_VFP,   // __attribute__((pcs("aapcs-vfp")))
+//CC_IntelOclBicc, // __attribute__((intel_ocl_bicc))
+//CC_SpirFunction, // default for OpenCL functions on SPIR target
+//CC_OpenCLKernel, // inferred for OpenCL kernels
+//CC_Swift,// __attribute__((swiftcall))
+//CC_PreserveMost, // __attribute__((preserve_most))
+//CC_PreserveAll,  // __attribute__((preserve_all))
+//  };
+
+#ifdef __x86_64__
+
+#ifdef __linux__
+// LINUX: !DISubprogram({{.*}}"add_msabi", {{.*}}type: ![[FTY:[0-9]+]]
+// LINUX: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_Win64,
+__attribute__((ms_abi)) int add_msabi(int a, int b) {
+  return a+b;
+}
+
+// LINUX: !DISubprogram({{.*}}"add_regcall", {{.*}}type: ![[FTY:[0-9]+]]
+// LINUX: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_X86RegCall,
+__attribute__((regcall)) int add_regcall(int a, int b) {
+  return a+b;
+}
+
+// LINUX: !DISubprogram({{.*}}"add_preserve_most", {{.*}}type: ![[FTY:[0-9]+]]
+// LINUX: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_PreserveMost,
+__attribute__((preserve_most)) int add_preserve_most(int a, int b) {
+  return a+b;
+}
+
+// LINUX: !DISubprogram({{.*}}"add_preserve_all", {{.*}}type: ![[FTY:[0-9]+]]
+// LINUX: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_PreserveAll,
+__attribute__((preserve_all)) int add_preserve_all(int a, int b) {
+  return a+b;
+}
+
+// LINUX: !DISubprogram({{.*}}"add_swiftcall", {{.*}}type: ![[FTY:[0-9]+]]
+// LINUX: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_Swift,
+__attribute__((swiftcall)) int add_swiftcall(int a, int b) {
+  return a+b;
+}
+
+// LINUX: !DISubprogram({{.*}}"add_inteloclbicc", {{.*}}type: ![[FTY:[0-9]+]]
+// LINUX: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_IntelOclBicc,
+__attribute__((intel_ocl_bicc)) int add_inteloclbicc(int a, int b) {
+  return a+b;
+}
+#endif
+
+#ifdef _WIN64
+// WINDOWS: !DISubprogram({{.*}}"add_sysvabi", {{.*}}type: ![[FTY:[0-9]+]]
+// WINDOWS: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_X86_64SysV,

[PATCH] D42351: Emit DWARF "constructor" calling convention for every supported Clang CC

2018-02-12 Thread Adrian Prantl via Phabricator via cfe-commits
aprantl accepted this revision.
aprantl added a comment.
This revision is now accepted and ready to land.

Looks good with one additional change to the test.

Side note: We should also add all the LLVM extensions to 
http://wiki.dwarfstd.org/index.php?title=Vendor_Extensions.




Comment at: test/CodeGen/debug-info-cc.c:1
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -o - -emit-llvm 
-debug-info-kind=limited %s >%t
+// RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -o - -emit-llvm 
-debug-info-kind=limited %s >>%t

I think I would prefer this to be written as 
```
// RUN: $clang_cc1 ... %s | FileCheck --check-prefix=LINUX
// RUN: $clang_cc1 ... %s | FileCheck --check-prefix=WINDOWS
...


// LINUX: !DISubprogram ...
```


https://reviews.llvm.org/D42351



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D42351: Emit DWARF "constructor" calling convention for every supported Clang CC

2018-02-10 Thread Adrien Guinet via Phabricator via cfe-commits
aguinet updated this revision to Diff 133745.
aguinet added a comment.
Herald added a subscriber: krytarowski.

Test case added!


https://reviews.llvm.org/D42351

Files:
  lib/CodeGen/CGDebugInfo.cpp
  test/CodeGen/debug-info-cc.c

Index: test/CodeGen/debug-info-cc.c
===
--- /dev/null
+++ test/CodeGen/debug-info-cc.c
@@ -0,0 +1,121 @@
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -o - -emit-llvm -debug-info-kind=limited %s >%t
+// RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -o - -emit-llvm -debug-info-kind=limited %s >>%t
+// RUN: %clang_cc1 -triple i386-pc-linux-gnu -o - -emit-llvm -debug-info-kind=limited %s >>%t
+// RUN: %clang_cc1 -triple armv7--linux-gnueabihf -o - -emit-llvm -debug-info-kind=limited %s >>%t
+// RUN: FileCheck %s <%t
+
+//  enum CallingConv {
+//CC_C,   // __attribute__((cdecl))
+//CC_X86StdCall,  // __attribute__((stdcall))
+//CC_X86FastCall, // __attribute__((fastcall))
+//CC_X86ThisCall, // __attribute__((thiscall))
+//CC_X86VectorCall, // __attribute__((vectorcall))
+//CC_X86Pascal,   // __attribute__((pascal))
+//CC_Win64,   // __attribute__((ms_abi))
+//CC_X86_64SysV,  // __attribute__((sysv_abi))
+//CC_X86RegCall, // __attribute__((regcall))
+//CC_AAPCS,   // __attribute__((pcs("aapcs")))
+//CC_AAPCS_VFP,   // __attribute__((pcs("aapcs-vfp")))
+//CC_IntelOclBicc, // __attribute__((intel_ocl_bicc))
+//CC_SpirFunction, // default for OpenCL functions on SPIR target
+//CC_OpenCLKernel, // inferred for OpenCL kernels
+//CC_Swift,// __attribute__((swiftcall))
+//CC_PreserveMost, // __attribute__((preserve_most))
+//CC_PreserveAll,  // __attribute__((preserve_all))
+//  };
+
+#ifdef __x86_64__
+
+#ifdef __linux__
+// CHECK: !DISubprogram({{.*}}"add_msabi", {{.*}}type: ![[FTY:[0-9]+]]
+// CHECK: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_Win64,
+__attribute__((ms_abi)) int add_msabi(int a, int b) {
+  return a+b;
+}
+
+// CHECK: !DISubprogram({{.*}}"add_regcall", {{.*}}type: ![[FTY:[0-9]+]]
+// CHECK: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_X86RegCall,
+__attribute__((regcall)) int add_regcall(int a, int b) {
+  return a+b;
+}
+
+// CHECK: !DISubprogram({{.*}}"add_preserve_most", {{.*}}type: ![[FTY:[0-9]+]]
+// CHECK: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_PreserveMost,
+__attribute__((preserve_most)) int add_preserve_most(int a, int b) {
+  return a+b;
+}
+
+// CHECK: !DISubprogram({{.*}}"add_preserve_all", {{.*}}type: ![[FTY:[0-9]+]]
+// CHECK: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_PreserveAll,
+__attribute__((preserve_all)) int add_preserve_all(int a, int b) {
+  return a+b;
+}
+
+// CHECK: !DISubprogram({{.*}}"add_swiftcall", {{.*}}type: ![[FTY:[0-9]+]]
+// CHECK: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_Swift,
+__attribute__((swiftcall)) int add_swiftcall(int a, int b) {
+  return a+b;
+}
+
+// CHECK: !DISubprogram({{.*}}"add_inteloclbicc", {{.*}}type: ![[FTY:[0-9]+]]
+// CHECK: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_IntelOclBicc,
+__attribute__((intel_ocl_bicc)) int add_inteloclbicc(int a, int b) {
+  return a+b;
+}
+#endif
+
+#ifdef _WIN64
+// CHECK: !DISubprogram({{.*}}"add_sysvabi", {{.*}}type: ![[FTY:[0-9]+]]
+// CHECK: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_X86_64SysV,
+__attribute__((sysv_abi)) int add_sysvabi(int a, int b) {
+  return a+b;
+}
+#endif
+
+#endif
+
+#ifdef __i386__
+// CHECK: !DISubprogram({{.*}}"add_stdcall", {{.*}}type: ![[FTY:[0-9]+]]
+// CHECK: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_BORLAND_stdcall,
+__attribute__((stdcall)) int add_stdcall(int a, int b) {
+  return a+b;
+}
+
+// CHECK: !DISubprogram({{.*}}"add_fastcall", {{.*}}type: ![[FTY:[0-9]+]]
+// CHECK: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_BORLAND_msfastcall,
+__attribute__((fastcall)) int add_fastcall(int a, int b) {
+  return a+b;
+}
+
+// CHECK: !DISubprogram({{.*}}"add_thiscall", {{.*}}type: ![[FTY:[0-9]+]]
+// CHECK: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_BORLAND_thiscall,
+__attribute__((thiscall)) int add_thiscall(int a, int b) {
+  return a+b;
+}
+
+// CHECK: !DISubprogram({{.*}}"add_vectorcall", {{.*}}type: ![[FTY:[0-9]+]]
+// CHECK: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_vectorcall,
+__attribute__((vectorcall)) int add_vectorcall(int a, int b) {
+  return a+b;
+}
+
+// CHECK: !DISubprogram({{.*}}"add_pascal", {{.*}}type: ![[FTY:[0-9]+]]
+// CHECK: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_BORLAND_pascal,
+__attribute__((pascal)) int add_pascal(int a, int b) {
+  return a+b;
+}
+#endif
+
+#ifdef __arm__
+// CHECK: !DISubprogram({{.*}}"add_aapcs", {{.*}}type: ![[FTY:[0-9]+]]
+// CHECK: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_AAPCS,
+__attribute__((pcs("aapcs"))) int add_aapcs(int a, int b) {
+  return a+b;
+}
+
+// CHECK: !DISubprogram({{.*}}"add_aapcs_vfp", {{.*}}type: ![[FTY:[0-9]+]]
+// CHECK: ![[FTY]] = !DISu

[PATCH] D42351: Emit DWARF "constructor" calling convention for every supported Clang CC

2018-02-01 Thread Paul Robinson via Phabricator via cfe-commits
probinson added a comment.

+1 for testcase.


Repository:
  rC Clang

https://reviews.llvm.org/D42351



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D42351: Emit DWARF "constructor" calling convention for every supported Clang CC

2018-01-22 Thread Adrian Prantl via Phabricator via cfe-commits
aprantl added a comment.

If we take https://reviews.llvm.org/D42350, taking this is fairly obvious, 
though it could use a testcase.


Repository:
  rC Clang

https://reviews.llvm.org/D42351



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D42351: Emit DWARF "constructor" calling convention for every supported Clang CC

2018-01-21 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a subscriber: aprantl.
rnk added a comment.

@aprantl


Repository:
  rC Clang

https://reviews.llvm.org/D42351



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D42351: Emit DWARF "constructor" calling convention for every supported Clang CC

2018-01-21 Thread Adrien Guinet via Phabricator via cfe-commits
aguinet created this revision.
aguinet added a reviewer: rnk.
Herald added subscribers: cfe-commits, JDevlieghere.

This needs https://reviews.llvm.org/D42350 in LLVM!


Repository:
  rC Clang

https://reviews.llvm.org/D42351

Files:
  lib/CodeGen/CGDebugInfo.cpp


Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -982,20 +982,28 @@
 return llvm::dwarf::DW_CC_LLVM_vectorcall;
   case CC_X86Pascal:
 return llvm::dwarf::DW_CC_BORLAND_pascal;
-
-  // FIXME: Create new DW_CC_ codes for these calling conventions.
   case CC_Win64:
+return llvm::dwarf::DW_CC_LLVM_Win64;
   case CC_X86_64SysV:
+return llvm::dwarf::DW_CC_LLVM_X86_64SysV;
   case CC_AAPCS:
+return llvm::dwarf::DW_CC_LLVM_AAPCS;
   case CC_AAPCS_VFP:
+return llvm::dwarf::DW_CC_LLVM_AAPCS_VFP;
   case CC_IntelOclBicc:
+return llvm::dwarf::DW_CC_LLVM_IntelOclBicc;
   case CC_SpirFunction:
+return llvm::dwarf::DW_CC_LLVM_SpirFunction;
   case CC_OpenCLKernel:
+return llvm::dwarf::DW_CC_LLVM_OpenCLKernel;
   case CC_Swift:
+return llvm::dwarf::DW_CC_LLVM_Swift;
   case CC_PreserveMost:
+return llvm::dwarf::DW_CC_LLVM_PreserveMost;
   case CC_PreserveAll:
+return llvm::dwarf::DW_CC_LLVM_PreserveAll;
   case CC_X86RegCall:
-return 0;
+return llvm::dwarf::DW_CC_LLVM_X86RegCall;
   }
   return 0;
 }


Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -982,20 +982,28 @@
 return llvm::dwarf::DW_CC_LLVM_vectorcall;
   case CC_X86Pascal:
 return llvm::dwarf::DW_CC_BORLAND_pascal;
-
-  // FIXME: Create new DW_CC_ codes for these calling conventions.
   case CC_Win64:
+return llvm::dwarf::DW_CC_LLVM_Win64;
   case CC_X86_64SysV:
+return llvm::dwarf::DW_CC_LLVM_X86_64SysV;
   case CC_AAPCS:
+return llvm::dwarf::DW_CC_LLVM_AAPCS;
   case CC_AAPCS_VFP:
+return llvm::dwarf::DW_CC_LLVM_AAPCS_VFP;
   case CC_IntelOclBicc:
+return llvm::dwarf::DW_CC_LLVM_IntelOclBicc;
   case CC_SpirFunction:
+return llvm::dwarf::DW_CC_LLVM_SpirFunction;
   case CC_OpenCLKernel:
+return llvm::dwarf::DW_CC_LLVM_OpenCLKernel;
   case CC_Swift:
+return llvm::dwarf::DW_CC_LLVM_Swift;
   case CC_PreserveMost:
+return llvm::dwarf::DW_CC_LLVM_PreserveMost;
   case CC_PreserveAll:
+return llvm::dwarf::DW_CC_LLVM_PreserveAll;
   case CC_X86RegCall:
-return 0;
+return llvm::dwarf::DW_CC_LLVM_X86RegCall;
   }
   return 0;
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits