[PATCH] D24752: [Modules] Add missing dependencies to clang builtins modulemap

2016-09-19 Thread Elad Cohen via cfe-commits
eladcohen created this revision.
eladcohen added a reviewer: rsmith.
eladcohen added a subscriber: cfe-commits.

X86 intrinsic header files mm3dnow.h and wmmintrin.h include and depend on 
mmintrin.h and emmintrin.h respectively.
This patch adds these missing dependencies to the corresponding submodules in 
the clang builtins modulemap.

https://reviews.llvm.org/D24752

Files:
  lib/Headers/module.modulemap
  test/Modules/compiler_builtins_x86_submodules.c

Index: test/Modules/compiler_builtins_x86_submodules.c
===
--- test/Modules/compiler_builtins_x86_submodules.c
+++ test/Modules/compiler_builtins_x86_submodules.c
@@ -0,0 +1,15 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -triple i686-unknown-unknown -target-feature +3dnowa 
-fsyntax-only -fmodules -fimplicit-module-maps -fmodules-cache-path=%t %s 
-verify -ffreestanding
+
+// expected-no-diagnostics
+
+#include
+
+__m64 x; // Verify that types which are used by mm3dnow.h
+ // but declared in the mmx submodule get imported
+
+#include
+
+__m128i y; // Verify that types which are used by wmmintrin.h
+   // but declared in the sse2 submodule get imported
+
Index: lib/Headers/module.modulemap
===
--- lib/Headers/module.modulemap
+++ lib/Headers/module.modulemap
@@ -119,6 +119,7 @@
 }
 
 explicit module mm3dnow {
+  export mmx
   header "mm3dnow.h"
 }
 
@@ -129,6 +130,7 @@
 }
 
 explicit module aes {
+  export sse2
   header "__wmmintrin_aes.h"
 }
 


Index: test/Modules/compiler_builtins_x86_submodules.c
===
--- test/Modules/compiler_builtins_x86_submodules.c
+++ test/Modules/compiler_builtins_x86_submodules.c
@@ -0,0 +1,15 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -triple i686-unknown-unknown -target-feature +3dnowa -fsyntax-only -fmodules -fimplicit-module-maps -fmodules-cache-path=%t %s -verify -ffreestanding
+
+// expected-no-diagnostics
+
+#include
+
+__m64 x; // Verify that types which are used by mm3dnow.h
+ // but declared in the mmx submodule get imported
+
+#include
+
+__m128i y; // Verify that types which are used by wmmintrin.h
+   // but declared in the sse2 submodule get imported
+
Index: lib/Headers/module.modulemap
===
--- lib/Headers/module.modulemap
+++ lib/Headers/module.modulemap
@@ -119,6 +119,7 @@
 }
 
 explicit module mm3dnow {
+  export mmx
   header "mm3dnow.h"
 }
 
@@ -129,6 +130,7 @@
 }
 
 explicit module aes {
+  export sse2
   header "__wmmintrin_aes.h"
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D24825: [X86] Remove the mm_malloc.h include guard hack from the X86 builtins tests

2016-09-22 Thread Elad Cohen via cfe-commits
eladcohen created this revision.
eladcohen added a subscriber: cfe-commits.

The X86 clang/test/CodeGen/*builtins.c tests define the mm_malloc.h include 
guard as a hack for avoiding its inclusion (mm_malloc.h requires a hosted 
environment since it expects stdlib.h to be available - which is not the case 
in these internal clang codegen tests).

This patch removes this hack and instead passes -ffreestanding to clang cc1.


https://reviews.llvm.org/D24825

Files:
  test/CodeGen/3dnow-builtins.c
  test/CodeGen/avx-builtins.c
  test/CodeGen/avx-cmp-builtins.c
  test/CodeGen/avx-shuffle-builtins.c
  test/CodeGen/avx2-builtins.c
  test/CodeGen/avx512bw-builtins.c
  test/CodeGen/avx512cdintrin.c
  test/CodeGen/avx512dq-builtins.c
  test/CodeGen/avx512er-builtins.c
  test/CodeGen/avx512f-builtins.c
  test/CodeGen/avx512ifma-builtins.c
  test/CodeGen/avx512pf-builtins.c
  test/CodeGen/avx512vbmi-builtins.c
  test/CodeGen/avx512vbmivl-builtin.c
  test/CodeGen/avx512vl-builtins.c
  test/CodeGen/avx512vlbw-builtins.c
  test/CodeGen/avx512vlcd-builtins.c
  test/CodeGen/avx512vldq-builtins.c
  test/CodeGen/bitscan-builtins.c
  test/CodeGen/bmi-builtins.c
  test/CodeGen/bmi2-builtins.c
  test/CodeGen/f16c-builtins.c
  test/CodeGen/fma-builtins.c
  test/CodeGen/fma4-builtins.c
  test/CodeGen/fsgsbase-builtins.c
  test/CodeGen/lzcnt-builtins.c
  test/CodeGen/mmx-builtins.c
  test/CodeGen/pclmul-builtins.c
  test/CodeGen/pku.c
  test/CodeGen/popcnt-builtins.c
  test/CodeGen/prefetchw-builtins.c
  test/CodeGen/rd-builtins.c
  test/CodeGen/rdrand-builtins.c
  test/CodeGen/rtm-builtins.c
  test/CodeGen/sha-builtins.c
  test/CodeGen/sse-builtins.c
  test/CodeGen/sse.c
  test/CodeGen/sse2-builtins.c
  test/CodeGen/sse3-builtins.c
  test/CodeGen/sse41-builtins.c
  test/CodeGen/sse42-builtins.c
  test/CodeGen/sse4a-builtins.c
  test/CodeGen/ssse3-builtins.c
  test/CodeGen/tbm-builtins.c
  test/CodeGen/vector.c
  test/CodeGen/xop-builtins.c

Index: test/CodeGen/xop-builtins.c
===
--- test/CodeGen/xop-builtins.c
+++ test/CodeGen/xop-builtins.c
@@ -1,8 +1,6 @@
-// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -target-feature +xop -emit-llvm -o - -Wall -Werror | FileCheck %s
-// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -target-feature +xop -fno-signed-char -emit-llvm -o - -Wall -Werror | FileCheck %s
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +xop -emit-llvm -o - -Wall -Werror | FileCheck %s
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +xop -fno-signed-char -emit-llvm -o - -Wall -Werror | FileCheck %s
 
-// Don't include mm_malloc.h, it's system specific.
-#define __MM_MALLOC_H
 
 #include 
 
Index: test/CodeGen/vector.c
===
--- test/CodeGen/vector.c
+++ test/CodeGen/vector.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple i386-apple-darwin9 -O1 -target-cpu core2 -debug-info-kind=limited -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -ffreestanding -triple i386-apple-darwin9 -O1 -target-cpu core2 -debug-info-kind=limited -emit-llvm %s -o - | FileCheck %s
 typedef short __v4hi __attribute__ ((__vector_size__ (8)));
 
 void test1() {
@@ -20,8 +20,6 @@
 
 
 
-// Don't include mm_malloc.h, it's system specific.
-#define __MM_MALLOC_H
 
 #include 
 
Index: test/CodeGen/tbm-builtins.c
===
--- test/CodeGen/tbm-builtins.c
+++ test/CodeGen/tbm-builtins.c
@@ -1,10 +1,8 @@
-// RUN: %clang_cc1 %s -O3 -triple=x86_64-unknown-unknown -target-feature +tbm -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -ffreestanding %s -O3 -triple=x86_64-unknown-unknown -target-feature +tbm -emit-llvm -o - | FileCheck %s
 // FIXME: The code generation checks for add/sub and/or are depending on the optimizer.
 // The REQUIRES keyword will be removed when the FIXME is complete.
 // REQUIRES: x86-registered-target
 
-// Don't include mm_malloc.h, it's system specific.
-#define __MM_MALLOC_H
 
 #include 
 
Index: test/CodeGen/ssse3-builtins.c
===
--- test/CodeGen/ssse3-builtins.c
+++ test/CodeGen/ssse3-builtins.c
@@ -1,7 +1,5 @@
-// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -target-feature +ssse3 -emit-llvm -o - -Wall -Werror | FileCheck %s
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +ssse3 -emit-llvm -o - -Wall -Werror | FileCheck %s
 
-// Don't include mm_malloc.h, it's system specific.
-#define __MM_MALLOC_H
 
 #include 
 
Index: test/CodeGen/sse4a-builtins.c
===
--- test/CodeGen/sse4a-builtins.c
+++ test/CodeGen/sse4a-builtins.c
@@ -1,7 +1,5 @@
-// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -target-feature +sse4a -emit-llvm -o - -Wall -Werror | FileCheck %s
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-d

Re: [PATCH] D24752: [Modules] Add missing dependencies to clang builtins modulemap

2016-09-27 Thread Elad Cohen via cfe-commits
eladcohen added a comment.

ping


https://reviews.llvm.org/D24752



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


Re: [PATCH] D24752: [Modules] Add missing dependencies to clang builtins modulemap

2016-09-28 Thread Elad Cohen via cfe-commits
eladcohen added inline comments.


Comment at: lib/Headers/module.modulemap:133
@@ -131,2 +132,3 @@
 explicit module aes {
+  export sse2
   header "__wmmintrin_aes.h"

bruno wrote:
> The mmx case above makes sense to me, but I find conceptually odd that we 
> need to re-export sse2 in aes module, why not explicitly #include 
>  in the source file?
emmintrin.h is already included explicitly in wmmintrin.h & __wmmintrin_aes.h.

If a user includes / there is no problem, since the 
intel submodule has an 'export *' directive and both aes & sse2 will be 
imported.

However, if the user only includes  (like in the 2nd half of the 
test I added), and uses modules, then any use of the '___m128i' type (which is 
used in the aes intrinsics and declared in sse2) will result with the error:
"File tst.c Line 11: missing '#include '; declaration of 
'___m128i' must be imported from module '_Builtin_intrinsics.intel.sse2' before 
it is required"

IIUC the possible fixes for this are adding 'export *' or 'export sse2' to the 
aes submodule.



https://reviews.llvm.org/D24752



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


r282581 - [X86] Remove the mm_malloc.h include guard hack from the X86 builtins tests

2016-09-28 Thread Elad Cohen via cfe-commits
Author: eladcohen
Date: Wed Sep 28 06:59:09 2016
New Revision: 282581

URL: http://llvm.org/viewvc/llvm-project?rev=282581&view=rev
Log:
[X86] Remove the mm_malloc.h include guard hack from the X86 builtins tests

The X86 clang/test/CodeGen/*builtins.c tests define the mm_malloc.h include
guard as a hack for avoiding its inclusion (mm_malloc.h requires a hosted
environment since it expects stdlib.h to be available - which is not the case
in these internal clang codegen tests).
This patch removes this hack and instead passes -ffreestanding to clang cc1.

Differential Revision: https://reviews.llvm.org/D24825


Modified:
cfe/trunk/test/CodeGen/3dnow-builtins.c
cfe/trunk/test/CodeGen/avx-builtins.c
cfe/trunk/test/CodeGen/avx-cmp-builtins.c
cfe/trunk/test/CodeGen/avx-shuffle-builtins.c
cfe/trunk/test/CodeGen/avx2-builtins.c
cfe/trunk/test/CodeGen/avx512bw-builtins.c
cfe/trunk/test/CodeGen/avx512cdintrin.c
cfe/trunk/test/CodeGen/avx512dq-builtins.c
cfe/trunk/test/CodeGen/avx512er-builtins.c
cfe/trunk/test/CodeGen/avx512f-builtins.c
cfe/trunk/test/CodeGen/avx512ifma-builtins.c
cfe/trunk/test/CodeGen/avx512pf-builtins.c
cfe/trunk/test/CodeGen/avx512vbmi-builtins.c
cfe/trunk/test/CodeGen/avx512vbmivl-builtin.c
cfe/trunk/test/CodeGen/avx512vl-builtins.c
cfe/trunk/test/CodeGen/avx512vlbw-builtins.c
cfe/trunk/test/CodeGen/avx512vlcd-builtins.c
cfe/trunk/test/CodeGen/avx512vldq-builtins.c
cfe/trunk/test/CodeGen/bitscan-builtins.c
cfe/trunk/test/CodeGen/bmi-builtins.c
cfe/trunk/test/CodeGen/bmi2-builtins.c
cfe/trunk/test/CodeGen/f16c-builtins.c
cfe/trunk/test/CodeGen/fma-builtins.c
cfe/trunk/test/CodeGen/fma4-builtins.c
cfe/trunk/test/CodeGen/fsgsbase-builtins.c
cfe/trunk/test/CodeGen/lzcnt-builtins.c
cfe/trunk/test/CodeGen/mmx-builtins.c
cfe/trunk/test/CodeGen/pclmul-builtins.c
cfe/trunk/test/CodeGen/pku.c
cfe/trunk/test/CodeGen/popcnt-builtins.c
cfe/trunk/test/CodeGen/prefetchw-builtins.c
cfe/trunk/test/CodeGen/rd-builtins.c
cfe/trunk/test/CodeGen/rdrand-builtins.c
cfe/trunk/test/CodeGen/rtm-builtins.c
cfe/trunk/test/CodeGen/sha-builtins.c
cfe/trunk/test/CodeGen/sse-builtins.c
cfe/trunk/test/CodeGen/sse.c
cfe/trunk/test/CodeGen/sse2-builtins.c
cfe/trunk/test/CodeGen/sse3-builtins.c
cfe/trunk/test/CodeGen/sse41-builtins.c
cfe/trunk/test/CodeGen/sse42-builtins.c
cfe/trunk/test/CodeGen/sse4a-builtins.c
cfe/trunk/test/CodeGen/ssse3-builtins.c
cfe/trunk/test/CodeGen/tbm-builtins.c
cfe/trunk/test/CodeGen/vector.c
cfe/trunk/test/CodeGen/xop-builtins.c

Modified: cfe/trunk/test/CodeGen/3dnow-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/3dnow-builtins.c?rev=282581&r1=282580&r2=282581&view=diff
==
--- cfe/trunk/test/CodeGen/3dnow-builtins.c (original)
+++ cfe/trunk/test/CodeGen/3dnow-builtins.c Wed Sep 28 06:59:09 2016
@@ -1,8 +1,6 @@
-// RUN: %clang_cc1 %s -triple=x86_64-unknown-unknown -target-feature +3dnowa 
-emit-llvm -o - -Wall -Werror | FileCheck %s -check-prefix=GCC 
-check-prefix=CHECK
-// RUN: %clang_cc1 %s -triple=x86_64-scei-ps4 -target-feature +3dnowa 
-emit-llvm -o - -Wall -Werror | FileCheck %s -check-prefix=PS4 
-check-prefix=CHECK
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-unknown-unknown 
-target-feature +3dnowa -emit-llvm -o - -Wall -Werror | FileCheck %s 
-check-prefix=GCC -check-prefix=CHECK
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-scei-ps4 -target-feature 
+3dnowa -emit-llvm -o - -Wall -Werror | FileCheck %s -check-prefix=PS4 
-check-prefix=CHECK
 
-// Don't include mm_malloc.h, it's system specific.
-#define __MM_MALLOC_H
 
 #include 
 

Modified: cfe/trunk/test/CodeGen/avx-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx-builtins.c?rev=282581&r1=282580&r2=282581&view=diff
==
--- cfe/trunk/test/CodeGen/avx-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx-builtins.c Wed Sep 28 06:59:09 2016
@@ -1,8 +1,6 @@
-// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -target-feature +avx 
-emit-llvm -o - -Wall -Werror | FileCheck %s
-// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -target-feature +avx 
-fno-signed-char -emit-llvm -o - -Wall -Werror | FileCheck %s
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin 
-target-feature +avx -emit-llvm -o - -Wall -Werror | FileCheck %s
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin 
-target-feature +avx -fno-signed-char -emit-llvm -o - -Wall -Werror | FileCheck 
%s
 
-// Don't include mm_malloc.h, it's system specific.
-#define __MM_MALLOC_H
 
 #include 
 

Modified: cfe/trunk/test/CodeGen/avx-cmp-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx-cmp-builtins.c?rev=282581&r1=282580&r2=282581&

Re: [PATCH] D24825: [X86] Remove the mm_malloc.h include guard hack from the X86 builtins tests

2016-09-28 Thread Elad Cohen via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL282581: [X86] Remove the mm_malloc.h include guard hack from 
the X86 builtins tests (authored by eladcohen).

Changed prior to commit:
  https://reviews.llvm.org/D24825?vs=72158&id=72805#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D24825

Files:
  cfe/trunk/test/CodeGen/3dnow-builtins.c
  cfe/trunk/test/CodeGen/avx-builtins.c
  cfe/trunk/test/CodeGen/avx-cmp-builtins.c
  cfe/trunk/test/CodeGen/avx-shuffle-builtins.c
  cfe/trunk/test/CodeGen/avx2-builtins.c
  cfe/trunk/test/CodeGen/avx512bw-builtins.c
  cfe/trunk/test/CodeGen/avx512cdintrin.c
  cfe/trunk/test/CodeGen/avx512dq-builtins.c
  cfe/trunk/test/CodeGen/avx512er-builtins.c
  cfe/trunk/test/CodeGen/avx512f-builtins.c
  cfe/trunk/test/CodeGen/avx512ifma-builtins.c
  cfe/trunk/test/CodeGen/avx512pf-builtins.c
  cfe/trunk/test/CodeGen/avx512vbmi-builtins.c
  cfe/trunk/test/CodeGen/avx512vbmivl-builtin.c
  cfe/trunk/test/CodeGen/avx512vl-builtins.c
  cfe/trunk/test/CodeGen/avx512vlbw-builtins.c
  cfe/trunk/test/CodeGen/avx512vlcd-builtins.c
  cfe/trunk/test/CodeGen/avx512vldq-builtins.c
  cfe/trunk/test/CodeGen/bitscan-builtins.c
  cfe/trunk/test/CodeGen/bmi-builtins.c
  cfe/trunk/test/CodeGen/bmi2-builtins.c
  cfe/trunk/test/CodeGen/f16c-builtins.c
  cfe/trunk/test/CodeGen/fma-builtins.c
  cfe/trunk/test/CodeGen/fma4-builtins.c
  cfe/trunk/test/CodeGen/fsgsbase-builtins.c
  cfe/trunk/test/CodeGen/lzcnt-builtins.c
  cfe/trunk/test/CodeGen/mmx-builtins.c
  cfe/trunk/test/CodeGen/pclmul-builtins.c
  cfe/trunk/test/CodeGen/pku.c
  cfe/trunk/test/CodeGen/popcnt-builtins.c
  cfe/trunk/test/CodeGen/prefetchw-builtins.c
  cfe/trunk/test/CodeGen/rd-builtins.c
  cfe/trunk/test/CodeGen/rdrand-builtins.c
  cfe/trunk/test/CodeGen/rtm-builtins.c
  cfe/trunk/test/CodeGen/sha-builtins.c
  cfe/trunk/test/CodeGen/sse-builtins.c
  cfe/trunk/test/CodeGen/sse.c
  cfe/trunk/test/CodeGen/sse2-builtins.c
  cfe/trunk/test/CodeGen/sse3-builtins.c
  cfe/trunk/test/CodeGen/sse41-builtins.c
  cfe/trunk/test/CodeGen/sse42-builtins.c
  cfe/trunk/test/CodeGen/sse4a-builtins.c
  cfe/trunk/test/CodeGen/ssse3-builtins.c
  cfe/trunk/test/CodeGen/tbm-builtins.c
  cfe/trunk/test/CodeGen/vector.c
  cfe/trunk/test/CodeGen/xop-builtins.c

Index: cfe/trunk/test/CodeGen/sha-builtins.c
===
--- cfe/trunk/test/CodeGen/sha-builtins.c
+++ cfe/trunk/test/CodeGen/sha-builtins.c
@@ -1,7 +1,5 @@
-// RUN: %clang_cc1 %s -triple=x86_64-unknown-unknown -target-feature +sha -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-unknown-unknown -target-feature +sha -emit-llvm -o - | FileCheck %s
 
-// Don't include mm_malloc.h, it's system specific.
-#define __MM_MALLOC_H
 
 #include 
 
Index: cfe/trunk/test/CodeGen/avx512cdintrin.c
===
--- cfe/trunk/test/CodeGen/avx512cdintrin.c
+++ cfe/trunk/test/CodeGen/avx512cdintrin.c
@@ -1,7 +1,5 @@
-// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -target-feature +avx512cd -emit-llvm -o - -Wall -Werror | FileCheck %s
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx512cd -emit-llvm -o - -Wall -Werror | FileCheck %s
 
-// Don't include mm_malloc.h, it's system specific.
-#define __MM_MALLOC_H
 
 #include 
 
Index: cfe/trunk/test/CodeGen/sse3-builtins.c
===
--- cfe/trunk/test/CodeGen/sse3-builtins.c
+++ cfe/trunk/test/CodeGen/sse3-builtins.c
@@ -1,7 +1,5 @@
-// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -target-feature +sse3 -emit-llvm -o - -Wall -Werror | FileCheck %s
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse3 -emit-llvm -o - -Wall -Werror | FileCheck %s
 
-// Don't include mm_malloc.h, it's system specific.
-#define __MM_MALLOC_H
 
 #include 
 
Index: cfe/trunk/test/CodeGen/avx512vbmi-builtins.c
===
--- cfe/trunk/test/CodeGen/avx512vbmi-builtins.c
+++ cfe/trunk/test/CodeGen/avx512vbmi-builtins.c
@@ -1,7 +1,5 @@
-// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -target-feature +avx512vbmi -emit-llvm -o - -Wall -Werror | FileCheck %s
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx512vbmi -emit-llvm -o - -Wall -Werror | FileCheck %s
 
-// Don't include mm_malloc.h, it's system specific.
-#define __MM_MALLOC_H
 
 #include 
 
Index: cfe/trunk/test/CodeGen/sse.c
===
--- cfe/trunk/test/CodeGen/sse.c
+++ cfe/trunk/test/CodeGen/sse.c
@@ -1,8 +1,6 @@
-// RUN: %clang_cc1 -O3 -triple x86_64-apple-macosx10.8.0 -target-feature +sse4.1 -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -ffreestanding -O3 -triple x86_64-apple-macosx10.8.0 -target-feature +sse4.1 -emit-llvm %s -o - | FileCheck %s
 // FIXME: This tes

Re: [PATCH] D24825: [X86] Remove the mm_malloc.h include guard hack from the X86 builtins tests

2016-09-28 Thread Elad Cohen via cfe-commits
eladcohen added a comment.

Thanks for the review! committed r282581.


Repository:
  rL LLVM

https://reviews.llvm.org/D24825



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


[PATCH] D25337: [Modules] Add a command line option for enabling the modules feature exclusively for the Clang builtins.

2016-10-06 Thread Elad Cohen via cfe-commits
eladcohen created this revision.
eladcohen added reviewers: hans, rnk, zvi, rsmith, chandlerc.
eladcohen added a subscriber: cfe-commits.

-fexclusive-builtin-modules enables the clang 'modules' feature exclusively for 
the clang intrinsic header files.

The end goal of this effort is to have this option on by default for x86 
targets so we could reduce the long compile time of the x86 intrinsic header 
files.


https://reviews.llvm.org/D25337

Files:
  docs/Modules.rst
  include/clang/Driver/Options.td
  lib/Driver/Tools.cpp
  test/CodeGen/3dnow-builtins.c
  test/CodeGen/adc-builtins.c
  test/CodeGen/adx-builtins.c
  test/CodeGen/attr-target-x86-mmx.c
  test/CodeGen/avx-builtins.c
  test/CodeGen/avx-cmp-builtins.c
  test/CodeGen/avx-shuffle-builtins.c
  test/CodeGen/avx2-builtins.c
  test/CodeGen/avx512bw-builtins.c
  test/CodeGen/avx512cdintrin.c
  test/CodeGen/avx512dq-builtins.c
  test/CodeGen/avx512er-builtins.c
  test/CodeGen/avx512f-builtins.c
  test/CodeGen/avx512ifma-builtins.c
  test/CodeGen/avx512ifmavl-builtins.c
  test/CodeGen/avx512pf-builtins.c
  test/CodeGen/avx512vbmi-builtins.c
  test/CodeGen/avx512vbmivl-builtin.c
  test/CodeGen/avx512vl-builtins.c
  test/CodeGen/avx512vlbw-builtins.c
  test/CodeGen/avx512vlcd-builtins.c
  test/CodeGen/avx512vldq-builtins.c
  test/CodeGen/bitscan-builtins.c
  test/CodeGen/bmi-builtins.c
  test/CodeGen/bmi2-builtins.c
  test/CodeGen/builtin-clflushopt.c
  test/CodeGen/f16c-builtins.c
  test/CodeGen/fma-builtins.c
  test/CodeGen/fma4-builtins.c
  test/CodeGen/fsgsbase-builtins.c
  test/CodeGen/lzcnt-builtins.c
  test/CodeGen/mmx-builtins.c
  test/CodeGen/pku.c
  test/CodeGen/popcnt-builtins.c
  test/CodeGen/prefetchw-builtins.c
  test/CodeGen/rd-builtins.c
  test/CodeGen/rdrand-builtins.c
  test/CodeGen/rtm-builtins.c
  test/CodeGen/sha-builtins.c
  test/CodeGen/sse-builtins.c
  test/CodeGen/sse2-builtins.c
  test/CodeGen/sse3-builtins.c
  test/CodeGen/sse41-builtins.c
  test/CodeGen/sse42-builtins.c
  test/CodeGen/sse4a-builtins.c
  test/CodeGen/ssse3-builtins.c
  test/CodeGen/target-builtin-error-2.c
  test/CodeGen/target-builtin-error.c
  test/CodeGen/target-builtin-noerror.c
  test/CodeGen/target-features-error-2.c
  test/CodeGen/tbm-builtins.c
  test/CodeGen/xop-builtins.c
  test/CodeGenCXX/mangle-ms-vector-types.cpp
  test/Driver/modules.m
  test/Driver/modules.mm
  test/Headers/x86-intrinsics-headers.c
  test/Headers/x86intrin-2.c
  test/Headers/x86intrin.c
  test/Headers/x86intrin.cpp
  test/lit.cfg

Index: test/lit.cfg
===
--- test/lit.cfg
+++ test/lit.cfg
@@ -268,6 +268,12 @@
 config.substitutions.append( ('%test_debuginfo', ' ' + config.llvm_src_root + '/utils/test_debuginfo.pl ') )
 config.substitutions.append( ('%itanium_abi_triple', makeItaniumABITriple(config.target_triple)) )
 config.substitutions.append( ('%ms_abi_triple', makeMSABITriple(config.target_triple)) )
+config.substitutions.append( ('%use_builtin_modules',
+  ' -fmodules -fmodule-map-file=' + 
+  getClangBuiltinIncludeDir(config.clang) +
+  '/module.modulemap '
+  '-fmodules-cache-path=%t_builtin_modules '
+  '-fmodules-validate-system-headers ' ))
 
 # The host triple might not be set, at least if we're compiling clang from
 # an already installed llvm.
Index: test/Headers/x86intrin.cpp
===
--- test/Headers/x86intrin.cpp
+++ test/Headers/x86intrin.cpp
@@ -1,4 +1,7 @@
 // RUN: %clang_cc1 -fsyntax-only -ffreestanding %s -verify
+
+// RUN: %clang_cc1 %use_builtin_modules -fsyntax-only -ffreestanding %s -verify
+
 // expected-no-diagnostics
 
 #if defined(i386) || defined(__x86_64__)
Index: test/Headers/x86intrin.c
===
--- test/Headers/x86intrin.c
+++ test/Headers/x86intrin.c
@@ -1,6 +1,11 @@
 // RUN: %clang_cc1 -fsyntax-only -ffreestanding %s -verify
 // RUN: %clang_cc1 -fsyntax-only -ffreestanding -fno-lax-vector-conversions %s -verify
 // RUN: %clang_cc1 -fsyntax-only -ffreestanding -x c++ %s -verify
+
+// RUN: %clang_cc1 %use_builtin_modules -fsyntax-only -ffreestanding %s -verify
+// RUN: %clang_cc1 %use_builtin_modules -fsyntax-only -ffreestanding -fno-lax-vector-conversions %s -verify
+// RUN: %clang_cc1 %use_builtin_modules -fsyntax-only -ffreestanding -x c++ %s -verify
+
 // expected-no-diagnostics
 
 #if defined(i386) || defined(__x86_64__)
Index: test/Headers/x86intrin-2.c
===
--- test/Headers/x86intrin-2.c
+++ test/Headers/x86intrin-2.c
@@ -1,6 +1,11 @@
 // RUN: %clang_cc1 -fsyntax-only -ffreestanding %s -verify
 // RUN: %clang_cc1 -fsyntax-only -ffreestanding -fno-lax-vector-conversions %s -verify
 // RUN: %clang_cc1 -fsyntax-only -ffreestanding -x c++ %s -verify
+
+// RUN: %clang

[PATCH] D25337: [Modules] Add a command line option for enabling the modules feature exclusively for the Clang builtins.

2016-10-09 Thread Elad Cohen via cfe-commits
eladcohen added a comment.

Hi Bruno,

The short answer is yes. Essentially it can be done, but we would actually like 
for all the users to always get this behavior, implicitly.

The long answer is that there is a history of problems regarding the intrinsic 
files:
http://lists.llvm.org/pipermail/cfe-dev/2016-May/048837.html
http://lists.llvm.org/pipermail/cfe-dev/2016-September/050943.html
Mainly compatibility issues because MSVC makes all the intrinsics available all 
the time, while in clang this is not always the case (On Windows the different 
h files are not-included unless asked for explicitly since AVX512 was added 
which impacted compile-time).
A suggestion was made to try and mitigate this by reducing the compile time 
using modules (only for the x86 intrinsics). This patch aims at adding this 
option. The new compile flag is just a milestone - if all goes well, we can 
turn this on by default (Then we won't actually need to use a specific compile 
flag, and we could always include all the intrinsic h files without their long 
compile time).


https://reviews.llvm.org/D25337



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


r279419 - Test commit (Removing trailing whitespace).

2016-08-22 Thread Elad Cohen via cfe-commits
Author: eladcohen
Date: Mon Aug 22 02:34:21 2016
New Revision: 279419

URL: http://llvm.org/viewvc/llvm-project?rev=279419&view=rev
Log:
Test commit (Removing trailing whitespace).

Modified:
cfe/trunk/include/clang/Driver/Driver.h

Modified: cfe/trunk/include/clang/Driver/Driver.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Driver.h?rev=279419&r1=279418&r2=279419&view=diff
==
--- cfe/trunk/include/clang/Driver/Driver.h (original)
+++ cfe/trunk/include/clang/Driver/Driver.h Mon Aug 22 02:34:21 2016
@@ -341,7 +341,7 @@ public:
   /// up response files, removing temporary files, etc.
   int ExecuteCompilation(Compilation &C,
  SmallVectorImpl< std::pair > &FailingCommands);
-  
+
   /// generateCompilationDiagnostics - Generate diagnostics information 
   /// including preprocessed source file(s).
   /// 


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


[PATCH] D23871: [Modules] Add 'freestanding' to the 'requires-declaration' feature-list.

2016-08-25 Thread Elad Cohen via cfe-commits
eladcohen created this revision.
eladcohen added reviewers: rsmith, andreybokhanko.
eladcohen added a subscriber: cfe-commits.

This adds support for modules that require (non-)freestanding environment such 
as the compiler builtin mm_malloc submodule.

https://reviews.llvm.org/D23871

Files:
  docs/Modules.rst
  lib/Basic/Module.cpp
  lib/Headers/module.modulemap
  test/Modules/compiler_builtins_x86.c

Index: test/Modules/compiler_builtins_x86.c
===
--- test/Modules/compiler_builtins_x86.c
+++ test/Modules/compiler_builtins_x86.c
@@ -0,0 +1,6 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fsyntax-only -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t %s -verify -ffreestanding
+// expected-no-diagnostics
+
+#include
+
Index: lib/Headers/module.modulemap
===
--- lib/Headers/module.modulemap
+++ lib/Headers/module.modulemap
@@ -63,6 +63,7 @@
 textual header "mwaitxintrin.h"
 
 explicit module mm_malloc {
+  requires !freestanding
   header "mm_malloc.h"
   export * // note: for  dependency
 }
Index: lib/Basic/Module.cpp
===
--- lib/Basic/Module.cpp
+++ lib/Basic/Module.cpp
@@ -64,6 +64,7 @@
 .Case("blocks", LangOpts.Blocks)
 .Case("cplusplus", LangOpts.CPlusPlus)
 .Case("cplusplus11", LangOpts.CPlusPlus11)
+.Case("freestanding", LangOpts.Freestanding)
 .Case("objc", LangOpts.ObjC1)
 .Case("objc_arc", LangOpts.ObjCAutoRefCount)
 .Case("opencl", LangOpts.OpenCL)
Index: docs/Modules.rst
===
--- docs/Modules.rst
+++ docs/Modules.rst
@@ -413,6 +413,9 @@
 cplusplus11
   C++11 support is available.
 
+freestanding
+  A freestanding environment is available.
+
 objc
   Objective-C support is available.
 


Index: test/Modules/compiler_builtins_x86.c
===
--- test/Modules/compiler_builtins_x86.c
+++ test/Modules/compiler_builtins_x86.c
@@ -0,0 +1,6 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fsyntax-only -fmodules -fimplicit-module-maps -fmodules-cache-path=%t %s -verify -ffreestanding
+// expected-no-diagnostics
+
+#include
+
Index: lib/Headers/module.modulemap
===
--- lib/Headers/module.modulemap
+++ lib/Headers/module.modulemap
@@ -63,6 +63,7 @@
 textual header "mwaitxintrin.h"
 
 explicit module mm_malloc {
+  requires !freestanding
   header "mm_malloc.h"
   export * // note: for  dependency
 }
Index: lib/Basic/Module.cpp
===
--- lib/Basic/Module.cpp
+++ lib/Basic/Module.cpp
@@ -64,6 +64,7 @@
 .Case("blocks", LangOpts.Blocks)
 .Case("cplusplus", LangOpts.CPlusPlus)
 .Case("cplusplus11", LangOpts.CPlusPlus11)
+.Case("freestanding", LangOpts.Freestanding)
 .Case("objc", LangOpts.ObjC1)
 .Case("objc_arc", LangOpts.ObjCAutoRefCount)
 .Case("opencl", LangOpts.OpenCL)
Index: docs/Modules.rst
===
--- docs/Modules.rst
+++ docs/Modules.rst
@@ -413,6 +413,9 @@
 cplusplus11
   C++11 support is available.
 
+freestanding
+  A freestanding environment is available.
+
 objc
   Objective-C support is available.
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23871: [Modules] Add 'freestanding' to the 'requires-declaration' feature-list.

2016-08-27 Thread Elad Cohen via cfe-commits
eladcohen added inline comments.


Comment at: lib/Headers/module.modulemap:66
@@ -65,2 +65,3 @@
 explicit module mm_malloc {
+  requires !freestanding
   header "mm_malloc.h"

rsmith wrote:
> Are there more parts of the intrinsics modules to which this should be 
> applied?
Not that I'm aware of. A "STDC_HOSTED" grep on the intrinsics modules header 
files didn't find anything other than mm_malloc.h.


https://reviews.llvm.org/D23871



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


Re: [PATCH] D23871: [Modules] Add 'freestanding' to the 'requires-declaration' feature-list.

2016-09-03 Thread Elad Cohen via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL280613: [Modules] Add 'freestanding' to the 
'requires-declaration' feature-list. (authored by eladcohen).

Changed prior to commit:
  https://reviews.llvm.org/D23871?vs=69239&id=70279#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D23871

Files:
  cfe/trunk/docs/Modules.rst
  cfe/trunk/lib/Basic/Module.cpp
  cfe/trunk/lib/Headers/module.modulemap
  cfe/trunk/test/Modules/compiler_builtins_x86.c

Index: cfe/trunk/docs/Modules.rst
===
--- cfe/trunk/docs/Modules.rst
+++ cfe/trunk/docs/Modules.rst
@@ -413,6 +413,9 @@
 cplusplus11
   C++11 support is available.
 
+freestanding
+  A freestanding environment is available.
+
 gnuinlineasm
   GNU inline ASM is available.
 
Index: cfe/trunk/test/Modules/compiler_builtins_x86.c
===
--- cfe/trunk/test/Modules/compiler_builtins_x86.c
+++ cfe/trunk/test/Modules/compiler_builtins_x86.c
@@ -0,0 +1,6 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fsyntax-only -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t %s -verify -ffreestanding
+// expected-no-diagnostics
+
+#include
+
Index: cfe/trunk/lib/Basic/Module.cpp
===
--- cfe/trunk/lib/Basic/Module.cpp
+++ cfe/trunk/lib/Basic/Module.cpp
@@ -64,6 +64,7 @@
 .Case("blocks", LangOpts.Blocks)
 .Case("cplusplus", LangOpts.CPlusPlus)
 .Case("cplusplus11", LangOpts.CPlusPlus11)
+.Case("freestanding", LangOpts.Freestanding)
 .Case("gnuinlineasm", LangOpts.GNUAsm)
 .Case("objc", LangOpts.ObjC1)
 .Case("objc_arc", LangOpts.ObjCAutoRefCount)
Index: cfe/trunk/lib/Headers/module.modulemap
===
--- cfe/trunk/lib/Headers/module.modulemap
+++ cfe/trunk/lib/Headers/module.modulemap
@@ -63,6 +63,7 @@
 textual header "mwaitxintrin.h"
 
 explicit module mm_malloc {
+  requires !freestanding
   header "mm_malloc.h"
   export * // note: for  dependency
 }


Index: cfe/trunk/docs/Modules.rst
===
--- cfe/trunk/docs/Modules.rst
+++ cfe/trunk/docs/Modules.rst
@@ -413,6 +413,9 @@
 cplusplus11
   C++11 support is available.
 
+freestanding
+  A freestanding environment is available.
+
 gnuinlineasm
   GNU inline ASM is available.
 
Index: cfe/trunk/test/Modules/compiler_builtins_x86.c
===
--- cfe/trunk/test/Modules/compiler_builtins_x86.c
+++ cfe/trunk/test/Modules/compiler_builtins_x86.c
@@ -0,0 +1,6 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fsyntax-only -fmodules -fimplicit-module-maps -fmodules-cache-path=%t %s -verify -ffreestanding
+// expected-no-diagnostics
+
+#include
+
Index: cfe/trunk/lib/Basic/Module.cpp
===
--- cfe/trunk/lib/Basic/Module.cpp
+++ cfe/trunk/lib/Basic/Module.cpp
@@ -64,6 +64,7 @@
 .Case("blocks", LangOpts.Blocks)
 .Case("cplusplus", LangOpts.CPlusPlus)
 .Case("cplusplus11", LangOpts.CPlusPlus11)
+.Case("freestanding", LangOpts.Freestanding)
 .Case("gnuinlineasm", LangOpts.GNUAsm)
 .Case("objc", LangOpts.ObjC1)
 .Case("objc_arc", LangOpts.ObjCAutoRefCount)
Index: cfe/trunk/lib/Headers/module.modulemap
===
--- cfe/trunk/lib/Headers/module.modulemap
+++ cfe/trunk/lib/Headers/module.modulemap
@@ -63,6 +63,7 @@
 textual header "mwaitxintrin.h"
 
 explicit module mm_malloc {
+  requires !freestanding
   header "mm_malloc.h"
   export * // note: for  dependency
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r280613 - [Modules] Add 'freestanding' to the 'requires-declaration' feature-list.

2016-09-03 Thread Elad Cohen via cfe-commits
Author: eladcohen
Date: Sun Sep  4 01:00:42 2016
New Revision: 280613

URL: http://llvm.org/viewvc/llvm-project?rev=280613&view=rev
Log:
[Modules] Add 'freestanding' to the 'requires-declaration' feature-list.

This adds support for modules that require (non-)freestanding
environment, such as the compiler builtin mm_malloc submodule.

Differential Revision: https://reviews.llvm.org/D23871


Added:
cfe/trunk/test/Modules/compiler_builtins_x86.c
Modified:
cfe/trunk/docs/Modules.rst
cfe/trunk/lib/Basic/Module.cpp
cfe/trunk/lib/Headers/module.modulemap

Modified: cfe/trunk/docs/Modules.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/Modules.rst?rev=280613&r1=280612&r2=280613&view=diff
==
--- cfe/trunk/docs/Modules.rst (original)
+++ cfe/trunk/docs/Modules.rst Sun Sep  4 01:00:42 2016
@@ -413,6 +413,9 @@ cplusplus
 cplusplus11
   C++11 support is available.
 
+freestanding
+  A freestanding environment is available.
+
 gnuinlineasm
   GNU inline ASM is available.
 

Modified: cfe/trunk/lib/Basic/Module.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Module.cpp?rev=280613&r1=280612&r2=280613&view=diff
==
--- cfe/trunk/lib/Basic/Module.cpp (original)
+++ cfe/trunk/lib/Basic/Module.cpp Sun Sep  4 01:00:42 2016
@@ -64,6 +64,7 @@ static bool hasFeature(StringRef Feature
 .Case("blocks", LangOpts.Blocks)
 .Case("cplusplus", LangOpts.CPlusPlus)
 .Case("cplusplus11", LangOpts.CPlusPlus11)
+.Case("freestanding", LangOpts.Freestanding)
 .Case("gnuinlineasm", LangOpts.GNUAsm)
 .Case("objc", LangOpts.ObjC1)
 .Case("objc_arc", LangOpts.ObjCAutoRefCount)

Modified: cfe/trunk/lib/Headers/module.modulemap
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/module.modulemap?rev=280613&r1=280612&r2=280613&view=diff
==
--- cfe/trunk/lib/Headers/module.modulemap (original)
+++ cfe/trunk/lib/Headers/module.modulemap Sun Sep  4 01:00:42 2016
@@ -63,6 +63,7 @@ module _Builtin_intrinsics [system] [ext
 textual header "mwaitxintrin.h"
 
 explicit module mm_malloc {
+  requires !freestanding
   header "mm_malloc.h"
   export * // note: for  dependency
 }

Added: cfe/trunk/test/Modules/compiler_builtins_x86.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/compiler_builtins_x86.c?rev=280613&view=auto
==
--- cfe/trunk/test/Modules/compiler_builtins_x86.c (added)
+++ cfe/trunk/test/Modules/compiler_builtins_x86.c Sun Sep  4 01:00:42 2016
@@ -0,0 +1,6 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fsyntax-only -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t %s -verify -ffreestanding
+// expected-no-diagnostics
+
+#include
+


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


Re: [PATCH] D23871: [Modules] Add 'freestanding' to the 'requires-declaration' feature-list.

2016-09-03 Thread Elad Cohen via cfe-commits
eladcohen added a comment.

Thanks Richard, committed r280613.


Repository:
  rL LLVM

https://reviews.llvm.org/D23871



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


[PATCH] D25337: [Modules] Add a command line option for enabling the modules feature exclusively for the Clang builtins.

2016-10-19 Thread Elad Cohen via cfe-commits
eladcohen added a comment.

In https://reviews.llvm.org/D25337#571845, @bruno wrote:

> > The long answer is that there is a history of problems regarding the 
> > intrinsic files:
> >  http://lists.llvm.org/pipermail/cfe-dev/2016-May/048837.html
> >  http://lists.llvm.org/pipermail/cfe-dev/2016-September/050943.html
> >  Mainly compatibility issues because MSVC makes all the intrinsics 
> > available all the time, while in clang this is not always the case (On 
> > Windows the different h files are not-included unless asked for explicitly 
> > since AVX512 was added which impacted compile-time).
>
> Thinking a bit more about this: did you ever consider a solution where 
> "immintrin.h" (or any similar other) would use "#include_next" and 
> "__has_include_next" to point to a second level (user specified) immintrin.h, 
> which then could use ifdefs to only include what's relevant?


I don't think we really want the users to have to maintain an updated user 
specific version of immintrin.h. Moreover, I think that at the end we actually 
do want clang to always include all the intrinsics same as MSVC.

>> A suggestion was made to try and mitigate this by reducing the compile time 
>> using modules (only for the x86 intrinsics). This patch aims at adding this 
>> option. The new compile flag is just a milestone - if all goes well, we can 
>> turn this on by default (Then we won't actually need to use a specific 
>> compile flag, and we could always include all the intrinsic h files without 
>> their long compile time).
> 
> The speedup sounds nice, but it seems awkward IMO to have such specific 
> behavior for x86 intrinsics only.

The feature itself is not x86 specific. It can be used for all the clang 
builtins. As for enabling it by default, I did have only x86 in mind but it can 
be done for all targets as well. (will probably require checking that all the 
other intrinsic headers are modular and that the modulemap is up to date).


https://reviews.llvm.org/D25337



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


[PATCH] D25767: [Modules] Add a command line option for loading the clang builtins modulemap file.

2016-10-19 Thread Elad Cohen via cfe-commits
eladcohen created this revision.
eladcohen added reviewers: rsmith, bruno, zvi.
eladcohen added a subscriber: cfe-commits.

-fbuiltin-module-map loads the clang builtins modulemap file.
(This is equivalent to -fmodule-map-file=/include/module.modulemap)

It can be used for enabling clang's 'modules' feature for the clang intrinsics 
headers files.


https://reviews.llvm.org/D25767

Files:
  docs/Modules.rst
  include/clang/Driver/Options.td
  lib/Driver/Tools.cpp
  test/Driver/modules.m
  test/Modules/compiler_builtins.m
  test/Modules/compiler_builtins_x86.c
  test/lit.cfg


Index: test/lit.cfg
===
--- test/lit.cfg
+++ test/lit.cfg
@@ -268,6 +268,7 @@
 config.substitutions.append( ('%test_debuginfo', ' ' + config.llvm_src_root + 
'/utils/test_debuginfo.pl ') )
 config.substitutions.append( ('%itanium_abi_triple', 
makeItaniumABITriple(config.target_triple)) )
 config.substitutions.append( ('%ms_abi_triple', 
makeMSABITriple(config.target_triple)) )
+config.substitutions.append( ('%resource_dir', 
getClangBuiltinIncludeDir(config.clang)) )
 
 # The host triple might not be set, at least if we're compiling clang from
 # an already installed llvm.
Index: test/Modules/compiler_builtins_x86.c
===
--- test/Modules/compiler_builtins_x86.c
+++ test/Modules/compiler_builtins_x86.c
@@ -1,5 +1,6 @@
 // RUN: rm -rf %t
 // RUN: %clang_cc1 -triple i686-unknown-unknown -fsyntax-only -fmodules 
-fimplicit-module-maps -fmodules-cache-path=%t %s -verify -ffreestanding
+// RUN: %clang_cc1 -triple i686-unknown-unknown -fsyntax-only -fmodules 
-fmodule-map-file=%resource_dir/module.modulemap -fmodules-cache-path=%t %s 
-verify -ffreestanding
 // expected-no-diagnostics
 
 #include
Index: test/Modules/compiler_builtins.m
===
--- test/Modules/compiler_builtins.m
+++ test/Modules/compiler_builtins.m
@@ -1,6 +1,7 @@
 // RUN: rm -rf %t
 // RUN: %clang_cc1 -fsyntax-only -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t %s -I%S/Inputs/System/usr/include -verify
 // RUN: %clang_cc1 -fsyntax-only -std=c99 -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t %s -I%S/Inputs/System/usr/include -verify
+// RUN: %clang_cc1 -fsyntax-only -fmodules 
-fmodule-map-file=%resource_dir/module.modulemap -fmodules-cache-path=%t %s 
-I%S/Inputs/System/usr/include -verify
 // expected-no-diagnostics
 
 #ifdef __SSE__
Index: test/Driver/modules.m
===
--- test/Driver/modules.m
+++ test/Driver/modules.m
@@ -51,6 +51,10 @@
 // CHECK-MODULE-MAP-FILES: "-fmodule-map-file=foo.map"
 // CHECK-MODULE-MAP-FILES: "-fmodule-map-file=bar.map"
 
+// RUN: %clang -fmodules -fbuiltin-module-map -### %s 2>&1 | FileCheck 
-check-prefix=CHECK-BUILTIN-MODULE-MAP %s
+// CHECK-BUILTIN-MODULE-MAP: "-fmodules"
+// CHECK-BUILTIN-MODULE-MAP: 
"-fmodule-map-file={{.*}}include{{/|}}module.modulemap"
+
 // RUN: %clang -fmodules -fmodule-file=foo.pcm -fmodule-file=bar.pcm -### %s 
2>&1 | FileCheck -check-prefix=CHECK-MODULE-FILES %s
 // CHECK-MODULE-FILES: "-fmodules"
 // CHECK-MODULE-FILES: "-fmodule-file=foo.pcm"
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -5533,6 +5533,18 @@
   // definitions.
   Args.AddAllArgs(CmdArgs, options::OPT_fmodule_map_file);
 
+  // -fbuiltin-module-map can be used to load the clang
+  // builtin headers modulemap file.
+  if (Args.hasArg(options::OPT_fbuiltin_module_map)) {
+SmallString<128> BuiltinModuleMap(getToolChain().getDriver().ResourceDir);
+llvm::sys::path::append(BuiltinModuleMap, "include");
+llvm::sys::path::append(BuiltinModuleMap, "module.modulemap");
+if (llvm::sys::fs::exists(BuiltinModuleMap)) {
+  CmdArgs.push_back(Args.MakeArgString("-fmodule-map-file=" +
+   BuiltinModuleMap));
+}
+  }
+
   // -fmodule-file can be used to specify files containing precompiled modules.
   if (HaveAnyModules)
 Args.AddAllArgs(CmdArgs, options::OPT_fmodule_file);
Index: include/clang/Driver/Options.td
===
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -553,6 +553,8 @@
 def fborland_extensions : Flag<["-"], "fborland-extensions">, Group, 
Flags<[CC1Option]>,
   HelpText<"Accept non-standard constructs supported by the Borland compiler">;
 def fbuiltin : Flag<["-"], "fbuiltin">, Group;
+def fbuiltin_module_map : Flag <["-"], "fbuiltin-module-map">, Group,
+  Flags<[DriverOption]>, HelpText<"Load the clang builtins module map file.">;
 def fcaret_diagnostics : Flag<["-"], "fcaret-diagnostics">, Group;
 def fclasspath_EQ : Joined<["-"], "fclasspath=">, Group;
 def fcolor_diagnostics : Flag<["-"], "fcolor-diagnostics">, Group,
I

[PATCH] D25337: [Modules] Add a command line option for enabling the modules feature exclusively for the Clang builtins.

2016-10-19 Thread Elad Cohen via cfe-commits
eladcohen added a comment.

In https://reviews.llvm.org/D25337#571877, @rsmith wrote:

> I really don't like the command-line interface you're proposing here. It 
> seems like it will be extremely confusing what something like `-fmodules 
> -fexclusive-builtin-modules` means, for instance (usually, later `-f` flags 
> override earlier ones, so does this *turn off* modules for everything other 
> than builtin headers?). Instead, we should use a command-line interface that 
> more naturally / obviously composes with other flags.
>
> It seems like the behavior you want here is precisely:
>
>   `-fmodules -fno-implicit-module-maps -fmodule-map-file= dir>/include/module.modulemap`
>   
>
> (The `-fmodules-validate-system-headers` part would only make sense for 
> people using clang directly from their build area; installed / released 
> versions of clang should not need this. Adding it makes your flag compose 
> poorly with other uses of modules.)
>
> I'd be happy with you adding a flag that is equivalent to 
> `-fmodule-map-file=/include/module.modulemap`.


You are right, this is the behavior I was aiming at. I just hoped I could get a 
single flag to achieve it instead of 3, but I agree that it doesn't behave well 
with the other module flags.
I uploaded the new flag in a separate review: https://reviews.llvm.org/D25767

> Also, it seems unlikely to me that we would ever turn this on by default. It 
> will cause havoc for distributed builds, especially ones that run compilation 
> actions in 'clean' environments, as (for instance) it will cause the complete 
> set of intrinsics headers to be compiled into a module on every compile. So 
> if this is your proposed solution for slow compiles using intrinsics headers, 
> you should be aware that this is not a complete solution to that problem.

What do you mean by 'clean' environments? As in no intermediate artifacts (such 
as the .pcm files) could be cached?

Do you have any thoughts or suggestions on how we can make the solution more 
complete?

I guess one possibility to handle this matter (IIRC mentioned by Chandler in 
one of the discussions) is to pre-compile the actual builtins module as part of 
the build system. But IIUC this is not feasible since there could be a huge 
matrix of all the different configurations we will have to maintain, right?


https://reviews.llvm.org/D25337



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


r285548 - [Modules] Add a command line option for loading the clang builtins modulemap.

2016-10-31 Thread Elad Cohen via cfe-commits
Author: eladcohen
Date: Mon Oct 31 03:21:54 2016
New Revision: 285548

URL: http://llvm.org/viewvc/llvm-project?rev=285548&view=rev
Log:
[Modules] Add a command line option for loading the clang builtins modulemap.

-fbuiltin-module-map loads the clang builtins modulemap file. (This is
equivalent to -fmodule-map-file=/include/module.modulemap)

Differential Revision: https://reviews.llvm.org/D25767


Modified:
cfe/trunk/docs/Modules.rst
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/modules.m
cfe/trunk/test/Modules/compiler_builtins.m
cfe/trunk/test/Modules/compiler_builtins_x86.c
cfe/trunk/test/lit.cfg

Modified: cfe/trunk/docs/Modules.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/Modules.rst?rev=285548&r1=285547&r2=285548&view=diff
==
--- cfe/trunk/docs/Modules.rst (original)
+++ cfe/trunk/docs/Modules.rst Mon Oct 31 03:21:54 2016
@@ -174,6 +174,9 @@ Command-line parameters
 ``-fmodules``
   Enable the modules feature.
 
+``-fbuiltin-module-map``
+  Load the Clang builtins module map file. (Equivalent to 
``-fmodule-map-file=/include/module.modulemap``)
+
 ``-fimplicit-module-maps``
   Enable implicit search for module map files named ``module.modulemap`` and 
similar. This option is implied by ``-fmodules``. If this is disabled with 
``-fno-implicit-module-maps``, module map files will only be loaded if they are 
explicitly specified via ``-fmodule-map-file`` or transitively used by another 
module map file.
 

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=285548&r1=285547&r2=285548&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Mon Oct 31 03:21:54 2016
@@ -553,6 +553,8 @@ def fbootclasspath_EQ : Joined<["-"], "f
 def fborland_extensions : Flag<["-"], "fborland-extensions">, Group, 
Flags<[CC1Option]>,
   HelpText<"Accept non-standard constructs supported by the Borland compiler">;
 def fbuiltin : Flag<["-"], "fbuiltin">, Group;
+def fbuiltin_module_map : Flag <["-"], "fbuiltin-module-map">, Group,
+  Flags<[DriverOption]>, HelpText<"Load the clang builtins module map file.">;
 def fcaret_diagnostics : Flag<["-"], "fcaret-diagnostics">, Group;
 def fclasspath_EQ : Joined<["-"], "fclasspath=">, Group;
 def fcolor_diagnostics : Flag<["-"], "fcolor-diagnostics">, Group,

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=285548&r1=285547&r2=285548&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Mon Oct 31 03:21:54 2016
@@ -5636,6 +5636,18 @@ void Clang::ConstructJob(Compilation &C,
   // definitions.
   Args.AddAllArgs(CmdArgs, options::OPT_fmodule_map_file);
 
+  // -fbuiltin-module-map can be used to load the clang
+  // builtin headers modulemap file.
+  if (Args.hasArg(options::OPT_fbuiltin_module_map)) {
+SmallString<128> BuiltinModuleMap(getToolChain().getDriver().ResourceDir);
+llvm::sys::path::append(BuiltinModuleMap, "include");
+llvm::sys::path::append(BuiltinModuleMap, "module.modulemap");
+if (llvm::sys::fs::exists(BuiltinModuleMap)) {
+  CmdArgs.push_back(Args.MakeArgString("-fmodule-map-file=" +
+   BuiltinModuleMap));
+}
+  }
+
   // -fmodule-file can be used to specify files containing precompiled modules.
   if (HaveAnyModules)
 Args.AddAllArgs(CmdArgs, options::OPT_fmodule_file);

Modified: cfe/trunk/test/Driver/modules.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/modules.m?rev=285548&r1=285547&r2=285548&view=diff
==
--- cfe/trunk/test/Driver/modules.m (original)
+++ cfe/trunk/test/Driver/modules.m Mon Oct 31 03:21:54 2016
@@ -51,6 +51,10 @@
 // CHECK-MODULE-MAP-FILES: "-fmodule-map-file=foo.map"
 // CHECK-MODULE-MAP-FILES: "-fmodule-map-file=bar.map"
 
+// RUN: %clang -fmodules -fbuiltin-module-map -### %s 2>&1 | FileCheck 
-check-prefix=CHECK-BUILTIN-MODULE-MAP %s
+// CHECK-BUILTIN-MODULE-MAP: "-fmodules"
+// CHECK-BUILTIN-MODULE-MAP: 
"-fmodule-map-file={{.*}}include{{/|}}module.modulemap"
+
 // RUN: %clang -fmodules -fmodule-file=foo.pcm -fmodule-file=bar.pcm -### %s 
2>&1 | FileCheck -check-prefix=CHECK-MODULE-FILES %s
 // CHECK-MODULE-FILES: "-fmodules"
 // CHECK-MODULE-FILES: "-fmodule-file=foo.pcm"

Modified: cfe/trunk/test/Modules/compiler_builtins.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/compiler_builtins.m?rev=285548&r1=285547&r2=285548&view=diff
=

[PATCH] D25767: [Modules] Add a command line option for loading the clang builtins modulemap file.

2016-10-31 Thread Elad Cohen via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL285548: [Modules] Add a command line option for loading the 
clang builtins modulemap. (authored by eladcohen).

Changed prior to commit:
  https://reviews.llvm.org/D25767?vs=75133&id=76355#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25767

Files:
  cfe/trunk/docs/Modules.rst
  cfe/trunk/include/clang/Driver/Options.td
  cfe/trunk/lib/Driver/Tools.cpp
  cfe/trunk/test/Driver/modules.m
  cfe/trunk/test/Modules/compiler_builtins.m
  cfe/trunk/test/Modules/compiler_builtins_x86.c
  cfe/trunk/test/lit.cfg


Index: cfe/trunk/docs/Modules.rst
===
--- cfe/trunk/docs/Modules.rst
+++ cfe/trunk/docs/Modules.rst
@@ -174,6 +174,9 @@
 ``-fmodules``
   Enable the modules feature.
 
+``-fbuiltin-module-map``
+  Load the Clang builtins module map file. (Equivalent to 
``-fmodule-map-file=/include/module.modulemap``)
+
 ``-fimplicit-module-maps``
   Enable implicit search for module map files named ``module.modulemap`` and 
similar. This option is implied by ``-fmodules``. If this is disabled with 
``-fno-implicit-module-maps``, module map files will only be loaded if they are 
explicitly specified via ``-fmodule-map-file`` or transitively used by another 
module map file.
 
Index: cfe/trunk/include/clang/Driver/Options.td
===
--- cfe/trunk/include/clang/Driver/Options.td
+++ cfe/trunk/include/clang/Driver/Options.td
@@ -553,6 +553,8 @@
 def fborland_extensions : Flag<["-"], "fborland-extensions">, Group, 
Flags<[CC1Option]>,
   HelpText<"Accept non-standard constructs supported by the Borland compiler">;
 def fbuiltin : Flag<["-"], "fbuiltin">, Group;
+def fbuiltin_module_map : Flag <["-"], "fbuiltin-module-map">, Group,
+  Flags<[DriverOption]>, HelpText<"Load the clang builtins module map file.">;
 def fcaret_diagnostics : Flag<["-"], "fcaret-diagnostics">, Group;
 def fclasspath_EQ : Joined<["-"], "fclasspath=">, Group;
 def fcolor_diagnostics : Flag<["-"], "fcolor-diagnostics">, Group,
Index: cfe/trunk/test/Driver/modules.m
===
--- cfe/trunk/test/Driver/modules.m
+++ cfe/trunk/test/Driver/modules.m
@@ -51,6 +51,10 @@
 // CHECK-MODULE-MAP-FILES: "-fmodule-map-file=foo.map"
 // CHECK-MODULE-MAP-FILES: "-fmodule-map-file=bar.map"
 
+// RUN: %clang -fmodules -fbuiltin-module-map -### %s 2>&1 | FileCheck 
-check-prefix=CHECK-BUILTIN-MODULE-MAP %s
+// CHECK-BUILTIN-MODULE-MAP: "-fmodules"
+// CHECK-BUILTIN-MODULE-MAP: 
"-fmodule-map-file={{.*}}include{{/|}}module.modulemap"
+
 // RUN: %clang -fmodules -fmodule-file=foo.pcm -fmodule-file=bar.pcm -### %s 
2>&1 | FileCheck -check-prefix=CHECK-MODULE-FILES %s
 // CHECK-MODULE-FILES: "-fmodules"
 // CHECK-MODULE-FILES: "-fmodule-file=foo.pcm"
Index: cfe/trunk/test/lit.cfg
===
--- cfe/trunk/test/lit.cfg
+++ cfe/trunk/test/lit.cfg
@@ -268,6 +268,7 @@
 config.substitutions.append( ('%test_debuginfo', ' ' + config.llvm_src_root + 
'/utils/test_debuginfo.pl ') )
 config.substitutions.append( ('%itanium_abi_triple', 
makeItaniumABITriple(config.target_triple)) )
 config.substitutions.append( ('%ms_abi_triple', 
makeMSABITriple(config.target_triple)) )
+config.substitutions.append( ('%resource_dir', 
getClangBuiltinIncludeDir(config.clang)) )
 
 # The host triple might not be set, at least if we're compiling clang from
 # an already installed llvm.
Index: cfe/trunk/test/Modules/compiler_builtins_x86.c
===
--- cfe/trunk/test/Modules/compiler_builtins_x86.c
+++ cfe/trunk/test/Modules/compiler_builtins_x86.c
@@ -1,5 +1,6 @@
 // RUN: rm -rf %t
 // RUN: %clang_cc1 -triple i686-unknown-unknown -fsyntax-only -fmodules 
-fimplicit-module-maps -fmodules-cache-path=%t %s -verify -ffreestanding
+// RUN: %clang_cc1 -triple i686-unknown-unknown -fsyntax-only -fmodules 
-fmodule-map-file=%resource_dir/module.modulemap -fmodules-cache-path=%t %s 
-verify -ffreestanding
 // expected-no-diagnostics
 
 #include
Index: cfe/trunk/test/Modules/compiler_builtins.m
===
--- cfe/trunk/test/Modules/compiler_builtins.m
+++ cfe/trunk/test/Modules/compiler_builtins.m
@@ -1,6 +1,7 @@
 // RUN: rm -rf %t
 // RUN: %clang_cc1 -fsyntax-only -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t %s -I%S/Inputs/System/usr/include -verify
 // RUN: %clang_cc1 -fsyntax-only -std=c99 -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t %s -I%S/Inputs/System/usr/include -verify
+// RUN: %clang_cc1 -fsyntax-only -fmodules 
-fmodule-map-file=%resource_dir/module.modulemap -fmodules-cache-path=%t %s 
-I%S/Inputs/System/usr/include -verify
 // expected-no-diagnostics
 
 #ifdef __SSE__
Index: cfe/trunk/lib/Driver/Tools.cpp
===

[PATCH] D25767: [Modules] Add a command line option for loading the clang builtins modulemap file.

2016-10-31 Thread Elad Cohen via cfe-commits
eladcohen added a comment.

Thanks for the review! committed r285548.


Repository:
  rL LLVM

https://reviews.llvm.org/D25767



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