Added \!con(a,b) syntax to concatnate two dag fragments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37063 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng 2007-05-15 01:23:24 +00:00
parent 5de723c118
commit 30d15757e3
7 changed files with 224 additions and 177 deletions

View File

@ -306,43 +306,44 @@ static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
*yy_cp = '\0'; \
yy_c_buf_p = yy_cp;
#define YY_NUM_RULES 34
#define YY_END_OF_BUFFER 35
static yyconst short int yy_acclist[145] =
#define YY_NUM_RULES 35
#define YY_END_OF_BUFFER 36
static yyconst short int yy_acclist[146] =
{ 0,
28, 28, 35, 33, 34, 26, 33, 34, 26, 34,
33, 34, 33, 34, 33, 34, 33, 34, 33, 34,
25, 33, 34, 25, 33, 34, 22, 33, 34, 33,
34, 22, 33, 34, 22, 33, 34, 22, 33, 34,
22, 33, 34, 22, 33, 34, 22, 33, 34, 22,
33, 34, 22, 33, 34, 28, 34, 29, 34, 31,
34, 26, 24, 23, 25, 27, 1, 22, 22, 22,
22, 22, 22, 22, 17, 22, 22, 22, 22, 22,
28, 29, 29, 32, 31, 30, 31, 23, 1, 25,
25, 5, 22, 22, 22, 10, 22, 12, 22, 22,
29, 29, 36, 34, 35, 27, 34, 35, 27, 35,
34, 35, 34, 35, 34, 35, 34, 35, 34, 35,
26, 34, 35, 26, 34, 35, 23, 34, 35, 34,
35, 23, 34, 35, 23, 34, 35, 23, 34, 35,
23, 34, 35, 23, 34, 35, 23, 34, 35, 23,
34, 35, 23, 34, 35, 29, 35, 30, 35, 32,
35, 27, 25, 24, 26, 28, 1, 23, 23, 23,
23, 23, 23, 23, 17, 23, 23, 23, 23, 23,
29, 30, 30, 33, 32, 31, 32, 24, 1, 26,
26, 5, 23, 23, 23, 10, 23, 12, 23, 23,
22, 4, 22, 16, 22, 22, 22, 22, 20, 18,
19, 3, 6, 22, 22, 9, 22, 13, 22, 22,
22, 8, 22, 22, 22, 11, 22, 15, 22, 22,
22, 22, 22, 22, 7, 22, 22, 22, 22, 22,
21, 2, 14, 22
23, 4, 23, 16, 23, 23, 23, 23, 18, 21,
19, 20, 3, 6, 23, 23, 9, 23, 13, 23,
23, 23, 8, 23, 23, 23, 11, 23, 15, 23,
23, 23, 23, 23, 23, 7, 23, 23, 23, 23,
23, 22, 2, 14, 23
} ;
static yyconst short int yy_accept[120] =
static yyconst short int yy_accept[123] =
{ 0,
1, 1, 1, 2, 3, 4, 6, 9, 11, 13,
15, 17, 19, 21, 24, 27, 30, 32, 35, 38,
41, 44, 47, 50, 53, 56, 58, 60, 62, 63,
63, 63, 64, 65, 66, 67, 68, 68, 68, 69,
69, 70, 71, 72, 73, 74, 75, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87, 88, 88,
88, 88, 89, 90, 91, 92, 92, 92, 94, 95,
96, 98, 100, 101, 102, 104, 106, 107, 108, 109,
110, 111, 112, 112, 112, 113, 115, 116, 118, 120,
121, 122, 124, 125, 126, 126, 128, 130, 131, 132,
63, 63, 63, 64, 65, 66, 67, 68, 68, 68,
69, 69, 70, 71, 72, 73, 74, 75, 77, 78,
79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
88, 88, 88, 88, 89, 90, 91, 92, 92, 92,
94, 95, 96, 98, 100, 101, 102, 104, 106, 107,
108, 109, 110, 111, 112, 113, 113, 113, 114, 116,
117, 119, 121, 122, 123, 125, 126, 127, 127, 129,
133, 133, 134, 135, 137, 137, 138, 139, 139, 139,
140, 140, 140, 141, 142, 142, 143, 145, 145
131, 132, 133, 134, 134, 135, 136, 138, 138, 139,
140, 140, 140, 141, 141, 141, 142, 143, 143, 144,
146, 146
} ;
static yyconst int yy_ec[256] =
@ -385,106 +386,106 @@ static yyconst int yy_meta[38] =
6, 6, 6, 6, 6, 1, 1
} ;
static yyconst short int yy_base[132] =
static yyconst short int yy_base[135] =
{ 0,
0, 0, 30, 31, 218, 219, 40, 43, 185, 210,
0, 37, 43, 43, 46, 0, 179, 188, 33, 43,
187, 183, 42, 177, 177, 0, 59, 62, 71, 46,
203, 219, 0, 69, 219, 0, 72, 0, 0, 171,
174, 188, 184, 180, 180, 180, 56, 168, 168, 172,
167, 0, 77, 78, 219, 82, 219, 83, 170, 76,
165, 0, 0, 84, 0, 158, 177, 161, 160, 169,
0, 162, 162, 161, 0, 0, 154, 153, 159, 219,
219, 219, 164, 146, 219, 0, 150, 0, 0, 160,
146, 0, 153, 149, 147, 0, 0, 155, 155, 150,
0, 0, 30, 31, 221, 222, 40, 43, 28, 214,
0, 38, 44, 44, 53, 0, 183, 192, 31, 49,
191, 187, 46, 181, 181, 0, 65, 66, 78, 183,
52, 206, 222, 0, 75, 222, 0, 58, 0, 0,
174, 177, 191, 187, 183, 183, 183, 58, 171, 171,
175, 170, 0, 82, 85, 222, 86, 222, 89, 171,
172, 35, 167, 0, 0, 89, 0, 160, 179, 163,
162, 171, 0, 164, 164, 163, 0, 0, 156, 155,
161, 222, 222, 222, 222, 166, 148, 222, 0, 152,
0, 0, 162, 148, 0, 155, 151, 149, 0, 0,
144, 150, 144, 0, 150, 95, 151, 126, 98, 92,
69, 93, 34, 219, 46, 219, 0, 219, 104, 110,
112, 115, 121, 127, 133, 136, 142, 145, 150, 156,
162
157, 157, 152, 146, 152, 146, 0, 128, 100, 110,
89, 102, 74, 65, 83, 52, 222, 53, 222, 0,
222, 108, 114, 116, 119, 125, 131, 137, 140, 146,
149, 154, 160, 166
} ;
static yyconst short int yy_def[132] =
static yyconst short int yy_def[135] =
{ 0,
118, 1, 119, 119, 118, 118, 118, 118, 118, 120,
121, 118, 118, 118, 118, 122, 118, 122, 122, 122,
122, 122, 122, 122, 122, 123, 124, 125, 118, 118,
120, 118, 126, 118, 118, 127, 118, 128, 122, 129,
122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
122, 123, 124, 124, 118, 125, 118, 125, 118, 118,
118, 126, 127, 118, 128, 129, 130, 122, 122, 122,
122, 122, 122, 122, 122, 122, 122, 122, 122, 118,
118, 118, 118, 129, 118, 122, 122, 122, 122, 122,
122, 122, 122, 122, 118, 122, 122, 122, 122, 122,
121, 1, 122, 122, 121, 121, 121, 121, 121, 123,
124, 121, 121, 121, 121, 125, 121, 125, 125, 125,
125, 125, 125, 125, 125, 126, 127, 128, 121, 121,
121, 123, 121, 129, 121, 121, 130, 121, 131, 125,
132, 125, 125, 125, 125, 125, 125, 125, 125, 125,
125, 125, 126, 127, 127, 121, 128, 121, 128, 121,
121, 121, 121, 129, 130, 121, 131, 132, 133, 125,
125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
125, 121, 121, 121, 121, 121, 132, 121, 125, 125,
125, 125, 125, 125, 125, 125, 125, 121, 125, 125,
118, 122, 122, 122, 118, 122, 122, 118, 118, 122,
118, 131, 122, 118, 131, 118, 122, 0, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118
125, 125, 125, 121, 125, 125, 125, 121, 125, 125,
121, 121, 125, 121, 134, 125, 121, 134, 121, 125,
0, 121, 121, 121, 121, 121, 121, 121, 121, 121,
121, 121, 121, 121
} ;
static yyconst short int yy_nxt[257] =
static yyconst short int yy_nxt[260] =
{ 0,
6, 7, 8, 7, 9, 10, 11, 6, 12, 13,
14, 15, 15, 16, 16, 17, 6, 16, 18, 19,
20, 16, 21, 16, 16, 22, 23, 24, 16, 16,
16, 25, 16, 16, 16, 6, 6, 27, 27, 28,
28, 29, 29, 29, 29, 29, 29, 34, 34, 34,
35, 116, 36, 34, 34, 34, 34, 34, 34, 42,
44, 37, 43, 48, 45, 117, 54, 49, 55, 57,
59, 58, 29, 29, 29, 74, 60, 38, 61, 34,
34, 34, 64, 64, 118, 54, 118, 55, 75, 118,
118, 118, 58, 81, 64, 64, 109, 109, 116, 109,
28, 29, 29, 29, 29, 29, 29, 30, 35, 35,
35, 36, 84, 37, 35, 35, 35, 43, 119, 31,
44, 85, 38, 35, 35, 35, 45, 49, 66, 66,
46, 50, 55, 58, 56, 59, 61, 76, 39, 29,
29, 29, 62, 120, 63, 35, 35, 35, 119, 121,
77, 121, 55, 121, 56, 121, 121, 117, 59, 66,
109, 114, 82, 112, 26, 26, 26, 26, 26, 26,
31, 31, 31, 31, 31, 31, 33, 33, 39, 39,
39, 52, 52, 113, 52, 52, 52, 53, 53, 53,
53, 53, 53, 56, 56, 56, 56, 56, 56, 62,
62, 62, 63, 111, 63, 63, 63, 63, 65, 65,
66, 66, 66, 66, 66, 66, 84, 84, 84, 84,
84, 84, 115, 115, 115, 115, 115, 115, 110, 108,
107, 106, 105, 104, 103, 102, 101, 100, 99, 98,
97, 96, 67, 95, 94, 93, 92, 91, 90, 89,
88, 87, 86, 85, 67, 83, 80, 79, 78, 77,
66, 112, 112, 112, 112, 116, 114, 115, 26, 26,
26, 26, 26, 26, 32, 32, 32, 32, 32, 32,
34, 34, 40, 40, 40, 53, 53, 113, 53, 53,
53, 54, 54, 54, 54, 54, 54, 57, 57, 57,
57, 57, 57, 64, 64, 64, 65, 111, 65, 65,
65, 65, 67, 67, 68, 68, 68, 68, 68, 68,
87, 87, 87, 87, 87, 87, 118, 118, 118, 118,
118, 118, 110, 109, 108, 107, 106, 105, 104, 103,
102, 101, 100, 99, 69, 98, 97, 96, 95, 94,
93, 92, 91, 90, 89, 88, 69, 86, 83, 82,
76, 73, 72, 71, 70, 69, 68, 67, 32, 51,
50, 47, 46, 41, 40, 32, 30, 118, 5, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118
81, 80, 79, 78, 75, 74, 73, 72, 71, 70,
69, 33, 60, 52, 51, 48, 47, 42, 41, 33,
121, 5, 121, 121, 121, 121, 121, 121, 121, 121,
121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
121, 121, 121, 121, 121, 121, 121, 121, 121
} ;
static yyconst short int yy_chk[257] =
static yyconst short int yy_chk[260] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 3, 4, 3,
4, 7, 7, 7, 8, 8, 8, 12, 12, 12,
13, 115, 13, 14, 14, 14, 15, 15, 15, 19,
20, 14, 19, 23, 20, 113, 27, 23, 27, 28,
30, 28, 29, 29, 29, 47, 30, 14, 30, 34,
34, 34, 37, 37, 53, 54, 53, 54, 47, 56,
58, 56, 58, 60, 64, 64, 106, 106, 112, 109,
4, 7, 7, 7, 8, 8, 8, 9, 12, 12,
12, 13, 62, 13, 14, 14, 14, 19, 118, 9,
19, 62, 14, 15, 15, 15, 20, 23, 38, 38,
20, 23, 27, 28, 27, 28, 31, 48, 14, 29,
29, 29, 31, 116, 31, 35, 35, 35, 115, 54,
48, 54, 55, 57, 55, 57, 59, 114, 59, 66,
109, 111, 60, 109, 119, 119, 119, 119, 119, 119,
120, 120, 120, 120, 120, 120, 121, 121, 122, 122,
122, 123, 123, 110, 123, 123, 123, 124, 124, 124,
124, 124, 124, 125, 125, 125, 125, 125, 125, 126,
126, 126, 127, 108, 127, 127, 127, 127, 128, 128,
129, 129, 129, 129, 129, 129, 130, 130, 130, 130,
130, 130, 131, 131, 131, 131, 131, 131, 107, 105,
103, 102, 101, 100, 99, 98, 95, 94, 93, 91,
90, 87, 84, 83, 79, 78, 77, 74, 73, 72,
70, 69, 68, 67, 66, 61, 59, 51, 50, 49,
66, 109, 109, 112, 112, 113, 111, 112, 122, 122,
122, 122, 122, 122, 123, 123, 123, 123, 123, 123,
124, 124, 125, 125, 125, 126, 126, 110, 126, 126,
126, 127, 127, 127, 127, 127, 127, 128, 128, 128,
128, 128, 128, 129, 129, 129, 130, 108, 130, 130,
130, 130, 131, 131, 132, 132, 132, 132, 132, 132,
133, 133, 133, 133, 133, 133, 134, 134, 134, 134,
134, 134, 106, 105, 104, 103, 102, 101, 98, 97,
96, 94, 93, 90, 87, 86, 81, 80, 79, 76,
75, 74, 72, 71, 70, 69, 68, 63, 61, 60,
48, 46, 45, 44, 43, 42, 41, 40, 31, 25,
24, 22, 21, 18, 17, 10, 9, 5, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118
52, 51, 50, 49, 47, 46, 45, 44, 43, 42,
41, 32, 30, 25, 24, 22, 21, 18, 17, 10,
5, 121, 121, 121, 121, 121, 121, 121, 121, 121,
121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
121, 121, 121, 121, 121, 121, 121, 121, 121
} ;
static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr;
@ -501,7 +502,7 @@ goto find_rule; \
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
char *yytext;
#line 1 "/Volumes/Big2/llvm/llvm/utils/TableGen/FileLexer.l"
#line 1 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"
#define INITIAL 0
/*===-- FileLexer.l - Scanner for TableGen Files ----------------*- C++ -*-===//
//
@ -519,7 +520,7 @@ char *yytext;
#define YY_NEVER_INTERACTIVE 1
#define comment 1
#line 30 "/Volumes/Big2/llvm/llvm/utils/TableGen/FileLexer.l"
#line 30 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"
#include "llvm/Config/config.h"
#include "llvm/Support/Streams.h"
#include "Record.h"
@ -665,7 +666,7 @@ int yywrap(void) {
using namespace llvm;
#line 669 "Lexer.cpp"
#line 670 "Lexer.cpp"
/* Macros after this point can all be overridden by user definitions in
* section 1.
@ -816,10 +817,10 @@ YY_DECL
register char *yy_cp, *yy_bp;
register int yy_act;
#line 185 "/Volumes/Big2/llvm/llvm/utils/TableGen/FileLexer.l"
#line 185 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"
#line 823 "Lexer.cpp"
#line 824 "Lexer.cpp"
if ( yy_init )
{
@ -867,14 +868,14 @@ yy_match:
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 119 )
if ( yy_current_state >= 122 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
*yy_state_ptr++ = yy_current_state;
++yy_cp;
}
while ( yy_current_state != 118 );
while ( yy_current_state != 121 );
yy_find_action:
yy_current_state = *--yy_state_ptr;
@ -912,183 +913,188 @@ do_action: /* This label is used only to access EOF actions. */
{ /* beginning of action switch */
case 1:
YY_RULE_SETUP
#line 187 "/Volumes/Big2/llvm/llvm/utils/TableGen/FileLexer.l"
#line 187 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"
{ /* Ignore comments */ }
YY_BREAK
case 2:
YY_RULE_SETUP
#line 189 "/Volumes/Big2/llvm/llvm/utils/TableGen/FileLexer.l"
#line 189 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"
{ HandleInclude(yytext); }
YY_BREAK
case 3:
YY_RULE_SETUP
#line 190 "/Volumes/Big2/llvm/llvm/utils/TableGen/FileLexer.l"
#line 190 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"
{ Filelval.StrVal = new std::string(yytext+2, yytext+yyleng-2);
return CODEFRAGMENT; }
YY_BREAK
case 4:
YY_RULE_SETUP
#line 193 "/Volumes/Big2/llvm/llvm/utils/TableGen/FileLexer.l"
#line 193 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"
{ return INT; }
YY_BREAK
case 5:
YY_RULE_SETUP
#line 194 "/Volumes/Big2/llvm/llvm/utils/TableGen/FileLexer.l"
#line 194 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"
{ return BIT; }
YY_BREAK
case 6:
YY_RULE_SETUP
#line 195 "/Volumes/Big2/llvm/llvm/utils/TableGen/FileLexer.l"
#line 195 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"
{ return BITS; }
YY_BREAK
case 7:
YY_RULE_SETUP
#line 196 "/Volumes/Big2/llvm/llvm/utils/TableGen/FileLexer.l"
#line 196 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"
{ return STRING; }
YY_BREAK
case 8:
YY_RULE_SETUP
#line 197 "/Volumes/Big2/llvm/llvm/utils/TableGen/FileLexer.l"
#line 197 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"
{ return LIST; }
YY_BREAK
case 9:
YY_RULE_SETUP
#line 198 "/Volumes/Big2/llvm/llvm/utils/TableGen/FileLexer.l"
#line 198 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"
{ return CODE; }
YY_BREAK
case 10:
YY_RULE_SETUP
#line 199 "/Volumes/Big2/llvm/llvm/utils/TableGen/FileLexer.l"
#line 199 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"
{ return DAG; }
YY_BREAK
case 11:
YY_RULE_SETUP
#line 201 "/Volumes/Big2/llvm/llvm/utils/TableGen/FileLexer.l"
#line 201 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"
{ return CLASS; }
YY_BREAK
case 12:
YY_RULE_SETUP
#line 202 "/Volumes/Big2/llvm/llvm/utils/TableGen/FileLexer.l"
#line 202 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"
{ return DEF; }
YY_BREAK
case 13:
YY_RULE_SETUP
#line 203 "/Volumes/Big2/llvm/llvm/utils/TableGen/FileLexer.l"
#line 203 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"
{ return DEFM; }
YY_BREAK
case 14:
YY_RULE_SETUP
#line 204 "/Volumes/Big2/llvm/llvm/utils/TableGen/FileLexer.l"
#line 204 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"
{ return MULTICLASS; }
YY_BREAK
case 15:
YY_RULE_SETUP
#line 205 "/Volumes/Big2/llvm/llvm/utils/TableGen/FileLexer.l"
#line 205 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"
{ return FIELD; }
YY_BREAK
case 16:
YY_RULE_SETUP
#line 206 "/Volumes/Big2/llvm/llvm/utils/TableGen/FileLexer.l"
#line 206 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"
{ return LET; }
YY_BREAK
case 17:
YY_RULE_SETUP
#line 207 "/Volumes/Big2/llvm/llvm/utils/TableGen/FileLexer.l"
#line 207 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"
{ return IN; }
YY_BREAK
case 18:
YY_RULE_SETUP
#line 209 "/Volumes/Big2/llvm/llvm/utils/TableGen/FileLexer.l"
{ return SRATOK; }
#line 209 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"
{ return CONCATTOK; }
YY_BREAK
case 19:
YY_RULE_SETUP
#line 210 "/Volumes/Big2/llvm/llvm/utils/TableGen/FileLexer.l"
{ return SRLTOK; }
#line 210 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"
{ return SRATOK; }
YY_BREAK
case 20:
YY_RULE_SETUP
#line 211 "/Volumes/Big2/llvm/llvm/utils/TableGen/FileLexer.l"
{ return SHLTOK; }
#line 211 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"
{ return SRLTOK; }
YY_BREAK
case 21:
YY_RULE_SETUP
#line 212 "/Volumes/Big2/llvm/llvm/utils/TableGen/FileLexer.l"
{ return STRCONCATTOK; }
#line 212 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"
{ return SHLTOK; }
YY_BREAK
case 22:
YY_RULE_SETUP
#line 215 "/Volumes/Big2/llvm/llvm/utils/TableGen/FileLexer.l"
{ Filelval.StrVal = new std::string(yytext, yytext+yyleng);
return ID; }
#line 213 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"
{ return STRCONCATTOK; }
YY_BREAK
case 23:
YY_RULE_SETUP
#line 217 "/Volumes/Big2/llvm/llvm/utils/TableGen/FileLexer.l"
{ Filelval.StrVal = new std::string(yytext+1, yytext+yyleng);
return VARNAME; }
#line 216 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"
{ Filelval.StrVal = new std::string(yytext, yytext+yyleng);
return ID; }
YY_BREAK
case 24:
YY_RULE_SETUP
#line 220 "/Volumes/Big2/llvm/llvm/utils/TableGen/FileLexer.l"
{ Filelval.StrVal = new std::string(yytext+1, yytext+yyleng-1);
return STRVAL; }
#line 218 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"
{ Filelval.StrVal = new std::string(yytext+1, yytext+yyleng);
return VARNAME; }
YY_BREAK
case 25:
YY_RULE_SETUP
#line 223 "/Volumes/Big2/llvm/llvm/utils/TableGen/FileLexer.l"
{ Filelval.IntVal = ParseInt(Filetext); return INTVAL; }
#line 221 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"
{ Filelval.StrVal = new std::string(yytext+1, yytext+yyleng-1);
return STRVAL; }
YY_BREAK
case 26:
YY_RULE_SETUP
#line 225 "/Volumes/Big2/llvm/llvm/utils/TableGen/FileLexer.l"
{ /* Ignore whitespace */ }
#line 224 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"
{ Filelval.IntVal = ParseInt(Filetext); return INTVAL; }
YY_BREAK
case 27:
YY_RULE_SETUP
#line 228 "/Volumes/Big2/llvm/llvm/utils/TableGen/FileLexer.l"
{ BEGIN(comment); CommentDepth++; }
#line 226 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"
{ /* Ignore whitespace */ }
YY_BREAK
case 28:
YY_RULE_SETUP
#line 229 "/Volumes/Big2/llvm/llvm/utils/TableGen/FileLexer.l"
{} /* eat anything that's not a '*' or '/' */
#line 229 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"
{ BEGIN(comment); CommentDepth++; }
YY_BREAK
case 29:
YY_RULE_SETUP
#line 230 "/Volumes/Big2/llvm/llvm/utils/TableGen/FileLexer.l"
{} /* eat up '*'s not followed by '/'s */
#line 230 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"
{} /* eat anything that's not a '*' or '/' */
YY_BREAK
case 30:
YY_RULE_SETUP
#line 231 "/Volumes/Big2/llvm/llvm/utils/TableGen/FileLexer.l"
{ ++CommentDepth; }
#line 231 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"
{} /* eat up '*'s not followed by '/'s */
YY_BREAK
case 31:
YY_RULE_SETUP
#line 232 "/Volumes/Big2/llvm/llvm/utils/TableGen/FileLexer.l"
{} /* eat up /'s not followed by *'s */
#line 232 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"
{ ++CommentDepth; }
YY_BREAK
case 32:
YY_RULE_SETUP
#line 233 "/Volumes/Big2/llvm/llvm/utils/TableGen/FileLexer.l"
{ if (!--CommentDepth) { BEGIN(INITIAL); } }
YY_BREAK
case YY_STATE_EOF(comment):
#line 234 "/Volumes/Big2/llvm/llvm/utils/TableGen/FileLexer.l"
{ err() << "Unterminated comment!\n"; exit(1); }
#line 233 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"
{} /* eat up /'s not followed by *'s */
YY_BREAK
case 33:
YY_RULE_SETUP
#line 236 "/Volumes/Big2/llvm/llvm/utils/TableGen/FileLexer.l"
{ return Filetext[0]; }
#line 234 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"
{ if (!--CommentDepth) { BEGIN(INITIAL); } }
YY_BREAK
case YY_STATE_EOF(comment):
#line 235 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"
{ err() << "Unterminated comment!\n"; exit(1); }
YY_BREAK
case 34:
YY_RULE_SETUP
#line 238 "/Volumes/Big2/llvm/llvm/utils/TableGen/FileLexer.l"
#line 237 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"
{ return Filetext[0]; }
YY_BREAK
case 35:
YY_RULE_SETUP
#line 239 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"
YY_FATAL_ERROR( "flex scanner jammed" );
YY_BREAK
#line 1092 "Lexer.cpp"
#line 1098 "Lexer.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@ -1377,7 +1383,7 @@ static yy_state_type yy_get_previous_state()
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 119 )
if ( yy_current_state >= 122 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@ -1407,11 +1413,11 @@ yy_state_type yy_current_state;
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 119 )
if ( yy_current_state >= 122 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
yy_is_jam = (yy_current_state == 118);
yy_is_jam = (yy_current_state == 121);
if ( ! yy_is_jam )
*yy_state_ptr++ = yy_current_state;
@ -1972,6 +1978,6 @@ int main()
return 0;
}
#endif
#line 238 "/Volumes/Big2/llvm/llvm/utils/TableGen/FileLexer.l"
#line 239 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l"

View File

@ -206,6 +206,7 @@ field { return FIELD; }
let { return LET; }
in { return IN; }
!con { return CONCATTOK; }
!sra { return SRATOK; }
!srl { return SRLTOK; }
!shl { return SHLTOK; }

View File

@ -206,6 +206,7 @@ field { return FIELD; }
let { return LET; }
in { return IN; }
!con { return CONCATTOK; }
!sra { return SRATOK; }
!srl { return SRLTOK; }
!shl { return SHLTOK; }

View File

@ -222,7 +222,7 @@ using namespace llvm;
};
%token INT BIT STRING BITS LIST CODE DAG CLASS DEF MULTICLASS DEFM FIELD LET IN
%token SHLTOK SRATOK SRLTOK STRCONCATTOK
%token CONCATTOK SHLTOK SRATOK SRLTOK STRCONCATTOK
%token <IntVal> INTVAL
%token <StrVal> ID VARNAME STRVAL CODEFRAGMENT
@ -391,6 +391,8 @@ Value : IDValue {
exit(1);
}
delete $3;
} | CONCATTOK '(' Value ',' Value ')' {
$$ = (new BinOpInit(BinOpInit::CONCAT, $3, $5))->Fold();
} | SHLTOK '(' Value ',' Value ')' {
$$ = (new BinOpInit(BinOpInit::SHL, $3, $5))->Fold();
} | SRATOK '(' Value ',' Value ')' {

View File

@ -222,7 +222,7 @@ using namespace llvm;
};
%token INT BIT STRING BITS LIST CODE DAG CLASS DEF MULTICLASS DEFM FIELD LET IN
%token SHLTOK SRATOK SRLTOK STRCONCATTOK
%token CONCATTOK SHLTOK SRATOK SRLTOK STRCONCATTOK
%token <IntVal> INTVAL
%token <StrVal> ID VARNAME STRVAL CODEFRAGMENT
@ -391,6 +391,8 @@ Value : IDValue {
exit(1);
}
delete $3;
} | CONCATTOK '(' Value ',' Value ')' {
$$ = (new BinOpInit(BinOpInit::CONCAT, $3, $5))->Fold();
} | SHLTOK '(' Value ',' Value ')' {
$$ = (new BinOpInit(BinOpInit::SHL, $3, $5))->Fold();
} | SRATOK '(' Value ',' Value ')' {

View File

@ -184,6 +184,18 @@ Init *DagRecTy::convertValue(TypedInit *TI) {
return 0;
}
Init *DagRecTy::convertValue(BinOpInit *BO) {
if (BO->getOpcode() == BinOpInit::CONCAT) {
Init *L = BO->getLHS()->convertInitializerTo(this);
Init *R = BO->getRHS()->convertInitializerTo(this);
if (L == 0 || R == 0) return 0;
if (L != BO->getLHS() || R != BO->getRHS())
return new BinOpInit(BinOpInit::CONCAT, L, R);
return BO;
}
return 0;
}
void RecordRecTy::print(std::ostream &OS) const {
OS << Rec->getName();
@ -378,6 +390,28 @@ void ListInit::print(std::ostream &OS) const {
Init *BinOpInit::Fold() {
switch (getOpcode()) {
default: assert(0 && "Unknown binop");
case CONCAT: {
DagInit *LHSs = dynamic_cast<DagInit*>(LHS);
DagInit *RHSs = dynamic_cast<DagInit*>(RHS);
if (LHSs && RHSs) {
DefInit *LOp = dynamic_cast<DefInit*>(LHSs->getOperator());
DefInit *ROp = dynamic_cast<DefInit*>(RHSs->getOperator());
if (LOp->getDef() != ROp->getDef())
throw "Concated Dag operators do not match!";
std::vector<Init*> Args;
std::vector<std::string> ArgNames;
for (unsigned i = 0, e = LHSs->getNumArgs(); i != e; ++i) {
Args.push_back(LHSs->getArg(i));
ArgNames.push_back(LHSs->getArgName(i));
}
for (unsigned i = 0, e = RHSs->getNumArgs(); i != e; ++i) {
Args.push_back(RHSs->getArg(i));
ArgNames.push_back(RHSs->getArgName(i));
}
return new DagInit(LHSs->getOperator(), Args, ArgNames);
}
break;
}
case STRCONCAT: {
StringInit *LHSs = dynamic_cast<StringInit*>(LHS);
StringInit *RHSs = dynamic_cast<StringInit*>(RHS);
@ -418,6 +452,7 @@ Init *BinOpInit::resolveReferences(Record &R, const RecordVal *RV) {
void BinOpInit::print(std::ostream &OS) const {
switch (Opc) {
case CONCAT: OS << "!con"; break;
case SHL: OS << "!shl"; break;
case SRA: OS << "!sra"; break;
case SRL: OS << "!srl"; break;

View File

@ -354,7 +354,7 @@ public:
virtual Init *convertValue( CodeInit *CI) { return 0; }
virtual Init *convertValue(VarBitInit *VB) { return 0; }
virtual Init *convertValue( DefInit *DI) { return 0; }
virtual Init *convertValue( BinOpInit *UI) { return 0; }
virtual Init *convertValue( BinOpInit *BO);
virtual Init *convertValue( DagInit *CI) { return (Init*)CI; }
virtual Init *convertValue( TypedInit *TI);
virtual Init *convertValue( VarInit *VI) { return RecTy::convertValue(VI);}
@ -648,7 +648,7 @@ public:
///
class BinOpInit : public Init {
public:
enum BinaryOp { SHL, SRA, SRL, STRCONCAT };
enum BinaryOp { SHL, SRA, SRL, STRCONCAT, CONCAT };
private:
BinaryOp Opc;
Init *LHS, *RHS;