blob: 44358573764a9e98fdfcd3e779985e89096ac5fc [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;
53
54// Property combinators
55// TOFIX: implement
56def and;
57def or;
58
Anton Korobeynikove9ffb5b2008-03-23 08:57:20 +000059// Map from suffixes to language names
60
61class LangToSuffixes<string str, list<string> lst> {
62 string lang = str;
63 list<string> suffixes = lst;
64}
65
66class LanguageMap<list<LangToSuffixes> lst> {
67 list<LangToSuffixes> map = lst;
68}
69
Mikhail Glushenkov2cfd2232008-05-06 16:35:25 +000070// Compilation graph
Anton Korobeynikove9ffb5b2008-03-23 08:57:20 +000071
Mikhail Glushenkov46d4e972008-05-06 16:36:06 +000072class EdgeBase<Tool t1, Tool t2, list<dag> lst> {
Mikhail Glushenkov2cfd2232008-05-06 16:35:25 +000073 Tool a = t1;
74 Tool b = t2;
Mikhail Glushenkov46d4e972008-05-06 16:36:06 +000075 list<dag> props = lst;
Anton Korobeynikove9ffb5b2008-03-23 08:57:20 +000076}
77
Mikhail Glushenkov46d4e972008-05-06 16:36:06 +000078class Edge<Tool t1, Tool t2> : EdgeBase<t1, t2, []>;
79
80// Edge and DefaultEdge are synonyms.
81class DefaultEdge<Tool t1, Tool t2> : EdgeBase<t1, t2, []>;
82
83// Optionally enabled edge.
84class OptionalEdge<Tool t1, Tool t2, list<dag> lst> : EdgeBase<t1, t2, lst>;
85
86class CompilationGraph<list<EdgeBase> lst> {
87 list<EdgeBase> edges = lst;
Anton Korobeynikove9ffb5b2008-03-23 08:57:20 +000088}