Anton Korobeynikov | e9ffb5b | 2008-03-23 08:57:20 +0000 | [diff] [blame] | 1 | //===- 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 | |
| 14 | class Tool<list<dag> l> { |
| 15 | list<dag> properties = l; |
| 16 | } |
| 17 | |
Mikhail Glushenkov | 46d4e97 | 2008-05-06 16:36:06 +0000 | [diff] [blame] | 18 | // Special Tool instance - graph root. |
Mikhail Glushenkov | 2cfd223 | 2008-05-06 16:35:25 +0000 | [diff] [blame] | 19 | |
| 20 | def root : Tool<[]>; |
| 21 | |
Anton Korobeynikov | e9ffb5b | 2008-03-23 08:57:20 +0000 | [diff] [blame] | 22 | // Possible Tool properties |
| 23 | |
| 24 | def in_language; |
| 25 | def out_language; |
| 26 | def output_suffix; |
| 27 | def cmd_line; |
| 28 | def join; |
| 29 | def sink; |
| 30 | |
| 31 | // Possible option types |
| 32 | |
| 33 | def switch_option; |
| 34 | def parameter_option; |
| 35 | def parameter_list_option; |
| 36 | def prefix_option; |
| 37 | def prefix_list_option; |
| 38 | |
| 39 | // Possible option properties |
| 40 | |
| 41 | def append_cmd; |
| 42 | def forward; |
| 43 | def stop_compilation; |
| 44 | def unpack_values; |
| 45 | def help; |
| 46 | def required; |
| 47 | |
Mikhail Glushenkov | 46d4e97 | 2008-05-06 16:36:06 +0000 | [diff] [blame] | 48 | // Possible edge properties |
| 49 | |
| 50 | def switch_on; |
| 51 | def parameter_equals; |
| 52 | def element_in_list; |
Mikhail Glushenkov | d622888 | 2008-05-06 18:15:12 +0000 | [diff] [blame] | 53 | def if_input_languages_contain; |
| 54 | |
| 55 | // Edge property combinators. |
Mikhail Glushenkov | dfcad6c | 2008-05-06 18:18:20 +0000 | [diff] [blame^] | 56 | def weight; |
Mikhail Glushenkov | 3f6743e | 2008-05-06 17:22:47 +0000 | [diff] [blame] | 57 | def and; |
Mikhail Glushenkov | d622888 | 2008-05-06 18:15:12 +0000 | [diff] [blame] | 58 | def or; |
Mikhail Glushenkov | 46d4e97 | 2008-05-06 16:36:06 +0000 | [diff] [blame] | 59 | |
Anton Korobeynikov | e9ffb5b | 2008-03-23 08:57:20 +0000 | [diff] [blame] | 60 | // Map from suffixes to language names |
| 61 | |
| 62 | class LangToSuffixes<string str, list<string> lst> { |
| 63 | string lang = str; |
| 64 | list<string> suffixes = lst; |
| 65 | } |
| 66 | |
| 67 | class LanguageMap<list<LangToSuffixes> lst> { |
| 68 | list<LangToSuffixes> map = lst; |
| 69 | } |
| 70 | |
Mikhail Glushenkov | 2cfd223 | 2008-05-06 16:35:25 +0000 | [diff] [blame] | 71 | // Compilation graph |
Anton Korobeynikov | e9ffb5b | 2008-03-23 08:57:20 +0000 | [diff] [blame] | 72 | |
Mikhail Glushenkov | 46d4e97 | 2008-05-06 16:36:06 +0000 | [diff] [blame] | 73 | class EdgeBase<Tool t1, Tool t2, list<dag> lst> { |
Mikhail Glushenkov | 2cfd223 | 2008-05-06 16:35:25 +0000 | [diff] [blame] | 74 | Tool a = t1; |
| 75 | Tool b = t2; |
Mikhail Glushenkov | 46d4e97 | 2008-05-06 16:36:06 +0000 | [diff] [blame] | 76 | list<dag> props = lst; |
Anton Korobeynikov | e9ffb5b | 2008-03-23 08:57:20 +0000 | [diff] [blame] | 77 | } |
| 78 | |
Mikhail Glushenkov | 46d4e97 | 2008-05-06 16:36:06 +0000 | [diff] [blame] | 79 | class Edge<Tool t1, Tool t2> : EdgeBase<t1, t2, []>; |
| 80 | |
Mikhail Glushenkov | dfcad6c | 2008-05-06 18:18:20 +0000 | [diff] [blame^] | 81 | // Edge and SimpleEdge are synonyms. |
| 82 | class SimpleEdge<Tool t1, Tool t2> : EdgeBase<t1, t2, []>; |
Mikhail Glushenkov | 46d4e97 | 2008-05-06 16:36:06 +0000 | [diff] [blame] | 83 | |
| 84 | // Optionally enabled edge. |
| 85 | class OptionalEdge<Tool t1, Tool t2, list<dag> lst> : EdgeBase<t1, t2, lst>; |
| 86 | |
| 87 | class CompilationGraph<list<EdgeBase> lst> { |
| 88 | list<EdgeBase> edges = lst; |
Anton Korobeynikov | e9ffb5b | 2008-03-23 08:57:20 +0000 | [diff] [blame] | 89 | } |