diff --git a/include/llvm/ConstantHandling.h b/include/llvm/ConstantHandling.h index cf18ef8cea4..79dd21c2c67 100644 --- a/include/llvm/ConstantHandling.h +++ b/include/llvm/ConstantHandling.h @@ -60,7 +60,6 @@ protected: inline ConstRules() {} // Can only be subclassed... public: // Unary Operators... - virtual ConstPoolVal *neg(const ConstPoolVal *V) const = 0; virtual ConstPoolVal *not(const ConstPoolVal *V) const = 0; // Binary Operators... @@ -88,10 +87,6 @@ private : }; -inline ConstPoolVal *operator-(const ConstPoolVal &V) { - return ConstRules::get(V)->neg(&V); -} - inline ConstPoolVal *operator!(const ConstPoolVal &V) { return ConstRules::get(V)->not(&V); } @@ -154,7 +149,6 @@ inline ConstPoolVal *ConstantFoldUnaryInstruction(unsigned Opcode, ConstPoolVal *V) { switch (Opcode) { case Instruction::Not: return !*V; - case Instruction::Neg: return -*V; } return 0; } diff --git a/include/llvm/InstrTypes.h b/include/llvm/InstrTypes.h index fa0ce87c9ca..8bfaca4a8a4 100644 --- a/include/llvm/InstrTypes.h +++ b/include/llvm/InstrTypes.h @@ -55,10 +55,12 @@ public: // create() - Construct a unary instruction, given the opcode // and its operand. // - static UnaryOperator *create(UnaryOps Op, Value *Source); + static UnaryOperator *create(UnaryOps Op, Value *Source, + const Type *DestTy = 0); - UnaryOperator(Value *S, UnaryOps iType, const string &Name = "") - : Instruction(S->getType(), iType, Name) { + UnaryOperator(Value *S, UnaryOps iType, const Type *ResultType, + const string &Name = "") + : Instruction(ResultType, iType, Name) { Operands.reserve(1); Operands.push_back(Use(S, this)); } diff --git a/include/llvm/Instruction.h b/include/llvm/Instruction.h index 96f2637ee2b..16adbb2982c 100644 --- a/include/llvm/Instruction.h +++ b/include/llvm/Instruction.h @@ -77,14 +77,8 @@ public: enum UnaryOps { FirstUnaryOp = NumTermOps, - Neg = NumTermOps, Not, - - // Type conversions... - ToBoolTy , - ToUByteTy , ToSByteTy, ToUShortTy, ToShortTy, - ToUInt , ToInt, ToULongTy , ToLongTy, - - ToFloatTy , ToDoubleTy, ToArrayTy , ToPointerTy, + Not = NumTermOps, // Binary inverse + Cast, // Type cast... NumUnaryOps // Must remain at end of enum }; diff --git a/include/llvm/iOperators.h b/include/llvm/iOperators.h index 4b6109a8541..5d02a404772 100644 --- a/include/llvm/iOperators.h +++ b/include/llvm/iOperators.h @@ -9,6 +9,20 @@ #include "llvm/InstrTypes.h" +//===----------------------------------------------------------------------===// +// Class to represent Unary operators +//===----------------------------------------------------------------------===// +// +class GenericUnaryInst : public UnaryOperator { +public: + GenericUnaryInst(UnaryOps Opcode, Value *S1, const Type *ResultTy = 0, + const string &Name = "") + : UnaryOperator(S1, Opcode, ResultTy, Name) { + } + + virtual const char *getOpcodeName() const; +}; + //===----------------------------------------------------------------------===// // Classes to represent Binary operators //===----------------------------------------------------------------------===// diff --git a/lib/AsmParser/Lexer.cpp b/lib/AsmParser/Lexer.cpp index 9edd3bf5b1c..7e2191b692f 100644 --- a/lib/AsmParser/Lexer.cpp +++ b/lib/AsmParser/Lexer.cpp @@ -308,26 +308,26 @@ static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); *yy_cp = '\0'; \ yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 58 -#define YY_END_OF_BUFFER 59 -static yyconst short int yy_acclist[113] = +#define YY_NUM_RULES 59 +#define YY_END_OF_BUFFER 60 +static yyconst short int yy_acclist[114] = { 0, - 59, 57, 58, 56, 57, 58, 56, 58, 57, 58, - 57, 58, 57, 58, 8, 57, 58, 52, 57, 58, - 1, 57, 58, 57, 58, 57, 58, 57, 58, 57, - 58, 57, 58, 57, 58, 57, 58, 57, 58, 57, - 58, 57, 58, 57, 58, 57, 58, 57, 58, 57, - 58, 57, 58, 57, 58, 57, 58, 50, 49, 54, - 53, 52, 1, 9, 40, 51, 49, 55, 28, 31, - 3, 16, 30, 24, 25, 26, 32, 39, 29, 11, - 27, 44, 45, 18, 4, 22, 17, 10, 2, 5, - 20, 23, 12, 34, 38, 36, 37, 35, 33, 14, + 60, 58, 59, 57, 58, 59, 57, 59, 58, 59, + 58, 59, 58, 59, 8, 58, 59, 53, 58, 59, + 1, 58, 59, 58, 59, 58, 59, 58, 59, 58, + 59, 58, 59, 58, 59, 58, 59, 58, 59, 58, + 59, 58, 59, 58, 59, 58, 59, 58, 59, 58, + 59, 58, 59, 58, 59, 58, 59, 51, 50, 55, + 54, 53, 1, 9, 41, 26, 52, 50, 56, 29, + 32, 3, 16, 31, 24, 27, 33, 40, 30, 11, + 28, 25, 45, 46, 18, 4, 22, 17, 10, 2, + 5, 20, 23, 12, 35, 39, 37, 38, 36, 34, - 46, 13, 19, 43, 21, 42, 41, 15, 6, 47, - 48, 7 + 14, 47, 13, 19, 44, 21, 43, 42, 15, 6, + 48, 49, 7 } ; -static yyconst short int yy_accept[199] = +static yyconst short int yy_accept[200] = { 0, 1, 1, 1, 2, 4, 7, 9, 11, 13, 15, 18, 21, 24, 26, 28, 30, 32, 34, 36, 38, @@ -336,20 +336,20 @@ static yyconst short int yy_accept[199] = 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, 66, - 66, 66, 66, 66, 66, 66, 66, 66, 67, 68, - 69, 70, 70, 70, 70, 70, 70, 71, 71, 72, - 72, 72, 72, 72, 72, 73, 73, 73, 73, 73, + 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, 75, 76, 77, 77, 78, 79, 79, 79, 79, 79, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 81, 82, 82, 82, 82, 82, 83, 83, - 83, 83, 84, 85, 85, 85, 85, 85, 85, 85, - 85, 85, 85, 85, 86, 87, 87, 88, 88, 88, - 89, 89, 90, 90, 90, 91, 92, 92, 92, 93, - 93, 93, 94, 95, 96, 97, 98, 99, 100, 101, - 102, 102, 103, 104, 104, 105, 105, 106, 106, 106, - 107, 107, 108, 109, 110, 110, 110, 110, 111, 111, - 112, 112, 112, 112, 112, 112, 113, 113 + 80, 80, 81, 82, 83, 83, 83, 83, 83, 84, + 84, 84, 84, 85, 86, 86, 86, 86, 86, 86, + 86, 86, 86, 86, 86, 87, 88, 88, 89, 89, + 89, 90, 90, 91, 91, 91, 92, 93, 93, 93, + 94, 94, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 103, 104, 105, 105, 106, 106, 107, 107, + 107, 108, 108, 109, 110, 111, 111, 111, 111, 112, + 112, 113, 113, 113, 113, 113, 113, 114, 114 } ; @@ -393,61 +393,61 @@ static yyconst int yy_meta[33] = 4, 4 } ; -static yyconst short int yy_base[203] = +static yyconst short int yy_base[204] = { 0, - 0, 0, 389, 390, 390, 390, 0, 379, 26, 379, + 0, 0, 391, 392, 392, 392, 0, 381, 26, 381, 27, 0, 28, 40, 29, 35, 34, 42, 30, 38, - 56, 60, 55, 63, 65, 84, 68, 107, 52, 382, - 376, 390, 0, 376, 375, 374, 74, 0, 32, 64, - 372, 78, 67, 371, 77, 92, 76, 79, 89, 98, - 100, 95, 102, 105, 108, 112, 111, 119, 122, 123, - 116, 126, 128, 129, 132, 134, 137, 138, 139, 140, - 143, 144, 145, 149, 146, 156, 154, 390, 0, 371, - 369, 157, 166, 158, 161, 167, 368, 170, 367, 174, - 175, 179, 180, 182, 366, 183, 181, 188, 184, 365, + 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, 76, 92, 95, + 98, 99, 108, 110, 111, 113, 118, 117, 121, 119, + 123, 124, 129, 126, 134, 136, 137, 139, 135, 372, + 140, 144, 146, 152, 147, 154, 156, 392, 0, 372, + 370, 157, 158, 162, 164, 155, 167, 369, 176, 368, + 170, 180, 177, 184, 181, 367, 187, 185, 186, 189, - 364, 363, 362, 190, 361, 360, 191, 211, 198, 199, - 359, 194, 200, 201, 202, 204, 205, 212, 203, 225, - 214, 358, 357, 228, 209, 231, 232, 356, 233, 234, - 235, 355, 354, 236, 238, 239, 241, 247, 249, 252, - 242, 254, 259, 353, 352, 256, 351, 264, 265, 350, - 267, 349, 270, 271, 348, 347, 273, 274, 346, 276, - 275, 345, 344, 343, 342, 341, 340, 335, 330, 325, - 283, 320, 319, 278, 317, 284, 316, 285, 288, 315, - 289, 313, 311, 310, 293, 291, 301, 308, 295, 244, - 303, 299, 302, 307, 309, 82, 390, 331, 334, 337, + 366, 365, 364, 195, 363, 362, 196, 216, 197, 201, + 361, 198, 199, 203, 204, 206, 207, 212, 208, 228, + 221, 360, 359, 358, 231, 219, 235, 236, 357, 237, + 238, 239, 356, 355, 240, 242, 243, 245, 251, 253, + 256, 246, 258, 263, 354, 353, 260, 352, 268, 269, + 351, 271, 350, 274, 275, 349, 348, 277, 278, 347, + 280, 279, 346, 345, 344, 339, 334, 329, 324, 323, + 321, 287, 320, 319, 282, 317, 288, 315, 289, 292, + 314, 293, 312, 248, 211, 297, 295, 305, 210, 299, + 172, 307, 303, 306, 311, 313, 74, 392, 335, 338, - 342, 53 + 341, 346, 53 } ; -static yyconst short int yy_def[203] = +static yyconst short int yy_def[204] = { 0, - 197, 1, 197, 197, 197, 197, 198, 199, 200, 197, - 199, 201, 199, 199, 199, 199, 199, 199, 199, 199, - 199, 199, 199, 199, 199, 199, 199, 199, 199, 198, - 199, 197, 202, 197, 197, 197, 199, 201, 199, 199, - 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, - 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, - 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, - 199, 199, 199, 199, 199, 199, 199, 197, 202, 197, - 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, - 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, + 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, 200, 198, 203, 198, + 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, + 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, - 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, - 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, - 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, - 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, - 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, - 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, - 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, - 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, - 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, - 199, 199, 199, 199, 199, 199, 0, 197, 197, 197, + 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, - 197, 197 + 198, 198, 198 } ; -static yyconst short int yy_nxt[423] = +static yyconst short int yy_nxt[425] = { 0, 4, 5, 6, 7, 8, 9, 10, 11, 4, 12, 13, 14, 15, 16, 17, 18, 19, 8, 20, 21, @@ -455,98 +455,98 @@ static yyconst short int yy_nxt[423] = 8, 8, 34, 35, 37, 32, 32, 32, 32, 45, 32, 39, 32, 32, 53, 81, 32, 40, 32, 46, 32, 41, 50, 47, 42, 49, 79, 48, 54, 55, - 32, 51, 43, 32, 32, 44, 56, 52, 32, 60, - 58, 32, 32, 32, 77, 32, 32, 61, 57, 64, - 62, 37, 32, 82, 32, 32, 32, 32, 59, 84, - 32, 63, 32, 71, 83, 65, 85, 32, 66, 72, + 32, 51, 43, 32, 32, 44, 56, 52, 32, 32, + 58, 32, 61, 32, 60, 63, 37, 32, 57, 32, + 32, 32, 32, 62, 32, 77, 32, 70, 59, 32, + 71, 82, 64, 84, 83, 65, 72, 32, 66, 32, - 32, 67, 89, 32, 86, 87, 32, 88, 32, 92, - 32, 68, 69, 32, 70, 32, 32, 90, 73, 32, - 32, 97, 91, 96, 32, 74, 75, 32, 94, 93, - 32, 32, 98, 76, 32, 95, 32, 32, 99, 101, - 32, 100, 32, 102, 103, 32, 32, 32, 32, 105, - 111, 32, 32, 32, 32, 104, 106, 32, 112, 109, - 110, 108, 32, 107, 32, 32, 32, 114, 117, 32, - 116, 113, 119, 118, 32, 32, 115, 122, 32, 120, - 123, 125, 32, 32, 121, 127, 124, 32, 32, 32, - 32, 32, 32, 128, 132, 129, 32, 131, 32, 32, + 32, 87, 88, 32, 89, 90, 32, 32, 67, 68, + 85, 69, 32, 93, 91, 73, 32, 86, 32, 32, + 92, 32, 74, 75, 97, 32, 32, 32, 98, 32, + 76, 32, 32, 95, 32, 94, 100, 32, 96, 99, + 101, 103, 32, 32, 32, 32, 102, 32, 32, 105, + 111, 104, 32, 112, 32, 32, 106, 107, 109, 110, + 32, 108, 32, 32, 32, 32, 32, 114, 113, 117, + 32, 118, 32, 116, 119, 32, 121, 115, 32, 120, + 32, 122, 124, 123, 32, 32, 125, 126, 32, 32, + 128, 129, 32, 32, 32, 32, 127, 32, 133, 130, - 126, 130, 32, 134, 133, 135, 32, 32, 32, 32, - 32, 32, 32, 32, 144, 145, 150, 32, 136, 32, - 32, 143, 32, 141, 142, 137, 148, 138, 154, 146, - 139, 147, 140, 32, 149, 152, 32, 151, 153, 32, - 32, 32, 32, 32, 32, 155, 32, 32, 158, 32, - 32, 157, 32, 162, 159, 32, 161, 32, 160, 156, - 32, 164, 32, 166, 32, 163, 168, 32, 170, 169, - 172, 171, 32, 32, 165, 32, 167, 175, 32, 32, - 173, 32, 32, 32, 32, 177, 32, 178, 180, 181, - 174, 32, 32, 32, 179, 176, 32, 32, 184, 32, + 131, 132, 134, 32, 32, 32, 32, 32, 135, 32, + 136, 32, 32, 145, 32, 32, 32, 146, 32, 32, + 32, 151, 142, 137, 32, 144, 143, 32, 149, 32, + 138, 147, 139, 148, 150, 140, 32, 141, 155, 32, + 152, 154, 153, 32, 32, 32, 32, 32, 32, 156, + 32, 32, 159, 32, 32, 158, 32, 163, 160, 32, + 162, 32, 161, 157, 32, 165, 32, 167, 32, 164, + 169, 32, 171, 170, 173, 172, 32, 32, 166, 32, + 168, 176, 32, 32, 174, 32, 32, 32, 32, 178, + 32, 179, 181, 182, 175, 32, 32, 32, 180, 177, - 182, 32, 186, 32, 185, 183, 188, 32, 187, 32, - 32, 32, 189, 192, 190, 32, 32, 32, 32, 32, - 194, 32, 191, 32, 32, 32, 193, 32, 32, 195, - 196, 30, 30, 32, 30, 30, 30, 31, 32, 31, - 33, 33, 38, 32, 38, 38, 38, 38, 32, 32, + 32, 32, 185, 32, 183, 32, 187, 32, 186, 184, + 189, 32, 188, 32, 32, 32, 190, 193, 191, 32, + 32, 32, 32, 32, 195, 32, 192, 32, 32, 32, + 194, 32, 32, 196, 197, 30, 30, 32, 30, 30, + 30, 31, 32, 31, 33, 33, 38, 32, 38, 38, + 38, 38, 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, 32, 80, 32, - 32, 36, 35, 80, 32, 78, 36, 32, 197, 3, - 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 80, + 32, 32, 32, 36, 35, 80, 32, 78, 36, 32, + 198, 3, 198, 198, 198, 198, 198, 198, 198, 198, - 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, - 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, - 197, 197 + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198 } ; -static yyconst short int yy_chk[423] = +static yyconst short int yy_chk[425] = { 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, 202, 16, 20, 20, - 29, 18, 14, 23, 21, 14, 21, 18, 22, 23, - 22, 24, 40, 25, 29, 43, 27, 23, 21, 25, - 24, 37, 37, 40, 47, 45, 42, 48, 22, 43, - 196, 24, 26, 27, 42, 26, 45, 49, 26, 27, + 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, 24, 48, 29, 42, 27, 22, 26, + 27, 40, 26, 43, 42, 26, 27, 46, 26, 45, - 46, 26, 49, 52, 46, 47, 50, 48, 51, 52, - 53, 26, 26, 54, 26, 28, 55, 50, 28, 57, - 56, 57, 51, 56, 61, 28, 28, 58, 54, 53, - 59, 60, 57, 28, 62, 55, 63, 64, 58, 60, - 65, 59, 66, 61, 62, 67, 68, 69, 70, 64, - 69, 71, 72, 73, 75, 63, 64, 74, 70, 67, - 68, 66, 77, 65, 76, 82, 84, 72, 75, 85, - 74, 71, 77, 76, 83, 86, 73, 84, 88, 82, - 85, 88, 90, 91, 83, 91, 86, 92, 93, 97, - 94, 96, 99, 92, 97, 93, 98, 96, 104, 107, + 49, 46, 47, 50, 48, 49, 51, 52, 26, 26, + 45, 26, 28, 52, 50, 28, 53, 45, 54, 55, + 51, 56, 28, 28, 56, 58, 57, 60, 57, 59, + 28, 61, 62, 54, 64, 53, 58, 63, 55, 57, + 59, 61, 65, 69, 66, 67, 60, 68, 71, 63, + 68, 62, 72, 69, 73, 75, 63, 64, 66, 67, + 74, 65, 76, 86, 77, 82, 83, 72, 71, 75, + 84, 76, 85, 74, 77, 87, 83, 73, 91, 82, + 191, 84, 86, 85, 89, 93, 87, 89, 92, 95, + 92, 93, 94, 98, 99, 97, 91, 100, 98, 94, - 90, 94, 112, 99, 98, 104, 109, 110, 113, 114, - 115, 119, 116, 117, 113, 114, 119, 125, 107, 108, - 118, 112, 121, 109, 110, 108, 117, 108, 125, 115, - 108, 116, 108, 120, 118, 121, 124, 120, 124, 126, - 127, 129, 130, 131, 134, 126, 135, 136, 130, 137, - 141, 129, 190, 136, 131, 138, 135, 139, 134, 127, - 140, 138, 142, 139, 146, 137, 140, 143, 142, 141, - 146, 143, 148, 149, 138, 151, 139, 151, 153, 154, - 148, 157, 158, 161, 160, 154, 174, 157, 160, 161, - 149, 171, 176, 178, 158, 153, 179, 181, 176, 186, + 95, 97, 99, 104, 107, 109, 112, 113, 100, 110, + 104, 114, 115, 113, 116, 117, 119, 114, 189, 185, + 118, 119, 109, 107, 108, 112, 110, 126, 117, 121, + 108, 115, 108, 116, 118, 108, 120, 108, 126, 125, + 120, 125, 121, 127, 128, 130, 131, 132, 135, 127, + 136, 137, 131, 138, 142, 130, 184, 137, 132, 139, + 136, 140, 135, 128, 141, 139, 143, 140, 147, 138, + 141, 144, 143, 142, 147, 144, 149, 150, 139, 152, + 140, 152, 154, 155, 149, 158, 159, 162, 161, 155, + 175, 158, 161, 162, 150, 172, 177, 179, 159, 154, - 171, 185, 179, 189, 178, 174, 185, 192, 181, 187, - 193, 191, 186, 191, 187, 194, 188, 195, 184, 183, - 193, 182, 189, 180, 177, 175, 192, 173, 172, 194, - 195, 198, 198, 170, 198, 198, 198, 199, 169, 199, - 200, 200, 201, 168, 201, 201, 201, 201, 167, 166, - 165, 164, 163, 162, 159, 156, 155, 152, 150, 147, - 145, 144, 133, 132, 128, 123, 122, 111, 106, 105, - 103, 102, 101, 100, 95, 89, 87, 81, 80, 44, - 41, 36, 35, 34, 31, 30, 10, 8, 3, 197, - 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, + 180, 182, 177, 187, 172, 186, 180, 190, 179, 175, + 186, 193, 182, 188, 194, 192, 187, 192, 188, 195, + 183, 196, 181, 178, 194, 176, 190, 174, 173, 171, + 193, 170, 169, 195, 196, 199, 199, 168, 199, 199, + 199, 200, 167, 200, 201, 201, 202, 166, 202, 202, + 202, 202, 165, 164, 163, 160, 157, 156, 153, 151, + 148, 146, 145, 134, 133, 129, 124, 123, 122, 111, + 106, 105, 103, 102, 101, 96, 90, 88, 81, 80, + 70, 44, 41, 36, 35, 34, 31, 30, 10, 8, + 3, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, - 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, - 197, 197 + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198 } ; static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr; @@ -816,14 +816,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 >= 198 ) + if ( yy_current_state >= 199 ) 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 != 197 ); + while ( yy_current_state != 198 ); yy_find_action: yy_current_state = *--yy_state_ptr; @@ -976,159 +976,164 @@ YY_RULE_SETUP case 24: YY_RULE_SETUP #line 114 "Lexer.l" -{ RET_TOK(UnaryOpVal, Neg, NEG); } +{ RET_TOK(UnaryOpVal, Not, NOT); } YY_BREAK case 25: YY_RULE_SETUP #line 115 "Lexer.l" -{ RET_TOK(UnaryOpVal, Not, NOT); } +{ RET_TOK(UnaryOpVal, Cast, CAST); } YY_BREAK case 26: YY_RULE_SETUP #line 117 "Lexer.l" -{ return PHI; } +{ return TO; } YY_BREAK case 27: YY_RULE_SETUP #line 118 "Lexer.l" -{ return CALL; } +{ return PHI; } YY_BREAK case 28: YY_RULE_SETUP #line 119 "Lexer.l" -{ RET_TOK(BinaryOpVal, Add, ADD); } +{ return CALL; } YY_BREAK case 29: YY_RULE_SETUP #line 120 "Lexer.l" -{ RET_TOK(BinaryOpVal, Sub, SUB); } +{ RET_TOK(BinaryOpVal, Add, ADD); } YY_BREAK case 30: YY_RULE_SETUP #line 121 "Lexer.l" -{ RET_TOK(BinaryOpVal, Mul, MUL); } +{ RET_TOK(BinaryOpVal, Sub, SUB); } YY_BREAK case 31: YY_RULE_SETUP #line 122 "Lexer.l" -{ RET_TOK(BinaryOpVal, Div, DIV); } +{ RET_TOK(BinaryOpVal, Mul, MUL); } YY_BREAK case 32: YY_RULE_SETUP #line 123 "Lexer.l" -{ RET_TOK(BinaryOpVal, Rem, REM); } +{ RET_TOK(BinaryOpVal, Div, DIV); } YY_BREAK case 33: YY_RULE_SETUP #line 124 "Lexer.l" -{ RET_TOK(BinaryOpVal, SetNE, SETNE); } +{ RET_TOK(BinaryOpVal, Rem, REM); } YY_BREAK case 34: YY_RULE_SETUP #line 125 "Lexer.l" -{ RET_TOK(BinaryOpVal, SetEQ, SETEQ); } +{ RET_TOK(BinaryOpVal, SetNE, SETNE); } YY_BREAK case 35: YY_RULE_SETUP #line 126 "Lexer.l" -{ RET_TOK(BinaryOpVal, SetLT, SETLT); } +{ RET_TOK(BinaryOpVal, SetEQ, SETEQ); } YY_BREAK case 36: YY_RULE_SETUP #line 127 "Lexer.l" -{ RET_TOK(BinaryOpVal, SetGT, SETGT); } +{ RET_TOK(BinaryOpVal, SetLT, SETLT); } YY_BREAK case 37: YY_RULE_SETUP #line 128 "Lexer.l" -{ RET_TOK(BinaryOpVal, SetLE, SETLE); } +{ RET_TOK(BinaryOpVal, SetGT, SETGT); } YY_BREAK case 38: YY_RULE_SETUP #line 129 "Lexer.l" -{ RET_TOK(BinaryOpVal, SetGE, SETGE); } +{ RET_TOK(BinaryOpVal, SetLE, SETLE); } YY_BREAK case 39: YY_RULE_SETUP -#line 131 "Lexer.l" -{ RET_TOK(TermOpVal, Ret, RET); } +#line 130 "Lexer.l" +{ RET_TOK(BinaryOpVal, SetGE, SETGE); } YY_BREAK case 40: YY_RULE_SETUP #line 132 "Lexer.l" -{ RET_TOK(TermOpVal, Br, BR); } +{ RET_TOK(TermOpVal, Ret, RET); } YY_BREAK case 41: YY_RULE_SETUP #line 133 "Lexer.l" -{ RET_TOK(TermOpVal, Switch, SWITCH); } +{ RET_TOK(TermOpVal, Br, BR); } YY_BREAK case 42: YY_RULE_SETUP -#line 136 "Lexer.l" -{ RET_TOK(MemOpVal, Malloc, MALLOC); } +#line 134 "Lexer.l" +{ RET_TOK(TermOpVal, Switch, SWITCH); } YY_BREAK case 43: YY_RULE_SETUP #line 137 "Lexer.l" -{ RET_TOK(MemOpVal, Alloca, ALLOCA); } +{ RET_TOK(MemOpVal, Malloc, MALLOC); } YY_BREAK case 44: YY_RULE_SETUP #line 138 "Lexer.l" -{ RET_TOK(MemOpVal, Free, FREE); } +{ RET_TOK(MemOpVal, Alloca, ALLOCA); } YY_BREAK case 45: YY_RULE_SETUP #line 139 "Lexer.l" -{ RET_TOK(MemOpVal, Load, LOAD); } +{ RET_TOK(MemOpVal, Free, FREE); } YY_BREAK case 46: YY_RULE_SETUP #line 140 "Lexer.l" -{ RET_TOK(MemOpVal, Store, STORE); } +{ RET_TOK(MemOpVal, Load, LOAD); } YY_BREAK case 47: YY_RULE_SETUP #line 141 "Lexer.l" -{ RET_TOK(MemOpVal, GetField, GETFIELD); } +{ RET_TOK(MemOpVal, Store, STORE); } YY_BREAK case 48: YY_RULE_SETUP #line 142 "Lexer.l" -{ RET_TOK(MemOpVal, PutField, PUTFIELD); } +{ RET_TOK(MemOpVal, GetField, GETFIELD); } YY_BREAK case 49: YY_RULE_SETUP -#line 145 "Lexer.l" -{ llvmAsmlval.StrVal = strdup(yytext+1); return VAR_ID; } +#line 143 "Lexer.l" +{ RET_TOK(MemOpVal, PutField, PUTFIELD); } YY_BREAK case 50: YY_RULE_SETUP #line 146 "Lexer.l" +{ llvmAsmlval.StrVal = strdup(yytext+1); return VAR_ID; } + YY_BREAK +case 51: +YY_RULE_SETUP +#line 147 "Lexer.l" { yytext[strlen(yytext)-1] = 0; // nuke colon llvmAsmlval.StrVal = strdup(yytext); return LABELSTR; } YY_BREAK -case 51: +case 52: YY_RULE_SETUP -#line 152 "Lexer.l" +#line 153 "Lexer.l" { yytext[strlen(yytext)-1] = 0; // nuke end quote llvmAsmlval.StrVal = strdup(yytext+1); // Nuke start quote return STRINGCONSTANT; } YY_BREAK -case 52: -YY_RULE_SETUP -#line 159 "Lexer.l" -{ llvmAsmlval.UInt64Val = atoull(yytext); return EUINT64VAL; } - YY_BREAK case 53: YY_RULE_SETUP #line 160 "Lexer.l" +{ llvmAsmlval.UInt64Val = atoull(yytext); return EUINT64VAL; } + YY_BREAK +case 54: +YY_RULE_SETUP +#line 161 "Lexer.l" { uint64_t Val = atoull(yytext+1); // +1: we have bigger negative range @@ -1138,14 +1143,14 @@ YY_RULE_SETUP return ESINT64VAL; } YY_BREAK -case 54: -YY_RULE_SETUP -#line 170 "Lexer.l" -{ llvmAsmlval.UIntVal = atoull(yytext+1); return UINTVAL; } - YY_BREAK case 55: YY_RULE_SETUP #line 171 "Lexer.l" +{ llvmAsmlval.UIntVal = atoull(yytext+1); return UINTVAL; } + YY_BREAK +case 56: +YY_RULE_SETUP +#line 172 "Lexer.l" { uint64_t Val = atoull(yytext+2); // +1: we have bigger negative range @@ -1155,22 +1160,22 @@ YY_RULE_SETUP return SINTVAL; } YY_BREAK -case 56: -YY_RULE_SETUP -#line 181 "Lexer.l" -{ /* Ignore whitespace */ } - YY_BREAK case 57: YY_RULE_SETUP #line 182 "Lexer.l" -{ /*printf("'%s'", yytext);*/ return yytext[0]; } +{ /* Ignore whitespace */ } YY_BREAK case 58: YY_RULE_SETUP -#line 184 "Lexer.l" +#line 183 "Lexer.l" +{ /*printf("'%s'", yytext);*/ return yytext[0]; } + YY_BREAK +case 59: +YY_RULE_SETUP +#line 185 "Lexer.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK -#line 1175 "Lexer.cpp" +#line 1180 "Lexer.cpp" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -1459,7 +1464,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 >= 198 ) + if ( yy_current_state >= 199 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1489,11 +1494,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 >= 198 ) + if ( yy_current_state >= 199 ) 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 == 197); + yy_is_jam = (yy_current_state == 198); if ( ! yy_is_jam ) *yy_state_ptr++ = yy_current_state; @@ -2054,5 +2059,5 @@ int main() return 0; } #endif -#line 184 "Lexer.l" +#line 185 "Lexer.l" diff --git a/lib/AsmParser/Lexer.l b/lib/AsmParser/Lexer.l index 89d776bbb0c..2d7ee22f327 100644 --- a/lib/AsmParser/Lexer.l +++ b/lib/AsmParser/Lexer.l @@ -111,9 +111,10 @@ type { llvmAsmlval.TypeVal = Type::TypeTy ; return TYPE; } label { llvmAsmlval.TypeVal = Type::LabelTy ; return LABEL; } -neg { RET_TOK(UnaryOpVal, Neg, NEG); } not { RET_TOK(UnaryOpVal, Not, NOT); } +cast { RET_TOK(UnaryOpVal, Cast, CAST); } +to { return TO; } phi { return PHI; } call { return CALL; } add { RET_TOK(BinaryOpVal, Add, ADD); } diff --git a/lib/AsmParser/llvmAsmParser.cpp b/lib/AsmParser/llvmAsmParser.cpp index 19c22ddfa10..d9cf7d7e88a 100644 --- a/lib/AsmParser/llvmAsmParser.cpp +++ b/lib/AsmParser/llvmAsmParser.cpp @@ -39,33 +39,32 @@ #define BEGINTOK 282 #define END 283 #define DECLARE 284 -#define PHI 285 -#define CALL 286 -#define RET 287 -#define BR 288 -#define SWITCH 289 -#define NEG 290 +#define TO 285 +#define PHI 286 +#define CALL 287 +#define RET 288 +#define BR 289 +#define SWITCH 290 #define NOT 291 -#define TOINT 292 -#define TOUINT 293 -#define ADD 294 -#define SUB 295 -#define MUL 296 -#define DIV 297 -#define REM 298 -#define SETLE 299 -#define SETGE 300 -#define SETLT 301 -#define SETGT 302 -#define SETEQ 303 -#define SETNE 304 -#define MALLOC 305 -#define ALLOCA 306 -#define FREE 307 -#define LOAD 308 -#define STORE 309 -#define GETFIELD 310 -#define PUTFIELD 311 +#define CAST 292 +#define ADD 293 +#define SUB 294 +#define MUL 295 +#define DIV 296 +#define REM 297 +#define SETLE 298 +#define SETGE 299 +#define SETLT 300 +#define SETGT 301 +#define SETEQ 302 +#define SETNE 303 +#define MALLOC 304 +#define ALLOCA 305 +#define FREE 306 +#define LOAD 307 +#define STORE 308 +#define GETFIELD 309 +#define PUTFIELD 310 #line 13 "llvmAsmParser.y" @@ -84,8 +83,8 @@ #include // Get definition of pair class #include // This embarasment is due to our flex lexer... -int yyerror(char *ErrorMsg); // Forward declarations to prevent "implicit -int yylex(); // declaration" of xxx warnings. +int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit +int yylex(); // declaration" of xxx warnings. int yyparse(); static Module *ParserResult; @@ -432,26 +431,26 @@ typedef union { -#define YYFINAL 232 +#define YYFINAL 234 #define YYFLAG -32768 -#define YYNTBASE 68 +#define YYNTBASE 67 -#define YYTRANSLATE(x) ((unsigned)(x) <= 311 ? yytranslate[x] : 104) +#define YYTRANSLATE(x) ((unsigned)(x) <= 310 ? yytranslate[x] : 103) 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, 64, + 65, 66, 2, 63, 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, + 57, 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, + 58, 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, 61, - 2, 2, 62, 2, 63, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 60, + 2, 2, 61, 2, 62, 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, @@ -469,8 +468,7 @@ static const char yytranslate[] = { 0, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 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 + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56 }; #if YYDEBUG != 0 @@ -479,76 +477,76 @@ 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, 90, 93, 94, 97, 100, - 103, 106, 109, 112, 119, 125, 134, 142, 149, 154, - 158, 160, 164, 165, 167, 170, 173, 175, 176, 179, - 183, 185, 187, 188, 194, 198, 201, 203, 205, 207, - 209, 211, 213, 215, 217, 219, 224, 228, 232, 238, - 242, 245, 248, 250, 254, 257, 260, 263, 267, 270, - 271, 275, 278, 282, 292, 302, 309, 315, 318, 325, - 333, 336, 340, 342, 343, 349, 353, 356, 363, 365, - 368, 374, 377, 383 + 80, 82, 84, 87, 88, 91, 94, 97, 100, 103, + 106, 113, 119, 128, 136, 143, 148, 152, 154, 158, + 159, 161, 164, 167, 169, 170, 173, 177, 179, 181, + 182, 188, 192, 195, 197, 199, 201, 203, 205, 207, + 209, 211, 213, 218, 222, 226, 232, 236, 239, 242, + 244, 248, 251, 254, 257, 261, 264, 265, 269, 272, + 276, 286, 296, 303, 309, 312, 319, 327, 330, 334, + 336, 337, 343, 347, 353, 356, 363, 365, 368, 374, + 377, 383 }; 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, 36, - 0, 37, 0, 38, 0, 39, 0, 40, 0, 41, - 0, 42, 0, 43, 0, 44, 0, 45, 0, 46, - 0, 47, 0, 48, 0, 49, 0, 50, 0, 15, - 0, 13, 0, 11, 0, 9, 0, 16, 0, 14, - 0, 12, 0, 10, 0, 74, 0, 75, 0, 22, - 58, 0, 0, 74, 69, 0, 75, 4, 0, 8, - 26, 0, 8, 27, 0, 19, 24, 0, 20, 70, - 0, 59, 70, 60, 59, 79, 60, 0, 59, 70, - 60, 59, 60, 0, 59, 4, 61, 70, 60, 59, - 79, 60, 0, 59, 4, 61, 70, 60, 59, 60, - 0, 62, 92, 63, 62, 79, 63, 0, 62, 63, - 62, 63, 0, 79, 64, 78, 0, 78, 0, 80, - 77, 78, 0, 0, 82, 0, 82, 89, 0, 80, - 25, 0, 22, 0, 0, 70, 83, 0, 84, 64, - 85, 0, 84, 0, 85, 0, 0, 71, 24, 65, - 86, 66, 0, 87, 80, 28, 0, 93, 29, 0, - 3, 0, 4, 0, 26, 0, 27, 0, 24, 0, - 68, 0, 22, 0, 90, 0, 91, 0, 71, 65, - 92, 66, 0, 71, 65, 66, 0, 59, 70, 60, - 0, 59, 4, 61, 70, 60, 0, 62, 92, 63, - 0, 62, 63, 0, 70, 67, 0, 70, 0, 92, - 64, 70, 0, 93, 94, 0, 88, 94, 0, 95, - 96, 0, 23, 95, 96, 0, 95, 98, 0, 0, - 33, 70, 91, 0, 33, 7, 0, 34, 21, 91, - 0, 34, 8, 91, 64, 21, 91, 64, 21, 91, - 0, 35, 76, 91, 64, 21, 91, 59, 97, 60, - 0, 97, 76, 90, 64, 21, 91, 0, 76, 90, - 64, 21, 91, 0, 77, 102, 0, 70, 59, 91, - 64, 91, 60, 0, 99, 64, 59, 91, 64, 91, - 60, 0, 70, 91, 0, 100, 64, 91, 0, 100, - 0, 0, 73, 70, 91, 64, 91, 0, 72, 70, - 91, 0, 31, 99, 0, 32, 70, 91, 65, 101, - 66, 0, 103, 0, 51, 70, 0, 51, 70, 64, - 14, 91, 0, 52, 70, 0, 52, 70, 64, 14, - 91, 0, 53, 70, 91, 0 + 0, 20, 0, 21, 0, 69, 0, 7, 0, 37, + 0, 39, 0, 40, 0, 41, 0, 42, 0, 43, + 0, 44, 0, 45, 0, 46, 0, 47, 0, 48, + 0, 49, 0, 15, 0, 13, 0, 11, 0, 9, + 0, 16, 0, 14, 0, 12, 0, 10, 0, 73, + 0, 74, 0, 22, 57, 0, 0, 73, 68, 0, + 74, 4, 0, 8, 26, 0, 8, 27, 0, 19, + 24, 0, 20, 69, 0, 58, 69, 59, 58, 78, + 59, 0, 58, 69, 59, 58, 59, 0, 58, 4, + 60, 69, 59, 58, 78, 59, 0, 58, 4, 60, + 69, 59, 58, 59, 0, 61, 91, 62, 61, 78, + 62, 0, 61, 62, 61, 62, 0, 78, 63, 77, + 0, 77, 0, 79, 76, 77, 0, 0, 81, 0, + 81, 88, 0, 79, 25, 0, 22, 0, 0, 69, + 82, 0, 83, 63, 84, 0, 83, 0, 84, 0, + 0, 70, 24, 64, 85, 65, 0, 86, 79, 28, + 0, 92, 29, 0, 3, 0, 4, 0, 26, 0, + 27, 0, 24, 0, 67, 0, 22, 0, 89, 0, + 90, 0, 70, 64, 91, 65, 0, 70, 64, 65, + 0, 58, 69, 59, 0, 58, 4, 60, 69, 59, + 0, 61, 91, 62, 0, 61, 62, 0, 69, 66, + 0, 69, 0, 91, 63, 69, 0, 92, 93, 0, + 87, 93, 0, 94, 95, 0, 23, 94, 95, 0, + 94, 97, 0, 0, 34, 69, 90, 0, 34, 7, + 0, 35, 21, 90, 0, 35, 8, 90, 63, 21, + 90, 63, 21, 90, 0, 36, 75, 90, 63, 21, + 90, 58, 96, 59, 0, 96, 75, 89, 63, 21, + 90, 0, 75, 89, 63, 21, 90, 0, 76, 101, + 0, 69, 58, 90, 63, 90, 59, 0, 98, 63, + 58, 90, 63, 90, 59, 0, 69, 90, 0, 99, + 63, 90, 0, 99, 0, 0, 72, 69, 90, 63, + 90, 0, 71, 69, 90, 0, 38, 69, 90, 31, + 69, 0, 32, 98, 0, 33, 69, 90, 64, 100, + 65, 0, 102, 0, 50, 69, 0, 50, 69, 63, + 14, 90, 0, 51, 69, 0, 51, 69, 63, 14, + 90, 0, 52, 69, 90, 0 }; #endif #if YYDEBUG != 0 static const short yyrline[] = { 0, - 435, 436, 443, 444, 455, 455, 455, 455, 455, 455, - 455, 456, 456, 456, 456, 456, 456, 456, 459, 459, - 464, 464, 464, 464, 465, 465, 465, 465, 465, 466, - 466, 466, 466, 466, 466, 470, 470, 470, 470, 471, - 471, 471, 471, 472, 472, 474, 477, 481, 486, 491, - 494, 497, 503, 506, 519, 523, 541, 548, 556, 570, - 573, 579, 587, 598, 603, 608, 617, 617, 619, 627, - 631, 636, 639, 643, 670, 674, 683, 686, 689, 692, - 695, 700, 703, 706, 713, 721, 726, 730, 733, 736, - 741, 744, 749, 753, 758, 762, 771, 776, 785, 789, - 793, 796, 799, 802, 807, 818, 826, 836, 844, 849, - 856, 860, 866, 866, 868, 873, 878, 889, 926, 930, - 935, 944, 949, 958 + 432, 433, 440, 441, 452, 452, 452, 452, 452, 452, + 452, 453, 453, 453, 453, 453, 453, 453, 456, 456, + 461, 462, 462, 462, 462, 462, 463, 463, 463, 463, + 463, 463, 467, 467, 467, 467, 468, 468, 468, 468, + 469, 469, 471, 474, 478, 483, 488, 491, 494, 500, + 503, 516, 520, 538, 545, 553, 567, 570, 576, 584, + 595, 600, 605, 614, 614, 616, 624, 628, 633, 636, + 640, 667, 671, 680, 683, 686, 689, 692, 697, 700, + 703, 710, 718, 723, 727, 730, 733, 738, 741, 746, + 750, 755, 759, 768, 773, 782, 786, 790, 793, 796, + 799, 804, 815, 823, 833, 841, 846, 853, 857, 863, + 863, 865, 870, 875, 878, 889, 926, 930, 935, 944, + 949, 958 }; #endif @@ -559,32 +557,32 @@ 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","PHI","CALL","RET","BR","SWITCH","NEG","NOT","TOINT","TOUINT","ADD", -"SUB","MUL","DIV","REM","SETLE","SETGE","SETLT","SETGT","SETEQ","SETNE","MALLOC", -"ALLOCA","FREE","LOAD","STORE","GETFIELD","PUTFIELD","'='","'['","']'","'x'", -"'{'","'}'","','","'('","')'","'*'","INTVAL","EINT64VAL","Types","TypesV","UnaryOps", -"BinaryOps","SIntType","UIntType","IntType","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","MemoryInst", NULL +"DECLARE","TO","PHI","CALL","RET","BR","SWITCH","NOT","CAST","ADD","SUB","MUL", +"DIV","REM","SETLE","SETGE","SETLT","SETGT","SETEQ","SETNE","MALLOC","ALLOCA", +"FREE","LOAD","STORE","GETFIELD","PUTFIELD","'='","'['","']'","'x'","'{'","'}'", +"','","'('","')'","'*'","INTVAL","EINT64VAL","Types","TypesV","UnaryOps","BinaryOps", +"SIntType","UIntType","IntType","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","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, 72, 72, 72, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 74, 74, 74, 74, 75, - 75, 75, 75, 76, 76, 77, 77, 78, 78, 78, - 78, 78, 78, 78, 78, 78, 78, 78, 78, 79, - 79, 80, 80, 81, 82, 82, 83, 83, 84, 85, - 85, 86, 86, 87, 88, 89, 90, 90, 90, 90, - 90, 91, 91, 91, 70, 70, 70, 70, 70, 70, - 70, 70, 92, 92, 93, 93, 94, 94, 95, 95, - 96, 96, 96, 96, 96, 97, 97, 98, 99, 99, - 100, 100, 101, 101, 102, 102, 102, 102, 102, 103, - 103, 103, 103, 103 + 67, 67, 68, 68, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 70, 70, + 71, 72, 72, 72, 72, 72, 72, 72, 72, 72, + 72, 72, 73, 73, 73, 73, 74, 74, 74, 74, + 75, 75, 76, 76, 77, 77, 77, 77, 77, 77, + 77, 77, 77, 77, 77, 77, 78, 78, 79, 79, + 80, 81, 81, 82, 82, 83, 84, 84, 85, 85, + 86, 87, 88, 89, 89, 89, 89, 89, 90, 90, + 90, 69, 69, 69, 69, 69, 69, 69, 69, 91, + 91, 92, 92, 93, 93, 94, 94, 95, 95, 95, + 95, 95, 96, 96, 97, 98, 98, 99, 99, 100, + 100, 101, 101, 101, 101, 101, 101, 102, 102, 102, + 102, 102 }; static const short yyr2[] = { 0, @@ -592,199 +590,199 @@ 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, 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, 3, 1, 0, 5, 3, 2, 6, 1, 2, - 5, 2, 5, 3 + 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, 3, 1, + 0, 5, 3, 5, 2, 6, 1, 2, 5, 2, + 5, 3 }; -static const short yydefact[] = { 63, - 47, 64, 0, 66, 0, 77, 78, 1, 2, 20, +static const short yydefact[] = { 60, + 44, 61, 0, 63, 0, 74, 75, 1, 2, 20, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 83, 81, 79, 80, 0, 0, - 82, 19, 0, 63, 100, 65, 84, 85, 100, 46, - 0, 39, 43, 38, 42, 37, 41, 36, 40, 0, - 0, 0, 0, 0, 0, 62, 78, 19, 0, 91, - 93, 0, 92, 0, 0, 47, 100, 96, 47, 76, - 95, 50, 51, 52, 53, 78, 19, 0, 0, 3, - 4, 48, 49, 0, 88, 90, 0, 73, 87, 0, - 75, 47, 0, 0, 0, 0, 97, 99, 0, 0, - 0, 0, 19, 94, 68, 71, 72, 0, 86, 98, - 102, 19, 0, 0, 44, 45, 0, 0, 0, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 35, 0, 0, 0, 0, 0, 108, - 119, 19, 0, 59, 0, 89, 67, 69, 0, 74, - 101, 0, 103, 0, 19, 117, 19, 120, 122, 19, - 19, 19, 0, 55, 61, 0, 0, 70, 0, 0, - 0, 0, 0, 0, 0, 124, 116, 0, 0, 54, - 0, 58, 0, 0, 0, 0, 114, 0, 0, 0, - 57, 0, 60, 0, 0, 0, 0, 19, 113, 0, - 121, 123, 115, 56, 0, 0, 0, 0, 111, 0, - 118, 0, 0, 0, 109, 0, 112, 104, 0, 105, - 0, 110, 0, 0, 0, 0, 107, 0, 106, 0, - 0, 0 + 15, 16, 17, 18, 80, 78, 76, 77, 0, 0, + 79, 19, 0, 60, 97, 62, 81, 82, 97, 43, + 0, 36, 40, 35, 39, 34, 38, 33, 37, 0, + 0, 0, 0, 0, 0, 59, 75, 19, 0, 88, + 90, 0, 89, 0, 0, 44, 97, 93, 44, 73, + 92, 47, 48, 49, 50, 75, 19, 0, 0, 3, + 4, 45, 46, 0, 85, 87, 0, 70, 84, 0, + 72, 44, 0, 0, 0, 0, 94, 96, 0, 0, + 0, 0, 19, 91, 65, 68, 69, 0, 83, 95, + 99, 19, 0, 0, 41, 42, 0, 0, 0, 21, + 0, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 0, 0, 0, 0, 0, 105, 117, 19, + 0, 56, 0, 86, 64, 66, 0, 71, 98, 0, + 100, 0, 19, 115, 19, 19, 118, 120, 19, 19, + 19, 0, 52, 58, 0, 0, 67, 0, 0, 0, + 0, 0, 0, 0, 0, 122, 113, 0, 0, 51, + 0, 55, 0, 0, 0, 0, 111, 0, 0, 0, + 0, 54, 0, 57, 0, 0, 0, 0, 19, 110, + 0, 114, 119, 121, 112, 53, 0, 0, 0, 0, + 108, 0, 116, 0, 0, 0, 106, 0, 109, 101, + 0, 102, 0, 107, 0, 0, 0, 0, 104, 0, + 103, 0, 0, 0 }; static const short yydefgoto[] = { 31, - 82, 61, 59, 138, 139, 54, 55, 117, 5, 165, - 166, 1, 230, 2, 148, 106, 107, 108, 34, 35, - 36, 37, 38, 62, 39, 68, 69, 97, 214, 98, - 156, 199, 200, 140, 141 + 82, 61, 59, 136, 137, 54, 55, 117, 5, 164, + 165, 1, 232, 2, 146, 106, 107, 108, 34, 35, + 36, 37, 38, 62, 39, 68, 69, 97, 216, 98, + 154, 200, 201, 138, 139 }; static const short yypact[] = {-32768, - 124, 319, 23,-32768, 64,-32768,-32768,-32768,-32768,-32768, + 131, 319, -53,-32768, 26,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 379, 233, --32768, 26, -20,-32768, 97,-32768,-32768,-32768, 95,-32768, - 41,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 86, - 319, 404, 294, 192, 160,-32768, 67, 38, 75,-32768, - -35, 87,-32768, 104, 208, 43,-32768,-32768, 0,-32768, --32768,-32768,-32768,-32768, -35, 115, 78, 121, 134,-32768, --32768,-32768,-32768, 319,-32768,-32768, 319, 319,-32768, 109, --32768, 0, 464, 10, 147, 323,-32768,-32768, 319, 120, - 125, 129, 81, -35, -3, 137,-32768, 127,-32768,-32768, - 138, 2, 103, 103,-32768,-32768, 103, 319, 319,-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768, 319, 319, 319, 319, 319,-32768, --32768, 107, 1,-32768, 64,-32768,-32768,-32768, 319,-32768, --32768, 140,-32768, 141, 33, 142, 2, 117, 122, 2, - 2, 2, 143,-32768,-32768, 6, 136,-32768, 187, 188, - 103, 172, 168, 242, 244,-32768,-32768, 197, 28,-32768, - 64,-32768, 103, 103, 198, 103, 319, 103, 103, 103, --32768, 55,-32768, 199, 205, 103, 201, 2, 202, 203, --32768,-32768,-32768,-32768, 247, 147, 211, 103,-32768, 103, --32768, 103, 128, 42,-32768, 212,-32768,-32768, 209,-32768, - 128,-32768, 254, 213, 103, 255,-32768, 103,-32768, 278, - 279,-32768 +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 378, 234, +-32768, -13, -21,-32768, 46,-32768,-32768,-32768, 85,-32768, + 53,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 65, + 319, 403, 294, 126, 108,-32768, 60, -11, 83,-32768, + 93, 76,-32768, 84, 209, 100,-32768,-32768, 32,-32768, +-32768,-32768,-32768,-32768, 93, 98, -8, 121, 92,-32768, +-32768,-32768,-32768, 319,-32768,-32768, 319, 319,-32768, 103, +-32768, 32, 462, 36, 189, 239,-32768,-32768, 319, 111, + 125, 127, 22, 93, -1, 129,-32768, 124,-32768,-32768, + 142, 4, 157, 157,-32768,-32768, 157, 319, 319,-32768, + 319,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, +-32768,-32768, 319, 319, 319, 319, 319,-32768,-32768, 24, + 3,-32768, 26,-32768,-32768,-32768, 319,-32768,-32768, 144, +-32768, 146, -34, 147, 4, 4, 61, 80, 4, 4, + 4, 132,-32768,-32768, 33, 113,-32768, 211, 213, 157, + 199, 195, 231, 249, 250,-32768,-32768, 202, 91,-32768, + 26,-32768, 157, 157, 203, 157, 319, 319, 157, 157, + 157,-32768, 50,-32768, 205, 215, 157, 206, 4, 212, + 228, 93,-32768,-32768,-32768,-32768, 273, 189, 258, 157, +-32768, 157,-32768, 157, 170, 62,-32768, 260,-32768,-32768, + 279,-32768, 170,-32768, 323, 284, 157, 327,-32768, 157, +-32768, 349, 350,-32768 }; static const short yypgoto[] = {-32768, --32768, -2, 280,-32768,-32768, -93, -92, -103, -46, -4, - -120, 246,-32768,-32768,-32768,-32768, 132,-32768,-32768,-32768, --32768, -109, -18, 36,-32768, 245, 216, 193,-32768,-32768, +-32768, -2, 351,-32768,-32768, -93, -90, -183, -63, -4, + -123, 317,-32768,-32768,-32768,-32768, 207,-32768,-32768,-32768, +-32768, -163, -19, -6,-32768, 318, 291, 267,-32768,-32768, -32768,-32768,-32768,-32768,-32768 }; -#define YYLAST 526 +#define YYLAST 523 static const short yytable[] = { 32, - 56, 115, 116, 64, 6, 7, 8, 9, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 113, 147, 50, - 51, 3, 96, 25, 167, 26, 58, 27, 28, -19, - 114, 63, 93, 94, 95, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 65, 96, 50, 51, 75, 77, - 42, 43, 44, 45, 46, 47, 48, 49, 192, 52, - 164, -19, 53, 63, 3, 180, 72, 73, 63, 181, - 91, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 40, 103, 50, 51, 104, 105, 52, 191, 79, 53, - 112, 171, 63, 151, 152, 153, 142, 85, 154, 63, - 90, 220, 213, 219, 63, 6, 7, 8, 9, 74, - 221, 224, 115, 116, 204, 155, 157, 67, 181, 67, - 115, 116, 52, 70, 25, 53, 26, 84, 27, 28, - 6, 7, 158, 159, 160, 161, 162, 100, 173, 65, - 146, 176, 177, 178, 63, 3, 105, 63, 4, 86, - 87, 26, 185, 27, 28, 42, 43, 44, 45, 46, - 47, 48, 49, 83, 194, 195, 163, 197, 88, 201, - 202, 203, 87, 63, 109, 99, 193, 207, 143, 209, - 174, -19, 101, 63, 198, 175, -19, 144, 63, 216, - 145, 217, 150, 218, 80, 81, 102, 87, 182, 181, - 149, 179, -20, 169, 170, 172, 227, 183, 184, 229, - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 186, 26, 187, 27, 28, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 188, 26, 189, 27, 28, - 190, 196, 205, 206, 208, 210, 29, 212, 211, 30, - 215, 222, 223, 89, 225, 228, 226, 231, 232, 66, - 168, 33, 92, 71, 110, 0, 0, 0, 0, 0, - 0, 29, 0, 0, 30, 60, 6, 7, 8, 9, + 56, 115, 64, 40, 116, 96, 6, 7, 8, 9, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 166, + 145, 50, 51, 170, 215, 25, 58, 26, 96, 27, + 28, 63, 223, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 65, 113, 50, 51, 79, 85, 75, 77, + 100, 221, 63, 3, 63, 193, 114, 63, 90, 226, + 52, 163, -19, 53, 63, 93, 94, 95, 67, 63, + 42, 43, 44, 45, 46, 47, 48, 49, 72, 73, + 144, 103, 162, 52, 104, 105, 53, 63, 74, 63, + 112, 180, 149, 150, 151, 181, 140, 152, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 67, 206, 50, + 51, 83, 181, 70, 115, 153, 155, 116, 156, 84, + 222, 3, 115, 174, -19, 116, 63, 91, 80, 81, + 157, 158, 159, 160, 161, 172, 173, 86, 87, 176, + 177, 178, 175, -19, 105, 63, 65, 88, 52, 192, + 185, 53, 3, 102, 87, 4, -19, 99, 63, 6, + 7, 8, 9, 195, 196, 87, 198, 109, 141, 203, + 204, 205, 6, 7, 182, 181, 194, 209, 25, 211, + 26, 101, 27, 28, 199, 202, 142, 143, 148, 179, + 218, 147, 219, 26, 220, 27, 28, 42, 43, 44, + 45, 46, 47, 48, 49, -20, 168, 229, 169, 171, + 231, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 183, 26, 184, 27, 28, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 0, 26, 0, 27, + 20, 21, 22, 23, 24, 25, 186, 26, 187, 27, + 28, 188, 189, 190, 191, 197, 29, 207, 210, 30, + 118, 119, 208, 89, 212, 120, 121, 122, 123, 124, + 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, + 135, 29, 213, 214, 30, 60, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 217, 26, 224, 27, 28, 6, 7, 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, 118, 119, 30, 78, 0, 120, 121, - 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, - 132, 133, 134, 135, 136, 137, 0, 29, 0, 0, - 30, 6, 57, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 25, 225, 26, 227, 27, 28, 228, 230, 233, 234, + 66, 29, 33, 167, 30, 78, 71, 92, 110, 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, 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, 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, 29, 0, 0, 30, 0, 0, 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 + 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, + 0, 0, 0, 0, 0, 0, 0, 0, 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 }; static const short yycheck[] = { 2, - 5, 95, 95, 24, 3, 4, 5, 6, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 8, 22, 19, - 20, 22, 69, 22, 145, 24, 29, 26, 27, 65, - 21, 67, 33, 34, 35, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 65, 92, 19, 20, 51, 52, - 9, 10, 11, 12, 13, 14, 15, 16, 179, 59, - 60, 65, 62, 67, 22, 60, 26, 27, 67, 64, - 28, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 58, 84, 19, 20, 87, 88, 59, 60, 53, 62, - 93, 59, 67, 112, 113, 114, 99, 60, 117, 67, - 65, 60, 206, 213, 67, 3, 4, 5, 6, 24, - 214, 221, 206, 206, 60, 118, 119, 23, 64, 23, - 214, 214, 59, 29, 22, 62, 24, 61, 26, 27, - 3, 4, 135, 136, 137, 138, 139, 60, 157, 65, - 60, 160, 161, 162, 67, 22, 149, 67, 25, 63, - 64, 24, 171, 26, 27, 9, 10, 11, 12, 13, - 14, 15, 16, 4, 183, 184, 60, 186, 65, 188, - 189, 190, 64, 67, 66, 61, 181, 196, 59, 198, - 64, 65, 62, 67, 187, 64, 65, 63, 67, 208, - 62, 210, 66, 212, 3, 4, 63, 64, 63, 64, - 64, 59, 65, 64, 64, 64, 225, 21, 21, 228, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 59, 24, 65, 26, 27, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 14, 24, 14, 26, 27, - 64, 64, 64, 59, 64, 64, 59, 21, 66, 62, - 60, 60, 64, 66, 21, 21, 64, 0, 0, 34, - 149, 2, 67, 39, 92, -1, -1, -1, -1, -1, - -1, 59, -1, -1, 62, 63, 3, 4, 5, 6, + 5, 95, 24, 57, 95, 69, 3, 4, 5, 6, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 143, + 22, 19, 20, 58, 208, 22, 29, 24, 92, 26, + 27, 66, 216, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 64, 8, 19, 20, 53, 59, 51, 52, + 59, 215, 66, 22, 66, 179, 21, 66, 65, 223, + 58, 59, 64, 61, 66, 34, 35, 36, 23, 66, + 9, 10, 11, 12, 13, 14, 15, 16, 26, 27, + 59, 84, 59, 58, 87, 88, 61, 66, 24, 66, + 93, 59, 112, 113, 114, 63, 99, 117, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 23, 59, 19, + 20, 4, 63, 29, 208, 118, 119, 208, 121, 60, + 59, 22, 216, 63, 64, 216, 66, 28, 3, 4, + 133, 134, 135, 136, 137, 155, 156, 62, 63, 159, + 160, 161, 63, 64, 147, 66, 64, 64, 58, 59, + 170, 61, 22, 62, 63, 25, 64, 60, 66, 3, + 4, 5, 6, 183, 184, 63, 186, 65, 58, 189, + 190, 191, 3, 4, 62, 63, 181, 197, 22, 199, + 24, 61, 26, 27, 187, 188, 62, 61, 65, 58, + 210, 63, 212, 24, 214, 26, 27, 9, 10, 11, + 12, 13, 14, 15, 16, 64, 63, 227, 63, 63, + 230, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 21, 24, 21, 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, + 17, 18, 19, 20, 21, 22, 58, 24, 64, 26, + 27, 31, 14, 14, 63, 63, 58, 63, 63, 61, + 32, 33, 58, 65, 63, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 58, 65, 21, 61, 62, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 59, 24, 59, 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, 31, 32, 62, 63, -1, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, -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, 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, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 22, 63, 24, 21, 26, 27, 63, 21, 0, 0, + 34, 58, 2, 147, 61, 62, 39, 67, 92, -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, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 58, -1, -1, 61, + 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, 58, -1, -1, 61, -1, -1, -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 + 58, -1, -1, 61, 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, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 58, + -1, -1, 61 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ #line 3 "/usr/dcs/software/supported/encap/bison-1.28/share/bison.simple" @@ -1330,7 +1328,7 @@ yyreduce: switch (yyn) { case 2: -#line 436 "llvmAsmParser.y" +#line 433 "llvmAsmParser.y" { if (yyvsp[0].UIntVal > (uint32_t)INT32_MAX) // Outside of my range! ThrowException("Value too large for type!"); @@ -1338,55 +1336,55 @@ case 2: ; break;} case 4: -#line 444 "llvmAsmParser.y" +#line 441 "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 46: -#line 474 "llvmAsmParser.y" +case 43: +#line 471 "llvmAsmParser.y" { yyval.StrVal = yyvsp[-1].StrVal; ; break;} -case 47: -#line 477 "llvmAsmParser.y" +case 44: +#line 474 "llvmAsmParser.y" { yyval.StrVal = 0; ; break;} -case 48: -#line 481 "llvmAsmParser.y" +case 45: +#line 478 "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 49: -#line 486 "llvmAsmParser.y" +case 46: +#line 483 "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 50: -#line 491 "llvmAsmParser.y" +case 47: +#line 488 "llvmAsmParser.y" { // Boolean constants yyval.ConstVal = new ConstPoolBool(true); ; break;} -case 51: -#line 494 "llvmAsmParser.y" +case 48: +#line 491 "llvmAsmParser.y" { // Boolean constants yyval.ConstVal = new ConstPoolBool(false); ; break;} -case 52: -#line 497 "llvmAsmParser.y" +case 49: +#line 494 "llvmAsmParser.y" { // String constants cerr << "FIXME: TODO: String constants [sbyte] not implemented yet!\n"; abort(); @@ -1394,14 +1392,14 @@ case 52: free(yyvsp[0].StrVal); ; break;} -case 53: -#line 503 "llvmAsmParser.y" +case 50: +#line 500 "llvmAsmParser.y" { // Type constants yyval.ConstVal = new ConstPoolType(yyvsp[0].TypeVal); ; break;} -case 54: -#line 506 "llvmAsmParser.y" +case 51: +#line 503 "llvmAsmParser.y" { // Nonempty array constant // Verify all elements are correct type! const ArrayType *AT = ArrayType::getArrayType(yyvsp[-4].TypeVal); @@ -1416,15 +1414,15 @@ case 54: delete yyvsp[-1].ConstVector; ; break;} -case 55: -#line 519 "llvmAsmParser.y" +case 52: +#line 516 "llvmAsmParser.y" { // Empty array constant vector Empty; yyval.ConstVal = new ConstPoolArray(ArrayType::getArrayType(yyvsp[-3].TypeVal), Empty); ; break;} -case 56: -#line 523 "llvmAsmParser.y" +case 53: +#line 520 "llvmAsmParser.y" { // Verify all elements are correct type! const ArrayType *AT = ArrayType::getArrayType(yyvsp[-4].TypeVal, (int)yyvsp[-6].UInt64Val); @@ -1444,8 +1442,8 @@ case 56: delete yyvsp[-1].ConstVector; ; break;} -case 57: -#line 541 "llvmAsmParser.y" +case 54: +#line 538 "llvmAsmParser.y" { if (yyvsp[-5].UInt64Val != 0) ThrowException("Type mismatch: constant sized array initialized with 0" @@ -1454,8 +1452,8 @@ case 57: yyval.ConstVal = new ConstPoolArray(ArrayType::getArrayType(yyvsp[-3].TypeVal, 0), Empty); ; break;} -case 58: -#line 548 "llvmAsmParser.y" +case 55: +#line 545 "llvmAsmParser.y" { StructType::ElementTypes Types(yyvsp[-4].TypeList->begin(), yyvsp[-4].TypeList->end()); delete yyvsp[-4].TypeList; @@ -1465,8 +1463,8 @@ case 58: delete yyvsp[-1].ConstVector; ; break;} -case 59: -#line 556 "llvmAsmParser.y" +case 56: +#line 553 "llvmAsmParser.y" { const StructType *St = StructType::getStructType(StructType::ElementTypes()); @@ -1474,21 +1472,21 @@ case 59: yyval.ConstVal = new ConstPoolStruct(St, Empty); ; break;} -case 60: -#line 570 "llvmAsmParser.y" +case 57: +#line 567 "llvmAsmParser.y" { (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(addConstValToConstantPool(yyvsp[0].ConstVal)); ; break;} -case 61: -#line 573 "llvmAsmParser.y" +case 58: +#line 570 "llvmAsmParser.y" { yyval.ConstVector = new vector(); yyval.ConstVector->push_back(addConstValToConstantPool(yyvsp[0].ConstVal)); ; break;} -case 62: -#line 579 "llvmAsmParser.y" +case 59: +#line 576 "llvmAsmParser.y" { if (yyvsp[-1].StrVal) { yyvsp[0].ConstVal->setName(yyvsp[-1].StrVal); @@ -1498,38 +1496,38 @@ case 62: addConstValToConstantPool(yyvsp[0].ConstVal); ; break;} -case 63: -#line 587 "llvmAsmParser.y" +case 60: +#line 584 "llvmAsmParser.y" { ; break;} -case 64: -#line 598 "llvmAsmParser.y" +case 61: +#line 595 "llvmAsmParser.y" { yyval.ModuleVal = ParserResult = yyvsp[0].ModuleVal; CurModule.ModuleDone(); ; break;} -case 65: -#line 603 "llvmAsmParser.y" +case 62: +#line 600 "llvmAsmParser.y" { yyvsp[-1].ModuleVal->getMethodList().push_back(yyvsp[0].MethodVal); CurMeth.MethodDone(); yyval.ModuleVal = yyvsp[-1].ModuleVal; ; break;} -case 66: -#line 608 "llvmAsmParser.y" +case 63: +#line 605 "llvmAsmParser.y" { yyval.ModuleVal = CurModule.CurrentModule; ; break;} -case 68: -#line 617 "llvmAsmParser.y" +case 65: +#line 614 "llvmAsmParser.y" { yyval.StrVal = 0; ; break;} -case 69: -#line 619 "llvmAsmParser.y" +case 66: +#line 616 "llvmAsmParser.y" { yyval.MethArgVal = new MethodArgument(yyvsp[-1].TypeVal); if (yyvsp[0].StrVal) { // Was the argument named? @@ -1538,34 +1536,34 @@ case 69: } ; break;} -case 70: -#line 627 "llvmAsmParser.y" +case 67: +#line 624 "llvmAsmParser.y" { yyval.MethodArgList = yyvsp[0].MethodArgList; yyvsp[0].MethodArgList->push_front(yyvsp[-2].MethArgVal); ; break;} -case 71: -#line 631 "llvmAsmParser.y" +case 68: +#line 628 "llvmAsmParser.y" { yyval.MethodArgList = new list(); yyval.MethodArgList->push_front(yyvsp[0].MethArgVal); ; break;} -case 72: -#line 636 "llvmAsmParser.y" +case 69: +#line 633 "llvmAsmParser.y" { yyval.MethodArgList = yyvsp[0].MethodArgList; ; break;} -case 73: -#line 639 "llvmAsmParser.y" +case 70: +#line 636 "llvmAsmParser.y" { yyval.MethodArgList = 0; ; break;} -case 74: -#line 643 "llvmAsmParser.y" +case 71: +#line 640 "llvmAsmParser.y" { MethodType::ParamTypes ParamTypeList; if (yyvsp[-1].MethodArgList) @@ -1593,68 +1591,68 @@ case 74: } ; break;} -case 75: -#line 670 "llvmAsmParser.y" +case 72: +#line 667 "llvmAsmParser.y" { yyval.MethodVal = CurMeth.CurrentMethod; ; break;} -case 76: -#line 674 "llvmAsmParser.y" +case 73: +#line 671 "llvmAsmParser.y" { yyval.MethodVal = yyvsp[-1].MethodVal; ; break;} -case 77: -#line 683 "llvmAsmParser.y" +case 74: +#line 680 "llvmAsmParser.y" { // A reference to a direct constant yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val); ; break;} -case 78: -#line 686 "llvmAsmParser.y" +case 75: +#line 683 "llvmAsmParser.y" { yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val); ; break;} -case 79: -#line 689 "llvmAsmParser.y" +case 76: +#line 686 "llvmAsmParser.y" { yyval.ValIDVal = ValID::create((int64_t)1); ; break;} -case 80: -#line 692 "llvmAsmParser.y" +case 77: +#line 689 "llvmAsmParser.y" { yyval.ValIDVal = ValID::create((int64_t)0); ; break;} -case 81: -#line 695 "llvmAsmParser.y" +case 78: +#line 692 "llvmAsmParser.y" { // Quoted strings work too... especially for methods yyval.ValIDVal = ValID::create_conststr(yyvsp[0].StrVal); ; break;} -case 82: -#line 700 "llvmAsmParser.y" +case 79: +#line 697 "llvmAsmParser.y" { // Is it an integer reference...? yyval.ValIDVal = ValID::create(yyvsp[0].SIntVal); ; break;} -case 83: -#line 703 "llvmAsmParser.y" +case 80: +#line 700 "llvmAsmParser.y" { // It must be a named reference then... yyval.ValIDVal = ValID::create(yyvsp[0].StrVal); ; break;} -case 84: -#line 706 "llvmAsmParser.y" +case 81: +#line 703 "llvmAsmParser.y" { yyval.ValIDVal = yyvsp[0].ValIDVal; ; break;} -case 85: -#line 713 "llvmAsmParser.y" +case 82: +#line 710 "llvmAsmParser.y" { Value *D = getVal(Type::TypeTy, yyvsp[0].ValIDVal, true); if (D == 0) ThrowException("Invalid user defined type: " + yyvsp[0].ValIDVal.getName()); @@ -1664,90 +1662,90 @@ case 85: yyval.TypeVal = CPT->getValue(); ; break;} -case 86: -#line 721 "llvmAsmParser.y" +case 83: +#line 718 "llvmAsmParser.y" { // Method derived type? MethodType::ParamTypes Params(yyvsp[-1].TypeList->begin(), yyvsp[-1].TypeList->end()); delete yyvsp[-1].TypeList; yyval.TypeVal = MethodType::getMethodType(yyvsp[-3].TypeVal, Params); ; break;} -case 87: -#line 726 "llvmAsmParser.y" +case 84: +#line 723 "llvmAsmParser.y" { // Method derived type? MethodType::ParamTypes Params; // Empty list yyval.TypeVal = MethodType::getMethodType(yyvsp[-2].TypeVal, Params); ; break;} -case 88: -#line 730 "llvmAsmParser.y" +case 85: +#line 727 "llvmAsmParser.y" { yyval.TypeVal = ArrayType::getArrayType(yyvsp[-1].TypeVal); ; break;} -case 89: -#line 733 "llvmAsmParser.y" +case 86: +#line 730 "llvmAsmParser.y" { yyval.TypeVal = ArrayType::getArrayType(yyvsp[-1].TypeVal, (int)yyvsp[-3].UInt64Val); ; break;} -case 90: -#line 736 "llvmAsmParser.y" +case 87: +#line 733 "llvmAsmParser.y" { StructType::ElementTypes Elements(yyvsp[-1].TypeList->begin(), yyvsp[-1].TypeList->end()); delete yyvsp[-1].TypeList; yyval.TypeVal = StructType::getStructType(Elements); ; break;} -case 91: -#line 741 "llvmAsmParser.y" +case 88: +#line 738 "llvmAsmParser.y" { yyval.TypeVal = StructType::getStructType(StructType::ElementTypes()); ; break;} -case 92: -#line 744 "llvmAsmParser.y" +case 89: +#line 741 "llvmAsmParser.y" { yyval.TypeVal = PointerType::getPointerType(yyvsp[-1].TypeVal); ; break;} -case 93: -#line 749 "llvmAsmParser.y" +case 90: +#line 746 "llvmAsmParser.y" { yyval.TypeList = new list(); yyval.TypeList->push_back(yyvsp[0].TypeVal); ; break;} -case 94: -#line 753 "llvmAsmParser.y" +case 91: +#line 750 "llvmAsmParser.y" { (yyval.TypeList=yyvsp[-2].TypeList)->push_back(yyvsp[0].TypeVal); ; break;} -case 95: -#line 758 "llvmAsmParser.y" +case 92: +#line 755 "llvmAsmParser.y" { yyvsp[-1].MethodVal->getBasicBlocks().push_back(yyvsp[0].BasicBlockVal); yyval.MethodVal = yyvsp[-1].MethodVal; ; break;} -case 96: -#line 762 "llvmAsmParser.y" +case 93: +#line 759 "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 97: -#line 771 "llvmAsmParser.y" +case 94: +#line 768 "llvmAsmParser.y" { yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal); InsertValue(yyvsp[-1].BasicBlockVal); yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal; ; break;} -case 98: -#line 776 "llvmAsmParser.y" +case 95: +#line 773 "llvmAsmParser.y" { yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal); yyvsp[-1].BasicBlockVal->setName(yyvsp[-2].StrVal); @@ -1757,47 +1755,47 @@ case 98: yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal; ; break;} -case 99: -#line 785 "llvmAsmParser.y" +case 96: +#line 782 "llvmAsmParser.y" { yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].InstVal); yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal; ; break;} -case 100: -#line 789 "llvmAsmParser.y" +case 97: +#line 786 "llvmAsmParser.y" { yyval.BasicBlockVal = new BasicBlock(); ; break;} -case 101: -#line 793 "llvmAsmParser.y" +case 98: +#line 790 "llvmAsmParser.y" { // Return with a result... yyval.TermInstVal = new ReturnInst(getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal)); ; break;} -case 102: -#line 796 "llvmAsmParser.y" +case 99: +#line 793 "llvmAsmParser.y" { // Return with no result... yyval.TermInstVal = new ReturnInst(); ; break;} -case 103: -#line 799 "llvmAsmParser.y" +case 100: +#line 796 "llvmAsmParser.y" { // Unconditional Branch... yyval.TermInstVal = new BranchInst((BasicBlock*)getVal(Type::LabelTy, yyvsp[0].ValIDVal)); ; break;} -case 104: -#line 802 "llvmAsmParser.y" +case 101: +#line 799 "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 105: -#line 807 "llvmAsmParser.y" +case 102: +#line 804 "llvmAsmParser.y" { SwitchInst *S = new SwitchInst(getVal(yyvsp[-7].TypeVal, yyvsp[-6].ValIDVal), (BasicBlock*)getVal(Type::LabelTy, yyvsp[-3].ValIDVal)); @@ -1809,8 +1807,8 @@ case 105: S->dest_push_back(I->first, I->second); ; break;} -case 106: -#line 818 "llvmAsmParser.y" +case 103: +#line 815 "llvmAsmParser.y" { yyval.JumpTable = yyvsp[-5].JumpTable; ConstPoolVal *V = (ConstPoolVal*)getVal(yyvsp[-4].TypeVal, yyvsp[-3].ValIDVal, true); @@ -1820,8 +1818,8 @@ case 106: yyval.JumpTable->push_back(make_pair(V, (BasicBlock*)getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal))); ; break;} -case 107: -#line 826 "llvmAsmParser.y" +case 104: +#line 823 "llvmAsmParser.y" { yyval.JumpTable = new list >(); ConstPoolVal *V = (ConstPoolVal*)getVal(yyvsp[-4].TypeVal, yyvsp[-3].ValIDVal, true); @@ -1832,8 +1830,8 @@ case 107: yyval.JumpTable->push_back(make_pair(V, (BasicBlock*)getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal))); ; break;} -case 108: -#line 836 "llvmAsmParser.y" +case 105: +#line 833 "llvmAsmParser.y" { if (yyvsp[-1].StrVal) // Is this definition named?? yyvsp[0].InstVal->setName(yyvsp[-1].StrVal); // if so, assign the name... @@ -1842,57 +1840,63 @@ case 108: yyval.InstVal = yyvsp[0].InstVal; ; break;} -case 109: -#line 844 "llvmAsmParser.y" +case 106: +#line 841 "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 110: -#line 849 "llvmAsmParser.y" +case 107: +#line 846 "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 111: -#line 856 "llvmAsmParser.y" +case 108: +#line 853 "llvmAsmParser.y" { // Used for call statements... yyval.ValueList = new list(); yyval.ValueList->push_back(getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal)); ; break;} -case 112: -#line 860 "llvmAsmParser.y" +case 109: +#line 857 "llvmAsmParser.y" { yyval.ValueList = yyvsp[-2].ValueList; yyvsp[-2].ValueList->push_back(getVal(yyvsp[-2].ValueList->front()->getType(), yyvsp[0].ValIDVal)); ; break;} -case 114: -#line 866 "llvmAsmParser.y" +case 111: +#line 863 "llvmAsmParser.y" { yyval.ValueList = 0; ; break;} -case 115: -#line 868 "llvmAsmParser.y" +case 112: +#line 865 "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 116: -#line 873 "llvmAsmParser.y" +case 113: +#line 870 "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 117: +case 114: +#line 875 "llvmAsmParser.y" +{ + yyval.InstVal = UnaryOperator::create(yyvsp[-4].UnaryOpVal, getVal(yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal), yyvsp[0].TypeVal); + ; + break;} +case 115: #line 878 "llvmAsmParser.y" { const Type *Ty = yyvsp[0].PHIList->front().first->getType(); @@ -1906,7 +1910,7 @@ case 117: delete yyvsp[0].PHIList; // Free the list... ; break;} -case 118: +case 116: #line 889 "llvmAsmParser.y" { if (!yyvsp[-4].TypeVal->isMethodType()) @@ -1946,13 +1950,13 @@ case 118: yyval.InstVal = new CallInst((Method*)V, Params); ; break;} -case 119: +case 117: #line 926 "llvmAsmParser.y" { yyval.InstVal = yyvsp[0].InstVal; ; break;} -case 120: +case 118: #line 930 "llvmAsmParser.y" { const Type *Ty = PointerType::getPointerType(yyvsp[0].TypeVal); @@ -1960,7 +1964,7 @@ case 120: yyval.InstVal = new MallocInst(Ty); ; break;} -case 121: +case 119: #line 935 "llvmAsmParser.y" { if (!yyvsp[-3].TypeVal->isArrayType() || ((const ArrayType*)yyvsp[-3].TypeVal)->isSized()) @@ -1972,7 +1976,7 @@ case 121: yyval.InstVal = new MallocInst(Ty, ArrSize); ; break;} -case 122: +case 120: #line 944 "llvmAsmParser.y" { const Type *Ty = PointerType::getPointerType(yyvsp[0].TypeVal); @@ -1980,7 +1984,7 @@ case 122: yyval.InstVal = new AllocaInst(Ty); ; break;} -case 123: +case 121: #line 949 "llvmAsmParser.y" { if (!yyvsp[-3].TypeVal->isArrayType() || ((const ArrayType*)yyvsp[-3].TypeVal)->isSized()) @@ -1992,7 +1996,7 @@ case 123: yyval.InstVal = new AllocaInst(Ty, ArrSize); ; break;} -case 124: +case 122: #line 958 "llvmAsmParser.y" { if (!yyvsp[-1].TypeVal->isPointerType()) @@ -2224,7 +2228,7 @@ yyerrhandle: } #line 964 "llvmAsmParser.y" -int yyerror(char *ErrorMsg) { +int yyerror(const char *ErrorMsg) { ThrowException(string("Parse error: ") + ErrorMsg); return 0; } diff --git a/lib/AsmParser/llvmAsmParser.h b/lib/AsmParser/llvmAsmParser.h index 6ee826958d0..01c6c8bf5dd 100644 --- a/lib/AsmParser/llvmAsmParser.h +++ b/lib/AsmParser/llvmAsmParser.h @@ -56,33 +56,32 @@ typedef union { #define BEGINTOK 282 #define END 283 #define DECLARE 284 -#define PHI 285 -#define CALL 286 -#define RET 287 -#define BR 288 -#define SWITCH 289 -#define NEG 290 +#define TO 285 +#define PHI 286 +#define CALL 287 +#define RET 288 +#define BR 289 +#define SWITCH 290 #define NOT 291 -#define TOINT 292 -#define TOUINT 293 -#define ADD 294 -#define SUB 295 -#define MUL 296 -#define DIV 297 -#define REM 298 -#define SETLE 299 -#define SETGE 300 -#define SETLT 301 -#define SETGT 302 -#define SETEQ 303 -#define SETNE 304 -#define MALLOC 305 -#define ALLOCA 306 -#define FREE 307 -#define LOAD 308 -#define STORE 309 -#define GETFIELD 310 -#define PUTFIELD 311 +#define CAST 292 +#define ADD 293 +#define SUB 294 +#define MUL 295 +#define DIV 296 +#define REM 297 +#define SETLE 298 +#define SETGE 299 +#define SETLT 300 +#define SETGT 301 +#define SETEQ 302 +#define SETNE 303 +#define MALLOC 304 +#define ALLOCA 305 +#define FREE 306 +#define LOAD 307 +#define STORE 308 +#define GETFIELD 309 +#define PUTFIELD 310 extern YYSTYPE llvmAsmlval; diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y index ffd8c663d3d..b3d521b4820 100644 --- a/lib/AsmParser/llvmAsmParser.y +++ b/lib/AsmParser/llvmAsmParser.y @@ -26,8 +26,8 @@ #include // Get definition of pair class #include // This embarasment is due to our flex lexer... -int yyerror(char *ErrorMsg); // Forward declarations to prevent "implicit -int yylex(); // declaration" of xxx warnings. +int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit +int yylex(); // declaration" of xxx warnings. int yyparse(); static Module *ParserResult; @@ -403,7 +403,7 @@ Module *RunVMAsmParser(const ToolCommandLine &Opts, FILE *F) { %type OptVAR_ID OptAssign -%token IMPLEMENTATION TRUE FALSE BEGINTOK END DECLARE +%token IMPLEMENTATION TRUE FALSE BEGINTOK END DECLARE TO %token PHI CALL // Basic Block Terminating Operators @@ -411,10 +411,7 @@ Module *RunVMAsmParser(const ToolCommandLine &Opts, FILE *F) { // Unary Operators %type UnaryOps // all the unary operators -%token NEG NOT - -// Unary Conversion Operators -%token TOINT TOUINT +%token NOT CAST // Binary Operators %type BinaryOps // all the binary operators @@ -461,7 +458,7 @@ TypesV : Types | VOID // Operations that are notably excluded from this list include: // RET, BR, & SWITCH because they end basic blocks and are treated specially. // -UnaryOps : NEG | NOT | TOINT | TOUINT +UnaryOps : NOT BinaryOps : ADD | SUB | MUL | DIV | REM BinaryOps : SETLE | SETGE | SETLT | SETGT | SETEQ | SETNE @@ -874,7 +871,10 @@ InstVal : BinaryOps Types ValueRef ',' ValueRef { $$ = UnaryOperator::create($1, getVal($2, $3)); if ($$ == 0) ThrowException("unary operator returned null!"); - } + } + | CAST Types ValueRef TO Types { + $$ = UnaryOperator::create($1, getVal($2, $3), $5); + } | PHI PHIList { const Type *Ty = $2->front().first->getType(); $$ = new PHINode(Ty); @@ -962,7 +962,7 @@ MemoryInst : MALLOC Types { } %% -int yyerror(char *ErrorMsg) { +int yyerror(const char *ErrorMsg) { ThrowException(string("Parse error: ") + ErrorMsg); return 0; } diff --git a/lib/Bytecode/Reader/InstructionReader.cpp b/lib/Bytecode/Reader/InstructionReader.cpp index ab70e24f513..80127cef8cc 100644 --- a/lib/Bytecode/Reader/InstructionReader.cpp +++ b/lib/Bytecode/Reader/InstructionReader.cpp @@ -105,6 +105,10 @@ bool BytecodeParser::ParseInstruction(const uchar *&Buf, const uchar *EndBuf, getValue(Raw.Ty, Raw.Arg1), getValue(Raw.Ty, Raw.Arg2)); return false; + } else if (Raw.Opcode == Instruction::Cast) { + Res = UnaryOperator::create(Instruction::Cast, getValue(Raw.Ty, Raw.Arg1), + getType(Raw.Arg2)); + return false; } else if (Raw.Opcode == Instruction::PHINode) { PHINode *PN = new PHINode(Raw.Ty); switch (Raw.NumOperands) { diff --git a/lib/Bytecode/Writer/InstructionWriter.cpp b/lib/Bytecode/Writer/InstructionWriter.cpp index 3bd9a0902b6..34d95682bfe 100644 --- a/lib/Bytecode/Writer/InstructionWriter.cpp +++ b/lib/Bytecode/Writer/InstructionWriter.cpp @@ -145,6 +145,15 @@ bool BytecodeWriter::processInstruction(const Instruction *I) { assert(Slot != -1 && "Type not available!!?!"); Type = (unsigned)Slot; + // Handle the special case for cast... + if (I->getOpcode() == Instruction::Cast) { + // Cast has to encode the destination type as the second argument in the + // packet, or else we won't know what type to cast to! + Slots[1] = Table.getValSlot(I->getType()); + assert(Slots[1] != -1 && "Cast return type unknown?"); + if (Slots[1] > MaxOpSlot) MaxOpSlot = Slots[1]; + NumOperands++; + } // Decide which instruction encoding to use. This is determined primarily by // the number of operands, and secondarily by whether or not the max operand diff --git a/lib/Transforms/Scalar/InductionVars.cpp b/lib/Transforms/Scalar/InductionVars.cpp index c59a441fad4..4f88685fc1f 100644 --- a/lib/Transforms/Scalar/InductionVars.cpp +++ b/lib/Transforms/Scalar/InductionVars.cpp @@ -79,16 +79,6 @@ static LIVType isLinearInductionVariableH(cfg::Interval *Int, Value *V, // loop variant computations must be instructions! Instruction *I = V->castInstructionAsserting(); switch (I->getOpcode()) { // Handle each instruction seperately - case Instruction::Neg: { - Value *SubV = ((UnaryOperator*)I)->getOperand(0); - LIVType SubLIVType = isLinearInductionVariableH(Int, SubV, PN); - switch (SubLIVType) { - case isLIC: // Loop invariant & other computations remain the same - case isOther: return SubLIVType; - case isLIV: // Return the opposite signed LIV type - case isNLIV: return neg(isLIV); - } - } case Instruction::Add: case Instruction::Sub: { Value *SubV1 = ((BinaryOperator*)I)->getOperand(0); diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index 398f7a87b8e..d84cba0752b 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/lib/VMCore/AsmWriter.cpp @@ -207,7 +207,9 @@ bool AssemblyWriter::processInstruction(const Instruction *I) { Out << ","; writeOperand(I->getOperand(0), true); } - + } else if (I->getOpcode() == Instruction::Cast) { + writeOperand(Operand, true); + Out << " to " << I->getType(); } else if (Operand) { // Print the normal way... // PrintAllTypes - Instructions who have operands of all the same type diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp index 54a79804818..e0a4ffbfb05 100644 --- a/lib/VMCore/ConstantFold.cpp +++ b/lib/VMCore/ConstantFold.cpp @@ -27,10 +27,6 @@ class TemplateRules : public ConstRules { // Redirecting functions that cast to the appropriate types //===--------------------------------------------------------------------===// - virtual ConstPoolVal *neg(const ConstPoolVal *V) const { - return SubClassName::Neg((const ArgType *)V); - } - virtual ConstPoolVal *not(const ConstPoolVal *V) const { return SubClassName::Not((const ArgType *)V); } @@ -55,7 +51,6 @@ class TemplateRules : public ConstRules { // Default "noop" implementations //===--------------------------------------------------------------------===// - inline static ConstPoolVal *Neg(const ArgType *V) { return 0; } inline static ConstPoolVal *Not(const ArgType *V) { return 0; } inline static ConstPoolVal *Add(const ArgType *V1, const ArgType *V2) { @@ -125,9 +120,6 @@ struct DirectRules : public TemplateRules > { - inline static ConstPoolVal *Neg(const ConstPoolClass *V) { - return new ConstPoolClass(*Ty, -(BuiltinType)V->getValue());; - } inline static ConstPoolVal *Not(const ConstPoolClass *V) { return new ConstPoolClass(*Ty, !(BuiltinType)V->getValue());; } diff --git a/lib/VMCore/ConstantFold.h b/lib/VMCore/ConstantFold.h index cf18ef8cea4..79dd21c2c67 100644 --- a/lib/VMCore/ConstantFold.h +++ b/lib/VMCore/ConstantFold.h @@ -60,7 +60,6 @@ protected: inline ConstRules() {} // Can only be subclassed... public: // Unary Operators... - virtual ConstPoolVal *neg(const ConstPoolVal *V) const = 0; virtual ConstPoolVal *not(const ConstPoolVal *V) const = 0; // Binary Operators... @@ -88,10 +87,6 @@ private : }; -inline ConstPoolVal *operator-(const ConstPoolVal &V) { - return ConstRules::get(V)->neg(&V); -} - inline ConstPoolVal *operator!(const ConstPoolVal &V) { return ConstRules::get(V)->not(&V); } @@ -154,7 +149,6 @@ inline ConstPoolVal *ConstantFoldUnaryInstruction(unsigned Opcode, ConstPoolVal *V) { switch (Opcode) { case Instruction::Not: return !*V; - case Instruction::Neg: return -*V; } return 0; } diff --git a/lib/VMCore/ConstantFolding.h b/lib/VMCore/ConstantFolding.h index cf18ef8cea4..79dd21c2c67 100644 --- a/lib/VMCore/ConstantFolding.h +++ b/lib/VMCore/ConstantFolding.h @@ -60,7 +60,6 @@ protected: inline ConstRules() {} // Can only be subclassed... public: // Unary Operators... - virtual ConstPoolVal *neg(const ConstPoolVal *V) const = 0; virtual ConstPoolVal *not(const ConstPoolVal *V) const = 0; // Binary Operators... @@ -88,10 +87,6 @@ private : }; -inline ConstPoolVal *operator-(const ConstPoolVal &V) { - return ConstRules::get(V)->neg(&V); -} - inline ConstPoolVal *operator!(const ConstPoolVal &V) { return ConstRules::get(V)->not(&V); } @@ -154,7 +149,6 @@ inline ConstPoolVal *ConstantFoldUnaryInstruction(unsigned Opcode, ConstPoolVal *V) { switch (Opcode) { case Instruction::Not: return !*V; - case Instruction::Neg: return -*V; } return 0; } diff --git a/lib/VMCore/InstrTypes.cpp b/lib/VMCore/InstrTypes.cpp index 9d3262cbda7..d0c410051a5 100644 --- a/lib/VMCore/InstrTypes.cpp +++ b/lib/VMCore/InstrTypes.cpp @@ -11,15 +11,6 @@ #include "llvm/Type.h" #include // find -// TODO: Move to getUnaryOperator iUnary.cpp when and if it exists! -UnaryOperator *UnaryOperator::create(UnaryOps Op, Value *Source) { - switch (Op) { - default: - cerr << "Don't know how to GetUnaryOperator " << Op << endl; - return 0; - } -} - //===----------------------------------------------------------------------===// // TerminatorInst Class //===----------------------------------------------------------------------===// diff --git a/lib/VMCore/iOperators.cpp b/lib/VMCore/iOperators.cpp index 61d5d26d2b4..6f7c2f158eb 100644 --- a/lib/VMCore/iOperators.cpp +++ b/lib/VMCore/iOperators.cpp @@ -7,6 +7,32 @@ #include "llvm/iBinary.h" #include "llvm/Type.h" +UnaryOperator *UnaryOperator::create(UnaryOps Op, Value *Source, + const Type *DestTy = 0) { + if (DestTy == 0) DestTy = Source->getType(); + switch (Op) { + case Not: assert(DestTy == Source->getType()); + case Cast: return new GenericUnaryInst(Op, Source, DestTy); + default: + cerr << "Don't know how to GetUnaryOperator " << Op << endl; + return 0; + } +} + +const char *GenericUnaryInst::getOpcodeName() const { + switch (getOpcode()) { + case Not: return "not"; + case Cast: return "cast"; + default: + cerr << "Invalid unary operator type!" << getOpcode() << endl; + abort(); + } +} + +//===----------------------------------------------------------------------===// +// BinaryOperator Class +//===----------------------------------------------------------------------===// + BinaryOperator *BinaryOperator::create(BinaryOps Op, Value *S1, Value *S2, const string &Name) { switch (Op) { @@ -20,6 +46,10 @@ BinaryOperator *BinaryOperator::create(BinaryOps Op, Value *S1, Value *S2, } } +//===----------------------------------------------------------------------===// +// GenericBinaryInst Class +//===----------------------------------------------------------------------===// + const char *GenericBinaryInst::getOpcodeName() const { switch (getOpcode()) { // Standard binary operators... @@ -35,7 +65,7 @@ const char *GenericBinaryInst::getOpcodeName() const { case Xor: return "xor"; default: cerr << "Invalid binary operator type!" << getOpcode() << endl; - return 0; + abort(); } } diff --git a/test/Feature/casttest.ll b/test/Feature/casttest.ll new file mode 100644 index 00000000000..5b2db7b4886 --- /dev/null +++ b/test/Feature/casttest.ll @@ -0,0 +1,11 @@ +implementation + +short "FunFunc"(long %x, sbyte %z) +begin +bb0: ;;