Add support for option aliases.
[oota-llvm.git] / tools / llvmc2 / Common.td
1 //===- Common.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 alias_option;
34 def switch_option;
35 def parameter_option;
36 def parameter_list_option;
37 def prefix_option;
38 def prefix_list_option;
39
40 // Possible option properties
41
42 def append_cmd;
43 def forward;
44 def stop_compilation;
45 def unpack_values;
46 def help;
47 def required;
48
49 // Empty DAG marker.
50 def empty;
51
52 // The 'case' construct.
53 def case;
54
55 // Primitive tests.
56 def switch_on;
57 def parameter_equals;
58 def element_in_list;
59 def input_languages_contain;
60 def not_empty;
61 // TOTHINK: remove?
62 def default;
63
64 // Boolean operators.
65 def and;
66 def or;
67
68 // Increase/decrease the edge weight.
69 def inc_weight;
70 def dec_weight;
71
72 // Map from suffixes to language names
73
74 class LangToSuffixes<string str, list<string> lst> {
75       string lang = str;
76       list<string> suffixes = lst;
77 }
78
79 class LanguageMap<list<LangToSuffixes> lst> {
80       list<LangToSuffixes> map = lst;
81 }
82
83 // Compilation graph
84
85 class EdgeBase<Tool t1, Tool t2, dag d> {
86       Tool a = t1;
87       Tool b = t2;
88       dag weight = d;
89 }
90
91 class Edge<Tool t1, Tool t2> : EdgeBase<t1, t2, (empty)>;
92
93 // Edge and SimpleEdge are synonyms.
94 class SimpleEdge<Tool t1, Tool t2> : EdgeBase<t1, t2, (empty)>;
95
96 // Optionally enabled edge.
97 class OptionalEdge<Tool t1, Tool t2, dag props> : EdgeBase<t1, t2, props>;
98
99 class CompilationGraph<list<EdgeBase> lst> {
100       list<EdgeBase> edges = lst;
101 }