diff options
Diffstat (limited to 'tools/llvmc2/plugins')
-rw-r--r-- | tools/llvmc2/plugins/Base/AutoGenerated.cpp | 1 | ||||
-rw-r--r-- | tools/llvmc2/plugins/Base/Base.td | 49 | ||||
-rw-r--r-- | tools/llvmc2/plugins/Base/Makefile | 12 | ||||
-rw-r--r-- | tools/llvmc2/plugins/Clang/AutoGenerated.cpp | 1 | ||||
-rw-r--r-- | tools/llvmc2/plugins/Clang/Clang.td | 86 | ||||
-rw-r--r-- | tools/llvmc2/plugins/Clang/Makefile | 13 | ||||
-rw-r--r-- | tools/llvmc2/plugins/Hello/Makefile | 11 |
7 files changed, 165 insertions, 8 deletions
diff --git a/tools/llvmc2/plugins/Base/AutoGenerated.cpp b/tools/llvmc2/plugins/Base/AutoGenerated.cpp new file mode 100644 index 0000000000..add8acb4a5 --- /dev/null +++ b/tools/llvmc2/plugins/Base/AutoGenerated.cpp @@ -0,0 +1 @@ +#include "AutoGenerated.inc" diff --git a/tools/llvmc2/plugins/Base/Base.td b/tools/llvmc2/plugins/Base/Base.td new file mode 100644 index 0000000000..bc40dd56ed --- /dev/null +++ b/tools/llvmc2/plugins/Base/Base.td @@ -0,0 +1,49 @@ +//===- Graph.td - LLVMC2 toolchain descriptions ------------*- tablegen -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file contains compilation graph description used by llvmc2. +// +//===----------------------------------------------------------------------===// + +include "llvm/CompilerDriver/Common.td" +include "llvm/CompilerDriver/Tools.td" + +// Toolchains + +def CompilationGraph : CompilationGraph<[ + Edge<root, llvm_gcc_c>, + Edge<root, llvm_gcc_assembler>, + Edge<root, llvm_gcc_cpp>, + Edge<root, llvm_as>, + + Edge<llvm_gcc_c, llc>, + Edge<llvm_gcc_cpp, llc>, + Edge<llvm_as, llc>, + + OptionalEdge<llvm_gcc_c, opt, (case (switch_on "opt"), (inc_weight))>, + OptionalEdge<llvm_gcc_cpp, opt, (case (switch_on "opt"), (inc_weight))>, + OptionalEdge<llvm_as, opt, (case (switch_on "opt"), (inc_weight))>, + Edge<opt, llc>, + + Edge<llc, llvm_gcc_assembler>, + Edge<llvm_gcc_assembler, llvm_gcc_linker>, + OptionalEdge<llvm_gcc_assembler, llvm_gcc_cpp_linker, + (case + (input_languages_contain "c++"), (inc_weight), + (or (parameter_equals "linker", "g++"), + (parameter_equals "linker", "c++")), (inc_weight))>, + + + Edge<root, llvm_gcc_linker>, + OptionalEdge<root, llvm_gcc_cpp_linker, + (case + (input_languages_contain "c++"), (inc_weight), + (or (parameter_equals "linker", "g++"), + (parameter_equals "linker", "c++")), (inc_weight))> + ]>; diff --git a/tools/llvmc2/plugins/Base/Makefile b/tools/llvmc2/plugins/Base/Makefile new file mode 100644 index 0000000000..e72f4fe38e --- /dev/null +++ b/tools/llvmc2/plugins/Base/Makefile @@ -0,0 +1,12 @@ +##===- tools/llvmc2/plugins/Base/Makefile ------------------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## + +LLVMC_PLUGIN = Base + +include ../Makefile.common diff --git a/tools/llvmc2/plugins/Clang/AutoGenerated.cpp b/tools/llvmc2/plugins/Clang/AutoGenerated.cpp new file mode 100644 index 0000000000..add8acb4a5 --- /dev/null +++ b/tools/llvmc2/plugins/Clang/AutoGenerated.cpp @@ -0,0 +1 @@ +#include "AutoGenerated.inc" diff --git a/tools/llvmc2/plugins/Clang/Clang.td b/tools/llvmc2/plugins/Clang/Clang.td new file mode 100644 index 0000000000..9985d70cda --- /dev/null +++ b/tools/llvmc2/plugins/Clang/Clang.td @@ -0,0 +1,86 @@ +// A (first stab at a) replacement for the Clang's ccc script. +// To compile, use this command: +// cd $LLVMC2_DIR +// make TOOLNAME=ccc2 BUILTIN_PLUGINS=Clang + +include "llvm/CompilerDriver/Common.td" + + +def Options : OptionList<[ +(switch_option "E", + (help "Stop after the preprocessing stage, do not run the compiler")) +]>; + +class clang_base<string language, dag cmdline> : Tool< +[(in_language language), + (out_language "llvm-bitcode"), + (output_suffix "bc"), + (cmd_line cmdline), + (switch_option "E", (stop_compilation), (output_suffix "i")), + (sink) +]>; + +def clang_c : clang_base<"c", +(case +(switch_on "E"), + (case + (not_empty "o"), + "clang -E -x c $INFILE -o $OUTFILE", + (default), + "clang -E -x c $INFILE"), +(default), + "clang -emit-llvm-bc -x c $INFILE -o $OUTFILE")>; + +def clang_cpp : clang_base<"c++", +(case +(switch_on "E"), + (case + (not_empty "o"), + "clang -E -x c++ $INFILE -o $OUTFILE", + (default), + "clang -E -x c++ $INFILE"), +(default), + "clang -emit-llvm-bc -x c++ $INFILE -o $OUTFILE")>; + +def clang_objective_c : clang_base<"objective-c", +(case +(switch_on "E"), + (case + (not_empty "o"), + "clang -E -x objective-c $INFILE -o $OUTFILE", + (default), + "clang -E -x objective-c $INFILE"), +(default), + "clang -emit-llvm-bc -x objective-c $INFILE -o $OUTFILE")>; + +// Default linker +def llvm_ld : Tool< +[(in_language "llvm-bitcode"), + (out_language "executable"), + (output_suffix "out"), + (cmd_line "llvm-ld -native -disable-internalize $INFILE -o $OUTFILE"), + (prefix_list_option "L", (forward), (help "Specify a library search path")), + (join) +]>; + +// Language map + +def LanguageMap : LanguageMap< + [LangToSuffixes<"c++", ["cc", "cp", "cxx", "cpp", "CPP", "c++", "C"]>, + LangToSuffixes<"c", ["c"]>, + LangToSuffixes<"objective-c", ["m"]>, + LangToSuffixes<"c-cpp-output", ["i"]>, + LangToSuffixes<"objective-c-cpp-output", ["mi"]> + ]>; + +// Compilation graph + +def CompilationGraph : CompilationGraph<[ + Edge<root, clang_c>, + Edge<root, clang_cpp>, + Edge<root, clang_objective_c>, + Edge<clang_c, llvm_ld>, + Edge<clang_cpp, llvm_ld>, + Edge<clang_objective_c, llvm_ld> + ]>; + diff --git a/tools/llvmc2/plugins/Clang/Makefile b/tools/llvmc2/plugins/Clang/Makefile new file mode 100644 index 0000000000..8904588222 --- /dev/null +++ b/tools/llvmc2/plugins/Clang/Makefile @@ -0,0 +1,13 @@ +##===- tools/llvmc2/plugins/Clang/Makefile -----------------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## + +LLVMC_PLUGIN = Clang + +include ../Makefile.common + diff --git a/tools/llvmc2/plugins/Hello/Makefile b/tools/llvmc2/plugins/Hello/Makefile index 3aeef24eea..8cd0b57a00 100644 --- a/tools/llvmc2/plugins/Hello/Makefile +++ b/tools/llvmc2/plugins/Hello/Makefile @@ -1,4 +1,4 @@ -##===- lib/Transforms/Hello/Makefile -----------------------*- Makefile -*-===## +##===- tools/llvmc2/plugins/Hello/Makefile -----------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # @@ -7,11 +7,6 @@ # ##===----------------------------------------------------------------------===## -LEVEL = ../../../.. -LIBRARYNAME = LLVMCHello -LOADABLE_MODULE = 1 -REQUIRES_EH = 1 -USEDLIBS = - -include $(LEVEL)/Makefile.common +LLVMC_PLUGIN = Hello +include ../Makefile.common |