[llvm-commits] [llvm] r114541 - in /llvm/trunk: test/LLVMC/C/emit-llvm-opt.c test/LLVMC/C/emit-llvm.c tools/llvmc/src/Base.td.in

Mikhail Glushenkov foldr at codedgers.com
Wed Sep 22 02:00:42 PDT 2010


Author: foldr
Date: Wed Sep 22 04:00:41 2010
New Revision: 114541

URL: http://llvm.org/viewvc/llvm-project?rev=114541&view=rev
Log:
llvmc: Support '-emit-llvm -S' with -opt.

Added:
    llvm/trunk/test/LLVMC/C/emit-llvm-opt.c
Modified:
    llvm/trunk/test/LLVMC/C/emit-llvm.c
    llvm/trunk/tools/llvmc/src/Base.td.in

Added: llvm/trunk/test/LLVMC/C/emit-llvm-opt.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/LLVMC/C/emit-llvm-opt.c?rev=114541&view=auto
==============================================================================
--- llvm/trunk/test/LLVMC/C/emit-llvm-opt.c (added)
+++ llvm/trunk/test/LLVMC/C/emit-llvm-opt.c Wed Sep 22 04:00:41 2010
@@ -0,0 +1,7 @@
+// RUN: llvmc -c -opt -emit-llvm -o - %s | llvm-dis | grep "@f0()" | count 1
+// RUN: llvmc -c -opt -emit-llvm -S -o - %s | grep "@f0()" | count 1
+// RUN: llvmc --dry-run -c -opt -emit-llvm %s |& grep "^opt"
+// XFAIL: vg_leak
+
+int f0(void) {
+}

Modified: llvm/trunk/test/LLVMC/C/emit-llvm.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/LLVMC/C/emit-llvm.c?rev=114541&r1=114540&r2=114541&view=diff
==============================================================================
--- llvm/trunk/test/LLVMC/C/emit-llvm.c (original)
+++ llvm/trunk/test/LLVMC/C/emit-llvm.c Wed Sep 22 04:00:41 2010
@@ -1,4 +1,5 @@
 // RUN: llvmc -c -emit-llvm -o - %s | llvm-dis | grep "@f0()" | count 1
+// RUN: llvmc -c -emit-llvm -S -o - %s | grep "@f0()" | count 1
 // XFAIL: vg_leak
 
 int f0(void) {

Modified: llvm/trunk/tools/llvmc/src/Base.td.in
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/src/Base.td.in?rev=114541&r1=114540&r2=114541&view=diff
==============================================================================
--- llvm/trunk/tools/llvmc/src/Base.td.in (original)
+++ llvm/trunk/tools/llvmc/src/Base.td.in Wed Sep 22 04:00:41 2010
@@ -178,14 +178,20 @@
          (switch_on "E"),
               [(forward "E"), (stop_compilation), (output_suffix E_ext)],
          (and (switch_on "E"), (empty "o")), (no_out_file),
-         (switch_on ["emit-llvm", "S"]),
-              [(output_suffix "ll"), (stop_compilation)],
-         (switch_on ["emit-llvm", "c"]), (stop_compilation),
+
+         // ('-emit-llvm') && !('opt') -> stop compilation
+         (and (switch_on "emit-llvm"), (not (switch_on "opt"))),
+              (stop_compilation),
+         // ('-S' && '-emit-llvm') && !('opt') -> output .ll
+         (and (switch_on ["emit-llvm", "S"]), (not (switch_on "opt"))),
+              [(forward "S"), (output_suffix "ll")],
+         // Ususally just output .bc
+         (not (switch_on "fsyntax-only")),
+              [(append_cmd "-c"), (append_cmd "-emit-llvm")],
+
+         // -fsyntax-only
          (switch_on "fsyntax-only"), [(forward "fsyntax-only"),
                                       (no_out_file), (stop_compilation)],
-         (switch_on ["S", "emit-llvm"]), [(forward "S"), (forward "emit-llvm")],
-         (not (or (switch_on ["S", "emit-llvm"]), (switch_on "fsyntax-only"))),
-             [(append_cmd "-c"), (append_cmd "-emit-llvm")],
 
          // Forwards
          (not_empty "Xpreprocessor"), (forward "Xpreprocessor"),
@@ -242,7 +248,10 @@
 [(in_language "llvm-bitcode"),
  (out_language "llvm-bitcode"),
  (output_suffix "opt.bc"),
- (actions (case (not_empty "Wo,"), (forward_value "Wo,"),
+ (actions (case (switch_on "emit-llvm"), (stop_compilation),
+                (switch_on ["emit-llvm", "S"]),
+                [(append_cmd "-S"), (output_suffix "ll")],
+                (not_empty "Wo,"), (forward_value "Wo,"),
                 (switch_on "O1"), (forward "O1"),
                 (switch_on "O2"), (forward "O2"),
                 (switch_on "O3"), (forward "O3"))),





More information about the llvm-commits mailing list