blob: 32e0180f8b86717f7e4394d2f6de480fb97931e6 [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 Glushenkov46d4e972008-05-06 16:36:06 +000018// Special Tool instance - graph root.
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
50def switch_on;
51def parameter_equals;
52def element_in_list;
Mikhail Glushenkovd6228882008-05-06 18:15:12 +000053def if_input_languages_contain;
54
55// Edge property combinators.
Mikhail Glushenkovdfcad6c2008-05-06 18:18:20 +000056def weight;
Mikhail Glushenkov3f6743e2008-05-06 17:22:47 +000057def and;
Mikhail Glushenkovd6228882008-05-06 18:15:12 +000058def or;
Mikhail Glushenkov46d4e972008-05-06 16:36:06 +000059
Anton Korobeynikove9ffb5b2008-03-23 08:57:20 +000060// Map from suffixes to language names
61
62class LangToSuffixes<string str, list<string> lst> {
63 string lang = str;
64 list<string> suffixes = lst;
65}
66
67class LanguageMap<list<LangToSuffixes> lst> {
68 list<LangToSuffixes> map = lst;
69}
70
Mikhail Glushenkov2cfd2232008-05-06 16:35:25 +000071// Compilation graph
Anton Korobeynikove9ffb5b2008-03-23 08:57:20 +000072
Mikhail Glushenkov46d4e972008-05-06 16:36:06 +000073class EdgeBase<Tool t1, Tool t2, list<dag> lst> {
Mikhail Glushenkov2cfd2232008-05-06 16:35:25 +000074 Tool a = t1;
75 Tool b = t2;
Mikhail Glushenkov46d4e972008-05-06 16:36:06 +000076 list<dag> props = lst;
Anton Korobeynikove9ffb5b2008-03-23 08:57:20 +000077}
78
Mikhail Glushenkov46d4e972008-05-06 16:36:06 +000079class Edge<Tool t1, Tool t2> : EdgeBase<t1, t2, []>;
80
Mikhail Glushenkovdfcad6c2008-05-06 18:18:20 +000081// Edge and SimpleEdge are synonyms.
82class SimpleEdge<Tool t1, Tool t2> : EdgeBase<t1, t2, []>;
Mikhail Glushenkov46d4e972008-05-06 16:36:06 +000083
84// Optionally enabled edge.
85class OptionalEdge<Tool t1, Tool t2, list<dag> lst> : EdgeBase<t1, t2, lst>;
86
87class CompilationGraph<list<EdgeBase> lst> {
88 list<EdgeBase> edges = lst;
Anton Korobeynikove9ffb5b2008-03-23 08:57:20 +000089}