diff options
author | Mikhail Glushenkov <foldr@codedgers.com> | 2008-05-30 06:08:50 +0000 |
---|---|---|
committer | Mikhail Glushenkov <foldr@codedgers.com> | 2008-05-30 06:08:50 +0000 |
commit | e5557f4da417388d54c102ad7dd046237487bce3 (patch) | |
tree | 5de78ed8167e5dc7fbdd0b2875ec95bf95a1ff2d /tools | |
parent | 61435195cecae519e1539747540a6563ed23b678 (diff) | |
download | llvm-e5557f4da417388d54c102ad7dd046237487bce3.tar.gz llvm-e5557f4da417388d54c102ad7dd046237487bce3.tar.bz2 llvm-e5557f4da417388d54c102ad7dd046237487bce3.tar.xz |
Add a generalised 'case' construct.
Besides assigning edge weights, it will also be used by the cmd_line tool property.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51727 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/llvmc2/Common.td | 27 | ||||
-rw-r--r-- | tools/llvmc2/Graph.td | 20 | ||||
-rw-r--r-- | tools/llvmc2/Makefile | 10 |
3 files changed, 33 insertions, 24 deletions
diff --git a/tools/llvmc2/Common.td b/tools/llvmc2/Common.td index b04596fb76..2a6b54eba8 100644 --- a/tools/llvmc2/Common.td +++ b/tools/llvmc2/Common.td @@ -45,19 +45,26 @@ def unpack_values; def help; def required; -// Possible edge properties +// Marker for an empty DAG. +def empty; -// 'Atomic' properties. +// The 'case' construct. +def case; + +// Primitive tests. def switch_on; def parameter_equals; def element_in_list; -def if_input_languages_contain; +def input_languages_contain; -// Edge property combinators. -def weight; +// Boolean operators. def and; def or; +// Increase/decrease the edge weight. +def inc_weight; +def dec_weight; + // Map from suffixes to language names class LangToSuffixes<string str, list<string> lst> { @@ -71,19 +78,19 @@ class LanguageMap<list<LangToSuffixes> lst> { // Compilation graph -class EdgeBase<Tool t1, Tool t2, list<dag> lst> { +class EdgeBase<Tool t1, Tool t2, dag d> { Tool a = t1; Tool b = t2; - list<dag> props = lst; + dag weight = d; } -class Edge<Tool t1, Tool t2> : EdgeBase<t1, t2, []>; +class Edge<Tool t1, Tool t2> : EdgeBase<t1, t2, (empty)>; // Edge and SimpleEdge are synonyms. -class SimpleEdge<Tool t1, Tool t2> : EdgeBase<t1, t2, []>; +class SimpleEdge<Tool t1, Tool t2> : EdgeBase<t1, t2, (empty)>; // Optionally enabled edge. -class OptionalEdge<Tool t1, Tool t2, list<dag> lst> : EdgeBase<t1, t2, lst>; +class OptionalEdge<Tool t1, Tool t2, dag props> : EdgeBase<t1, t2, props>; class CompilationGraph<list<EdgeBase> lst> { list<EdgeBase> edges = lst; diff --git a/tools/llvmc2/Graph.td b/tools/llvmc2/Graph.td index 6fb998b28b..5c2902e288 100644 --- a/tools/llvmc2/Graph.td +++ b/tools/llvmc2/Graph.td @@ -26,22 +26,24 @@ def CompilationGraph : CompilationGraph<[ Edge<llvm_gcc_cpp, llc>, Edge<llvm_as, llc>, - OptionalEdge<llvm_gcc_c, opt, [(switch_on "opt")]>, - OptionalEdge<llvm_gcc_cpp, opt, [(switch_on "opt")]>, - OptionalEdge<llvm_as, opt, [(switch_on "opt")]>, + 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, - [(if_input_languages_contain "c++"), - (or (parameter_equals "linker", "g++"), - (parameter_equals "linker", "c++"))]>, + (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, - [(if_input_languages_contain "c++"), - (or (parameter_equals "linker", "g++"), - (parameter_equals "linker", "c++"))]> + (case + (input_languages_contain "c++"), (inc_weight), + (or (parameter_equals "linker", "g++"), + (parameter_equals "linker", "c++")), (inc_weight))> ]>; diff --git a/tools/llvmc2/Makefile b/tools/llvmc2/Makefile index 0c4782b6e9..04cd954e53 100644 --- a/tools/llvmc2/Makefile +++ b/tools/llvmc2/Makefile @@ -14,15 +14,15 @@ REQUIRES_EH := 1 include $(LEVEL)/Makefile.common -GRAPH = Graph.td -TOOLS_SOURCE=$(GRAPH) Tools.td Common.td +GRAPH=Graph.td +TOOLS=Tools.td +TOOLS_SOURCE=$(GRAPH) $(TOOLS) Common.td # TOFIX: integrate this part into Makefile.rules? # The degree of horrorshowness in that file is too much for me atm. -$(ObjDir)/AutoGenerated.inc.tmp: $(TOOLS_SOURCE) $(ObjDir)/.dir - $(Echo) "Building LLVMCC configuration library with tblgen" +$(ObjDir)/AutoGenerated.inc.tmp: $(TOOLS_SOURCE) $(ObjDir)/.dir $(TBLGEN) + $(Echo) "Building LLVMC configuration library with tblgen" $(Verb) $(TableGen) -gen-llvmc -o $(call SYSPATH, $@) $< AutoGenerated.inc : $(ObjDir)/AutoGenerated.inc.tmp $(Verb) $(CMP) -s $@ $< || $(CP) $< $@ - |