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