blob: b04596fb76e7b530a1a245b1d459824b76854786 [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 Glushenkov46d4e972008-05-06 16:36:06 +000048// Possible edge properties
49
Mikhail Glushenkov7adcf1e2008-05-09 08:27:26 +000050// 'Atomic' properties.
Mikhail Glushenkov46d4e972008-05-06 16:36:06 +000051def switch_on;
52def parameter_equals;
53def element_in_list;
Mikhail Glushenkovd6228882008-05-06 18:15:12 +000054def if_input_languages_contain;
55
56// Edge property combinators.
Mikhail Glushenkovdfcad6c2008-05-06 18:18:20 +000057def weight;
Mikhail Glushenkov3f6743e2008-05-06 17:22:47 +000058def and;
Mikhail Glushenkovd6228882008-05-06 18:15:12 +000059def or;
Mikhail Glushenkov46d4e972008-05-06 16:36:06 +000060
Anton Korobeynikove9ffb5b2008-03-23 08:57:20 +000061// Map from suffixes to language names
62
63class LangToSuffixes<string str, list<string> lst> {
64 string lang = str;
65 list<string> suffixes = lst;
66}
67
68class LanguageMap<list<LangToSuffixes> lst> {
69 list<LangToSuffixes> map = lst;
70}
71
Mikhail Glushenkov2cfd2232008-05-06 16:35:25 +000072// Compilation graph
Anton Korobeynikove9ffb5b2008-03-23 08:57:20 +000073
Mikhail Glushenkov46d4e972008-05-06 16:36:06 +000074class EdgeBase<Tool t1, Tool t2, list<dag> lst> {
Mikhail Glushenkov2cfd2232008-05-06 16:35:25 +000075 Tool a = t1;
76 Tool b = t2;
Mikhail Glushenkov46d4e972008-05-06 16:36:06 +000077 list<dag> props = lst;
Anton Korobeynikove9ffb5b2008-03-23 08:57:20 +000078}
79
Mikhail Glushenkov46d4e972008-05-06 16:36:06 +000080class Edge<Tool t1, Tool t2> : EdgeBase<t1, t2, []>;
81
Mikhail Glushenkovdfcad6c2008-05-06 18:18:20 +000082// Edge and SimpleEdge are synonyms.
83class SimpleEdge<Tool t1, Tool t2> : EdgeBase<t1, t2, []>;
Mikhail Glushenkov46d4e972008-05-06 16:36:06 +000084
85// Optionally enabled edge.
86class OptionalEdge<Tool t1, Tool t2, list<dag> lst> : EdgeBase<t1, t2, lst>;
87
88class CompilationGraph<list<EdgeBase> lst> {
89 list<EdgeBase> edges = lst;
Anton Korobeynikove9ffb5b2008-03-23 08:57:20 +000090}