Protect ChangeCompareStride from situations in which it is possible
[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 // Option list - used to specify aliases and sometimes help strings.
73 class OptionList<list<dag> l> {
74       list<dag> options = l;
75 }
76
77 // Map from suffixes to language names
78
79 class LangToSuffixes<string str, list<string> lst> {
80       string lang = str;
81       list<string> suffixes = lst;
82 }
83
84 class LanguageMap<list<LangToSuffixes> lst> {
85       list<LangToSuffixes> map = lst;
86 }
87
88 // Compilation graph
89
90 class EdgeBase<Tool t1, Tool t2, dag d> {
91       Tool a = t1;
92       Tool b = t2;
93       dag weight = d;
94 }
95
96 class Edge<Tool t1, Tool t2> : EdgeBase<t1, t2, (empty)>;
97
98 // Edge and SimpleEdge are synonyms.
99 class SimpleEdge<Tool t1, Tool t2> : EdgeBase<t1, t2, (empty)>;
100
101 // Optionally enabled edge.
102 class OptionalEdge<Tool t1, Tool t2, dag props> : EdgeBase<t1, t2, props>;
103
104 class CompilationGraph<list<EdgeBase> lst> {
105       list<EdgeBase> edges = lst;
106 }