blob: 364cac3549402cc543ad5eb5678e66f6f0432bd7 [file] [log] [blame]
Anton Korobeynikove9ffb5b2008-03-23 08:57:20 +00001//===- 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
14class Tool<list<dag> l> {
15 list<dag> properties = l;
16}
17
Mikhail Glushenkov7adcf1e2008-05-09 08:27:26 +000018// Special Tool instance - the root node of the compilation graph.
Mikhail Glushenkov2cfd2232008-05-06 16:35:25 +000019
20def root : Tool<[]>;
21
Anton Korobeynikove9ffb5b2008-03-23 08:57:20 +000022// Possible Tool properties
23
24def in_language;
25def out_language;
26def output_suffix;
27def cmd_line;
28def join;
29def sink;
30
31// Possible option types
32
33def switch_option;
34def parameter_option;
35def parameter_list_option;
36def prefix_option;
37def prefix_list_option;
38
39// Possible option properties
40
41def append_cmd;
42def forward;
43def stop_compilation;
44def unpack_values;
45def help;
46def required;
47
Mikhail Glushenkovdedba642008-05-30 06:08:50 +000048// Marker for an empty DAG.
49def empty;
Mikhail Glushenkov46d4e972008-05-06 16:36:06 +000050
Mikhail Glushenkovdedba642008-05-30 06:08:50 +000051// The 'case' construct.
52def case;
53
54// Primitive tests.
Mikhail Glushenkov46d4e972008-05-06 16:36:06 +000055def switch_on;
56def parameter_equals;
57def element_in_list;
Mikhail Glushenkovdedba642008-05-30 06:08:50 +000058def input_languages_contain;
Mikhail Glushenkov35576b02008-05-30 06:10:19 +000059def default;
Mikhail Glushenkovd6228882008-05-06 18:15:12 +000060
Mikhail Glushenkovdedba642008-05-30 06:08:50 +000061// Boolean operators.
Mikhail Glushenkov3f6743e2008-05-06 17:22:47 +000062def and;
Mikhail Glushenkovd6228882008-05-06 18:15:12 +000063def or;
Mikhail Glushenkov46d4e972008-05-06 16:36:06 +000064
Mikhail Glushenkovdedba642008-05-30 06:08:50 +000065// Increase/decrease the edge weight.
66def inc_weight;
67def dec_weight;
68
Anton Korobeynikove9ffb5b2008-03-23 08:57:20 +000069// Map from suffixes to language names
70
71class LangToSuffixes<string str, list<string> lst> {
72 string lang = str;
73 list<string> suffixes = lst;
74}
75
76class LanguageMap<list<LangToSuffixes> lst> {
77 list<LangToSuffixes> map = lst;
78}
79
Mikhail Glushenkov2cfd2232008-05-06 16:35:25 +000080// Compilation graph
Anton Korobeynikove9ffb5b2008-03-23 08:57:20 +000081
Mikhail Glushenkovdedba642008-05-30 06:08:50 +000082class EdgeBase<Tool t1, Tool t2, dag d> {
Mikhail Glushenkov2cfd2232008-05-06 16:35:25 +000083 Tool a = t1;
84 Tool b = t2;
Mikhail Glushenkovdedba642008-05-30 06:08:50 +000085 dag weight = d;
Anton Korobeynikove9ffb5b2008-03-23 08:57:20 +000086}
87
Mikhail Glushenkovdedba642008-05-30 06:08:50 +000088class Edge<Tool t1, Tool t2> : EdgeBase<t1, t2, (empty)>;
Mikhail Glushenkov46d4e972008-05-06 16:36:06 +000089
Mikhail Glushenkovdfcad6c2008-05-06 18:18:20 +000090// Edge and SimpleEdge are synonyms.
Mikhail Glushenkovdedba642008-05-30 06:08:50 +000091class SimpleEdge<Tool t1, Tool t2> : EdgeBase<t1, t2, (empty)>;
Mikhail Glushenkov46d4e972008-05-06 16:36:06 +000092
93// Optionally enabled edge.
Mikhail Glushenkovdedba642008-05-30 06:08:50 +000094class OptionalEdge<Tool t1, Tool t2, dag props> : EdgeBase<t1, t2, props>;
Mikhail Glushenkov46d4e972008-05-06 16:36:06 +000095
96class CompilationGraph<list<EdgeBase> lst> {
97 list<EdgeBase> edges = lst;
Anton Korobeynikove9ffb5b2008-03-23 08:57:20 +000098}