blob: 046e19e4448e2db484c88cdb21a53b7c3eb8e6e9 [file] [log] [blame]
Mikhail Glushenkov2d3327f2008-05-30 06:20:54 +00001//===- Common.td - Common definitions for LLVMCC ----------*- tablegen -*-===//
Anton Korobeynikove9ffb5b2008-03-23 08:57:20 +00002//
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
Mikhail Glushenkovb623c322008-05-30 06:22:52 +000033def alias_option;
Anton Korobeynikove9ffb5b2008-03-23 08:57:20 +000034def switch_option;
35def parameter_option;
36def parameter_list_option;
37def prefix_option;
38def prefix_list_option;
39
40// Possible option properties
41
42def append_cmd;
43def forward;
44def stop_compilation;
45def unpack_values;
46def help;
47def required;
48
Mikhail Glushenkovb623c322008-05-30 06:22:52 +000049// Empty DAG marker.
Mikhail Glushenkovdedba642008-05-30 06:08:50 +000050def empty;
Mikhail Glushenkov46d4e972008-05-06 16:36:06 +000051
Mikhail Glushenkovdedba642008-05-30 06:08:50 +000052// The 'case' construct.
53def case;
54
55// Primitive tests.
Mikhail Glushenkov46d4e972008-05-06 16:36:06 +000056def switch_on;
57def parameter_equals;
58def element_in_list;
Mikhail Glushenkovdedba642008-05-30 06:08:50 +000059def input_languages_contain;
Mikhail Glushenkov242d0e62008-05-30 06:19:52 +000060def not_empty;
61// TOTHINK: remove?
Mikhail Glushenkov35576b02008-05-30 06:10:19 +000062def default;
Mikhail Glushenkovd6228882008-05-06 18:15:12 +000063
Mikhail Glushenkovdedba642008-05-30 06:08:50 +000064// Boolean operators.
Mikhail Glushenkov3f6743e2008-05-06 17:22:47 +000065def and;
Mikhail Glushenkovd6228882008-05-06 18:15:12 +000066def or;
Mikhail Glushenkov46d4e972008-05-06 16:36:06 +000067
Mikhail Glushenkovdedba642008-05-30 06:08:50 +000068// Increase/decrease the edge weight.
69def inc_weight;
70def dec_weight;
71
Mikhail Glushenkovd638e852008-05-30 06:26:08 +000072// Option list - used to specify aliases and sometimes help strings.
73class OptionList<list<dag> l> {
74 list<dag> options = l;
75}
76
Anton Korobeynikove9ffb5b2008-03-23 08:57:20 +000077// Map from suffixes to language names
78
79class LangToSuffixes<string str, list<string> lst> {
80 string lang = str;
81 list<string> suffixes = lst;
82}
83
84class LanguageMap<list<LangToSuffixes> lst> {
85 list<LangToSuffixes> map = lst;
86}
87
Mikhail Glushenkov2cfd2232008-05-06 16:35:25 +000088// Compilation graph
Anton Korobeynikove9ffb5b2008-03-23 08:57:20 +000089
Mikhail Glushenkovdedba642008-05-30 06:08:50 +000090class EdgeBase<Tool t1, Tool t2, dag d> {
Mikhail Glushenkov2cfd2232008-05-06 16:35:25 +000091 Tool a = t1;
92 Tool b = t2;
Mikhail Glushenkovdedba642008-05-30 06:08:50 +000093 dag weight = d;
Anton Korobeynikove9ffb5b2008-03-23 08:57:20 +000094}
95
Mikhail Glushenkovdedba642008-05-30 06:08:50 +000096class Edge<Tool t1, Tool t2> : EdgeBase<t1, t2, (empty)>;
Mikhail Glushenkov46d4e972008-05-06 16:36:06 +000097
Mikhail Glushenkovdfcad6c2008-05-06 18:18:20 +000098// Edge and SimpleEdge are synonyms.
Mikhail Glushenkovdedba642008-05-30 06:08:50 +000099class SimpleEdge<Tool t1, Tool t2> : EdgeBase<t1, t2, (empty)>;
Mikhail Glushenkov46d4e972008-05-06 16:36:06 +0000100
101// Optionally enabled edge.
Mikhail Glushenkovdedba642008-05-30 06:08:50 +0000102class OptionalEdge<Tool t1, Tool t2, dag props> : EdgeBase<t1, t2, props>;
Mikhail Glushenkov46d4e972008-05-06 16:36:06 +0000103
104class CompilationGraph<list<EdgeBase> lst> {
105 list<EdgeBase> edges = lst;
Anton Korobeynikove9ffb5b2008-03-23 08:57:20 +0000106}