blob: 524ea56728ddf6e3616818f5f771bf30f7d91514 [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
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 Glushenkov242d0e62008-05-30 06:19:52 +000059def not_empty;
60// TOTHINK: remove?
Mikhail Glushenkov35576b02008-05-30 06:10:19 +000061def default;
Mikhail Glushenkovd6228882008-05-06 18:15:12 +000062
Mikhail Glushenkovdedba642008-05-30 06:08:50 +000063// Boolean operators.
Mikhail Glushenkov3f6743e2008-05-06 17:22:47 +000064def and;
Mikhail Glushenkovd6228882008-05-06 18:15:12 +000065def or;
Mikhail Glushenkov46d4e972008-05-06 16:36:06 +000066
Mikhail Glushenkovdedba642008-05-30 06:08:50 +000067// Increase/decrease the edge weight.
68def inc_weight;
69def dec_weight;
70
Anton Korobeynikove9ffb5b2008-03-23 08:57:20 +000071// Map from suffixes to language names
72
73class LangToSuffixes<string str, list<string> lst> {
74 string lang = str;
75 list<string> suffixes = lst;
76}
77
78class LanguageMap<list<LangToSuffixes> lst> {
79 list<LangToSuffixes> map = lst;
80}
81
Mikhail Glushenkov2cfd2232008-05-06 16:35:25 +000082// Compilation graph
Anton Korobeynikove9ffb5b2008-03-23 08:57:20 +000083
Mikhail Glushenkovdedba642008-05-30 06:08:50 +000084class EdgeBase<Tool t1, Tool t2, dag d> {
Mikhail Glushenkov2cfd2232008-05-06 16:35:25 +000085 Tool a = t1;
86 Tool b = t2;
Mikhail Glushenkovdedba642008-05-30 06:08:50 +000087 dag weight = d;
Anton Korobeynikove9ffb5b2008-03-23 08:57:20 +000088}
89
Mikhail Glushenkovdedba642008-05-30 06:08:50 +000090class Edge<Tool t1, Tool t2> : EdgeBase<t1, t2, (empty)>;
Mikhail Glushenkov46d4e972008-05-06 16:36:06 +000091
Mikhail Glushenkovdfcad6c2008-05-06 18:18:20 +000092// Edge and SimpleEdge are synonyms.
Mikhail Glushenkovdedba642008-05-30 06:08:50 +000093class SimpleEdge<Tool t1, Tool t2> : EdgeBase<t1, t2, (empty)>;
Mikhail Glushenkov46d4e972008-05-06 16:36:06 +000094
95// Optionally enabled edge.
Mikhail Glushenkovdedba642008-05-30 06:08:50 +000096class OptionalEdge<Tool t1, Tool t2, dag props> : EdgeBase<t1, t2, props>;
Mikhail Glushenkov46d4e972008-05-06 16:36:06 +000097
98class CompilationGraph<list<EdgeBase> lst> {
99 list<EdgeBase> edges = lst;
Anton Korobeynikove9ffb5b2008-03-23 08:57:20 +0000100}