llvmc: Add a new option type (switch_list).
[oota-llvm.git] / include / llvm / CompilerDriver / Common.td
1 //===- Common.td - Common definitions for LLVMC2  ----------*- 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 llvmc tool description files.
11 //
12 //===----------------------------------------------------------------------===//
13
14 class Tool<list<dag> l> {
15       list<dag> properties = l;
16 }
17
18 // Possible Tool properties.
19
20 def in_language;
21 def out_language;
22 def output_suffix;
23 def command;
24 def out_file_option;
25 def in_file_option;
26 def join;
27 def sink;
28 def works_on_empty;
29 def actions;
30
31 // Possible option types.
32
33 def alias_option;
34 def switch_option;
35 def switch_list_option;
36 def parameter_option;
37 def parameter_list_option;
38 def prefix_option;
39 def prefix_list_option;
40
41 // Possible option properties.
42
43 def extern;
44 def help;
45 def hidden;
46 def init;
47 def multi_val;
48 def one_or_more;
49 def zero_or_more;
50 def optional;
51 def really_hidden;
52 def required;
53 def comma_separated;
54 def forward_not_split;
55
56 // The 'case' construct.
57 def case;
58
59 // Boolean constants.
60 def true;
61 def false;
62
63 // Boolean operators.
64 def and;
65 def or;
66 def not;
67
68 // Primitive tests.
69 def switch_on;
70 def parameter_equals;
71 def element_in_list;
72 def input_languages_contain;
73 def empty;
74 def not_empty;
75 def default;
76 def single_input_file;
77 def multiple_input_files;
78 def any_switch_on;
79 def any_not_empty;
80 def any_empty;
81
82 // Possible actions.
83
84 def append_cmd;
85 def forward;
86 def forward_as;
87 def forward_value;
88 def forward_transformed_value;
89 def stop_compilation;
90 def no_out_file;
91 def unpack_values;
92 def warning;
93 def error;
94 def set_option;
95 def unset_option;
96
97 // Increase/decrease the edge weight.
98 def inc_weight;
99 def dec_weight;
100
101 // Empty DAG marker.
102 def empty_dag_marker;
103
104 // Used to specify plugin priority.
105 class PluginPriority<int p> {
106       int priority = p;
107 }
108
109 // Option list - a single place to specify options.
110 class OptionList<list<dag> l> {
111       list<dag> options = l;
112 }
113
114 // Option preprocessor - actions taken during plugin loading.
115 class OptionPreprocessor<dag d> {
116       dag preprocessor = d;
117 }
118
119 // Map from suffixes to language names
120
121 class LangToSuffixes<string str, list<string> lst> {
122       string lang = str;
123       list<string> suffixes = lst;
124 }
125
126 class LanguageMap<list<LangToSuffixes> lst> {
127       list<LangToSuffixes> map = lst;
128 }
129
130 // Compilation graph
131
132 class EdgeBase<string t1, string t2, dag d> {
133       string a = t1;
134       string b = t2;
135       dag weight = d;
136 }
137
138 class Edge<string t1, string t2> : EdgeBase<t1, t2, (empty_dag_marker)>;
139
140 // Edge and SimpleEdge are synonyms.
141 class SimpleEdge<string t1, string t2> : EdgeBase<t1, t2, (empty_dag_marker)>;
142
143 // Optionally enabled edge.
144 class OptionalEdge<string t1, string t2, dag props> : EdgeBase<t1, t2, props>;
145
146 class CompilationGraph<list<EdgeBase> lst> {
147       list<EdgeBase> edges = lst;
148 }