llvmc: split llvm_gcc_based into llvm_gcc_{pch,comp}_based.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114434 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/llvmc/src/Base.td.in b/tools/llvmc/src/Base.td.in
index f82276c..12c283a 100644
--- a/tools/llvmc/src/Base.td.in
+++ b/tools/llvmc/src/Base.td.in
@@ -165,10 +165,10 @@
 // Tools
 
 class llvm_gcc_based <string cmd, string in_lang,
-                      string E_ext, string out_lang> : Tool<
+                      string E_ext, string out_lang, string out_ext> : Tool<
 [(in_language in_lang),
- (out_language "llvm-bitcode"),
- (output_suffix out_lang),
+ (out_language out_lang),
+ (output_suffix out_ext),
  (command cmd),
  (actions
      (case
@@ -214,24 +214,29 @@
  (sink)
 ]>;
 
-def llvm_gcc_c : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x c", "c", "i", "bc">;
-def llvm_gcc_cpp : llvm_gcc_based<"@LLVMGXXCOMMAND@ -x c++", "c++", "i", "bc">;
-def llvm_gcc_m : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x objective-c",
-                                                  "objective-c", "mi", "bc">;
-def llvm_gcc_mxx : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x objective-c++",
-                                  "objective-c++", "mi", "bc">;
+class llvm_gcc_comp_based <string cmd, string in_lang, string E_ext>
+: llvm_gcc_based<cmd, in_lang, E_ext, "llvm-bitcode", "bc">;
 
-def llvm_gcc_c_pch : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x c-header",
-                                                      "c-header", "i", "gch">;
-def llvm_gcc_cpp_pch : llvm_gcc_based<"@LLVMGXXCOMMAND@ -x c++-header",
-                                                        "c++-header",
-                                                        "i", "gch">;
-def llvm_gcc_m_pch : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x objective-c-header",
-                                                      "objective-c-header",
-                                                      "mi", "gch">;
-def llvm_gcc_mxx_pch
-    : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x objective-c++-header",
-                                       "objective-c++-header", "mi", "gch">;
+class llvm_gcc_pch_based <string cmd, string in_lang, string E_ext>
+: llvm_gcc_based<cmd, in_lang, E_ext, "precompiled-header", "gch">;
+
+def llvm_gcc_c : llvm_gcc_comp_based
+    <"@LLVMGCCCOMMAND@ -x c", "c", "i">;
+def llvm_gcc_cpp : llvm_gcc_comp_based
+    <"@LLVMGXXCOMMAND@ -x c++", "c++", "i">;
+def llvm_gcc_m : llvm_gcc_comp_based
+    <"@LLVMGCCCOMMAND@ -x objective-c", "objective-c", "mi">;
+def llvm_gcc_mxx : llvm_gcc_comp_based
+    <"@LLVMGCCCOMMAND@ -x objective-c++", "objective-c++", "mi">;
+
+def llvm_gcc_c_pch : llvm_gcc_pch_based
+    <"@LLVMGCCCOMMAND@ -x c-header", "c-header", "i">;
+def llvm_gcc_cpp_pch : llvm_gcc_pch_based
+    <"@LLVMGXXCOMMAND@ -x c++-header", "c++-header", "i">;
+def llvm_gcc_m_pch : llvm_gcc_pch_based
+    <"@LLVMGCCCOMMAND@ -x objective-c-header", "objective-c-header", "mi">;
+def llvm_gcc_mxx_pch : llvm_gcc_pch_based
+    <"@LLVMGCCCOMMAND@ -x objective-c++-header", "objective-c++-header", "mi">;
 
 def opt : Tool<
 [(in_language "llvm-bitcode"),
@@ -343,6 +348,7 @@
 // Language map
 
 def LanguageMap : LanguageMap<[
+    (lang_to_suffixes "precompiled-header", ["gch", "pch"]),
     (lang_to_suffixes "c++", ["cc", "cp", "cxx", "cpp", "CPP", "c++", "C"]),
     (lang_to_suffixes "c++-header", "hpp"),
     (lang_to_suffixes "c", "c"),