New tests for the 'case' expression: not_empty, in_language.
[oota-llvm.git] / tools / llvmc2 / Common.td
1 //===- Tools.td - Common definitions for LLVMCC  -----------*- tablegen -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains common definitions used in llvmcc tool description files.
11 //
12 //===----------------------------------------------------------------------===//
13
14 class Tool<list<dag> l> {
15       list<dag> properties = l;
16 }
17
18 // Special Tool instance - the root node of the compilation graph.
19
20 def root : Tool<[]>;
21
22 // Possible Tool properties
23
24 def in_language;
25 def out_language;
26 def output_suffix;
27 def cmd_line;
28 def join;
29 def sink;
30
31 // Possible option types
32
33 def switch_option;
34 def parameter_option;
35 def parameter_list_option;
36 def prefix_option;
37 def prefix_list_option;
38
39 // Possible option properties
40
41 def append_cmd;
42 def forward;
43 def stop_compilation;
44 def unpack_values;
45 def help;
46 def required;
47
48 // Marker for an empty DAG.
49 def empty;
50
51 // The 'case' construct.
52 def case;
53
54 // Primitive tests.
55 def switch_on;
56 def parameter_equals;
57 def element_in_list;
58 def input_languages_contain;
59 def not_empty;
60 // TOTHINK: remove?
61 def default;
62
63 // Boolean operators.
64 def and;
65 def or;
66
67 // Increase/decrease the edge weight.
68 def inc_weight;
69 def dec_weight;
70
71 // Map from suffixes to language names
72
73 class LangToSuffixes<string str, list<string> lst> {
74       string lang = str;
75       list<string> suffixes = lst;
76 }
77
78 class LanguageMap<list<LangToSuffixes> lst> {
79       list<LangToSuffixes> map = lst;
80 }
81
82 // Compilation graph
83
84 class EdgeBase<Tool t1, Tool t2, dag d> {
85       Tool a = t1;
86       Tool b = t2;
87       dag weight = d;
88 }
89
90 class Edge<Tool t1, Tool t2> : EdgeBase<t1, t2, (empty)>;
91
92 // Edge and SimpleEdge are synonyms.
93 class SimpleEdge<Tool t1, Tool t2> : EdgeBase<t1, t2, (empty)>;
94
95 // Optionally enabled edge.
96 class OptionalEdge<Tool t1, Tool t2, dag props> : EdgeBase<t1, t2, props>;
97
98 class CompilationGraph<list<EdgeBase> lst> {
99       list<EdgeBase> edges = lst;
100 }