From 212f70d92e95dc63bc7a5ee46bf571dc6dd8e191 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 15 Jul 2001 00:17:01 +0000 Subject: [PATCH] Add support to the parser to recognize floating point constants llvm-svn: 188 --- llvm/lib/AsmParser/Lexer.cpp | 494 +++++++------ llvm/lib/AsmParser/Lexer.l | 5 + llvm/lib/AsmParser/ParserInternals.h | 9 +- llvm/lib/AsmParser/llvmAsmParser.cpp | 1028 +++++++++++++------------- llvm/lib/AsmParser/llvmAsmParser.h | 104 +-- llvm/lib/AsmParser/llvmAsmParser.y | 28 +- 6 files changed, 874 insertions(+), 794 deletions(-) diff --git a/llvm/lib/AsmParser/Lexer.cpp b/llvm/lib/AsmParser/Lexer.cpp index 09d9e515fb31..98928f38105a 100644 --- a/llvm/lib/AsmParser/Lexer.cpp +++ b/llvm/lib/AsmParser/Lexer.cpp @@ -308,49 +308,50 @@ static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); *yy_cp = '\0'; \ yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 60 -#define YY_END_OF_BUFFER 61 -static yyconst short int yy_acclist[115] = +#define YY_NUM_RULES 61 +#define YY_END_OF_BUFFER 62 +static yyconst short int yy_acclist[117] = { 0, - 61, 59, 60, 58, 59, 60, 58, 60, 59, 60, - 59, 60, 59, 60, 8, 59, 60, 54, 59, 60, - 1, 59, 60, 59, 60, 59, 60, 59, 60, 59, - 60, 59, 60, 59, 60, 59, 60, 59, 60, 59, - 60, 59, 60, 59, 60, 59, 60, 59, 60, 59, - 60, 59, 60, 59, 60, 59, 60, 52, 51, 56, - 55, 54, 1, 9, 43, 36, 53, 51, 57, 25, - 28, 3, 16, 27, 24, 37, 29, 42, 40, 41, - 26, 11, 38, 39, 47, 48, 18, 4, 22, 17, - 10, 2, 5, 20, 23, 12, 31, 35, 33, 34, + 62, 60, 61, 59, 60, 61, 59, 61, 60, 61, + 60, 61, 60, 61, 8, 60, 61, 54, 60, 61, + 1, 60, 61, 60, 61, 60, 61, 60, 61, 60, + 61, 60, 61, 60, 61, 60, 61, 60, 61, 60, + 61, 60, 61, 60, 61, 60, 61, 60, 61, 60, + 61, 60, 61, 60, 61, 60, 61, 52, 51, 56, + 55, 58, 54, 1, 9, 43, 36, 53, 51, 57, + 58, 25, 28, 3, 16, 27, 24, 37, 29, 42, + 40, 41, 26, 11, 38, 39, 47, 48, 18, 4, + 22, 17, 10, 2, 5, 20, 23, 12, 31, 35, - 32, 30, 14, 49, 13, 19, 46, 21, 45, 44, - 15, 6, 50, 7 + 33, 34, 32, 30, 14, 49, 13, 19, 46, 21, + 45, 44, 15, 6, 50, 7 } ; -static yyconst short int yy_accept[200] = +static yyconst short int yy_accept[202] = { 0, 1, 1, 1, 2, 4, 7, 9, 11, 13, 15, 18, 21, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, - 58, 58, 59, 60, 60, 61, 62, 63, 64, 64, - 64, 65, 65, 65, 66, 66, 66, 66, 66, 66, - 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, - 66, 66, 66, 66, 66, 66, 66, 66, 66, 67, - 67, 67, 67, 67, 67, 67, 67, 68, 69, 70, - 71, 71, 71, 71, 71, 71, 71, 72, 72, 73, - 73, 73, 73, 73, 73, 74, 74, 74, 74, 74, + 58, 58, 59, 60, 60, 61, 62, 63, 64, 65, + 65, 65, 66, 66, 66, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 68, 68, 68, 68, 68, 68, 68, 68, 69, 70, + 71, 72, 73, 73, 73, 73, 73, 73, 73, 74, + 74, 75, 75, 75, 75, 75, 75, 76, 76, 76, - 75, 76, 77, 78, 79, 79, 79, 80, 80, 81, - 81, 82, 82, 82, 82, 82, 82, 82, 82, 82, - 82, 82, 83, 84, 85, 85, 85, 85, 85, 86, - 86, 86, 86, 87, 88, 88, 88, 88, 88, 88, - 88, 88, 88, 88, 89, 90, 90, 91, 91, 91, - 92, 92, 93, 93, 93, 94, 95, 95, 95, 96, - 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, - 105, 106, 107, 107, 108, 108, 109, 109, 109, 110, - 111, 112, 113, 113, 113, 113, 113, 113, 113, 113, - 113, 113, 113, 113, 113, 114, 114, 115, 115 + 76, 76, 77, 78, 79, 80, 81, 81, 81, 82, + 82, 83, 83, 84, 84, 84, 84, 84, 84, 84, + 84, 84, 84, 84, 85, 86, 87, 87, 87, 87, + 87, 88, 88, 88, 88, 89, 90, 90, 90, 90, + 90, 90, 90, 90, 90, 90, 91, 92, 92, 93, + 93, 93, 94, 94, 95, 95, 95, 96, 97, 97, + 97, 98, 98, 99, 100, 101, 102, 103, 104, 105, + 106, 107, 107, 108, 109, 109, 110, 110, 111, 111, + 111, 112, 113, 114, 115, 115, 115, 115, 115, 115, + 115, 115, 115, 115, 115, 115, 115, 116, 116, 117, + 117 } ; static yyconst int yy_ec[256] = @@ -359,16 +360,16 @@ static yyconst int yy_ec[256] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 4, 1, 5, 6, 1, 1, 1, - 1, 1, 1, 1, 7, 5, 1, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 9, 10, 1, + 1, 1, 1, 1, 7, 8, 1, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 10, 11, 1, 1, 1, 1, 1, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 1, 1, 1, 1, 5, 1, 11, 12, 13, 14, + 1, 1, 1, 1, 5, 1, 12, 13, 14, 15, - 15, 16, 17, 18, 19, 5, 5, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 5, - 32, 5, 1, 1, 1, 1, 1, 1, 1, 1, + 16, 17, 18, 19, 20, 5, 5, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 5, + 33, 5, 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, 1, @@ -385,168 +386,170 @@ static yyconst int yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst int yy_meta[33] = +static yyconst int yy_meta[34] = { 0, - 1, 1, 2, 3, 4, 1, 5, 4, 6, 1, + 1, 1, 2, 3, 4, 1, 5, 4, 4, 6, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4 + 4, 4, 4 } ; -static yyconst short int yy_base[204] = +static yyconst short int yy_base[206] = { 0, - 0, 0, 391, 392, 392, 392, 0, 381, 26, 381, - 27, 0, 28, 40, 29, 35, 34, 42, 30, 38, - 56, 60, 52, 55, 61, 81, 65, 104, 63, 384, - 378, 392, 0, 378, 377, 376, 69, 0, 32, 72, - 374, 78, 71, 373, 91, 89, 73, 75, 92, 99, - 98, 105, 106, 108, 113, 116, 118, 117, 124, 121, - 126, 127, 129, 130, 133, 134, 138, 143, 372, 76, - 142, 137, 145, 151, 154, 156, 392, 0, 372, 370, - 155, 161, 159, 162, 164, 167, 369, 172, 368, 168, - 174, 179, 181, 177, 367, 184, 189, 191, 182, 366, + 0, 0, 398, 399, 399, 399, 0, 387, 27, 387, + 29, 0, 25, 37, 31, 32, 34, 39, 49, 45, + 59, 60, 52, 35, 63, 81, 53, 104, 64, 391, + 384, 399, 0, 384, 383, 382, 72, 93, 0, 74, + 75, 380, 77, 68, 379, 88, 94, 89, 96, 97, + 108, 95, 105, 112, 113, 117, 118, 124, 123, 127, + 120, 125, 129, 130, 132, 133, 140, 142, 146, 378, + 143, 149, 152, 155, 157, 158, 159, 399, 0, 378, + 161, 376, 162, 170, 166, 172, 165, 174, 375, 178, + 374, 65, 186, 173, 187, 189, 373, 190, 192, 191, - 365, 364, 363, 362, 192, 212, 361, 180, 360, 196, - 359, 195, 198, 200, 202, 203, 215, 205, 224, 226, - 227, 358, 357, 356, 207, 231, 210, 217, 355, 232, - 233, 234, 354, 353, 235, 238, 237, 241, 246, 248, - 250, 251, 255, 352, 351, 256, 350, 258, 261, 349, - 268, 348, 263, 267, 347, 346, 271, 264, 345, 275, - 344, 343, 342, 341, 340, 335, 330, 325, 321, 272, - 316, 315, 274, 314, 282, 310, 283, 284, 307, 306, - 305, 208, 285, 286, 287, 289, 292, 294, 297, 298, - 301, 303, 302, 304, 201, 309, 74, 392, 331, 334, + 194, 372, 371, 370, 369, 368, 182, 206, 367, 198, + 366, 203, 365, 202, 204, 207, 208, 209, 211, 216, + 218, 222, 225, 364, 363, 362, 229, 232, 233, 234, + 361, 235, 236, 237, 360, 359, 240, 241, 244, 245, + 249, 250, 252, 257, 258, 358, 357, 259, 356, 261, + 266, 355, 270, 354, 267, 273, 353, 352, 274, 275, + 351, 277, 350, 349, 348, 347, 346, 345, 340, 335, + 330, 276, 326, 325, 278, 320, 282, 319, 286, 289, + 318, 317, 311, 310, 290, 291, 292, 293, 294, 299, + 300, 302, 303, 306, 307, 309, 308, 314, 195, 399, - 337, 342, 53 + 337, 340, 343, 348, 54 } ; -static yyconst short int yy_def[204] = +static yyconst short int yy_def[206] = { 0, - 198, 1, 198, 198, 198, 198, 199, 200, 201, 198, - 200, 202, 200, 200, 200, 200, 200, 200, 200, 200, - 200, 200, 200, 200, 200, 200, 200, 200, 200, 199, - 200, 198, 203, 198, 198, 198, 200, 202, 200, 200, - 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, - 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, - 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, - 200, 200, 200, 200, 200, 200, 198, 203, 198, 200, - 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, - 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, + 200, 1, 200, 200, 200, 200, 201, 202, 203, 200, + 202, 204, 202, 202, 202, 202, 202, 202, 202, 202, + 202, 202, 202, 202, 202, 202, 202, 202, 202, 201, + 202, 200, 205, 200, 200, 200, 202, 202, 204, 202, + 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, + 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, + 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, + 202, 202, 202, 202, 202, 202, 202, 200, 205, 200, + 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, + 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, - 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, - 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, - 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, - 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, - 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, - 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, - 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, - 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, - 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, - 200, 200, 200, 200, 200, 200, 200, 0, 198, 198, + 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, + 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, + 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, + 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, + 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, + 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, + 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, + 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, + 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, + 202, 202, 202, 202, 202, 202, 202, 202, 202, 0, - 198, 198, 198 + 200, 200, 200, 200, 200 } ; -static yyconst short int yy_nxt[425] = +static yyconst short int yy_nxt[433] = { 0, - 4, 5, 6, 7, 8, 9, 10, 11, 4, 12, - 13, 14, 15, 16, 17, 18, 19, 8, 20, 21, - 22, 23, 8, 24, 8, 25, 26, 27, 28, 29, - 8, 8, 34, 35, 37, 32, 32, 32, 32, 45, - 32, 39, 32, 32, 53, 80, 32, 40, 32, 46, - 32, 41, 50, 47, 42, 49, 78, 48, 54, 55, - 32, 51, 43, 32, 32, 44, 56, 52, 32, 32, - 58, 32, 61, 32, 60, 62, 37, 32, 57, 32, - 32, 32, 32, 32, 32, 76, 32, 69, 59, 32, - 70, 81, 63, 83, 82, 64, 71, 32, 65, 32, + 4, 5, 6, 7, 8, 9, 10, 8, 11, 4, + 12, 13, 14, 15, 16, 17, 18, 19, 8, 20, + 21, 22, 23, 8, 24, 8, 25, 26, 27, 28, + 29, 8, 8, 34, 32, 35, 37, 38, 32, 40, + 32, 32, 46, 32, 32, 41, 32, 47, 32, 42, + 51, 48, 43, 62, 32, 49, 50, 79, 32, 52, + 44, 32, 32, 45, 54, 53, 55, 56, 32, 32, + 57, 59, 32, 32, 32, 61, 70, 32, 63, 71, + 81, 32, 58, 32, 32, 72, 32, 77, 82, 60, + 32, 85, 129, 64, 84, 83, 65, 32, 32, 66, - 32, 86, 87, 88, 113, 89, 32, 32, 66, 67, - 84, 68, 32, 32, 32, 72, 32, 85, 90, 92, - 91, 32, 73, 74, 32, 32, 32, 96, 97, 32, - 75, 94, 32, 93, 32, 32, 99, 32, 32, 98, - 95, 32, 32, 100, 102, 32, 32, 103, 101, 111, - 32, 32, 107, 32, 104, 108, 110, 106, 109, 32, - 105, 112, 32, 32, 32, 114, 116, 32, 115, 32, - 32, 118, 32, 117, 119, 32, 32, 120, 122, 121, - 32, 123, 32, 126, 128, 32, 125, 32, 32, 32, - 32, 124, 32, 129, 127, 130, 131, 32, 132, 32, + 37, 38, 32, 32, 32, 32, 32, 88, 86, 67, + 68, 91, 69, 32, 32, 87, 73, 32, 93, 89, + 94, 32, 32, 74, 75, 90, 32, 32, 92, 32, + 98, 76, 32, 32, 32, 99, 32, 96, 32, 32, + 95, 32, 32, 101, 104, 97, 100, 102, 103, 32, + 105, 32, 32, 109, 113, 32, 110, 106, 32, 111, + 108, 32, 107, 112, 32, 114, 32, 32, 32, 81, + 32, 32, 115, 116, 32, 32, 120, 118, 121, 32, + 119, 32, 32, 32, 117, 122, 124, 32, 131, 123, + 128, 32, 125, 126, 127, 32, 32, 130, 32, 32, - 32, 135, 133, 32, 32, 141, 32, 134, 32, 32, - 32, 32, 144, 32, 145, 32, 32, 153, 32, 136, - 32, 142, 143, 32, 155, 32, 137, 149, 138, 146, - 147, 139, 32, 140, 32, 32, 148, 150, 151, 32, - 32, 32, 32, 32, 156, 32, 32, 158, 152, 32, - 154, 157, 161, 159, 32, 163, 32, 160, 32, 32, - 165, 162, 167, 32, 32, 169, 32, 170, 164, 32, - 171, 32, 32, 166, 172, 32, 32, 168, 174, 32, - 32, 176, 32, 32, 178, 177, 173, 179, 175, 180, - 32, 32, 32, 32, 32, 32, 182, 32, 184, 185, + 32, 32, 132, 32, 32, 134, 135, 32, 136, 133, + 138, 32, 32, 32, 137, 32, 32, 32, 32, 146, + 32, 139, 147, 140, 143, 32, 141, 32, 142, 144, + 145, 32, 152, 150, 32, 153, 148, 149, 32, 151, + 155, 32, 32, 32, 32, 32, 32, 154, 157, 32, + 32, 160, 156, 32, 32, 159, 163, 161, 32, 32, + 165, 32, 158, 162, 167, 169, 32, 32, 32, 164, + 32, 172, 171, 166, 173, 32, 32, 168, 174, 32, + 170, 176, 32, 32, 32, 32, 32, 32, 178, 179, + 181, 32, 175, 177, 182, 32, 180, 184, 32, 32, - 32, 181, 32, 183, 190, 32, 32, 186, 187, 32, - 32, 32, 32, 32, 32, 32, 188, 32, 32, 189, - 191, 194, 32, 32, 32, 192, 196, 195, 193, 32, - 197, 30, 30, 32, 30, 30, 30, 31, 32, 31, - 33, 33, 38, 32, 38, 38, 38, 38, 32, 32, + 32, 32, 32, 32, 186, 187, 183, 185, 32, 32, + 192, 32, 32, 188, 189, 32, 32, 32, 32, 32, + 32, 190, 191, 32, 193, 196, 32, 32, 32, 32, + 194, 195, 198, 197, 32, 32, 199, 30, 30, 32, + 30, 30, 30, 31, 32, 31, 33, 33, 39, 32, + 39, 39, 39, 39, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 79, - 32, 32, 32, 36, 35, 79, 32, 77, 36, 32, - 198, 3, 198, 198, 198, 198, 198, 198, 198, 198, + 32, 32, 32, 32, 32, 32, 80, 32, 32, 32, + 36, 35, 80, 32, 78, 36, 32, 200, 3, 200, - 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 198, 198, 198, 198 + 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, + 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, + 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, + 200, 200 } ; -static yyconst short int yy_chk[425] = +static yyconst short int yy_chk[433] = { 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, 9, 9, 11, 11, 13, 15, 19, 15, - 39, 13, 17, 16, 19, 39, 20, 13, 14, 16, - 18, 14, 18, 16, 14, 17, 203, 16, 20, 20, - 23, 18, 14, 24, 21, 14, 21, 18, 22, 25, - 22, 29, 24, 27, 23, 25, 37, 37, 21, 43, - 40, 47, 197, 48, 70, 29, 42, 27, 22, 26, - 27, 40, 26, 43, 42, 26, 27, 46, 26, 45, + 1, 1, 1, 9, 13, 9, 11, 11, 11, 13, + 15, 16, 15, 17, 24, 13, 14, 16, 18, 14, + 18, 16, 14, 24, 20, 16, 17, 205, 19, 18, + 14, 23, 27, 14, 19, 18, 20, 20, 21, 22, + 21, 22, 25, 29, 92, 23, 27, 44, 25, 27, + 37, 37, 21, 40, 41, 27, 43, 29, 40, 22, + 26, 44, 92, 26, 43, 41, 26, 46, 48, 26, - 49, 46, 47, 48, 70, 49, 51, 50, 26, 26, - 45, 26, 28, 52, 53, 28, 54, 45, 50, 52, - 51, 55, 28, 28, 56, 58, 57, 56, 57, 60, - 28, 54, 59, 53, 61, 62, 58, 63, 64, 57, - 55, 65, 66, 59, 61, 72, 67, 62, 60, 67, - 71, 68, 65, 73, 62, 65, 66, 64, 65, 74, - 63, 68, 75, 81, 76, 71, 73, 83, 72, 82, - 84, 75, 85, 74, 76, 86, 90, 81, 83, 82, - 88, 84, 91, 88, 91, 94, 86, 92, 108, 93, - 99, 85, 96, 92, 90, 93, 94, 97, 96, 98, + 38, 38, 38, 47, 52, 49, 50, 47, 46, 26, + 26, 50, 26, 28, 53, 46, 28, 51, 52, 48, + 53, 54, 55, 28, 28, 49, 56, 57, 51, 61, + 57, 28, 59, 58, 62, 58, 60, 55, 63, 64, + 54, 65, 66, 59, 62, 56, 58, 60, 61, 67, + 63, 68, 71, 66, 68, 69, 66, 63, 72, 66, + 65, 73, 64, 67, 74, 69, 75, 76, 77, 81, + 81, 83, 71, 72, 87, 85, 76, 74, 77, 84, + 75, 86, 94, 88, 73, 83, 85, 90, 94, 84, + 90, 107, 86, 87, 88, 93, 95, 93, 96, 98, - 105, 99, 97, 112, 110, 108, 113, 98, 114, 195, - 115, 116, 113, 118, 114, 125, 182, 125, 127, 105, - 106, 110, 112, 117, 127, 128, 106, 118, 106, 115, - 116, 106, 119, 106, 120, 121, 117, 119, 120, 126, - 130, 131, 132, 135, 128, 137, 136, 131, 121, 138, - 126, 130, 136, 132, 139, 138, 140, 135, 141, 142, - 139, 137, 140, 143, 146, 142, 148, 143, 138, 149, - 146, 153, 158, 139, 148, 154, 151, 141, 151, 157, - 170, 154, 173, 160, 158, 157, 149, 160, 153, 170, - 175, 177, 178, 183, 184, 185, 175, 186, 178, 183, + 100, 99, 95, 101, 199, 98, 99, 110, 100, 96, + 107, 114, 112, 115, 101, 108, 116, 117, 118, 115, + 119, 108, 116, 108, 110, 120, 108, 121, 108, 112, + 114, 122, 121, 119, 123, 122, 117, 118, 127, 120, + 127, 128, 129, 130, 132, 133, 134, 123, 129, 137, + 138, 133, 128, 139, 140, 132, 138, 134, 141, 142, + 140, 143, 130, 137, 141, 142, 144, 145, 148, 139, + 150, 145, 144, 140, 148, 151, 155, 141, 150, 153, + 143, 153, 156, 159, 160, 172, 162, 175, 156, 159, + 162, 177, 151, 155, 172, 179, 160, 177, 180, 185, - 187, 173, 188, 177, 188, 189, 190, 184, 185, 191, - 193, 192, 194, 181, 180, 179, 186, 196, 176, 187, - 189, 192, 174, 172, 171, 190, 194, 193, 191, 169, - 196, 199, 199, 168, 199, 199, 199, 200, 167, 200, - 201, 201, 202, 166, 202, 202, 202, 202, 165, 164, - 163, 162, 161, 159, 156, 155, 152, 150, 147, 145, - 144, 134, 133, 129, 124, 123, 122, 111, 109, 107, - 104, 103, 102, 101, 100, 95, 89, 87, 80, 79, - 69, 44, 41, 36, 35, 34, 31, 30, 10, 8, - 3, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 186, 187, 188, 189, 180, 185, 175, 179, 190, 191, + 190, 192, 193, 186, 187, 194, 195, 197, 196, 184, + 183, 188, 189, 198, 191, 194, 182, 181, 178, 176, + 192, 193, 196, 195, 174, 173, 198, 201, 201, 171, + 201, 201, 201, 202, 170, 202, 203, 203, 204, 169, + 204, 204, 204, 204, 168, 167, 166, 165, 164, 163, + 161, 158, 157, 154, 152, 149, 147, 146, 136, 135, + 131, 126, 125, 124, 113, 111, 109, 106, 105, 104, + 103, 102, 97, 91, 89, 82, 80, 70, 45, 42, + 36, 35, 34, 31, 30, 10, 8, 3, 200, 200, - 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 198, 198, 198, 198 + 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, + 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, + 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, + 200, 200 } ; static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr; @@ -614,7 +617,9 @@ uint64_t atoull(const char *Buffer) { * are preceeded by a '%' character. These represent unnamed variable slots. */ /* E[PN]Integer: match positive and negative literal integer values */ -#line 618 "Lexer.cpp" +/* FPConstant - A Floating point constant. + TODO: Expand lexer to support 10e50 FP constant notation */ +#line 623 "Lexer.cpp" /* Macros after this point can all be overridden by user definitions in * section 1. @@ -765,10 +770,10 @@ YY_DECL register char *yy_cp, *yy_bp; register int yy_act; -#line 83 "Lexer.l" +#line 87 "Lexer.l" -#line 772 "Lexer.cpp" +#line 777 "Lexer.cpp" if ( yy_init ) { @@ -816,14 +821,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 >= 199 ) + if ( yy_current_state >= 201 ) 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 != 198 ); + while ( yy_current_state != 200 ); yy_find_action: yy_current_state = *--yy_state_ptr; @@ -860,262 +865,262 @@ do_action: /* This label is used only to access EOF actions. */ { /* beginning of action switch */ case 1: YY_RULE_SETUP -#line 85 "Lexer.l" +#line 89 "Lexer.l" { /* Ignore comments for now */ } YY_BREAK case 2: YY_RULE_SETUP -#line 87 "Lexer.l" +#line 91 "Lexer.l" { return BEGINTOK; } YY_BREAK case 3: YY_RULE_SETUP -#line 88 "Lexer.l" +#line 92 "Lexer.l" { return END; } YY_BREAK case 4: YY_RULE_SETUP -#line 89 "Lexer.l" +#line 93 "Lexer.l" { return TRUE; } YY_BREAK case 5: YY_RULE_SETUP -#line 90 "Lexer.l" +#line 94 "Lexer.l" { return FALSE; } YY_BREAK case 6: YY_RULE_SETUP -#line 91 "Lexer.l" +#line 95 "Lexer.l" { return DECLARE; } YY_BREAK case 7: YY_RULE_SETUP -#line 92 "Lexer.l" +#line 96 "Lexer.l" { return IMPLEMENTATION; } YY_BREAK case 8: YY_RULE_SETUP -#line 94 "Lexer.l" +#line 98 "Lexer.l" { cerr << "deprecated argument '-' used!\n"; return '-'; } YY_BREAK case 9: YY_RULE_SETUP -#line 95 "Lexer.l" +#line 99 "Lexer.l" { cerr << "deprecated type 'bb' used!\n"; llvmAsmlval.TypeVal = Type::LabelTy; return LABEL;} YY_BREAK case 10: YY_RULE_SETUP -#line 97 "Lexer.l" +#line 101 "Lexer.l" { llvmAsmlval.TypeVal = Type::VoidTy ; return VOID; } YY_BREAK case 11: YY_RULE_SETUP -#line 98 "Lexer.l" +#line 102 "Lexer.l" { llvmAsmlval.TypeVal = Type::BoolTy ; return BOOL; } YY_BREAK case 12: YY_RULE_SETUP -#line 99 "Lexer.l" +#line 103 "Lexer.l" { llvmAsmlval.TypeVal = Type::SByteTy ; return SBYTE; } YY_BREAK case 13: YY_RULE_SETUP -#line 100 "Lexer.l" +#line 104 "Lexer.l" { llvmAsmlval.TypeVal = Type::UByteTy ; return UBYTE; } YY_BREAK case 14: YY_RULE_SETUP -#line 101 "Lexer.l" +#line 105 "Lexer.l" { llvmAsmlval.TypeVal = Type::ShortTy ; return SHORT; } YY_BREAK case 15: YY_RULE_SETUP -#line 102 "Lexer.l" +#line 106 "Lexer.l" { llvmAsmlval.TypeVal = Type::UShortTy; return USHORT; } YY_BREAK case 16: YY_RULE_SETUP -#line 103 "Lexer.l" +#line 107 "Lexer.l" { llvmAsmlval.TypeVal = Type::IntTy ; return INT; } YY_BREAK case 17: YY_RULE_SETUP -#line 104 "Lexer.l" +#line 108 "Lexer.l" { llvmAsmlval.TypeVal = Type::UIntTy ; return UINT; } YY_BREAK case 18: YY_RULE_SETUP -#line 105 "Lexer.l" +#line 109 "Lexer.l" { llvmAsmlval.TypeVal = Type::LongTy ; return LONG; } YY_BREAK case 19: YY_RULE_SETUP -#line 106 "Lexer.l" +#line 110 "Lexer.l" { llvmAsmlval.TypeVal = Type::ULongTy ; return ULONG; } YY_BREAK case 20: YY_RULE_SETUP -#line 107 "Lexer.l" +#line 111 "Lexer.l" { llvmAsmlval.TypeVal = Type::FloatTy ; return FLOAT; } YY_BREAK case 21: YY_RULE_SETUP -#line 108 "Lexer.l" +#line 112 "Lexer.l" { llvmAsmlval.TypeVal = Type::DoubleTy; return DOUBLE; } YY_BREAK case 22: YY_RULE_SETUP -#line 110 "Lexer.l" +#line 114 "Lexer.l" { llvmAsmlval.TypeVal = Type::TypeTy ; return TYPE; } YY_BREAK case 23: YY_RULE_SETUP -#line 112 "Lexer.l" +#line 116 "Lexer.l" { llvmAsmlval.TypeVal = Type::LabelTy ; return LABEL; } YY_BREAK case 24: YY_RULE_SETUP -#line 115 "Lexer.l" +#line 119 "Lexer.l" { RET_TOK(UnaryOpVal, Not, NOT); } YY_BREAK case 25: YY_RULE_SETUP -#line 117 "Lexer.l" +#line 121 "Lexer.l" { RET_TOK(BinaryOpVal, Add, ADD); } YY_BREAK case 26: YY_RULE_SETUP -#line 118 "Lexer.l" +#line 122 "Lexer.l" { RET_TOK(BinaryOpVal, Sub, SUB); } YY_BREAK case 27: YY_RULE_SETUP -#line 119 "Lexer.l" +#line 123 "Lexer.l" { RET_TOK(BinaryOpVal, Mul, MUL); } YY_BREAK case 28: YY_RULE_SETUP -#line 120 "Lexer.l" +#line 124 "Lexer.l" { RET_TOK(BinaryOpVal, Div, DIV); } YY_BREAK case 29: YY_RULE_SETUP -#line 121 "Lexer.l" +#line 125 "Lexer.l" { RET_TOK(BinaryOpVal, Rem, REM); } YY_BREAK case 30: YY_RULE_SETUP -#line 122 "Lexer.l" +#line 126 "Lexer.l" { RET_TOK(BinaryOpVal, SetNE, SETNE); } YY_BREAK case 31: YY_RULE_SETUP -#line 123 "Lexer.l" +#line 127 "Lexer.l" { RET_TOK(BinaryOpVal, SetEQ, SETEQ); } YY_BREAK case 32: YY_RULE_SETUP -#line 124 "Lexer.l" +#line 128 "Lexer.l" { RET_TOK(BinaryOpVal, SetLT, SETLT); } YY_BREAK case 33: YY_RULE_SETUP -#line 125 "Lexer.l" +#line 129 "Lexer.l" { RET_TOK(BinaryOpVal, SetGT, SETGT); } YY_BREAK case 34: YY_RULE_SETUP -#line 126 "Lexer.l" +#line 130 "Lexer.l" { RET_TOK(BinaryOpVal, SetLE, SETLE); } YY_BREAK case 35: YY_RULE_SETUP -#line 127 "Lexer.l" +#line 131 "Lexer.l" { RET_TOK(BinaryOpVal, SetGE, SETGE); } YY_BREAK case 36: YY_RULE_SETUP -#line 129 "Lexer.l" +#line 133 "Lexer.l" { return TO; } YY_BREAK case 37: YY_RULE_SETUP -#line 130 "Lexer.l" +#line 134 "Lexer.l" { RET_TOK(OtherOpVal, PHINode, PHI); } YY_BREAK case 38: YY_RULE_SETUP -#line 131 "Lexer.l" +#line 135 "Lexer.l" { RET_TOK(OtherOpVal, Call, CALL); } YY_BREAK case 39: YY_RULE_SETUP -#line 132 "Lexer.l" +#line 136 "Lexer.l" { RET_TOK(OtherOpVal, Cast, CAST); } YY_BREAK case 40: YY_RULE_SETUP -#line 133 "Lexer.l" +#line 137 "Lexer.l" { RET_TOK(OtherOpVal, Shl, SHL); } YY_BREAK case 41: YY_RULE_SETUP -#line 134 "Lexer.l" +#line 138 "Lexer.l" { RET_TOK(OtherOpVal, Shr, SHR); } YY_BREAK case 42: YY_RULE_SETUP -#line 136 "Lexer.l" +#line 140 "Lexer.l" { RET_TOK(TermOpVal, Ret, RET); } YY_BREAK case 43: YY_RULE_SETUP -#line 137 "Lexer.l" +#line 141 "Lexer.l" { RET_TOK(TermOpVal, Br, BR); } YY_BREAK case 44: YY_RULE_SETUP -#line 138 "Lexer.l" +#line 142 "Lexer.l" { RET_TOK(TermOpVal, Switch, SWITCH); } YY_BREAK case 45: YY_RULE_SETUP -#line 141 "Lexer.l" +#line 145 "Lexer.l" { RET_TOK(MemOpVal, Malloc, MALLOC); } YY_BREAK case 46: YY_RULE_SETUP -#line 142 "Lexer.l" +#line 146 "Lexer.l" { RET_TOK(MemOpVal, Alloca, ALLOCA); } YY_BREAK case 47: YY_RULE_SETUP -#line 143 "Lexer.l" +#line 147 "Lexer.l" { RET_TOK(MemOpVal, Free, FREE); } YY_BREAK case 48: YY_RULE_SETUP -#line 144 "Lexer.l" +#line 148 "Lexer.l" { RET_TOK(MemOpVal, Load, LOAD); } YY_BREAK case 49: YY_RULE_SETUP -#line 145 "Lexer.l" +#line 149 "Lexer.l" { RET_TOK(MemOpVal, Store, STORE); } YY_BREAK case 50: YY_RULE_SETUP -#line 146 "Lexer.l" +#line 150 "Lexer.l" { RET_TOK(MemOpVal, GetElementPtr, GETELEMENTPTR); } YY_BREAK case 51: YY_RULE_SETUP -#line 149 "Lexer.l" +#line 153 "Lexer.l" { llvmAsmlval.StrVal = strdup(yytext+1); return VAR_ID; } YY_BREAK case 52: YY_RULE_SETUP -#line 150 "Lexer.l" +#line 154 "Lexer.l" { yytext[strlen(yytext)-1] = 0; // nuke colon llvmAsmlval.StrVal = strdup(yytext); @@ -1124,7 +1129,7 @@ YY_RULE_SETUP YY_BREAK case 53: YY_RULE_SETUP -#line 156 "Lexer.l" +#line 160 "Lexer.l" { yytext[strlen(yytext)-1] = 0; // nuke end quote llvmAsmlval.StrVal = strdup(yytext+1); // Nuke start quote @@ -1133,12 +1138,12 @@ YY_RULE_SETUP YY_BREAK case 54: YY_RULE_SETUP -#line 163 "Lexer.l" +#line 167 "Lexer.l" { llvmAsmlval.UInt64Val = atoull(yytext); return EUINT64VAL; } YY_BREAK case 55: YY_RULE_SETUP -#line 164 "Lexer.l" +#line 168 "Lexer.l" { uint64_t Val = atoull(yytext+1); // +1: we have bigger negative range @@ -1150,12 +1155,12 @@ YY_RULE_SETUP YY_BREAK case 56: YY_RULE_SETUP -#line 174 "Lexer.l" +#line 178 "Lexer.l" { llvmAsmlval.UIntVal = atoull(yytext+1); return UINTVAL; } YY_BREAK case 57: YY_RULE_SETUP -#line 175 "Lexer.l" +#line 179 "Lexer.l" { uint64_t Val = atoull(yytext+2); // +1: we have bigger negative range @@ -1167,20 +1172,25 @@ YY_RULE_SETUP YY_BREAK case 58: YY_RULE_SETUP -#line 185 "Lexer.l" -{ /* Ignore whitespace */ } +#line 188 "Lexer.l" +{ llvmAsmlval.FPVal = atof(yytext); return FPVAL; } YY_BREAK case 59: YY_RULE_SETUP -#line 186 "Lexer.l" -{ /*printf("'%s'", yytext);*/ return yytext[0]; } +#line 190 "Lexer.l" +{ /* Ignore whitespace */ } YY_BREAK case 60: YY_RULE_SETUP -#line 188 "Lexer.l" +#line 191 "Lexer.l" +{ /*printf("'%s'", yytext);*/ return yytext[0]; } + YY_BREAK +case 61: +YY_RULE_SETUP +#line 193 "Lexer.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK -#line 1185 "Lexer.cpp" +#line 1195 "Lexer.cpp" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -1469,7 +1479,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 >= 199 ) + if ( yy_current_state >= 201 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1499,11 +1509,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 >= 199 ) + if ( yy_current_state >= 201 ) 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 == 198); + yy_is_jam = (yy_current_state == 200); if ( ! yy_is_jam ) *yy_state_ptr++ = yy_current_state; @@ -2064,5 +2074,5 @@ int main() return 0; } #endif -#line 188 "Lexer.l" +#line 193 "Lexer.l" diff --git a/llvm/lib/AsmParser/Lexer.l b/llvm/lib/AsmParser/Lexer.l index 91fc1b69c96c..e966de155fbf 100644 --- a/llvm/lib/AsmParser/Lexer.l +++ b/llvm/lib/AsmParser/Lexer.l @@ -80,6 +80,10 @@ ENInteger %-[0-9]+ PInteger [0-9]+ NInteger -[0-9]+ +/* FPConstant - A Floating point constant. + TODO: Expand lexer to support 10e50 FP constant notation */ +FPConstant [0-9]+[.][0-9]* + %% {Comment} { /* Ignore comments for now */ } @@ -181,6 +185,7 @@ getelementptr { RET_TOK(MemOpVal, GetElementPtr, GETELEMENTPTR); } return SINTVAL; } +{FPConstant} { llvmAsmlval.FPVal = atof(yytext); return FPVAL; } [ \t\n] { /* Ignore whitespace */ } . { /*printf("'%s'", yytext);*/ return yytext[0]; } diff --git a/llvm/lib/AsmParser/ParserInternals.h b/llvm/lib/AsmParser/ParserInternals.h index bd26fdbaaf55..d9f34440b850 100644 --- a/llvm/lib/AsmParser/ParserInternals.h +++ b/llvm/lib/AsmParser/ParserInternals.h @@ -53,12 +53,14 @@ static inline void ThrowException(const string &message) { // struct ValID { int Type; // 0 = number, 1 = name, 2 = const pool, - // 3 = unsigned const pool, 4 = const string + // 3 = unsigned const pool, 4 = const string, + // 5 = const fp union { int Num; // If it's a numeric reference char *Name; // If it's a named reference. Memory must be free'd. int64_t ConstPool64; // Constant pool reference. This is the value uint64_t UConstPool64;// Unsigned constant pool reference. + double ConstPoolFP; // Floating point constant pool reference }; static ValID create(int Num) { @@ -81,6 +83,10 @@ struct ValID { ValID D; D.Type = 4; D.Name = Name; return D; } + static ValID create(double Val) { + ValID D; D.Type = 5; D.ConstPoolFP = Val; return D; + } + inline void destroy() { if (Type == 1 || Type == 4) free(Name); // Free this strdup'd memory... } @@ -97,6 +103,7 @@ struct ValID { case 0: return string("#") + itostr(Num); case 1: return Name; case 4: return string("\"") + Name + string("\""); + case 5: return ftostr(ConstPoolFP); default: return string("%") + itostr(ConstPool64); } } diff --git a/llvm/lib/AsmParser/llvmAsmParser.cpp b/llvm/lib/AsmParser/llvmAsmParser.cpp index 330e8a58acd4..f0a5767774ff 100644 --- a/llvm/lib/AsmParser/llvmAsmParser.cpp +++ b/llvm/lib/AsmParser/llvmAsmParser.cpp @@ -15,57 +15,58 @@ #define EUINT64VAL 258 #define SINTVAL 259 #define UINTVAL 260 -#define VOID 261 -#define BOOL 262 -#define SBYTE 263 -#define UBYTE 264 -#define SHORT 265 -#define USHORT 266 -#define INT 267 -#define UINT 268 -#define LONG 269 -#define ULONG 270 -#define FLOAT 271 -#define DOUBLE 272 -#define STRING 273 -#define TYPE 274 -#define LABEL 275 -#define VAR_ID 276 -#define LABELSTR 277 -#define STRINGCONSTANT 278 -#define IMPLEMENTATION 279 -#define TRUE 280 -#define FALSE 281 -#define BEGINTOK 282 -#define END 283 -#define DECLARE 284 -#define TO 285 -#define RET 286 -#define BR 287 -#define SWITCH 288 -#define NOT 289 -#define ADD 290 -#define SUB 291 -#define MUL 292 -#define DIV 293 -#define REM 294 -#define SETLE 295 -#define SETGE 296 -#define SETLT 297 -#define SETGT 298 -#define SETEQ 299 -#define SETNE 300 -#define MALLOC 301 -#define ALLOCA 302 -#define FREE 303 -#define LOAD 304 -#define STORE 305 -#define GETELEMENTPTR 306 -#define PHI 307 -#define CALL 308 -#define CAST 309 -#define SHL 310 -#define SHR 311 +#define FPVAL 261 +#define VOID 262 +#define BOOL 263 +#define SBYTE 264 +#define UBYTE 265 +#define SHORT 266 +#define USHORT 267 +#define INT 268 +#define UINT 269 +#define LONG 270 +#define ULONG 271 +#define FLOAT 272 +#define DOUBLE 273 +#define STRING 274 +#define TYPE 275 +#define LABEL 276 +#define VAR_ID 277 +#define LABELSTR 278 +#define STRINGCONSTANT 279 +#define IMPLEMENTATION 280 +#define TRUE 281 +#define FALSE 282 +#define BEGINTOK 283 +#define END 284 +#define DECLARE 285 +#define TO 286 +#define RET 287 +#define BR 288 +#define SWITCH 289 +#define NOT 290 +#define ADD 291 +#define SUB 292 +#define MUL 293 +#define DIV 294 +#define REM 295 +#define SETLE 296 +#define SETGE 297 +#define SETLT 298 +#define SETGT 299 +#define SETEQ 300 +#define SETNE 301 +#define MALLOC 302 +#define ALLOCA 303 +#define FREE 304 +#define LOAD 305 +#define STORE 306 +#define GETELEMENTPTR 307 +#define PHI 308 +#define CALL 309 +#define CAST 310 +#define SHL 311 +#define SHR 312 #line 13 "llvmAsmParser.y" @@ -199,7 +200,8 @@ static Value *getVal(const Type *Type, ValID &D, case 2: // Is it a constant pool reference?? case 3: // Is it an unsigned const pool reference? - case 4:{ // Is it a string const pool reference? + case 4: // Is it a string const pool reference? + case 5:{ // Is it a floating point const pool reference? ConstPoolVal *CPV = 0; // Check to make sure that "Type" is an integral type, and that our @@ -210,14 +212,16 @@ static Value *getVal(const Type *Type, ValID &D, CPV = new ConstPoolBool(D.ConstPool64 != 0); } else { if (!ConstPoolSInt::isValueValidForType(Type, D.ConstPool64)) - ThrowException("Symbolic constant pool reference is invalid!"); + ThrowException("Symbolic constant pool value '" + + itostr(D.ConstPool64) + "' is invalid for type '" + + Type->getName() + "'!"); CPV = new ConstPoolSInt(Type, D.ConstPool64); } break; case 3: if (!ConstPoolUInt::isValueValidForType(Type, D.UConstPool64)) { if (!ConstPoolSInt::isValueValidForType(Type, D.ConstPool64)) { - ThrowException("Symbolic constant pool reference is invalid!"); + ThrowException("Integral constant pool reference is invalid!"); } else { // This is really a signed reference. Transmogrify. CPV = new ConstPoolSInt(Type, D.ConstPool64); } @@ -231,6 +235,12 @@ static Value *getVal(const Type *Type, ValID &D, //CPV = new ConstPoolString(D.Name); D.destroy(); // Free the string memory break; + case 5: + if (!ConstPoolFP::isValueValidForType(Type, D.ConstPoolFP)) + ThrowException("FP constant invalid for type!!"); + else + CPV = new ConstPoolFP(Type, D.ConstPoolFP); + break; } assert(CPV && "How did we escape creating a constant??"); @@ -427,7 +437,7 @@ Module *RunVMAsmParser(const ToolCommandLine &Opts, FILE *F) { } -#line 373 "llvmAsmParser.y" +#line 382 "llvmAsmParser.y" typedef union { Module *ModuleVal; Method *MethodVal; @@ -449,6 +459,7 @@ typedef union { uint64_t UInt64Val; int SIntVal; unsigned UIntVal; + double FPVal; char *StrVal; // This memory is allocated by strdup! ValID ValIDVal; // May contain memory allocated by strdup @@ -469,26 +480,26 @@ typedef union { -#define YYFINAL 260 +#define YYFINAL 265 #define YYFLAG -32768 -#define YYNTBASE 68 +#define YYNTBASE 69 -#define YYTRANSLATE(x) ((unsigned)(x) <= 311 ? yytranslate[x] : 106) +#define YYTRANSLATE(x) ((unsigned)(x) <= 312 ? yytranslate[x] : 108) static const char yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 65, - 66, 67, 2, 64, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 66, + 67, 68, 2, 65, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 58, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 59, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 59, 2, 60, 2, 2, 2, 2, 2, 2, 2, + 60, 2, 61, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 61, - 2, 2, 62, 2, 63, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 62, + 2, 2, 63, 2, 64, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -507,7 +518,7 @@ static const char yytranslate[] = { 0, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57 + 57, 58 }; #if YYDEBUG != 0 @@ -516,79 +527,82 @@ static const short yyprhs[] = { 0, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, - 80, 82, 84, 86, 88, 91, 92, 95, 98, 101, - 104, 107, 110, 117, 123, 132, 140, 147, 152, 156, - 158, 162, 163, 165, 168, 171, 173, 174, 177, 181, - 183, 185, 186, 192, 196, 199, 201, 203, 205, 207, - 209, 211, 213, 215, 217, 222, 226, 230, 236, 240, - 243, 246, 248, 252, 255, 258, 261, 265, 268, 269, - 273, 276, 280, 290, 300, 307, 313, 316, 323, 331, - 334, 339, 341, 342, 348, 352, 359, 365, 368, 375, - 377, 380, 381, 384, 390, 393, 399, 403, 408, 416 + 80, 82, 84, 86, 88, 90, 92, 95, 96, 99, + 102, 105, 108, 111, 114, 117, 124, 130, 139, 147, + 154, 159, 163, 165, 169, 170, 172, 175, 178, 180, + 181, 184, 188, 190, 192, 193, 199, 203, 206, 208, + 210, 212, 214, 216, 218, 220, 222, 224, 226, 231, + 235, 239, 245, 249, 252, 255, 257, 261, 264, 267, + 270, 274, 277, 278, 282, 285, 289, 299, 309, 316, + 322, 325, 332, 340, 343, 348, 350, 351, 357, 361, + 368, 374, 377, 384, 386, 389, 390, 393, 399, 402, + 408, 412, 417, 425 }; static const short yyrhs[] = { 5, - 0, 6, 0, 3, 0, 4, 0, 8, 0, 9, - 0, 10, 0, 11, 0, 12, 0, 13, 0, 14, - 0, 15, 0, 16, 0, 17, 0, 18, 0, 19, - 0, 20, 0, 21, 0, 70, 0, 7, 0, 35, - 0, 36, 0, 37, 0, 38, 0, 39, 0, 40, - 0, 41, 0, 42, 0, 43, 0, 44, 0, 45, - 0, 46, 0, 56, 0, 57, 0, 15, 0, 13, - 0, 11, 0, 9, 0, 16, 0, 14, 0, 12, - 0, 10, 0, 75, 0, 76, 0, 22, 58, 0, - 0, 75, 69, 0, 76, 4, 0, 8, 26, 0, - 8, 27, 0, 19, 24, 0, 20, 70, 0, 59, - 70, 60, 59, 80, 60, 0, 59, 70, 60, 59, - 60, 0, 59, 4, 61, 70, 60, 59, 80, 60, - 0, 59, 4, 61, 70, 60, 59, 60, 0, 62, - 93, 63, 62, 80, 63, 0, 62, 63, 62, 63, - 0, 80, 64, 79, 0, 79, 0, 81, 78, 79, - 0, 0, 83, 0, 83, 90, 0, 81, 25, 0, - 22, 0, 0, 70, 84, 0, 85, 64, 86, 0, - 85, 0, 86, 0, 0, 71, 24, 65, 87, 66, - 0, 88, 81, 28, 0, 94, 29, 0, 3, 0, - 4, 0, 26, 0, 27, 0, 24, 0, 68, 0, - 22, 0, 91, 0, 92, 0, 71, 65, 93, 66, - 0, 71, 65, 66, 0, 59, 70, 60, 0, 59, - 4, 61, 70, 60, 0, 62, 93, 63, 0, 62, - 63, 0, 70, 67, 0, 70, 0, 93, 64, 70, - 0, 94, 95, 0, 89, 95, 0, 96, 97, 0, - 23, 96, 97, 0, 96, 99, 0, 0, 32, 70, - 92, 0, 32, 7, 0, 33, 21, 92, 0, 33, - 8, 92, 64, 21, 92, 64, 21, 92, 0, 34, - 77, 92, 64, 21, 92, 59, 98, 60, 0, 98, - 77, 91, 64, 21, 92, 0, 77, 91, 64, 21, - 92, 0, 78, 103, 0, 70, 59, 92, 64, 92, - 60, 0, 100, 64, 59, 92, 64, 92, 60, 0, - 70, 92, 0, 101, 64, 70, 92, 0, 101, 0, - 0, 73, 70, 92, 64, 92, 0, 72, 70, 92, - 0, 74, 70, 92, 64, 70, 92, 0, 55, 70, - 92, 31, 70, 0, 53, 100, 0, 54, 70, 92, - 65, 102, 66, 0, 105, 0, 64, 80, 0, 0, - 47, 70, 0, 47, 70, 64, 14, 92, 0, 48, - 70, 0, 48, 70, 64, 14, 92, 0, 49, 70, - 92, 0, 50, 70, 92, 104, 0, 51, 70, 92, - 64, 70, 92, 104, 0, 52, 70, 92, 104, 0 + 0, 6, 0, 3, 0, 4, 0, 9, 0, 10, + 0, 11, 0, 12, 0, 13, 0, 14, 0, 15, + 0, 16, 0, 17, 0, 18, 0, 19, 0, 20, + 0, 21, 0, 22, 0, 71, 0, 8, 0, 36, + 0, 37, 0, 38, 0, 39, 0, 40, 0, 41, + 0, 42, 0, 43, 0, 44, 0, 45, 0, 46, + 0, 47, 0, 57, 0, 58, 0, 16, 0, 14, + 0, 12, 0, 10, 0, 17, 0, 15, 0, 13, + 0, 11, 0, 76, 0, 77, 0, 18, 0, 19, + 0, 23, 59, 0, 0, 76, 70, 0, 77, 4, + 0, 9, 27, 0, 9, 28, 0, 79, 7, 0, + 20, 25, 0, 21, 71, 0, 60, 71, 61, 60, + 82, 61, 0, 60, 71, 61, 60, 61, 0, 60, + 4, 62, 71, 61, 60, 82, 61, 0, 60, 4, + 62, 71, 61, 60, 61, 0, 63, 95, 64, 63, + 82, 64, 0, 63, 64, 63, 64, 0, 82, 65, + 81, 0, 81, 0, 83, 80, 81, 0, 0, 85, + 0, 85, 92, 0, 83, 26, 0, 23, 0, 0, + 71, 86, 0, 87, 65, 88, 0, 87, 0, 88, + 0, 0, 72, 25, 66, 89, 67, 0, 90, 83, + 29, 0, 96, 30, 0, 3, 0, 4, 0, 7, + 0, 27, 0, 28, 0, 25, 0, 69, 0, 23, + 0, 93, 0, 94, 0, 72, 66, 95, 67, 0, + 72, 66, 67, 0, 60, 71, 61, 0, 60, 4, + 62, 71, 61, 0, 63, 95, 64, 0, 63, 64, + 0, 71, 68, 0, 71, 0, 95, 65, 71, 0, + 96, 97, 0, 91, 97, 0, 98, 99, 0, 24, + 98, 99, 0, 98, 101, 0, 0, 33, 71, 94, + 0, 33, 8, 0, 34, 22, 94, 0, 34, 9, + 94, 65, 22, 94, 65, 22, 94, 0, 35, 78, + 94, 65, 22, 94, 60, 100, 61, 0, 100, 78, + 93, 65, 22, 94, 0, 78, 93, 65, 22, 94, + 0, 80, 105, 0, 71, 60, 94, 65, 94, 61, + 0, 102, 65, 60, 94, 65, 94, 61, 0, 71, + 94, 0, 103, 65, 71, 94, 0, 103, 0, 0, + 74, 71, 94, 65, 94, 0, 73, 71, 94, 0, + 75, 71, 94, 65, 71, 94, 0, 56, 71, 94, + 32, 71, 0, 54, 102, 0, 55, 71, 94, 66, + 104, 67, 0, 107, 0, 65, 82, 0, 0, 48, + 71, 0, 48, 71, 65, 15, 94, 0, 49, 71, + 0, 49, 71, 65, 15, 94, 0, 50, 71, 94, + 0, 51, 71, 94, 106, 0, 52, 71, 94, 65, + 71, 94, 106, 0, 53, 71, 94, 106, 0 }; #endif #if YYDEBUG != 0 static const short yyrline[] = { 0, - 470, 471, 478, 479, 490, 490, 490, 490, 490, 490, - 490, 491, 491, 491, 491, 491, 491, 491, 494, 494, - 499, 500, 500, 500, 500, 500, 501, 501, 501, 501, - 501, 501, 502, 502, 506, 506, 506, 506, 507, 507, - 507, 507, 508, 508, 511, 514, 521, 526, 531, 534, - 537, 543, 546, 559, 563, 581, 588, 596, 610, 613, - 623, 640, 651, 658, 663, 672, 672, 674, 682, 686, - 691, 694, 698, 725, 729, 738, 741, 744, 747, 750, - 755, 758, 761, 768, 776, 781, 785, 788, 791, 796, - 799, 804, 808, 813, 817, 826, 831, 840, 844, 848, - 851, 854, 857, 862, 873, 881, 891, 899, 904, 911, - 915, 921, 921, 923, 928, 933, 937, 940, 951, 988, - 993, 995, 999, 1002, 1009, 1012, 1020, 1026, 1035, 1047 + 481, 482, 489, 490, 501, 501, 501, 501, 501, 501, + 501, 502, 502, 502, 502, 502, 502, 502, 505, 505, + 510, 511, 511, 511, 511, 511, 512, 512, 512, 512, + 512, 512, 513, 513, 517, 517, 517, 517, 518, 518, + 518, 518, 519, 519, 520, 520, 523, 526, 533, 538, + 543, 546, 549, 552, 558, 561, 574, 578, 596, 603, + 611, 625, 628, 638, 655, 666, 673, 678, 687, 687, + 689, 697, 701, 706, 709, 713, 740, 744, 753, 756, + 759, 762, 765, 768, 773, 776, 779, 786, 794, 799, + 803, 806, 809, 814, 817, 822, 826, 831, 835, 844, + 849, 858, 862, 866, 869, 872, 875, 880, 891, 899, + 909, 917, 922, 929, 933, 939, 939, 941, 946, 951, + 955, 958, 969, 1006, 1011, 1013, 1017, 1020, 1027, 1030, + 1038, 1044, 1053, 1065 }; #endif @@ -596,36 +610,37 @@ static const short yyrline[] = { 0, #if YYDEBUG != 0 || defined (YYERROR_VERBOSE) static const char * const yytname[] = { "$","error","$undefined.","ESINT64VAL", -"EUINT64VAL","SINTVAL","UINTVAL","VOID","BOOL","SBYTE","UBYTE","SHORT","USHORT", -"INT","UINT","LONG","ULONG","FLOAT","DOUBLE","STRING","TYPE","LABEL","VAR_ID", -"LABELSTR","STRINGCONSTANT","IMPLEMENTATION","TRUE","FALSE","BEGINTOK","END", -"DECLARE","TO","RET","BR","SWITCH","NOT","ADD","SUB","MUL","DIV","REM","SETLE", -"SETGE","SETLT","SETGT","SETEQ","SETNE","MALLOC","ALLOCA","FREE","LOAD","STORE", -"GETELEMENTPTR","PHI","CALL","CAST","SHL","SHR","'='","'['","']'","'x'","'{'", -"'}'","','","'('","')'","'*'","INTVAL","EINT64VAL","Types","TypesV","UnaryOps", -"BinaryOps","ShiftOps","SIntType","UIntType","IntType","OptAssign","ConstVal", -"ConstVector","ConstPool","Module","MethodList","OptVAR_ID","ArgVal","ArgListH", -"ArgList","MethodHeaderH","MethodHeader","Method","ConstValueRef","ValueRef", -"TypeList","BasicBlockList","BasicBlock","InstructionList","BBTerminatorInst", +"EUINT64VAL","SINTVAL","UINTVAL","FPVAL","VOID","BOOL","SBYTE","UBYTE","SHORT", +"USHORT","INT","UINT","LONG","ULONG","FLOAT","DOUBLE","STRING","TYPE","LABEL", +"VAR_ID","LABELSTR","STRINGCONSTANT","IMPLEMENTATION","TRUE","FALSE","BEGINTOK", +"END","DECLARE","TO","RET","BR","SWITCH","NOT","ADD","SUB","MUL","DIV","REM", +"SETLE","SETGE","SETLT","SETGT","SETEQ","SETNE","MALLOC","ALLOCA","FREE","LOAD", +"STORE","GETELEMENTPTR","PHI","CALL","CAST","SHL","SHR","'='","'['","']'","'x'", +"'{'","'}'","','","'('","')'","'*'","INTVAL","EINT64VAL","Types","TypesV","UnaryOps", +"BinaryOps","ShiftOps","SIntType","UIntType","IntType","FPType","OptAssign", +"ConstVal","ConstVector","ConstPool","Module","MethodList","OptVAR_ID","ArgVal", +"ArgListH","ArgList","MethodHeaderH","MethodHeader","Method","ConstValueRef", +"ValueRef","TypeList","BasicBlockList","BasicBlock","InstructionList","BBTerminatorInst", "JumpTable","Inst","PHIList","ValueRefList","ValueRefListE","InstVal","UByteList", "MemoryInst", NULL }; #endif static const short yyr1[] = { 0, - 68, 68, 69, 69, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 71, 71, - 72, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 74, 74, 75, 75, 75, 75, 76, 76, - 76, 76, 77, 77, 78, 78, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, 80, 80, - 81, 81, 82, 83, 83, 84, 84, 85, 86, 86, - 87, 87, 88, 89, 90, 91, 91, 91, 91, 91, - 92, 92, 92, 70, 70, 70, 70, 70, 70, 70, - 70, 93, 93, 94, 94, 95, 95, 96, 96, 97, - 97, 97, 97, 97, 98, 98, 99, 100, 100, 101, - 101, 102, 102, 103, 103, 103, 103, 103, 103, 103, - 104, 104, 105, 105, 105, 105, 105, 105, 105, 105 + 69, 69, 70, 70, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 72, 72, + 73, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 75, 75, 76, 76, 76, 76, 77, 77, + 77, 77, 78, 78, 79, 79, 80, 80, 81, 81, + 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, + 81, 82, 82, 83, 83, 84, 85, 85, 86, 86, + 87, 88, 88, 89, 89, 90, 91, 92, 93, 93, + 93, 93, 93, 93, 94, 94, 94, 71, 71, 71, + 71, 71, 71, 71, 71, 95, 95, 96, 96, 97, + 97, 98, 98, 99, 99, 99, 99, 99, 100, 100, + 101, 102, 102, 103, 103, 104, 104, 105, 105, 105, + 105, 105, 105, 105, 106, 106, 107, 107, 107, 107, + 107, 107, 107, 107 }; static const short yyr2[] = { 0, @@ -633,203 +648,214 @@ static const short yyr2[] = { 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, 2, 0, 2, 2, 2, 2, - 2, 2, 6, 5, 8, 7, 6, 4, 3, 1, - 3, 0, 1, 2, 2, 1, 0, 2, 3, 1, - 1, 0, 5, 3, 2, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 4, 3, 3, 5, 3, 2, - 2, 1, 3, 2, 2, 2, 3, 2, 0, 3, - 2, 3, 9, 9, 6, 5, 2, 6, 7, 2, - 4, 1, 0, 5, 3, 6, 5, 2, 6, 1, - 2, 0, 2, 5, 2, 5, 3, 4, 7, 4 + 1, 1, 1, 1, 1, 1, 2, 0, 2, 2, + 2, 2, 2, 2, 2, 6, 5, 8, 7, 6, + 4, 3, 1, 3, 0, 1, 2, 2, 1, 0, + 2, 3, 1, 1, 0, 5, 3, 2, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 4, 3, + 3, 5, 3, 2, 2, 1, 3, 2, 2, 2, + 3, 2, 0, 3, 2, 3, 9, 9, 6, 5, + 2, 6, 7, 2, 4, 1, 0, 5, 3, 6, + 5, 2, 6, 1, 2, 0, 2, 5, 2, 5, + 3, 4, 7, 4 }; -static const short yydefact[] = { 62, - 46, 63, 0, 65, 0, 76, 77, 1, 2, 20, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 82, 80, 78, 79, 0, 0, - 81, 19, 0, 62, 99, 64, 83, 84, 99, 45, - 0, 38, 42, 37, 41, 36, 40, 35, 39, 0, - 0, 0, 0, 0, 0, 61, 77, 19, 0, 90, - 92, 0, 91, 0, 0, 46, 99, 95, 46, 75, - 94, 49, 50, 51, 52, 77, 19, 0, 0, 3, - 4, 47, 48, 0, 87, 89, 0, 72, 86, 0, - 74, 46, 0, 0, 0, 0, 96, 98, 0, 0, - 0, 0, 19, 93, 67, 70, 71, 0, 85, 97, - 101, 19, 0, 0, 43, 44, 0, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 33, 34, - 0, 0, 0, 107, 120, 19, 0, 58, 0, 88, - 66, 68, 0, 73, 100, 0, 102, 0, 123, 125, - 19, 19, 19, 19, 19, 118, 19, 19, 19, 19, - 19, 0, 54, 60, 0, 0, 69, 0, 0, 0, - 0, 127, 122, 0, 122, 0, 0, 0, 0, 115, - 0, 0, 0, 53, 0, 57, 0, 0, 0, 0, - 0, 128, 0, 130, 0, 0, 113, 0, 0, 0, - 56, 0, 59, 0, 0, 124, 126, 121, 19, 0, - 0, 19, 112, 0, 117, 114, 19, 55, 0, 0, - 122, 0, 0, 110, 0, 119, 116, 0, 0, 0, - 129, 108, 0, 19, 103, 0, 104, 0, 109, 111, - 0, 0, 0, 0, 106, 0, 105, 0, 0, 0 +static const short yydefact[] = { 65, + 48, 66, 0, 68, 0, 79, 80, 1, 2, 81, + 20, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 86, 84, 82, 83, 0, + 0, 85, 19, 0, 65, 103, 67, 87, 88, 103, + 47, 0, 38, 42, 37, 41, 36, 40, 35, 39, + 45, 46, 0, 0, 0, 0, 0, 0, 0, 64, + 80, 19, 0, 94, 96, 0, 95, 0, 0, 48, + 103, 99, 48, 78, 98, 51, 52, 54, 55, 80, + 19, 0, 0, 3, 4, 49, 50, 53, 0, 91, + 93, 0, 75, 90, 0, 77, 48, 0, 0, 0, + 0, 100, 102, 0, 0, 0, 0, 19, 97, 70, + 73, 74, 0, 89, 101, 105, 19, 0, 0, 43, + 44, 0, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 33, 34, 0, 0, 0, 111, 124, + 19, 0, 61, 0, 92, 69, 71, 0, 76, 104, + 0, 106, 0, 127, 129, 19, 19, 19, 19, 19, + 122, 19, 19, 19, 19, 19, 0, 57, 63, 0, + 0, 72, 0, 0, 0, 0, 131, 126, 0, 126, + 0, 0, 0, 0, 119, 0, 0, 0, 56, 0, + 60, 0, 0, 0, 0, 0, 132, 0, 134, 0, + 0, 117, 0, 0, 0, 59, 0, 62, 0, 0, + 128, 130, 125, 19, 0, 0, 19, 116, 0, 121, + 118, 19, 58, 0, 0, 126, 0, 0, 114, 0, + 123, 120, 0, 0, 0, 133, 112, 0, 19, 107, + 0, 108, 0, 113, 115, 0, 0, 0, 0, 110, + 0, 109, 0, 0, 0 }; -static const short yydefgoto[] = { 31, - 82, 61, 59, 141, 142, 143, 54, 55, 117, 5, - 174, 175, 1, 258, 2, 152, 106, 107, 108, 34, - 35, 36, 37, 38, 62, 39, 68, 69, 97, 240, - 98, 166, 223, 224, 144, 202, 145 +static const short yydefgoto[] = { 32, + 86, 65, 63, 146, 147, 148, 57, 58, 122, 59, + 5, 179, 180, 1, 263, 2, 157, 111, 112, 113, + 35, 36, 37, 38, 39, 66, 40, 72, 73, 102, + 245, 103, 171, 228, 229, 149, 207, 150 }; static const short yypact[] = {-32768, - 70, 321, -6,-32768, 90,-32768,-32768,-32768,-32768,-32768, + 181, 350, -36,-32768, 94,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 381, 235, --32768, 45, -20,-32768, 98,-32768,-32768,-32768, 93,-32768, - 67,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 56, - 321, 406, 296, 181, 142,-32768, 97, -14, 96,-32768, - 46, 123,-32768, 101, 210, 122,-32768,-32768, 135,-32768, --32768,-32768,-32768,-32768, 46, 111, 29, 112, 129,-32768, --32768,-32768,-32768, 321,-32768,-32768, 321, 321,-32768, 79, --32768, 135, 466, 13, 268, 461,-32768,-32768, 321, 118, - 125, 119, 47, 46, 10, 126,-32768, 131,-32768,-32768, - 133, 4, 52, 52,-32768,-32768, 52,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 321, - 321, 321, 321, 321, 321, 321, 321, 321,-32768,-32768, - 321, 321, 321,-32768,-32768, 48, 3,-32768, 90,-32768, --32768,-32768, 321,-32768,-32768, 138,-32768, 139, 106, 115, - 4, 4, 4, 4, 0, 140, 4, 4, 4, 4, - 4, 148,-32768,-32768, 99, 132,-32768, 178, 189, 197, - 221,-32768, 194, 196, 194, 52, 204, 199, 234,-32768, - 202, 203, 28,-32768, 90,-32768, 52, 52, 52, 52, - 90,-32768, 321,-32768, 206, 52, 321, 321, 52, 321, --32768, 100,-32768, 207, 209,-32768,-32768, 211, 4, 52, - 222, 4, 223, 208, 46,-32768, 4,-32768, 252, 268, - 194, 225, 52,-32768, 321,-32768,-32768, 52, 57, 435, --32768,-32768, 228, 4,-32768, 226,-32768, 57,-32768,-32768, - 270, 229, 52, 271,-32768, 52,-32768, 289, 295,-32768 +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 411, + 262,-32768, 14, 29,-32768, 42,-32768,-32768,-32768, 70, +-32768, 141,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, +-32768,-32768, 73, 350, 437, 324, 205, 146, 178,-32768, + 133, 24, 136,-32768, 50, 155,-32768, 162, 236, 169, +-32768,-32768, 156,-32768,-32768,-32768,-32768,-32768, 50, 164, + 58, 149, 157,-32768,-32768,-32768,-32768,-32768, 350,-32768, +-32768, 350, 350,-32768, 84,-32768, 156, 498, 48, 161, + 491,-32768,-32768, 350, 163, 165, 167, 59, 50, 33, + 166,-32768, 168,-32768,-32768, 170, -1, 159, 159,-32768, +-32768, 159,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, +-32768,-32768,-32768,-32768, 350, 350, 350, 350, 350, 350, + 350, 350, 350,-32768,-32768, 350, 350, 350,-32768,-32768, + 87, 0,-32768, 94,-32768,-32768,-32768, 350,-32768,-32768, + 172,-32768, 195, 135, 150, -1, -1, -1, -1, 16, + 197, -1, -1, -1, -1, -1, 173,-32768,-32768, 56, + 160,-32768, 210, 212, 271, 273,-32768, 226, 227, 226, + 159, 233, 228, 263,-32768, 232, 235, 20,-32768, 94, +-32768, 159, 159, 159, 159, 94,-32768, 350,-32768, 237, + 159, 350, 350, 159, 350,-32768, 132,-32768, 239, 238, +-32768,-32768, 240, -1, 159, 241, -1, 242, 234, 50, +-32768, -1,-32768, 286, 161, 226, 248, 159,-32768, 350, +-32768,-32768, 159, 61, 32,-32768,-32768, 249, -1,-32768, + 246,-32768, 61,-32768,-32768, 290, 250, 159, 291,-32768, + 159,-32768, 314, 316,-32768 }; static const short yypgoto[] = {-32768, --32768, -2, 294,-32768,-32768,-32768, -93, -92, -205, -63, - -4, -129, 285,-32768,-32768,-32768,-32768, 168,-32768,-32768, --32768,-32768, -215, -44, 1,-32768, 305, 279, 257,-32768, --32768,-32768,-32768,-32768,-32768, -180,-32768 +-32768, -2, 225,-32768,-32768,-32768, -93, -92, -173,-32768, + -18, -4, -129, 282,-32768,-32768,-32768,-32768, 190,-32768, +-32768,-32768,-32768, -194, -44, 2,-32768, 278, 252, 222, +-32768,-32768,-32768,-32768,-32768,-32768, -139,-32768 }; -#define YYLAST 528 +#define YYLAST 561 -static const short yytable[] = { 32, - 56, 115, 116, 64, 204, 96, 6, 7, 8, 9, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 176, - 113, 50, 51, 246, 239, 25, 58, 26, 96, 27, - 28, 151, 252, 114, 248, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 65, 85, 50, 51, 75, 77, - 241, 40, 63, 79, 6, 7, 8, 9, 186, 6, - 7, 52, 173, 212, 53, 90, 63, 155, 156, 157, - 63, 218, 158, 25, -19, 26, 63, 27, 28, 74, - 26, 103, 27, 28, 104, 105, 52, 211, 100, 53, - 112, 3, 72, 73, 4, 63, 146, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 150, 172, 50, 51, - -19, 63, 63, 63, 63, 67, 182, 183, 184, 185, - 67, 70, 188, 189, 190, 191, 192, 159, 160, 161, - 162, 163, 164, 165, 167, 168, 115, 116, 169, 170, - 171, 205, 87, 3, 109, 83, 115, 116, 52, 91, - 105, 53, 214, 215, 216, 217, 3, 84, 194, 228, - 65, 221, 195, 195, 226, 88, 93, 94, 95, 180, - -19, 99, 63, 101, 231, 232, 147, 234, 181, -19, - 149, 63, 237, 80, 81, 86, 87, 148, 243, 153, - 213, 102, 87, 245, 196, 195, 154, -20, 197, 250, - 219, 178, 179, 187, 222, 225, 193, 227, 255, 198, - 199, 257, 6, 7, 8, 9, 10, 11, 12, 13, +static const short yytable[] = { 33, + 60, 6, 7, 8, 9, 10, 120, 121, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 26, 41, 27, 181, 28, 29, 62, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 43, 44, 45, 46, 47, 48, 49, 50, 251, + 209, 79, 81, 68, 101, 156, 118, 83, 257, 55, + 178, 244, 56, 6, 7, 71, 67, 10, 217, 119, + 95, 253, 160, 161, 162, 191, 223, 163, 101, 55, + 216, 67, 56, 67, 90, 27, 108, 28, 29, 109, + 110, 67, 252, 71, 69, 117, 246, 78, -19, 74, + 67, 151, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, -19, 199, 67, 105, 155, + 200, 187, 188, 189, 190, 67, 67, 193, 194, 195, + 196, 197, 164, 165, 166, 167, 168, 169, 170, 172, + 173, 120, 121, 174, 175, 176, 210, 177, 92, 87, + 114, 120, 121, 55, 67, 110, 56, 219, 220, 221, + 222, 6, 7, 8, 9, 10, 226, 76, 77, 231, + 43, 44, 45, 46, 47, 48, 49, 50, 3, 236, + 237, 26, 239, 27, 88, 28, 29, 242, 98, 99, + 100, 3, 233, 248, 89, 218, 200, 96, 250, 185, + -19, 69, 67, 3, 255, 224, 4, 84, 85, 227, + 230, 106, 232, 260, 186, -19, 262, 67, 91, 92, + 107, 92, 152, 201, 200, 104, 34, 93, 153, 154, + 158, 202, 198, 203, 159, -20, 183, 249, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 184, + 27, 192, 28, 29, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 204, 27, 205, 28, 29, + 206, 208, 211, 212, 213, 30, 214, 235, 31, 215, + 241, 225, 94, 234, 200, 238, 240, 243, 247, 254, + 256, 258, 261, 264, 259, 265, 70, 75, 115, 0, + 0, 30, 97, 0, 31, 64, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 182, 27, 0, + 28, 29, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 244, 26, 200, 27, 28, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 201, 26, 203, - 27, 28, 206, 207, 208, 209, 210, 230, 29, 220, - 229, 30, 238, 236, 195, 89, 42, 43, 44, 45, - 46, 47, 48, 49, 242, 233, 235, 249, 259, 251, - 253, 256, 254, 29, 260, 33, 30, 60, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 66, 26, - 177, 27, 28, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 71, 26, 92, 27, 28, 110, 0, - 0, 0, 0, 0, 29, 0, 0, 30, 78, 0, + 24, 25, 26, 0, 27, 0, 28, 29, 0, 0, + 0, 0, 0, 30, 0, 0, 31, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, - 0, 0, 30, 6, 57, 8, 9, 10, 11, 12, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, + 0, 0, 31, 6, 61, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 0, 26, 0, 27, 28, 6, 76, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 0, 26, - 0, 27, 28, 0, 0, 0, 0, 0, 0, 29, - 0, 0, 30, 42, 43, 44, 45, 46, 47, 48, - 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 29, 0, 0, 30, 6, 7, - 8, 9, 111, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 0, 26, - 0, 27, 28, 0, 247, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 0, 0, - 0, 0, 0, 0, 29, 0, 0, 30 + 23, 24, 25, 26, 0, 27, 0, 28, 29, 6, + 80, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 0, 27, 0, 28, 29, 0, 0, 0, 0, 0, + 30, 0, 0, 31, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 30, 0, 0, 31, + 6, 7, 8, 9, 10, 116, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 0, 27, 0, 28, 29, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 0, + 0, 0, 0, 0, 0, 0, 0, 30, 0, 0, + 31 }; static const short yycheck[] = { 2, - 5, 95, 95, 24, 185, 69, 3, 4, 5, 6, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 149, - 8, 19, 20, 239, 230, 22, 29, 24, 92, 26, - 27, 22, 248, 21, 240, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 65, 60, 19, 20, 51, 52, - 231, 58, 67, 53, 3, 4, 5, 6, 59, 3, - 4, 59, 60, 193, 62, 65, 67, 112, 113, 114, - 67, 201, 117, 22, 65, 24, 67, 26, 27, 24, - 24, 84, 26, 27, 87, 88, 59, 60, 60, 62, - 93, 22, 26, 27, 25, 67, 99, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 60, 60, 19, 20, - 65, 67, 67, 67, 67, 23, 161, 162, 163, 164, - 23, 29, 167, 168, 169, 170, 171, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 230, 230, 141, 142, - 143, 186, 64, 22, 66, 4, 240, 240, 59, 28, - 153, 62, 197, 198, 199, 200, 22, 61, 60, 60, - 65, 206, 64, 64, 209, 65, 32, 33, 34, 64, - 65, 61, 67, 62, 219, 220, 59, 222, 64, 65, - 62, 67, 227, 3, 4, 63, 64, 63, 233, 64, - 195, 63, 64, 238, 63, 64, 66, 65, 21, 244, - 203, 64, 64, 64, 207, 208, 59, 210, 253, 21, - 14, 256, 3, 4, 5, 6, 7, 8, 9, 10, + 5, 3, 4, 5, 6, 7, 100, 100, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 235, 24, 14, 26, 27, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 64, 24, 64, - 26, 27, 59, 65, 31, 64, 64, 59, 59, 64, - 64, 62, 21, 66, 64, 66, 9, 10, 11, 12, - 13, 14, 15, 16, 60, 64, 64, 60, 0, 64, - 21, 21, 64, 59, 0, 2, 62, 63, 3, 4, + 21, 23, 59, 25, 154, 27, 28, 30, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 10, 11, 12, 13, 14, 15, 16, 17, 244, + 190, 54, 55, 25, 73, 23, 9, 56, 253, 60, + 61, 235, 63, 3, 4, 24, 68, 7, 198, 22, + 69, 245, 117, 118, 119, 60, 206, 122, 97, 60, + 61, 68, 63, 68, 61, 25, 89, 27, 28, 92, + 93, 68, 61, 24, 66, 98, 236, 25, 66, 30, + 68, 104, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 66, 61, 68, 61, 61, + 65, 166, 167, 168, 169, 68, 68, 172, 173, 174, + 175, 176, 135, 136, 137, 138, 139, 140, 141, 142, + 143, 235, 235, 146, 147, 148, 191, 61, 65, 4, + 67, 245, 245, 60, 68, 158, 63, 202, 203, 204, + 205, 3, 4, 5, 6, 7, 211, 27, 28, 214, + 10, 11, 12, 13, 14, 15, 16, 17, 23, 224, + 225, 23, 227, 25, 7, 27, 28, 232, 33, 34, + 35, 23, 61, 238, 62, 200, 65, 29, 243, 65, + 66, 66, 68, 23, 249, 208, 26, 3, 4, 212, + 213, 63, 215, 258, 65, 66, 261, 68, 64, 65, + 64, 65, 60, 64, 65, 62, 2, 66, 64, 63, + 65, 22, 60, 22, 67, 66, 65, 240, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 34, 24, - 153, 26, 27, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 39, 24, 67, 26, 27, 92, -1, - -1, -1, -1, -1, 59, -1, -1, 62, 63, -1, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 65, + 25, 65, 27, 28, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 15, 25, 15, 27, 28, + 65, 65, 60, 66, 32, 60, 65, 60, 63, 65, + 67, 65, 67, 65, 65, 65, 65, 22, 61, 61, + 65, 22, 22, 0, 65, 0, 35, 40, 97, -1, + -1, 60, 71, -1, 63, 64, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 158, 25, -1, + 27, 28, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, -1, 25, -1, 27, 28, -1, -1, + -1, -1, -1, 60, -1, -1, 63, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 59, - -1, -1, 62, 3, 4, 5, 6, 7, 8, 9, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 60, + -1, -1, 63, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, -1, 24, -1, 26, 27, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, -1, 24, - -1, 26, 27, -1, -1, -1, -1, -1, -1, 59, - -1, -1, 62, 9, 10, 11, 12, 13, 14, 15, - 16, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 59, -1, -1, 62, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, -1, 24, - -1, 26, 27, -1, 60, 35, 36, 37, 38, 39, + 20, 21, 22, 23, -1, 25, -1, 27, 28, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + -1, 25, -1, 27, 28, -1, -1, -1, -1, -1, + 60, -1, -1, 63, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 60, -1, -1, 63, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, -1, 25, -1, 27, 28, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, -1, -1, - -1, -1, -1, -1, 59, -1, -1, 62 + 50, 51, 52, 53, 54, 55, 56, 57, 58, -1, + -1, -1, -1, -1, -1, -1, -1, 60, -1, -1, + 63 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ #line 3 "/usr/dcs/software/supported/encap/bison-1.28/share/bison.simple" @@ -1375,7 +1401,7 @@ yyreduce: switch (yyn) { case 2: -#line 471 "llvmAsmParser.y" +#line 482 "llvmAsmParser.y" { if (yyvsp[0].UIntVal > (uint32_t)INT32_MAX) // Outside of my range! ThrowException("Value too large for type!"); @@ -1383,55 +1409,61 @@ case 2: ; break;} case 4: -#line 479 "llvmAsmParser.y" +#line 490 "llvmAsmParser.y" { if (yyvsp[0].UInt64Val > (uint64_t)INT64_MAX) // Outside of my range! ThrowException("Value too large for type!"); yyval.SInt64Val = (int64_t)yyvsp[0].UInt64Val; ; break;} -case 45: -#line 511 "llvmAsmParser.y" +case 47: +#line 523 "llvmAsmParser.y" { yyval.StrVal = yyvsp[-1].StrVal; ; break;} -case 46: -#line 514 "llvmAsmParser.y" +case 48: +#line 526 "llvmAsmParser.y" { yyval.StrVal = 0; ; break;} -case 47: -#line 521 "llvmAsmParser.y" +case 49: +#line 533 "llvmAsmParser.y" { // integral constants if (!ConstPoolSInt::isValueValidForType(yyvsp[-1].TypeVal, yyvsp[0].SInt64Val)) ThrowException("Constant value doesn't fit in type!"); yyval.ConstVal = new ConstPoolSInt(yyvsp[-1].TypeVal, yyvsp[0].SInt64Val); ; break;} -case 48: -#line 526 "llvmAsmParser.y" +case 50: +#line 538 "llvmAsmParser.y" { // integral constants if (!ConstPoolUInt::isValueValidForType(yyvsp[-1].TypeVal, yyvsp[0].UInt64Val)) ThrowException("Constant value doesn't fit in type!"); yyval.ConstVal = new ConstPoolUInt(yyvsp[-1].TypeVal, yyvsp[0].UInt64Val); ; break;} -case 49: -#line 531 "llvmAsmParser.y" +case 51: +#line 543 "llvmAsmParser.y" { // Boolean constants yyval.ConstVal = new ConstPoolBool(true); ; break;} -case 50: -#line 534 "llvmAsmParser.y" +case 52: +#line 546 "llvmAsmParser.y" { // Boolean constants yyval.ConstVal = new ConstPoolBool(false); ; break;} -case 51: -#line 537 "llvmAsmParser.y" +case 53: +#line 549 "llvmAsmParser.y" +{ // Float & Double constants + yyval.ConstVal = new ConstPoolFP(yyvsp[-1].TypeVal, yyvsp[0].FPVal); + ; + break;} +case 54: +#line 552 "llvmAsmParser.y" { // String constants cerr << "FIXME: TODO: String constants [sbyte] not implemented yet!\n"; abort(); @@ -1439,14 +1471,14 @@ case 51: free(yyvsp[0].StrVal); ; break;} -case 52: -#line 543 "llvmAsmParser.y" +case 55: +#line 558 "llvmAsmParser.y" { // Type constants yyval.ConstVal = new ConstPoolType(yyvsp[0].TypeVal); ; break;} -case 53: -#line 546 "llvmAsmParser.y" +case 56: +#line 561 "llvmAsmParser.y" { // Nonempty array constant // Verify all elements are correct type! const ArrayType *AT = ArrayType::getArrayType(yyvsp[-4].TypeVal); @@ -1461,15 +1493,15 @@ case 53: delete yyvsp[-1].ConstVector; ; break;} -case 54: -#line 559 "llvmAsmParser.y" +case 57: +#line 574 "llvmAsmParser.y" { // Empty array constant vector Empty; yyval.ConstVal = new ConstPoolArray(ArrayType::getArrayType(yyvsp[-3].TypeVal), Empty); ; break;} -case 55: -#line 563 "llvmAsmParser.y" +case 58: +#line 578 "llvmAsmParser.y" { // Verify all elements are correct type! const ArrayType *AT = ArrayType::getArrayType(yyvsp[-4].TypeVal, (int)yyvsp[-6].UInt64Val); @@ -1489,8 +1521,8 @@ case 55: delete yyvsp[-1].ConstVector; ; break;} -case 56: -#line 581 "llvmAsmParser.y" +case 59: +#line 596 "llvmAsmParser.y" { if (yyvsp[-5].UInt64Val != 0) ThrowException("Type mismatch: constant sized array initialized with 0" @@ -1499,8 +1531,8 @@ case 56: yyval.ConstVal = new ConstPoolArray(ArrayType::getArrayType(yyvsp[-3].TypeVal, 0), Empty); ; break;} -case 57: -#line 588 "llvmAsmParser.y" +case 60: +#line 603 "llvmAsmParser.y" { StructType::ElementTypes Types(yyvsp[-4].TypeList->begin(), yyvsp[-4].TypeList->end()); delete yyvsp[-4].TypeList; @@ -1510,8 +1542,8 @@ case 57: delete yyvsp[-1].ConstVector; ; break;} -case 58: -#line 596 "llvmAsmParser.y" +case 61: +#line 611 "llvmAsmParser.y" { const StructType *St = StructType::getStructType(StructType::ElementTypes()); @@ -1519,21 +1551,21 @@ case 58: yyval.ConstVal = new ConstPoolStruct(St, Empty); ; break;} -case 59: -#line 610 "llvmAsmParser.y" +case 62: +#line 625 "llvmAsmParser.y" { (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(addConstValToConstantPool(yyvsp[0].ConstVal)); ; break;} -case 60: -#line 613 "llvmAsmParser.y" +case 63: +#line 628 "llvmAsmParser.y" { yyval.ConstVector = new vector(); yyval.ConstVector->push_back(addConstValToConstantPool(yyvsp[0].ConstVal)); ; break;} -case 61: -#line 623 "llvmAsmParser.y" +case 64: +#line 638 "llvmAsmParser.y" { if (yyvsp[-1].StrVal) { yyvsp[0].ConstVal->setName(yyvsp[-1].StrVal); @@ -1543,38 +1575,38 @@ case 61: addConstValToConstantPool(yyvsp[0].ConstVal); ; break;} -case 62: -#line 640 "llvmAsmParser.y" +case 65: +#line 655 "llvmAsmParser.y" { ; break;} -case 63: -#line 651 "llvmAsmParser.y" +case 66: +#line 666 "llvmAsmParser.y" { yyval.ModuleVal = ParserResult = yyvsp[0].ModuleVal; CurModule.ModuleDone(); ; break;} -case 64: -#line 658 "llvmAsmParser.y" +case 67: +#line 673 "llvmAsmParser.y" { yyvsp[-1].ModuleVal->getMethodList().push_back(yyvsp[0].MethodVal); CurMeth.MethodDone(); yyval.ModuleVal = yyvsp[-1].ModuleVal; ; break;} -case 65: -#line 663 "llvmAsmParser.y" +case 68: +#line 678 "llvmAsmParser.y" { yyval.ModuleVal = CurModule.CurrentModule; ; break;} -case 67: -#line 672 "llvmAsmParser.y" +case 70: +#line 687 "llvmAsmParser.y" { yyval.StrVal = 0; ; break;} -case 68: -#line 674 "llvmAsmParser.y" +case 71: +#line 689 "llvmAsmParser.y" { yyval.MethArgVal = new MethodArgument(yyvsp[-1].TypeVal); if (yyvsp[0].StrVal) { // Was the argument named? @@ -1583,34 +1615,34 @@ case 68: } ; break;} -case 69: -#line 682 "llvmAsmParser.y" +case 72: +#line 697 "llvmAsmParser.y" { yyval.MethodArgList = yyvsp[0].MethodArgList; yyvsp[0].MethodArgList->push_front(yyvsp[-2].MethArgVal); ; break;} -case 70: -#line 686 "llvmAsmParser.y" +case 73: +#line 701 "llvmAsmParser.y" { yyval.MethodArgList = new list(); yyval.MethodArgList->push_front(yyvsp[0].MethArgVal); ; break;} -case 71: -#line 691 "llvmAsmParser.y" +case 74: +#line 706 "llvmAsmParser.y" { yyval.MethodArgList = yyvsp[0].MethodArgList; ; break;} -case 72: -#line 694 "llvmAsmParser.y" +case 75: +#line 709 "llvmAsmParser.y" { yyval.MethodArgList = 0; ; break;} -case 73: -#line 698 "llvmAsmParser.y" +case 76: +#line 713 "llvmAsmParser.y" { MethodType::ParamTypes ParamTypeList; if (yyvsp[-1].MethodArgList) @@ -1638,68 +1670,74 @@ case 73: } ; break;} -case 74: -#line 725 "llvmAsmParser.y" +case 77: +#line 740 "llvmAsmParser.y" { yyval.MethodVal = CurMeth.CurrentMethod; ; break;} -case 75: -#line 729 "llvmAsmParser.y" +case 78: +#line 744 "llvmAsmParser.y" { yyval.MethodVal = yyvsp[-1].MethodVal; ; break;} -case 76: -#line 738 "llvmAsmParser.y" +case 79: +#line 753 "llvmAsmParser.y" { // A reference to a direct constant yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val); ; break;} -case 77: -#line 741 "llvmAsmParser.y" +case 80: +#line 756 "llvmAsmParser.y" { yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val); ; break;} -case 78: -#line 744 "llvmAsmParser.y" +case 81: +#line 759 "llvmAsmParser.y" +{ // Perhaps it's an FP constant? + yyval.ValIDVal = ValID::create(yyvsp[0].FPVal); + ; + break;} +case 82: +#line 762 "llvmAsmParser.y" { yyval.ValIDVal = ValID::create((int64_t)1); ; break;} -case 79: -#line 747 "llvmAsmParser.y" +case 83: +#line 765 "llvmAsmParser.y" { yyval.ValIDVal = ValID::create((int64_t)0); ; break;} -case 80: -#line 750 "llvmAsmParser.y" +case 84: +#line 768 "llvmAsmParser.y" { // Quoted strings work too... especially for methods yyval.ValIDVal = ValID::create_conststr(yyvsp[0].StrVal); ; break;} -case 81: -#line 755 "llvmAsmParser.y" +case 85: +#line 773 "llvmAsmParser.y" { // Is it an integer reference...? yyval.ValIDVal = ValID::create(yyvsp[0].SIntVal); ; break;} -case 82: -#line 758 "llvmAsmParser.y" -{ // It must be a named reference then... +case 86: +#line 776 "llvmAsmParser.y" +{ // Is it a named reference...? yyval.ValIDVal = ValID::create(yyvsp[0].StrVal); ; break;} -case 83: -#line 761 "llvmAsmParser.y" +case 87: +#line 779 "llvmAsmParser.y" { yyval.ValIDVal = yyvsp[0].ValIDVal; ; break;} -case 84: -#line 768 "llvmAsmParser.y" +case 88: +#line 786 "llvmAsmParser.y" { Value *D = getVal(Type::TypeTy, yyvsp[0].ValIDVal, true); if (D == 0) ThrowException("Invalid user defined type: " + yyvsp[0].ValIDVal.getName()); @@ -1709,90 +1747,90 @@ case 84: yyval.TypeVal = CPT->getValue(); ; break;} -case 85: -#line 776 "llvmAsmParser.y" +case 89: +#line 794 "llvmAsmParser.y" { // Method derived type? MethodType::ParamTypes Params(yyvsp[-1].TypeList->begin(), yyvsp[-1].TypeList->end()); delete yyvsp[-1].TypeList; yyval.TypeVal = checkNewType(MethodType::getMethodType(yyvsp[-3].TypeVal, Params)); ; break;} -case 86: -#line 781 "llvmAsmParser.y" +case 90: +#line 799 "llvmAsmParser.y" { // Method derived type? MethodType::ParamTypes Params; // Empty list yyval.TypeVal = checkNewType(MethodType::getMethodType(yyvsp[-2].TypeVal, Params)); ; break;} -case 87: -#line 785 "llvmAsmParser.y" +case 91: +#line 803 "llvmAsmParser.y" { yyval.TypeVal = checkNewType(ArrayType::getArrayType(yyvsp[-1].TypeVal)); ; break;} -case 88: -#line 788 "llvmAsmParser.y" +case 92: +#line 806 "llvmAsmParser.y" { yyval.TypeVal = checkNewType(ArrayType::getArrayType(yyvsp[-1].TypeVal, (int)yyvsp[-3].UInt64Val)); ; break;} -case 89: -#line 791 "llvmAsmParser.y" +case 93: +#line 809 "llvmAsmParser.y" { StructType::ElementTypes Elements(yyvsp[-1].TypeList->begin(), yyvsp[-1].TypeList->end()); delete yyvsp[-1].TypeList; yyval.TypeVal = checkNewType(StructType::getStructType(Elements)); ; break;} -case 90: -#line 796 "llvmAsmParser.y" +case 94: +#line 814 "llvmAsmParser.y" { yyval.TypeVal = checkNewType(StructType::getStructType(StructType::ElementTypes())); ; break;} -case 91: -#line 799 "llvmAsmParser.y" +case 95: +#line 817 "llvmAsmParser.y" { yyval.TypeVal = checkNewType(PointerType::getPointerType(yyvsp[-1].TypeVal)); ; break;} -case 92: -#line 804 "llvmAsmParser.y" +case 96: +#line 822 "llvmAsmParser.y" { yyval.TypeList = new list(); yyval.TypeList->push_back(yyvsp[0].TypeVal); ; break;} -case 93: -#line 808 "llvmAsmParser.y" +case 97: +#line 826 "llvmAsmParser.y" { (yyval.TypeList=yyvsp[-2].TypeList)->push_back(yyvsp[0].TypeVal); ; break;} -case 94: -#line 813 "llvmAsmParser.y" +case 98: +#line 831 "llvmAsmParser.y" { yyvsp[-1].MethodVal->getBasicBlocks().push_back(yyvsp[0].BasicBlockVal); yyval.MethodVal = yyvsp[-1].MethodVal; ; break;} -case 95: -#line 817 "llvmAsmParser.y" +case 99: +#line 835 "llvmAsmParser.y" { // Do not allow methods with 0 basic blocks yyval.MethodVal = yyvsp[-1].MethodVal; // in them... yyvsp[-1].MethodVal->getBasicBlocks().push_back(yyvsp[0].BasicBlockVal); ; break;} -case 96: -#line 826 "llvmAsmParser.y" +case 100: +#line 844 "llvmAsmParser.y" { yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal); InsertValue(yyvsp[-1].BasicBlockVal); yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal; ; break;} -case 97: -#line 831 "llvmAsmParser.y" +case 101: +#line 849 "llvmAsmParser.y" { yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal); yyvsp[-1].BasicBlockVal->setName(yyvsp[-2].StrVal); @@ -1802,47 +1840,47 @@ case 97: yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal; ; break;} -case 98: -#line 840 "llvmAsmParser.y" +case 102: +#line 858 "llvmAsmParser.y" { yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].InstVal); yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal; ; break;} -case 99: -#line 844 "llvmAsmParser.y" +case 103: +#line 862 "llvmAsmParser.y" { yyval.BasicBlockVal = new BasicBlock(); ; break;} -case 100: -#line 848 "llvmAsmParser.y" +case 104: +#line 866 "llvmAsmParser.y" { // Return with a result... yyval.TermInstVal = new ReturnInst(getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal)); ; break;} -case 101: -#line 851 "llvmAsmParser.y" +case 105: +#line 869 "llvmAsmParser.y" { // Return with no result... yyval.TermInstVal = new ReturnInst(); ; break;} -case 102: -#line 854 "llvmAsmParser.y" +case 106: +#line 872 "llvmAsmParser.y" { // Unconditional Branch... yyval.TermInstVal = new BranchInst((BasicBlock*)getVal(Type::LabelTy, yyvsp[0].ValIDVal)); ; break;} -case 103: -#line 857 "llvmAsmParser.y" +case 107: +#line 875 "llvmAsmParser.y" { yyval.TermInstVal = new BranchInst((BasicBlock*)getVal(Type::LabelTy, yyvsp[-3].ValIDVal), (BasicBlock*)getVal(Type::LabelTy, yyvsp[0].ValIDVal), getVal(Type::BoolTy, yyvsp[-6].ValIDVal)); ; break;} -case 104: -#line 862 "llvmAsmParser.y" +case 108: +#line 880 "llvmAsmParser.y" { SwitchInst *S = new SwitchInst(getVal(yyvsp[-7].TypeVal, yyvsp[-6].ValIDVal), (BasicBlock*)getVal(Type::LabelTy, yyvsp[-3].ValIDVal)); @@ -1854,8 +1892,8 @@ case 104: S->dest_push_back(I->first, I->second); ; break;} -case 105: -#line 873 "llvmAsmParser.y" +case 109: +#line 891 "llvmAsmParser.y" { yyval.JumpTable = yyvsp[-5].JumpTable; ConstPoolVal *V = (ConstPoolVal*)getVal(yyvsp[-4].TypeVal, yyvsp[-3].ValIDVal, true); @@ -1865,8 +1903,8 @@ case 105: yyval.JumpTable->push_back(make_pair(V, (BasicBlock*)getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal))); ; break;} -case 106: -#line 881 "llvmAsmParser.y" +case 110: +#line 899 "llvmAsmParser.y" { yyval.JumpTable = new list >(); ConstPoolVal *V = (ConstPoolVal*)getVal(yyvsp[-4].TypeVal, yyvsp[-3].ValIDVal, true); @@ -1877,8 +1915,8 @@ case 106: yyval.JumpTable->push_back(make_pair(V, (BasicBlock*)getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal))); ; break;} -case 107: -#line 891 "llvmAsmParser.y" +case 111: +#line 909 "llvmAsmParser.y" { if (yyvsp[-1].StrVal) // Is this definition named?? yyvsp[0].InstVal->setName(yyvsp[-1].StrVal); // if so, assign the name... @@ -1887,71 +1925,71 @@ case 107: yyval.InstVal = yyvsp[0].InstVal; ; break;} -case 108: -#line 899 "llvmAsmParser.y" +case 112: +#line 917 "llvmAsmParser.y" { // Used for PHI nodes yyval.PHIList = new list >(); yyval.PHIList->push_back(make_pair(getVal(yyvsp[-5].TypeVal, yyvsp[-3].ValIDVal), (BasicBlock*)getVal(Type::LabelTy, yyvsp[-1].ValIDVal))); ; break;} -case 109: -#line 904 "llvmAsmParser.y" +case 113: +#line 922 "llvmAsmParser.y" { yyval.PHIList = yyvsp[-6].PHIList; yyvsp[-6].PHIList->push_back(make_pair(getVal(yyvsp[-6].PHIList->front().first->getType(), yyvsp[-3].ValIDVal), (BasicBlock*)getVal(Type::LabelTy, yyvsp[-1].ValIDVal))); ; break;} -case 110: -#line 911 "llvmAsmParser.y" +case 114: +#line 929 "llvmAsmParser.y" { // Used for call statements... yyval.ValueList = new list(); yyval.ValueList->push_back(getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal)); ; break;} -case 111: -#line 915 "llvmAsmParser.y" +case 115: +#line 933 "llvmAsmParser.y" { yyval.ValueList = yyvsp[-3].ValueList; yyvsp[-3].ValueList->push_back(getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal)); ; break;} -case 113: -#line 921 "llvmAsmParser.y" +case 117: +#line 939 "llvmAsmParser.y" { yyval.ValueList = 0; ; break;} -case 114: -#line 923 "llvmAsmParser.y" +case 118: +#line 941 "llvmAsmParser.y" { yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, getVal(yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal), getVal(yyvsp[-3].TypeVal, yyvsp[0].ValIDVal)); if (yyval.InstVal == 0) ThrowException("binary operator returned null!"); ; break;} -case 115: -#line 928 "llvmAsmParser.y" +case 119: +#line 946 "llvmAsmParser.y" { yyval.InstVal = UnaryOperator::create(yyvsp[-2].UnaryOpVal, getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal)); if (yyval.InstVal == 0) ThrowException("unary operator returned null!"); ; break;} -case 116: -#line 933 "llvmAsmParser.y" +case 120: +#line 951 "llvmAsmParser.y" { if (yyvsp[-1].TypeVal != Type::UByteTy) ThrowException("Shift amount must be ubyte!"); yyval.InstVal = new ShiftInst(yyvsp[-5].OtherOpVal, getVal(yyvsp[-4].TypeVal, yyvsp[-3].ValIDVal), getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal)); ; break;} -case 117: -#line 937 "llvmAsmParser.y" +case 121: +#line 955 "llvmAsmParser.y" { yyval.InstVal = new CastInst(getVal(yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal), yyvsp[0].TypeVal); ; break;} -case 118: -#line 940 "llvmAsmParser.y" +case 122: +#line 958 "llvmAsmParser.y" { const Type *Ty = yyvsp[0].PHIList->front().first->getType(); yyval.InstVal = new PHINode(Ty); @@ -1964,8 +2002,8 @@ case 118: delete yyvsp[0].PHIList; // Free the list... ; break;} -case 119: -#line 951 "llvmAsmParser.y" +case 123: +#line 969 "llvmAsmParser.y" { if (!yyvsp[-4].TypeVal->isMethodType()) ThrowException("Can only call methods: invalid type '" + @@ -2004,32 +2042,32 @@ case 119: yyval.InstVal = new CallInst((Method*)V, Params); ; break;} -case 120: -#line 988 "llvmAsmParser.y" +case 124: +#line 1006 "llvmAsmParser.y" { yyval.InstVal = yyvsp[0].InstVal; ; break;} -case 121: -#line 993 "llvmAsmParser.y" +case 125: +#line 1011 "llvmAsmParser.y" { yyval.ConstVector = yyvsp[0].ConstVector; ; break;} -case 122: -#line 995 "llvmAsmParser.y" +case 126: +#line 1013 "llvmAsmParser.y" { yyval.ConstVector = new vector(); ; break;} -case 123: -#line 999 "llvmAsmParser.y" +case 127: +#line 1017 "llvmAsmParser.y" { yyval.InstVal = new MallocInst(checkNewType(PointerType::getPointerType(yyvsp[0].TypeVal))); ; break;} -case 124: -#line 1002 "llvmAsmParser.y" +case 128: +#line 1020 "llvmAsmParser.y" { if (!yyvsp[-3].TypeVal->isArrayType() || ((const ArrayType*)yyvsp[-3].TypeVal)->isSized()) ThrowException("Trying to allocate " + yyvsp[-3].TypeVal->getName() + @@ -2038,14 +2076,14 @@ case 124: yyval.InstVal = new MallocInst(Ty, getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal)); ; break;} -case 125: -#line 1009 "llvmAsmParser.y" +case 129: +#line 1027 "llvmAsmParser.y" { yyval.InstVal = new AllocaInst(checkNewType(PointerType::getPointerType(yyvsp[0].TypeVal))); ; break;} -case 126: -#line 1012 "llvmAsmParser.y" +case 130: +#line 1030 "llvmAsmParser.y" { if (!yyvsp[-3].TypeVal->isArrayType() || ((const ArrayType*)yyvsp[-3].TypeVal)->isSized()) ThrowException("Trying to allocate " + yyvsp[-3].TypeVal->getName() + @@ -2055,16 +2093,16 @@ case 126: yyval.InstVal = new AllocaInst(Ty, ArrSize); ; break;} -case 127: -#line 1020 "llvmAsmParser.y" +case 131: +#line 1038 "llvmAsmParser.y" { if (!yyvsp[-1].TypeVal->isPointerType()) ThrowException("Trying to free nonpointer type " + yyvsp[-1].TypeVal->getName() + "!"); yyval.InstVal = new FreeInst(getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal)); ; break;} -case 128: -#line 1026 "llvmAsmParser.y" +case 132: +#line 1044 "llvmAsmParser.y" { if (!yyvsp[-2].TypeVal->isPointerType()) ThrowException("Can't load from nonpointer type: " + yyvsp[-2].TypeVal->getName()); @@ -2075,8 +2113,8 @@ case 128: delete yyvsp[0].ConstVector; // Free the vector... ; break;} -case 129: -#line 1035 "llvmAsmParser.y" +case 133: +#line 1053 "llvmAsmParser.y" { if (!yyvsp[-2].TypeVal->isPointerType()) ThrowException("Can't store to a nonpointer type: " + yyvsp[-2].TypeVal->getName()); @@ -2090,8 +2128,8 @@ case 129: delete yyvsp[0].ConstVector; ; break;} -case 130: -#line 1047 "llvmAsmParser.y" +case 134: +#line 1065 "llvmAsmParser.y" { if (!yyvsp[-2].TypeVal->isPointerType()) ThrowException("getelementptr insn requires pointer operand!"); @@ -2324,7 +2362,7 @@ yyerrhandle: } return 1; } -#line 1057 "llvmAsmParser.y" +#line 1075 "llvmAsmParser.y" int yyerror(const char *ErrorMsg) { ThrowException(string("Parse error: ") + ErrorMsg); diff --git a/llvm/lib/AsmParser/llvmAsmParser.h b/llvm/lib/AsmParser/llvmAsmParser.h index b4c0ee7c99be..7f4e30f912cf 100644 --- a/llvm/lib/AsmParser/llvmAsmParser.h +++ b/llvm/lib/AsmParser/llvmAsmParser.h @@ -19,6 +19,7 @@ typedef union { uint64_t UInt64Val; int SIntVal; unsigned UIntVal; + double FPVal; char *StrVal; // This memory is allocated by strdup! ValID ValIDVal; // May contain memory allocated by strdup @@ -33,57 +34,58 @@ typedef union { #define EUINT64VAL 258 #define SINTVAL 259 #define UINTVAL 260 -#define VOID 261 -#define BOOL 262 -#define SBYTE 263 -#define UBYTE 264 -#define SHORT 265 -#define USHORT 266 -#define INT 267 -#define UINT 268 -#define LONG 269 -#define ULONG 270 -#define FLOAT 271 -#define DOUBLE 272 -#define STRING 273 -#define TYPE 274 -#define LABEL 275 -#define VAR_ID 276 -#define LABELSTR 277 -#define STRINGCONSTANT 278 -#define IMPLEMENTATION 279 -#define TRUE 280 -#define FALSE 281 -#define BEGINTOK 282 -#define END 283 -#define DECLARE 284 -#define TO 285 -#define RET 286 -#define BR 287 -#define SWITCH 288 -#define NOT 289 -#define ADD 290 -#define SUB 291 -#define MUL 292 -#define DIV 293 -#define REM 294 -#define SETLE 295 -#define SETGE 296 -#define SETLT 297 -#define SETGT 298 -#define SETEQ 299 -#define SETNE 300 -#define MALLOC 301 -#define ALLOCA 302 -#define FREE 303 -#define LOAD 304 -#define STORE 305 -#define GETELEMENTPTR 306 -#define PHI 307 -#define CALL 308 -#define CAST 309 -#define SHL 310 -#define SHR 311 +#define FPVAL 261 +#define VOID 262 +#define BOOL 263 +#define SBYTE 264 +#define UBYTE 265 +#define SHORT 266 +#define USHORT 267 +#define INT 268 +#define UINT 269 +#define LONG 270 +#define ULONG 271 +#define FLOAT 272 +#define DOUBLE 273 +#define STRING 274 +#define TYPE 275 +#define LABEL 276 +#define VAR_ID 277 +#define LABELSTR 278 +#define STRINGCONSTANT 279 +#define IMPLEMENTATION 280 +#define TRUE 281 +#define FALSE 282 +#define BEGINTOK 283 +#define END 284 +#define DECLARE 285 +#define TO 286 +#define RET 287 +#define BR 288 +#define SWITCH 289 +#define NOT 290 +#define ADD 291 +#define SUB 292 +#define MUL 293 +#define DIV 294 +#define REM 295 +#define SETLE 296 +#define SETGE 297 +#define SETLT 298 +#define SETGT 299 +#define SETEQ 300 +#define SETNE 301 +#define MALLOC 302 +#define ALLOCA 303 +#define FREE 304 +#define LOAD 305 +#define STORE 306 +#define GETELEMENTPTR 307 +#define PHI 308 +#define CALL 309 +#define CAST 310 +#define SHL 311 +#define SHR 312 extern YYSTYPE llvmAsmlval; diff --git a/llvm/lib/AsmParser/llvmAsmParser.y b/llvm/lib/AsmParser/llvmAsmParser.y index e5534cda76b5..fdfda7ef75cd 100644 --- a/llvm/lib/AsmParser/llvmAsmParser.y +++ b/llvm/lib/AsmParser/llvmAsmParser.y @@ -141,7 +141,8 @@ static Value *getVal(const Type *Type, ValID &D, case 2: // Is it a constant pool reference?? case 3: // Is it an unsigned const pool reference? - case 4:{ // Is it a string const pool reference? + case 4: // Is it a string const pool reference? + case 5:{ // Is it a floating point const pool reference? ConstPoolVal *CPV = 0; // Check to make sure that "Type" is an integral type, and that our @@ -152,14 +153,16 @@ static Value *getVal(const Type *Type, ValID &D, CPV = new ConstPoolBool(D.ConstPool64 != 0); } else { if (!ConstPoolSInt::isValueValidForType(Type, D.ConstPool64)) - ThrowException("Symbolic constant pool reference is invalid!"); + ThrowException("Symbolic constant pool value '" + + itostr(D.ConstPool64) + "' is invalid for type '" + + Type->getName() + "'!"); CPV = new ConstPoolSInt(Type, D.ConstPool64); } break; case 3: if (!ConstPoolUInt::isValueValidForType(Type, D.UConstPool64)) { if (!ConstPoolSInt::isValueValidForType(Type, D.ConstPool64)) { - ThrowException("Symbolic constant pool reference is invalid!"); + ThrowException("Integral constant pool reference is invalid!"); } else { // This is really a signed reference. Transmogrify. CPV = new ConstPoolSInt(Type, D.ConstPool64); } @@ -173,6 +176,12 @@ static Value *getVal(const Type *Type, ValID &D, //CPV = new ConstPoolString(D.Name); D.destroy(); // Free the string memory break; + case 5: + if (!ConstPoolFP::isValueValidForType(Type, D.ConstPoolFP)) + ThrowException("FP constant invalid for type!!"); + else + CPV = new ConstPoolFP(Type, D.ConstPoolFP); + break; } assert(CPV && "How did we escape creating a constant??"); @@ -391,6 +400,7 @@ Module *RunVMAsmParser(const ToolCommandLine &Opts, FILE *F) { uint64_t UInt64Val; int SIntVal; unsigned UIntVal; + double FPVal; char *StrVal; // This memory is allocated by strdup! ValID ValIDVal; // May contain memory allocated by strdup @@ -430,9 +440,10 @@ Module *RunVMAsmParser(const ToolCommandLine &Opts, FILE *F) { %token SINTVAL // Signed 32 bit ints... %token UINTVAL // Unsigned 32 bit ints... %type INTVAL +%token FPVAL // Float or Double constant // Built in types... -%type Types TypesV SIntType UIntType IntType +%type Types TypesV SIntType UIntType IntType FPType %token VOID BOOL SBYTE UBYTE SHORT USHORT INT UINT LONG ULONG %token FLOAT DOUBLE STRING TYPE LABEL @@ -506,6 +517,7 @@ ShiftOps : SHL | SHR SIntType : LONG | INT | SHORT | SBYTE UIntType : ULONG | UINT | USHORT | UBYTE IntType : SIntType | UIntType +FPType : FLOAT | DOUBLE // OptAssign - Value producing statements have an optional assignment component OptAssign : VAR_ID '=' { @@ -534,6 +546,9 @@ ConstVal : SIntType EINT64VAL { // integral constants | BOOL FALSE { // Boolean constants $$ = new ConstPoolBool(false); } + | FPType FPVAL { // Float & Double constants + $$ = new ConstPoolFP($1, $2); + } | STRING STRINGCONSTANT { // String constants cerr << "FIXME: TODO: String constants [sbyte] not implemented yet!\n"; abort(); @@ -741,6 +756,9 @@ ConstValueRef : ESINT64VAL { // A reference to a direct constant | EUINT64VAL { $$ = ValID::create($1); } + | FPVAL { // Perhaps it's an FP constant? + $$ = ValID::create($1); + } | TRUE { $$ = ValID::create((int64_t)1); } @@ -755,7 +773,7 @@ ConstValueRef : ESINT64VAL { // A reference to a direct constant ValueRef : INTVAL { // Is it an integer reference...? $$ = ValID::create($1); } - | VAR_ID { // It must be a named reference then... + | VAR_ID { // Is it a named reference...? $$ = ValID::create($1); } | ConstValueRef {