diff --git a/include/llvm/iMemory.h b/include/llvm/iMemory.h index 0ef3ee107db..dc8d7592364 100644 --- a/include/llvm/iMemory.h +++ b/include/llvm/iMemory.h @@ -19,10 +19,10 @@ public: assert(Ty->isPointerType() && "Can't allocate a non pointer type!"); if (ArraySize) { - // Make sure they didn't try to specify a size for !(unsized array) type... + // Make sure they didn't try to specify a size for !(unsized array) type assert((getType()->getValueType()->isArrayType() && ((const ArrayType*)getType()->getValueType())->isUnsized()) && - "Trying to allocate something other than unsized array, with size!"); + "Trying to allocate something other than unsized array, with size!"); Operands.reserve(1); Operands.push_back(Use(ArraySize, this)); @@ -37,10 +37,11 @@ public: virtual Instruction *clone() const = 0; }; + class MallocInst : public AllocationInst { public: MallocInst(const Type *Ty, Value *ArraySize = 0, const string &Name = "") - : AllocationInst(Ty, ArraySize, Instruction::Malloc, Name) {} + : AllocationInst(Ty, ArraySize, Malloc, Name) {} virtual Instruction *clone() const { return new MallocInst(getType(), Operands.size() ? Operands[1] : 0); @@ -49,10 +50,11 @@ public: virtual const char *getOpcodeName() const { return "malloc"; } }; + class AllocaInst : public AllocationInst { public: AllocaInst(const Type *Ty, Value *ArraySize = 0, const string &Name = "") - : AllocationInst(Ty, ArraySize, Instruction::Alloca, Name) {} + : AllocationInst(Ty, ArraySize, Alloca, Name) {} virtual Instruction *clone() const { return new AllocaInst(getType(), Operands.size() ? Operands[1] : 0); @@ -62,20 +64,41 @@ public: }; - class FreeInst : public Instruction { public: FreeInst(Value *Ptr, const string &Name = "") - : Instruction(Type::VoidTy, Instruction::Free, Name) { + : Instruction(Type::VoidTy, Free, Name) { assert(Ptr->getType()->isPointerType() && "Can't free nonpointer!"); Operands.reserve(1); Operands.push_back(Use(Ptr, this)); } - inline ~FreeInst() {} virtual Instruction *clone() const { return new FreeInst(Operands[0]); } virtual const char *getOpcodeName() const { return "free"; } }; + +class LoadInst : public Instruction { + LoadInst(const LoadInst &LI) : Instruction(LI.getType(), Load) { + Operands.reserve(LI.Operands.size()); + for (unsigned i = 0, E = LI.Operands.size(); i != E; ++i) + Operands.push_back(Use(LI.Operands[i], this)); + } +public: + LoadInst(Value *Ptr, const vector &Idx, + const string &Name = ""); + virtual Instruction *clone() const { return new LoadInst(*this); } + virtual const char *getOpcodeName() const { return "load"; } + + // getIndexedType - Returns the type of the element that would be loaded with + // a load instruction with the specified parameters. + // + // A null type is returned if the indices are invalid for the specified + // pointer type. + // + static const Type *getIndexedType(const Type *Ptr, + const vector &); +}; + #endif // LLVM_IMEMORY_H diff --git a/include/llvm/iOther.h b/include/llvm/iOther.h index cf9fe968939..ce5aa930620 100644 --- a/include/llvm/iOther.h +++ b/include/llvm/iOther.h @@ -12,30 +12,6 @@ #include "llvm/Method.h" #include -//===----------------------------------------------------------------------===// -// CastInst Class -//===----------------------------------------------------------------------===// - -// CastInst - This function represents a cast from Operand[0] to the type of -// the instruction (i->getType()). -// -class CastInst : public Instruction { - CastInst(const CastInst &CI) : Instruction(CI.getType(), Cast) { - Operands.reserve(1); - Operands.push_back(Use((Value*)CI.getOperand(0), this)); - } -public: - CastInst(Value *S, const Type *Ty, const string &Name = "") - : Instruction(Ty, Cast, Name) { - Operands.reserve(1); - Operands.push_back(Use(S, this)); - } - - virtual Instruction *clone() const { return new CastInst(*this); } - virtual const char *getOpcodeName() const { return "cast"; } -}; - - //===----------------------------------------------------------------------===// // PHINode Class //===----------------------------------------------------------------------===// @@ -80,6 +56,30 @@ public: }; +//===----------------------------------------------------------------------===// +// CastInst Class +//===----------------------------------------------------------------------===// + +// CastInst - This class represents a cast from Operand[0] to the type of +// the instruction (i->getType()). +// +class CastInst : public Instruction { + CastInst(const CastInst &CI) : Instruction(CI.getType(), Cast) { + Operands.reserve(1); + Operands.push_back(Use(Operands[0], this)); + } +public: + CastInst(Value *S, const Type *Ty, const string &Name = "") + : Instruction(Ty, Cast, Name) { + Operands.reserve(1); + Operands.push_back(Use(S, this)); + } + + virtual Instruction *clone() const { return new CastInst(*this); } + virtual const char *getOpcodeName() const { return "cast"; } +}; + + //===----------------------------------------------------------------------===// // MethodArgument Class //===----------------------------------------------------------------------===// @@ -127,4 +127,32 @@ public: } }; + +//===----------------------------------------------------------------------===// +// ShiftInst Class +//===----------------------------------------------------------------------===// + +// ShiftInst - This class represents left and right shift instructions. +// +class ShiftInst : public Instruction { + ShiftInst(const ShiftInst &CI) : Instruction(CI.getType(), CI.getOpcode()) { + Operands.reserve(2); + Operands.push_back(Use(Operands[0], this)); + Operands.push_back(Use(Operands[1], this)); + } +public: + ShiftInst(OtherOps Opcode, Value *S, Value *SA, const string &Name = "") + : Instruction(S->getType(), Opcode, Name) { + assert((Opcode == Shl || Opcode == Shr) && "ShiftInst Opcode invalid!"); + Operands.reserve(2); + Operands.push_back(Use(S, this)); + Operands.push_back(Use(SA, this)); + } + + virtual Instruction *clone() const { return new ShiftInst(*this); } + virtual const char *getOpcodeName() const { + return getOpcode() == Shl ? "shl" : "shr"; + } +}; + #endif diff --git a/lib/AsmParser/Lexer.cpp b/lib/AsmParser/Lexer.cpp index cf37530b2b0..8773b8471ed 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 59 -#define YY_END_OF_BUFFER 60 -static yyconst short int yy_acclist[114] = +#define YY_NUM_RULES 61 +#define YY_END_OF_BUFFER 62 +static yyconst short int yy_acclist[116] = { 0, - 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, 28, 52, 50, 56, 29, - 32, 3, 16, 31, 24, 25, 33, 40, 30, 11, - 26, 27, 45, 46, 18, 4, 22, 17, 10, 2, - 5, 20, 23, 12, 35, 39, 37, 38, 36, 34, + 62, 60, 61, 59, 60, 61, 59, 61, 60, 61, + 60, 61, 60, 61, 8, 60, 61, 55, 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, 53, 52, 57, + 56, 55, 1, 9, 43, 36, 54, 52, 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, 33, 34, - 14, 47, 13, 19, 44, 21, 43, 42, 15, 6, - 48, 49, 7 + 32, 30, 14, 49, 13, 19, 46, 21, 45, 44, + 15, 6, 50, 51, 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, @@ -340,17 +340,18 @@ static yyconst short int yy_accept[200] = 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, 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 + 74, 75, 76, 77, 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, 88, 89, 90, 90, + 91, 91, 91, 92, 92, 93, 93, 93, 94, 95, + 95, 95, 96, 96, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 105, 106, 107, 107, 108, 108, + 109, 109, 109, 110, 110, 111, 112, 113, 113, 113, + 113, 114, 114, 115, 115, 115, 115, 115, 115, 116, + 116 } ; static yyconst int yy_ec[256] = @@ -393,61 +394,61 @@ static yyconst int yy_meta[33] = 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, + 0, 0, 395, 396, 396, 396, 0, 385, 26, 385, 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, 76, 92, 95, + 56, 60, 52, 55, 61, 81, 65, 104, 63, 388, + 382, 396, 0, 382, 381, 380, 69, 0, 32, 72, + 378, 78, 71, 377, 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, + 123, 124, 129, 126, 134, 140, 136, 139, 135, 376, + 144, 137, 146, 147, 156, 158, 155, 396, 0, 376, + 374, 159, 161, 163, 166, 162, 168, 373, 172, 372, + 176, 178, 182, 183, 184, 371, 185, 187, 189, 193, - 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, + 370, 369, 368, 196, 367, 366, 186, 206, 365, 198, + 364, 199, 363, 201, 202, 207, 209, 210, 211, 218, + 221, 223, 222, 362, 361, 360, 231, 225, 234, 230, + 359, 237, 238, 239, 358, 357, 241, 242, 245, 243, + 248, 256, 257, 246, 258, 266, 356, 355, 268, 354, + 253, 260, 353, 269, 352, 272, 273, 351, 350, 276, + 278, 349, 280, 281, 348, 347, 346, 345, 344, 339, + 334, 329, 323, 283, 322, 321, 285, 319, 288, 317, + 286, 293, 316, 291, 315, 314, 312, 295, 296, 298, + 311, 301, 200, 305, 306, 308, 310, 313, 74, 396, - 341, 346, 53 + 335, 338, 341, 346, 53 } ; -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, 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, 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, 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, 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[429] = { 0, 4, 5, 6, 7, 8, 9, 10, 11, 4, 12, 13, 14, 15, 16, 17, 18, 19, 8, 20, 21, @@ -465,88 +466,88 @@ static yyconst short int yy_nxt[425] = 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, + 113, 104, 32, 114, 32, 32, 106, 107, 112, 109, + 116, 108, 110, 32, 32, 111, 32, 32, 118, 32, + 32, 32, 115, 121, 32, 120, 32, 117, 119, 123, + 32, 122, 124, 128, 32, 125, 32, 127, 130, 126, + 32, 32, 32, 32, 32, 32, 131, 32, 132, 134, - 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, + 135, 32, 129, 133, 32, 136, 32, 32, 32, 32, + 32, 138, 137, 139, 32, 32, 147, 32, 32, 32, + 140, 148, 141, 144, 145, 142, 32, 143, 146, 32, + 32, 32, 151, 32, 153, 154, 149, 150, 32, 32, + 152, 156, 32, 155, 157, 32, 32, 32, 158, 32, + 32, 32, 161, 32, 32, 160, 32, 159, 162, 165, + 164, 32, 167, 163, 32, 32, 32, 166, 32, 176, + 169, 171, 173, 172, 32, 168, 32, 32, 174, 178, + 32, 32, 175, 170, 32, 177, 32, 180, 32, 32, + 181, 32, 183, 32, 32, 184, 32, 179, 182, 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, + 185, 32, 187, 32, 32, 188, 32, 189, 191, 32, + 190, 193, 186, 32, 32, 195, 32, 192, 32, 32, + 32, 32, 32, 32, 32, 32, 197, 32, 194, 32, + 32, 32, 198, 196, 199, 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, 80, - 32, 32, 32, 36, 35, 80, 32, 78, 36, 32, - 198, 3, 198, 198, 198, 198, 198, 198, 198, 198, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 80, 32, 32, 32, 36, 35, 80, + 32, 78, 36, 32, 200, 3, 200, 200, 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 } ; -static yyconst short int yy_chk[425] = +static yyconst short int yy_chk[429] = { 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, + 18, 14, 18, 16, 14, 17, 205, 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, + 40, 47, 199, 24, 48, 29, 42, 27, 22, 26, 27, 40, 26, 43, 42, 26, 27, 46, 26, 45, 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, + 59, 61, 65, 69, 67, 72, 60, 68, 66, 63, + 68, 62, 71, 69, 73, 74, 63, 64, 67, 66, + 72, 65, 66, 77, 75, 66, 76, 82, 74, 83, + 86, 84, 71, 77, 85, 76, 87, 73, 75, 83, + 89, 82, 84, 89, 91, 85, 92, 87, 92, 86, + 93, 94, 95, 97, 107, 98, 93, 99, 94, 97, - 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, + 98, 100, 91, 95, 104, 99, 110, 112, 193, 114, + 115, 104, 100, 107, 108, 116, 115, 117, 118, 119, + 108, 116, 108, 110, 112, 108, 120, 108, 114, 121, + 123, 122, 119, 128, 121, 122, 117, 118, 130, 127, + 120, 127, 129, 123, 128, 132, 133, 134, 129, 137, + 138, 140, 133, 139, 144, 132, 141, 130, 134, 139, + 138, 151, 141, 137, 142, 143, 145, 140, 152, 151, + 142, 143, 145, 144, 146, 141, 149, 154, 146, 154, + 156, 157, 149, 142, 160, 152, 161, 157, 163, 164, + 160, 174, 163, 177, 181, 164, 179, 156, 161, 184, - 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, + 174, 182, 179, 188, 189, 181, 190, 182, 188, 192, + 184, 190, 177, 194, 195, 194, 196, 189, 197, 191, + 187, 198, 186, 185, 183, 180, 196, 178, 192, 176, + 175, 173, 197, 195, 198, 201, 201, 172, 201, 201, + 201, 202, 171, 202, 203, 203, 204, 170, 204, 204, + 204, 204, 169, 168, 167, 166, 165, 162, 159, 158, + 155, 153, 150, 148, 147, 136, 135, 131, 126, 125, + 124, 113, 111, 109, 106, 105, 103, 102, 101, 96, + 90, 88, 81, 80, 70, 44, 41, 36, 35, 34, + 31, 30, 10, 8, 3, 200, 200, 200, 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 } ; static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr; @@ -614,7 +615,7 @@ 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" +#line 619 "Lexer.cpp" /* Macros after this point can all be overridden by user definitions in * section 1. @@ -768,7 +769,7 @@ YY_DECL #line 83 "Lexer.l" -#line 772 "Lexer.cpp" +#line 773 "Lexer.cpp" if ( yy_init ) { @@ -816,14 +817,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; @@ -975,165 +976,175 @@ YY_RULE_SETUP YY_BREAK case 24: YY_RULE_SETUP -#line 114 "Lexer.l" +#line 115 "Lexer.l" { RET_TOK(UnaryOpVal, Not, NOT); } YY_BREAK case 25: YY_RULE_SETUP -#line 116 "Lexer.l" -{ return PHI; } +#line 117 "Lexer.l" +{ RET_TOK(BinaryOpVal, Add, ADD); } YY_BREAK case 26: YY_RULE_SETUP -#line 117 "Lexer.l" -{ return CALL; } +#line 118 "Lexer.l" +{ RET_TOK(BinaryOpVal, Sub, SUB); } YY_BREAK case 27: YY_RULE_SETUP -#line 118 "Lexer.l" -{ return CAST; } +#line 119 "Lexer.l" +{ RET_TOK(BinaryOpVal, Mul, MUL); } YY_BREAK case 28: YY_RULE_SETUP -#line 119 "Lexer.l" -{ return TO; } +#line 120 "Lexer.l" +{ RET_TOK(BinaryOpVal, Div, DIV); } YY_BREAK case 29: YY_RULE_SETUP -#line 120 "Lexer.l" -{ RET_TOK(BinaryOpVal, Add, ADD); } +#line 121 "Lexer.l" +{ RET_TOK(BinaryOpVal, Rem, REM); } YY_BREAK case 30: YY_RULE_SETUP -#line 121 "Lexer.l" -{ RET_TOK(BinaryOpVal, Sub, SUB); } +#line 122 "Lexer.l" +{ RET_TOK(BinaryOpVal, SetNE, SETNE); } YY_BREAK case 31: YY_RULE_SETUP -#line 122 "Lexer.l" -{ RET_TOK(BinaryOpVal, Mul, MUL); } +#line 123 "Lexer.l" +{ RET_TOK(BinaryOpVal, SetEQ, SETEQ); } YY_BREAK case 32: YY_RULE_SETUP -#line 123 "Lexer.l" -{ RET_TOK(BinaryOpVal, Div, DIV); } +#line 124 "Lexer.l" +{ RET_TOK(BinaryOpVal, SetLT, SETLT); } YY_BREAK case 33: YY_RULE_SETUP -#line 124 "Lexer.l" -{ RET_TOK(BinaryOpVal, Rem, REM); } +#line 125 "Lexer.l" +{ RET_TOK(BinaryOpVal, SetGT, SETGT); } YY_BREAK case 34: YY_RULE_SETUP -#line 125 "Lexer.l" -{ RET_TOK(BinaryOpVal, SetNE, SETNE); } +#line 126 "Lexer.l" +{ RET_TOK(BinaryOpVal, SetLE, SETLE); } YY_BREAK case 35: YY_RULE_SETUP -#line 126 "Lexer.l" -{ RET_TOK(BinaryOpVal, SetEQ, SETEQ); } +#line 127 "Lexer.l" +{ RET_TOK(BinaryOpVal, SetGE, SETGE); } YY_BREAK case 36: YY_RULE_SETUP -#line 127 "Lexer.l" -{ RET_TOK(BinaryOpVal, SetLT, SETLT); } +#line 129 "Lexer.l" +{ return TO; } YY_BREAK case 37: YY_RULE_SETUP -#line 128 "Lexer.l" -{ RET_TOK(BinaryOpVal, SetGT, SETGT); } +#line 130 "Lexer.l" +{ RET_TOK(OtherOpVal, PHINode, PHI); } YY_BREAK case 38: YY_RULE_SETUP -#line 129 "Lexer.l" -{ RET_TOK(BinaryOpVal, SetLE, SETLE); } +#line 131 "Lexer.l" +{ RET_TOK(OtherOpVal, Call, CALL); } YY_BREAK case 39: YY_RULE_SETUP -#line 130 "Lexer.l" -{ RET_TOK(BinaryOpVal, SetGE, SETGE); } +#line 132 "Lexer.l" +{ RET_TOK(OtherOpVal, Cast, CAST); } YY_BREAK case 40: YY_RULE_SETUP -#line 132 "Lexer.l" -{ RET_TOK(TermOpVal, Ret, RET); } +#line 133 "Lexer.l" +{ RET_TOK(OtherOpVal, Shl, SHL); } YY_BREAK case 41: YY_RULE_SETUP -#line 133 "Lexer.l" -{ RET_TOK(TermOpVal, Br, BR); } +#line 134 "Lexer.l" +{ RET_TOK(OtherOpVal, Shr, SHR); } YY_BREAK case 42: YY_RULE_SETUP -#line 134 "Lexer.l" -{ RET_TOK(TermOpVal, Switch, SWITCH); } +#line 136 "Lexer.l" +{ RET_TOK(TermOpVal, Ret, RET); } YY_BREAK case 43: YY_RULE_SETUP #line 137 "Lexer.l" -{ RET_TOK(MemOpVal, Malloc, MALLOC); } +{ RET_TOK(TermOpVal, Br, BR); } YY_BREAK case 44: YY_RULE_SETUP #line 138 "Lexer.l" -{ RET_TOK(MemOpVal, Alloca, ALLOCA); } +{ RET_TOK(TermOpVal, Switch, SWITCH); } YY_BREAK case 45: YY_RULE_SETUP -#line 139 "Lexer.l" -{ RET_TOK(MemOpVal, Free, FREE); } +#line 141 "Lexer.l" +{ RET_TOK(MemOpVal, Malloc, MALLOC); } YY_BREAK case 46: YY_RULE_SETUP -#line 140 "Lexer.l" -{ RET_TOK(MemOpVal, Load, LOAD); } +#line 142 "Lexer.l" +{ RET_TOK(MemOpVal, Alloca, ALLOCA); } YY_BREAK case 47: YY_RULE_SETUP -#line 141 "Lexer.l" -{ RET_TOK(MemOpVal, Store, STORE); } +#line 143 "Lexer.l" +{ RET_TOK(MemOpVal, Free, FREE); } YY_BREAK case 48: YY_RULE_SETUP -#line 142 "Lexer.l" -{ RET_TOK(MemOpVal, GetField, GETFIELD); } +#line 144 "Lexer.l" +{ RET_TOK(MemOpVal, Load, LOAD); } YY_BREAK case 49: YY_RULE_SETUP -#line 143 "Lexer.l" -{ RET_TOK(MemOpVal, PutField, PUTFIELD); } +#line 145 "Lexer.l" +{ RET_TOK(MemOpVal, Store, STORE); } YY_BREAK case 50: YY_RULE_SETUP #line 146 "Lexer.l" -{ llvmAsmlval.StrVal = strdup(yytext+1); return VAR_ID; } +{ RET_TOK(MemOpVal, GetField, GETFIELD); } YY_BREAK case 51: YY_RULE_SETUP #line 147 "Lexer.l" +{ RET_TOK(MemOpVal, PutField, PUTFIELD); } + YY_BREAK +case 52: +YY_RULE_SETUP +#line 150 "Lexer.l" +{ llvmAsmlval.StrVal = strdup(yytext+1); return VAR_ID; } + YY_BREAK +case 53: +YY_RULE_SETUP +#line 151 "Lexer.l" { yytext[strlen(yytext)-1] = 0; // nuke colon llvmAsmlval.StrVal = strdup(yytext); return LABELSTR; } YY_BREAK -case 52: +case 54: YY_RULE_SETUP -#line 153 "Lexer.l" +#line 157 "Lexer.l" { yytext[strlen(yytext)-1] = 0; // nuke end quote llvmAsmlval.StrVal = strdup(yytext+1); // Nuke start quote return STRINGCONSTANT; } YY_BREAK -case 53: +case 55: YY_RULE_SETUP -#line 160 "Lexer.l" +#line 164 "Lexer.l" { llvmAsmlval.UInt64Val = atoull(yytext); return EUINT64VAL; } YY_BREAK -case 54: +case 56: YY_RULE_SETUP -#line 161 "Lexer.l" +#line 165 "Lexer.l" { uint64_t Val = atoull(yytext+1); // +1: we have bigger negative range @@ -1143,14 +1154,14 @@ YY_RULE_SETUP return ESINT64VAL; } YY_BREAK -case 55: +case 57: YY_RULE_SETUP -#line 171 "Lexer.l" +#line 175 "Lexer.l" { llvmAsmlval.UIntVal = atoull(yytext+1); return UINTVAL; } YY_BREAK -case 56: +case 58: YY_RULE_SETUP -#line 172 "Lexer.l" +#line 176 "Lexer.l" { uint64_t Val = atoull(yytext+2); // +1: we have bigger negative range @@ -1160,22 +1171,22 @@ YY_RULE_SETUP return SINTVAL; } YY_BREAK -case 57: -YY_RULE_SETUP -#line 182 "Lexer.l" -{ /* Ignore whitespace */ } - YY_BREAK -case 58: -YY_RULE_SETUP -#line 183 "Lexer.l" -{ /*printf("'%s'", yytext);*/ return yytext[0]; } - YY_BREAK case 59: YY_RULE_SETUP -#line 185 "Lexer.l" +#line 186 "Lexer.l" +{ /* Ignore whitespace */ } + YY_BREAK +case 60: +YY_RULE_SETUP +#line 187 "Lexer.l" +{ /*printf("'%s'", yytext);*/ return yytext[0]; } + YY_BREAK +case 61: +YY_RULE_SETUP +#line 189 "Lexer.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK -#line 1180 "Lexer.cpp" +#line 1191 "Lexer.cpp" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -1464,7 +1475,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]; @@ -1494,11 +1505,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; @@ -2059,5 +2070,5 @@ int main() return 0; } #endif -#line 185 "Lexer.l" +#line 189 "Lexer.l" diff --git a/lib/AsmParser/Lexer.l b/lib/AsmParser/Lexer.l index 28a3c1dfb40..c0bd75cf797 100644 --- a/lib/AsmParser/Lexer.l +++ b/lib/AsmParser/Lexer.l @@ -111,12 +111,9 @@ type { llvmAsmlval.TypeVal = Type::TypeTy ; return TYPE; } label { llvmAsmlval.TypeVal = Type::LabelTy ; return LABEL; } + not { RET_TOK(UnaryOpVal, Not, NOT); } -phi { return PHI; } -call { return CALL; } -cast { return CAST; } -to { return TO; } add { RET_TOK(BinaryOpVal, Add, ADD); } sub { RET_TOK(BinaryOpVal, Sub, SUB); } mul { RET_TOK(BinaryOpVal, Mul, MUL); } @@ -129,6 +126,13 @@ setgt { RET_TOK(BinaryOpVal, SetGT, SETGT); } setle { RET_TOK(BinaryOpVal, SetLE, SETLE); } setge { RET_TOK(BinaryOpVal, SetGE, SETGE); } +to { return TO; } +phi { RET_TOK(OtherOpVal, PHINode, PHI); } +call { RET_TOK(OtherOpVal, Call, CALL); } +cast { RET_TOK(OtherOpVal, Cast, CAST); } +shl { RET_TOK(OtherOpVal, Shl, SHL); } +shr { RET_TOK(OtherOpVal, Shr, SHR); } + ret { RET_TOK(TermOpVal, Ret, RET); } br { RET_TOK(TermOpVal, Br, BR); } switch { RET_TOK(TermOpVal, Switch, SWITCH); } diff --git a/lib/AsmParser/llvmAsmParser.cpp b/lib/AsmParser/llvmAsmParser.cpp index f3138b21756..5d384ec56ec 100644 --- a/lib/AsmParser/llvmAsmParser.cpp +++ b/lib/AsmParser/llvmAsmParser.cpp @@ -40,31 +40,33 @@ #define END 283 #define DECLARE 284 #define TO 285 -#define PHI 286 -#define CALL 287 -#define CAST 288 -#define RET 289 -#define BR 290 -#define SWITCH 291 -#define NOT 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 +#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 GETFIELD 306 +#define PUTFIELD 307 +#define PHI 308 +#define CALL 309 +#define CAST 310 +#define SHL 311 +#define SHR 312 #line 13 "llvmAsmParser.y" @@ -420,6 +422,7 @@ typedef union { Instruction::BinaryOps BinaryOpVal; Instruction::TermOps TermOpVal; Instruction::MemoryOps MemOpVal; + Instruction::OtherOps OtherOpVal; } YYSTYPE; #include @@ -431,26 +434,26 @@ typedef union { -#define YYFINAL 234 +#define YYFINAL 248 #define YYFLAG -32768 -#define YYNTBASE 67 +#define YYNTBASE 69 -#define YYTRANSLATE(x) ((unsigned)(x) <= 310 ? yytranslate[x] : 103) +#define YYTRANSLATE(x) ((unsigned)(x) <= 312 ? yytranslate[x] : 107) 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, 64, - 65, 66, 2, 63, 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, - 57, 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, - 58, 2, 59, 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, 60, - 2, 2, 61, 2, 62, 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, @@ -468,7 +471,8 @@ 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 + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58 }; #if YYDEBUG != 0 @@ -477,76 +481,78 @@ 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, 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 + 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, 338, 340, 341, 347, 351, 358, 364, 367, 374, + 376, 379, 380, 383, 389, 392, 398, 402 }; 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, 69, 0, 7, 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, 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, 35, 69, 90, 0, 35, 7, - 0, 36, 21, 90, 0, 36, 8, 90, 63, 21, - 90, 63, 21, 90, 0, 37, 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, 34, 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 + 0, 20, 0, 21, 0, 71, 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, 57, 0, 58, 0, 15, 0, 13, + 0, 11, 0, 9, 0, 16, 0, 14, 0, 12, + 0, 10, 0, 76, 0, 77, 0, 22, 59, 0, + 0, 76, 70, 0, 77, 4, 0, 8, 26, 0, + 8, 27, 0, 19, 24, 0, 20, 71, 0, 60, + 71, 61, 60, 81, 61, 0, 60, 71, 61, 60, + 61, 0, 60, 4, 62, 71, 61, 60, 81, 61, + 0, 60, 4, 62, 71, 61, 60, 61, 0, 63, + 94, 64, 63, 81, 64, 0, 63, 64, 63, 64, + 0, 81, 65, 80, 0, 80, 0, 82, 79, 80, + 0, 0, 84, 0, 84, 91, 0, 82, 25, 0, + 22, 0, 0, 71, 85, 0, 86, 65, 87, 0, + 86, 0, 87, 0, 0, 72, 24, 66, 88, 67, + 0, 89, 82, 28, 0, 95, 29, 0, 3, 0, + 4, 0, 26, 0, 27, 0, 24, 0, 69, 0, + 22, 0, 92, 0, 93, 0, 72, 66, 94, 67, + 0, 72, 66, 67, 0, 60, 71, 61, 0, 60, + 4, 62, 71, 61, 0, 63, 94, 64, 0, 63, + 64, 0, 71, 68, 0, 71, 0, 94, 65, 71, + 0, 95, 96, 0, 90, 96, 0, 97, 98, 0, + 23, 97, 98, 0, 97, 100, 0, 0, 32, 71, + 93, 0, 32, 7, 0, 33, 21, 93, 0, 33, + 8, 93, 65, 21, 93, 65, 21, 93, 0, 34, + 78, 93, 65, 21, 93, 60, 99, 61, 0, 99, + 78, 92, 65, 21, 93, 0, 78, 92, 65, 21, + 93, 0, 79, 104, 0, 71, 60, 93, 65, 93, + 61, 0, 101, 65, 60, 93, 65, 93, 61, 0, + 71, 93, 0, 102, 65, 93, 0, 102, 0, 0, + 74, 71, 93, 65, 93, 0, 73, 71, 93, 0, + 75, 71, 93, 65, 71, 93, 0, 56, 71, 93, + 31, 71, 0, 54, 101, 0, 55, 71, 93, 66, + 103, 67, 0, 106, 0, 65, 81, 0, 0, 47, + 71, 0, 47, 71, 65, 14, 93, 0, 48, 71, + 0, 48, 71, 65, 14, 93, 0, 49, 71, 93, + 0, 50, 71, 93, 105, 0 }; #endif #if YYDEBUG != 0 static const short yyrline[] = { 0, - 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 + 434, 435, 442, 443, 454, 454, 454, 454, 454, 454, + 454, 455, 455, 455, 455, 455, 455, 455, 458, 458, + 463, 464, 464, 464, 464, 464, 465, 465, 465, 465, + 465, 465, 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, 882, 885, 896, 933, + 938, 940, 944, 949, 958, 963, 972, 978 }; #endif @@ -557,32 +563,33 @@ 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","PHI","CALL","CAST","RET","BR","SWITCH","NOT","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","RET","BR","SWITCH","NOT","ADD","SUB","MUL","DIV","REM","SETLE", +"SETGE","SETLT","SETGT","SETEQ","SETNE","MALLOC","ALLOCA","FREE","LOAD","STORE", +"GETFIELD","PUTFIELD","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", +"JumpTable","Inst","PHIList","ValueRefList","ValueRefListE","InstVal","UByteList", +"MemoryInst", NULL }; #endif static const short yyr1[] = { 0, - 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 + 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, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 81, 81, + 82, 82, 83, 84, 84, 85, 85, 86, 87, 87, + 88, 88, 89, 90, 91, 92, 92, 92, 92, 92, + 93, 93, 93, 71, 71, 71, 71, 71, 71, 71, + 71, 94, 94, 95, 95, 96, 96, 97, 97, 98, + 98, 98, 98, 98, 99, 99, 100, 101, 101, 102, + 102, 103, 103, 104, 104, 104, 104, 104, 104, 104, + 105, 105, 106, 106, 106, 106, 106, 106 }; static const short yyr2[] = { 0, @@ -590,199 +597,207 @@ 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, 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 + 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, 6, 5, 2, 6, 1, + 2, 0, 2, 5, 2, 5, 3, 4 }; -static const short yydefact[] = { 60, - 44, 61, 0, 63, 0, 74, 75, 1, 2, 20, +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, 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, 0, - 21, 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 + 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, 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, 118, 19, 19, 19, 19, 19, 0, 54, 60, + 0, 0, 69, 0, 0, 0, 0, 127, 122, 0, + 0, 0, 0, 115, 0, 0, 0, 53, 0, 57, + 0, 0, 0, 0, 0, 128, 0, 0, 113, 0, + 0, 0, 56, 0, 59, 0, 0, 124, 126, 121, + 0, 0, 19, 112, 0, 117, 114, 19, 55, 0, + 0, 0, 0, 110, 0, 119, 116, 0, 0, 0, + 108, 0, 111, 103, 0, 104, 0, 109, 0, 0, + 0, 0, 106, 0, 105, 0, 0, 0 }; static const short yydefgoto[] = { 31, - 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 + 82, 61, 59, 139, 140, 141, 54, 55, 117, 5, + 170, 171, 1, 246, 2, 150, 106, 107, 108, 34, + 35, 36, 37, 38, 62, 39, 68, 69, 97, 230, + 98, 162, 214, 215, 142, 196, 143 }; static const short yypact[] = {-32768, - 7, 319, 12,-32768, 26,-32768,-32768,-32768,-32768,-32768, + 19, 342, -51,-32768, 99,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 378, 234, --32768, 13, -21,-32768, 86,-32768,-32768,-32768, 85,-32768, - -22,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 88, - 319, 403, 294, 64, 121,-32768, 66, 24, 74,-32768, - -12, 81,-32768, 83, 209, 102,-32768,-32768, 22,-32768, --32768,-32768,-32768,-32768, -12, 68, 54, 87, 96,-32768, --32768,-32768,-32768, 319,-32768,-32768, 319, 319,-32768, 92, --32768, 22, 462, 45, 189, 239,-32768,-32768, 319, 108, - 113, 115, 63, -12, -1, 119,-32768, 127,-32768,-32768, - 125, 4, 157, 157,-32768,-32768, 157, 319, 319, 319, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768,-32768, 319, 319, 319, 319, 319,-32768,-32768, 80, - 3,-32768, 26,-32768,-32768,-32768, 319,-32768,-32768, 143, --32768, 144, -33, 146, 4, 4, 90, 124, 4, 4, - 4, 152,-32768,-32768, -8, 106,-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, 33,-32768, 205, 217, 157, 206, 4, 230, - 229, -12,-32768,-32768,-32768,-32768, 255, 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 +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 403, 255, +-32768, -3, -18,-32768, 142,-32768,-32768,-32768, 55,-32768, + 68,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 117, + 342, 428, 317, 118, 163,-32768, 131, 59, 112,-32768, + 11, 61,-32768, 129, 230, 95,-32768,-32768, 124,-32768, +-32768,-32768,-32768,-32768, 11, 134, 82, 139, 96,-32768, +-32768,-32768,-32768, 342,-32768,-32768, 342, 342,-32768, 75, +-32768, 124, 489, 16, 160, 482,-32768,-32768, 342, 143, + 140, 144, 116, 11, 21, 145,-32768, 138,-32768,-32768, + 146, -1, 66, 66,-32768,-32768, 66,-32768,-32768,-32768, +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 342, + 342, 342, 342, 342, 342, 342,-32768,-32768, 342, 342, + 342,-32768,-32768, 122, 20,-32768, 99,-32768,-32768,-32768, + 342,-32768,-32768, 149,-32768, 150, 98, 126, -1, -1, + 6, 152, -1, -1, -1, -1, -1, 148,-32768,-32768, + -54, 123,-32768, 188, 197, 205, 206,-32768, 156, 66, + 162, 157, 193,-32768, 161, 165, 43,-32768, 99,-32768, + 66, 66, 66, 66, 99,-32768, 166, 66, 342, 342, + 66, 342,-32768, -19,-32768, 190, 167,-32768,-32768, 213, + 66, 215, -1, 218, 158, 11,-32768, -1,-32768, 207, + 160, 192, 66,-32768, 66,-32768,-32768, 66, 72, 3, +-32768, 223,-32768,-32768, 220,-32768, 72,-32768, 265, 222, + 66, 267,-32768, 66,-32768, 289, 291,-32768 }; static const short yypgoto[] = {-32768, --32768, -2, 351,-32768,-32768, -93, -89, -128, -45, -4, - -123, 317,-32768,-32768,-32768,-32768, 207,-32768,-32768,-32768, --32768, -134, -19, -5,-32768, 318, 291, 267,-32768,-32768, --32768,-32768,-32768,-32768,-32768 +-32768, -2, 290,-32768,-32768,-32768, -86, -85, -183, -47, + -4, -127, 260,-32768,-32768,-32768,-32768, 147,-32768,-32768, +-32768,-32768, -113, -12, 8,-32768, 256, 229, 208,-32768, +-32768,-32768,-32768,-32768,-32768,-32768,-32768 }; -#define YYLAST 523 +#define YYLAST 552 static const short yytable[] = { 32, - 56, 115, 64, 72, 73, 116, 6, 7, 8, 9, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 166, - 145, 50, 51, 96, 170, 25, 58, 26, 3, 27, - 28, 4, 63, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 65, 3, 50, 51, 96, 79, 75, 77, - 180, -19, 113, 63, 181, 193, 93, 94, 95, 90, - 52, 163, -19, 53, 63, 114, 80, 81, 40, 63, - 42, 43, 44, 45, 46, 47, 48, 49, 63, 215, - 221, 103, 85, 52, 104, 105, 53, 223, 226, 63, - 112, 206, 149, 150, 151, 181, 140, 152, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 67, 67, 50, - 51, 74, 100, 70, 115, 153, 155, 156, 116, 63, - 222, 144, 115, 3, 83, 84, 116, 99, 63, 91, - 157, 158, 159, 160, 161, 172, 173, 65, 162, 176, - 177, 178, 86, 87, 105, 63, 88, 101, 52, 192, - 185, 53, 174, -19, 87, 63, 109, 102, 87, 6, - 7, 8, 9, 195, 196, 141, 198, 182, 181, 203, - 204, 205, 6, 7, 142, 143, 194, 209, 25, 211, - 26, 147, 27, 28, 199, 202, 175, -19, -20, 63, - 218, 148, 219, 26, 220, 27, 28, 42, 43, 44, - 45, 46, 47, 48, 49, 168, 169, 229, 171, 179, - 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, 186, 26, 187, 27, - 28, 188, 189, 190, 191, 197, 29, 207, 210, 30, - 118, 119, 120, 89, 208, 214, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 29, 212, 213, 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, 225, 26, 227, 27, 28, 228, 230, 233, 234, - 66, 29, 33, 167, 30, 78, 71, 92, 110, 0, + 56, 6, 7, 8, 9, 64, 188, 40, 115, 116, + 189, 42, 43, 44, 45, 46, 47, 48, 49, 172, + 25, 96, 26, 113, 27, 28, 58, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 114, 229, 50, 51, + 3, 219, 149, 4, 96, 189, 237, 65, 75, 77, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 204, + 79, 50, 51, 236, 63, 180, 63, 210, 6, 7, + 8, 9, 90, 63, 6, 7, -19, 67, 63, 52, + 169, 103, 53, 70, 104, 105, -19, 25, 63, 26, + 112, 27, 28, 72, 73, 26, 144, 27, 28, 153, + 154, 155, 52, 203, 156, 53, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 235, 3, 50, 51, 85, + 80, 81, 91, 240, 86, 87, 63, 157, 158, 159, + 160, 161, 163, 164, 115, 116, 165, 166, 167, 87, + 74, 109, 100, 115, 116, 3, 178, 179, 105, 63, + 182, 183, 184, 185, 186, 93, 94, 95, 52, 102, + 87, 53, 176, -19, 67, 63, 83, 197, 42, 43, + 44, 45, 46, 47, 48, 49, 148, 65, 206, 207, + 208, 209, 168, 63, 205, 212, 190, 189, 217, 63, + 177, -19, 84, 63, 88, 99, 213, 216, 222, 218, + 224, 101, 145, 146, 152, 227, 147, 187, 191, 151, + 232, -20, 233, 174, 175, 234, 181, 192, 193, 194, + 195, 198, 199, 200, 226, 201, 221, 228, 243, 202, + 211, 245, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 231, 26, 220, 27, 28, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 189, 26, 223, + 27, 28, 225, 238, 239, 241, 242, 244, 247, 29, + 248, 33, 30, 66, 71, 92, 89, 173, 0, 110, 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, 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, - 29, 0, 0, 30, 6, 7, 8, 9, 111, 11, + 0, 0, 0, 0, 29, 0, 0, 30, 60, 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, 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, 0, 29, 0, 0, 30, + 78, 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, 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, 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 + 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, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, + 132, 133, 0, 0, 0, 134, 135, 136, 137, 138, + 0, 0, 0, 0, 0, 0, 0, 0, 29, 0, + 0, 30 }; static const short yycheck[] = { 2, - 5, 95, 24, 26, 27, 95, 3, 4, 5, 6, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 143, - 22, 19, 20, 69, 58, 22, 29, 24, 22, 26, - 27, 25, 66, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 64, 22, 19, 20, 92, 53, 51, 52, - 59, 64, 8, 66, 63, 179, 35, 36, 37, 65, - 58, 59, 64, 61, 66, 21, 3, 4, 57, 66, - 9, 10, 11, 12, 13, 14, 15, 16, 66, 208, - 215, 84, 59, 58, 87, 88, 61, 216, 223, 66, - 93, 59, 112, 113, 114, 63, 99, 117, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 23, 23, 19, - 20, 24, 59, 29, 208, 118, 119, 120, 208, 66, - 59, 59, 216, 22, 4, 60, 216, 60, 66, 28, - 133, 134, 135, 136, 137, 155, 156, 64, 59, 159, - 160, 161, 62, 63, 147, 66, 64, 61, 58, 59, - 170, 61, 63, 64, 63, 66, 65, 62, 63, 3, - 4, 5, 6, 183, 184, 58, 186, 62, 63, 189, - 190, 191, 3, 4, 62, 61, 181, 197, 22, 199, - 24, 63, 26, 27, 187, 188, 63, 64, 64, 66, - 210, 65, 212, 24, 214, 26, 27, 9, 10, 11, - 12, 13, 14, 15, 16, 63, 63, 227, 63, 58, - 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, 58, 24, 64, 26, - 27, 31, 14, 14, 63, 63, 58, 63, 63, 61, - 32, 33, 34, 65, 58, 21, 38, 39, 40, 41, - 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 58, 63, 65, 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, 63, 24, 21, 26, 27, 63, 21, 0, 0, - 34, 58, 2, 147, 61, 62, 39, 67, 92, -1, + 5, 3, 4, 5, 6, 24, 61, 59, 95, 95, + 65, 9, 10, 11, 12, 13, 14, 15, 16, 147, + 22, 69, 24, 8, 26, 27, 29, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 21, 221, 19, 20, + 22, 61, 22, 25, 92, 65, 230, 66, 51, 52, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 187, + 53, 19, 20, 61, 68, 60, 68, 195, 3, 4, + 5, 6, 65, 68, 3, 4, 66, 23, 68, 60, + 61, 84, 63, 29, 87, 88, 66, 22, 68, 24, + 93, 26, 27, 26, 27, 24, 99, 26, 27, 112, + 113, 114, 60, 61, 117, 63, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 229, 22, 19, 20, 61, + 3, 4, 28, 237, 64, 65, 68, 130, 131, 132, + 133, 134, 135, 136, 221, 221, 139, 140, 141, 65, + 24, 67, 61, 230, 230, 22, 159, 160, 151, 68, + 163, 164, 165, 166, 167, 32, 33, 34, 60, 64, + 65, 63, 65, 66, 23, 68, 4, 180, 9, 10, + 11, 12, 13, 14, 15, 16, 61, 66, 191, 192, + 193, 194, 61, 68, 189, 198, 64, 65, 201, 68, + 65, 66, 62, 68, 66, 62, 199, 200, 211, 202, + 213, 63, 60, 64, 67, 218, 63, 60, 21, 65, + 223, 66, 225, 65, 65, 228, 65, 21, 14, 14, + 65, 60, 66, 31, 67, 65, 60, 21, 241, 65, + 65, 244, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 61, 24, 65, 26, 27, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 65, 24, 65, + 26, 27, 65, 61, 65, 21, 65, 21, 0, 60, + 0, 2, 63, 34, 39, 67, 67, 151, -1, 92, -1, -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, - 58, -1, -1, 61, 3, 4, 5, 6, 7, 8, + -1, -1, -1, -1, 60, -1, -1, 63, 64, 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, -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, 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, -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, -1, 58, - -1, -1, 61 + -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, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, -1, -1, -1, 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" @@ -1328,7 +1343,7 @@ yyreduce: switch (yyn) { case 2: -#line 433 "llvmAsmParser.y" +#line 435 "llvmAsmParser.y" { if (yyvsp[0].UIntVal > (uint32_t)INT32_MAX) // Outside of my range! ThrowException("Value too large for type!"); @@ -1336,55 +1351,55 @@ case 2: ; break;} case 4: -#line 441 "llvmAsmParser.y" +#line 443 "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 43: -#line 471 "llvmAsmParser.y" +case 45: +#line 474 "llvmAsmParser.y" { yyval.StrVal = yyvsp[-1].StrVal; ; break;} -case 44: -#line 474 "llvmAsmParser.y" +case 46: +#line 477 "llvmAsmParser.y" { yyval.StrVal = 0; ; break;} -case 45: -#line 478 "llvmAsmParser.y" +case 47: +#line 481 "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 46: -#line 483 "llvmAsmParser.y" +case 48: +#line 486 "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 47: -#line 488 "llvmAsmParser.y" +case 49: +#line 491 "llvmAsmParser.y" { // Boolean constants yyval.ConstVal = new ConstPoolBool(true); ; break;} -case 48: -#line 491 "llvmAsmParser.y" +case 50: +#line 494 "llvmAsmParser.y" { // Boolean constants yyval.ConstVal = new ConstPoolBool(false); ; break;} -case 49: -#line 494 "llvmAsmParser.y" +case 51: +#line 497 "llvmAsmParser.y" { // String constants cerr << "FIXME: TODO: String constants [sbyte] not implemented yet!\n"; abort(); @@ -1392,14 +1407,14 @@ case 49: free(yyvsp[0].StrVal); ; break;} -case 50: -#line 500 "llvmAsmParser.y" +case 52: +#line 503 "llvmAsmParser.y" { // Type constants yyval.ConstVal = new ConstPoolType(yyvsp[0].TypeVal); ; break;} -case 51: -#line 503 "llvmAsmParser.y" +case 53: +#line 506 "llvmAsmParser.y" { // Nonempty array constant // Verify all elements are correct type! const ArrayType *AT = ArrayType::getArrayType(yyvsp[-4].TypeVal); @@ -1414,15 +1429,15 @@ case 51: delete yyvsp[-1].ConstVector; ; break;} -case 52: -#line 516 "llvmAsmParser.y" +case 54: +#line 519 "llvmAsmParser.y" { // Empty array constant vector Empty; yyval.ConstVal = new ConstPoolArray(ArrayType::getArrayType(yyvsp[-3].TypeVal), Empty); ; break;} -case 53: -#line 520 "llvmAsmParser.y" +case 55: +#line 523 "llvmAsmParser.y" { // Verify all elements are correct type! const ArrayType *AT = ArrayType::getArrayType(yyvsp[-4].TypeVal, (int)yyvsp[-6].UInt64Val); @@ -1442,8 +1457,8 @@ case 53: delete yyvsp[-1].ConstVector; ; break;} -case 54: -#line 538 "llvmAsmParser.y" +case 56: +#line 541 "llvmAsmParser.y" { if (yyvsp[-5].UInt64Val != 0) ThrowException("Type mismatch: constant sized array initialized with 0" @@ -1452,8 +1467,8 @@ case 54: yyval.ConstVal = new ConstPoolArray(ArrayType::getArrayType(yyvsp[-3].TypeVal, 0), Empty); ; break;} -case 55: -#line 545 "llvmAsmParser.y" +case 57: +#line 548 "llvmAsmParser.y" { StructType::ElementTypes Types(yyvsp[-4].TypeList->begin(), yyvsp[-4].TypeList->end()); delete yyvsp[-4].TypeList; @@ -1463,8 +1478,8 @@ case 55: delete yyvsp[-1].ConstVector; ; break;} -case 56: -#line 553 "llvmAsmParser.y" +case 58: +#line 556 "llvmAsmParser.y" { const StructType *St = StructType::getStructType(StructType::ElementTypes()); @@ -1472,21 +1487,21 @@ case 56: yyval.ConstVal = new ConstPoolStruct(St, Empty); ; break;} -case 57: -#line 567 "llvmAsmParser.y" +case 59: +#line 570 "llvmAsmParser.y" { (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(addConstValToConstantPool(yyvsp[0].ConstVal)); ; break;} -case 58: -#line 570 "llvmAsmParser.y" +case 60: +#line 573 "llvmAsmParser.y" { yyval.ConstVector = new vector(); yyval.ConstVector->push_back(addConstValToConstantPool(yyvsp[0].ConstVal)); ; break;} -case 59: -#line 576 "llvmAsmParser.y" +case 61: +#line 579 "llvmAsmParser.y" { if (yyvsp[-1].StrVal) { yyvsp[0].ConstVal->setName(yyvsp[-1].StrVal); @@ -1496,38 +1511,38 @@ case 59: addConstValToConstantPool(yyvsp[0].ConstVal); ; break;} -case 60: -#line 584 "llvmAsmParser.y" +case 62: +#line 587 "llvmAsmParser.y" { ; break;} -case 61: -#line 595 "llvmAsmParser.y" +case 63: +#line 598 "llvmAsmParser.y" { yyval.ModuleVal = ParserResult = yyvsp[0].ModuleVal; CurModule.ModuleDone(); ; break;} -case 62: -#line 600 "llvmAsmParser.y" +case 64: +#line 603 "llvmAsmParser.y" { yyvsp[-1].ModuleVal->getMethodList().push_back(yyvsp[0].MethodVal); CurMeth.MethodDone(); yyval.ModuleVal = yyvsp[-1].ModuleVal; ; break;} -case 63: -#line 605 "llvmAsmParser.y" +case 65: +#line 608 "llvmAsmParser.y" { yyval.ModuleVal = CurModule.CurrentModule; ; break;} -case 65: -#line 614 "llvmAsmParser.y" +case 67: +#line 617 "llvmAsmParser.y" { yyval.StrVal = 0; ; break;} -case 66: -#line 616 "llvmAsmParser.y" +case 68: +#line 619 "llvmAsmParser.y" { yyval.MethArgVal = new MethodArgument(yyvsp[-1].TypeVal); if (yyvsp[0].StrVal) { // Was the argument named? @@ -1536,34 +1551,34 @@ case 66: } ; break;} -case 67: -#line 624 "llvmAsmParser.y" +case 69: +#line 627 "llvmAsmParser.y" { yyval.MethodArgList = yyvsp[0].MethodArgList; yyvsp[0].MethodArgList->push_front(yyvsp[-2].MethArgVal); ; break;} -case 68: -#line 628 "llvmAsmParser.y" +case 70: +#line 631 "llvmAsmParser.y" { yyval.MethodArgList = new list(); yyval.MethodArgList->push_front(yyvsp[0].MethArgVal); ; break;} -case 69: -#line 633 "llvmAsmParser.y" +case 71: +#line 636 "llvmAsmParser.y" { yyval.MethodArgList = yyvsp[0].MethodArgList; ; break;} -case 70: -#line 636 "llvmAsmParser.y" +case 72: +#line 639 "llvmAsmParser.y" { yyval.MethodArgList = 0; ; break;} -case 71: -#line 640 "llvmAsmParser.y" +case 73: +#line 643 "llvmAsmParser.y" { MethodType::ParamTypes ParamTypeList; if (yyvsp[-1].MethodArgList) @@ -1591,68 +1606,68 @@ case 71: } ; break;} -case 72: -#line 667 "llvmAsmParser.y" +case 74: +#line 670 "llvmAsmParser.y" { yyval.MethodVal = CurMeth.CurrentMethod; ; break;} -case 73: -#line 671 "llvmAsmParser.y" +case 75: +#line 674 "llvmAsmParser.y" { yyval.MethodVal = yyvsp[-1].MethodVal; ; break;} -case 74: -#line 680 "llvmAsmParser.y" +case 76: +#line 683 "llvmAsmParser.y" { // A reference to a direct constant yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val); ; break;} -case 75: -#line 683 "llvmAsmParser.y" +case 77: +#line 686 "llvmAsmParser.y" { yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val); ; break;} -case 76: -#line 686 "llvmAsmParser.y" +case 78: +#line 689 "llvmAsmParser.y" { yyval.ValIDVal = ValID::create((int64_t)1); ; break;} -case 77: -#line 689 "llvmAsmParser.y" +case 79: +#line 692 "llvmAsmParser.y" { yyval.ValIDVal = ValID::create((int64_t)0); ; break;} -case 78: -#line 692 "llvmAsmParser.y" +case 80: +#line 695 "llvmAsmParser.y" { // Quoted strings work too... especially for methods yyval.ValIDVal = ValID::create_conststr(yyvsp[0].StrVal); ; break;} -case 79: -#line 697 "llvmAsmParser.y" +case 81: +#line 700 "llvmAsmParser.y" { // Is it an integer reference...? yyval.ValIDVal = ValID::create(yyvsp[0].SIntVal); ; break;} -case 80: -#line 700 "llvmAsmParser.y" +case 82: +#line 703 "llvmAsmParser.y" { // It must be a named reference then... yyval.ValIDVal = ValID::create(yyvsp[0].StrVal); ; break;} -case 81: -#line 703 "llvmAsmParser.y" +case 83: +#line 706 "llvmAsmParser.y" { yyval.ValIDVal = yyvsp[0].ValIDVal; ; break;} -case 82: -#line 710 "llvmAsmParser.y" +case 84: +#line 713 "llvmAsmParser.y" { Value *D = getVal(Type::TypeTy, yyvsp[0].ValIDVal, true); if (D == 0) ThrowException("Invalid user defined type: " + yyvsp[0].ValIDVal.getName()); @@ -1662,90 +1677,90 @@ case 82: yyval.TypeVal = CPT->getValue(); ; break;} -case 83: -#line 718 "llvmAsmParser.y" +case 85: +#line 721 "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 84: -#line 723 "llvmAsmParser.y" +case 86: +#line 726 "llvmAsmParser.y" { // Method derived type? MethodType::ParamTypes Params; // Empty list yyval.TypeVal = MethodType::getMethodType(yyvsp[-2].TypeVal, Params); ; break;} -case 85: -#line 727 "llvmAsmParser.y" +case 87: +#line 730 "llvmAsmParser.y" { yyval.TypeVal = ArrayType::getArrayType(yyvsp[-1].TypeVal); ; break;} -case 86: -#line 730 "llvmAsmParser.y" +case 88: +#line 733 "llvmAsmParser.y" { yyval.TypeVal = ArrayType::getArrayType(yyvsp[-1].TypeVal, (int)yyvsp[-3].UInt64Val); ; break;} -case 87: -#line 733 "llvmAsmParser.y" +case 89: +#line 736 "llvmAsmParser.y" { StructType::ElementTypes Elements(yyvsp[-1].TypeList->begin(), yyvsp[-1].TypeList->end()); delete yyvsp[-1].TypeList; yyval.TypeVal = StructType::getStructType(Elements); ; break;} -case 88: -#line 738 "llvmAsmParser.y" +case 90: +#line 741 "llvmAsmParser.y" { yyval.TypeVal = StructType::getStructType(StructType::ElementTypes()); ; break;} -case 89: -#line 741 "llvmAsmParser.y" +case 91: +#line 744 "llvmAsmParser.y" { yyval.TypeVal = PointerType::getPointerType(yyvsp[-1].TypeVal); ; break;} -case 90: -#line 746 "llvmAsmParser.y" +case 92: +#line 749 "llvmAsmParser.y" { yyval.TypeList = new list(); yyval.TypeList->push_back(yyvsp[0].TypeVal); ; break;} -case 91: -#line 750 "llvmAsmParser.y" +case 93: +#line 753 "llvmAsmParser.y" { (yyval.TypeList=yyvsp[-2].TypeList)->push_back(yyvsp[0].TypeVal); ; break;} -case 92: -#line 755 "llvmAsmParser.y" +case 94: +#line 758 "llvmAsmParser.y" { yyvsp[-1].MethodVal->getBasicBlocks().push_back(yyvsp[0].BasicBlockVal); yyval.MethodVal = yyvsp[-1].MethodVal; ; break;} -case 93: -#line 759 "llvmAsmParser.y" +case 95: +#line 762 "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 94: -#line 768 "llvmAsmParser.y" +case 96: +#line 771 "llvmAsmParser.y" { yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal); InsertValue(yyvsp[-1].BasicBlockVal); yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal; ; break;} -case 95: -#line 773 "llvmAsmParser.y" +case 97: +#line 776 "llvmAsmParser.y" { yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal); yyvsp[-1].BasicBlockVal->setName(yyvsp[-2].StrVal); @@ -1755,47 +1770,47 @@ case 95: yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal; ; break;} -case 96: -#line 782 "llvmAsmParser.y" +case 98: +#line 785 "llvmAsmParser.y" { yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].InstVal); yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal; ; break;} -case 97: -#line 786 "llvmAsmParser.y" +case 99: +#line 789 "llvmAsmParser.y" { yyval.BasicBlockVal = new BasicBlock(); ; break;} -case 98: -#line 790 "llvmAsmParser.y" +case 100: +#line 793 "llvmAsmParser.y" { // Return with a result... yyval.TermInstVal = new ReturnInst(getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal)); ; break;} -case 99: -#line 793 "llvmAsmParser.y" +case 101: +#line 796 "llvmAsmParser.y" { // Return with no result... yyval.TermInstVal = new ReturnInst(); ; break;} -case 100: -#line 796 "llvmAsmParser.y" +case 102: +#line 799 "llvmAsmParser.y" { // Unconditional Branch... yyval.TermInstVal = new BranchInst((BasicBlock*)getVal(Type::LabelTy, yyvsp[0].ValIDVal)); ; break;} -case 101: -#line 799 "llvmAsmParser.y" +case 103: +#line 802 "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 102: -#line 804 "llvmAsmParser.y" +case 104: +#line 807 "llvmAsmParser.y" { SwitchInst *S = new SwitchInst(getVal(yyvsp[-7].TypeVal, yyvsp[-6].ValIDVal), (BasicBlock*)getVal(Type::LabelTy, yyvsp[-3].ValIDVal)); @@ -1807,8 +1822,8 @@ case 102: S->dest_push_back(I->first, I->second); ; break;} -case 103: -#line 815 "llvmAsmParser.y" +case 105: +#line 818 "llvmAsmParser.y" { yyval.JumpTable = yyvsp[-5].JumpTable; ConstPoolVal *V = (ConstPoolVal*)getVal(yyvsp[-4].TypeVal, yyvsp[-3].ValIDVal, true); @@ -1818,8 +1833,8 @@ case 103: yyval.JumpTable->push_back(make_pair(V, (BasicBlock*)getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal))); ; break;} -case 104: -#line 823 "llvmAsmParser.y" +case 106: +#line 826 "llvmAsmParser.y" { yyval.JumpTable = new list >(); ConstPoolVal *V = (ConstPoolVal*)getVal(yyvsp[-4].TypeVal, yyvsp[-3].ValIDVal, true); @@ -1830,8 +1845,8 @@ case 104: yyval.JumpTable->push_back(make_pair(V, (BasicBlock*)getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal))); ; break;} -case 105: -#line 833 "llvmAsmParser.y" +case 107: +#line 836 "llvmAsmParser.y" { if (yyvsp[-1].StrVal) // Is this definition named?? yyvsp[0].InstVal->setName(yyvsp[-1].StrVal); // if so, assign the name... @@ -1840,64 +1855,71 @@ case 105: yyval.InstVal = yyvsp[0].InstVal; ; break;} -case 106: -#line 841 "llvmAsmParser.y" +case 108: +#line 844 "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 107: -#line 846 "llvmAsmParser.y" +case 109: +#line 849 "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 108: -#line 853 "llvmAsmParser.y" +case 110: +#line 856 "llvmAsmParser.y" { // Used for call statements... yyval.ValueList = new list(); yyval.ValueList->push_back(getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal)); ; break;} -case 109: -#line 857 "llvmAsmParser.y" +case 111: +#line 860 "llvmAsmParser.y" { yyval.ValueList = yyvsp[-2].ValueList; yyvsp[-2].ValueList->push_back(getVal(yyvsp[-2].ValueList->front()->getType(), yyvsp[0].ValIDVal)); ; break;} -case 111: -#line 863 "llvmAsmParser.y" +case 113: +#line 866 "llvmAsmParser.y" { yyval.ValueList = 0; ; break;} -case 112: -#line 865 "llvmAsmParser.y" +case 114: +#line 868 "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 113: -#line 870 "llvmAsmParser.y" +case 115: +#line 873 "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 114: -#line 875 "llvmAsmParser.y" +case 116: +#line 878 "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 882 "llvmAsmParser.y" { yyval.InstVal = new CastInst(getVal(yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal), yyvsp[0].TypeVal); ; break;} -case 115: -#line 878 "llvmAsmParser.y" +case 118: +#line 885 "llvmAsmParser.y" { const Type *Ty = yyvsp[0].PHIList->front().first->getType(); yyval.InstVal = new PHINode(Ty); @@ -1910,8 +1932,8 @@ case 115: delete yyvsp[0].PHIList; // Free the list... ; break;} -case 116: -#line 889 "llvmAsmParser.y" +case 119: +#line 896 "llvmAsmParser.y" { if (!yyvsp[-4].TypeVal->isMethodType()) ThrowException("Can only call methods: invalid type '" + @@ -1950,22 +1972,34 @@ case 116: yyval.InstVal = new CallInst((Method*)V, Params); ; break;} -case 117: -#line 926 "llvmAsmParser.y" +case 120: +#line 933 "llvmAsmParser.y" { yyval.InstVal = yyvsp[0].InstVal; ; break;} -case 118: -#line 930 "llvmAsmParser.y" +case 121: +#line 938 "llvmAsmParser.y" +{ + yyval.ConstVector = yyvsp[0].ConstVector; +; + break;} +case 122: +#line 940 "llvmAsmParser.y" +{ + yyval.ConstVector = new vector(); +; + break;} +case 123: +#line 944 "llvmAsmParser.y" { const Type *Ty = PointerType::getPointerType(yyvsp[0].TypeVal); addConstValToConstantPool(new ConstPoolType(Ty)); yyval.InstVal = new MallocInst(Ty); ; break;} -case 119: -#line 935 "llvmAsmParser.y" +case 124: +#line 949 "llvmAsmParser.y" { if (!yyvsp[-3].TypeVal->isArrayType() || ((const ArrayType*)yyvsp[-3].TypeVal)->isSized()) ThrowException("Trying to allocate " + yyvsp[-3].TypeVal->getName() + @@ -1976,16 +2010,16 @@ case 119: yyval.InstVal = new MallocInst(Ty, ArrSize); ; break;} -case 120: -#line 944 "llvmAsmParser.y" +case 125: +#line 958 "llvmAsmParser.y" { const Type *Ty = PointerType::getPointerType(yyvsp[0].TypeVal); addConstValToConstantPool(new ConstPoolType(Ty)); yyval.InstVal = new AllocaInst(Ty); ; break;} -case 121: -#line 949 "llvmAsmParser.y" +case 126: +#line 963 "llvmAsmParser.y" { if (!yyvsp[-3].TypeVal->isArrayType() || ((const ArrayType*)yyvsp[-3].TypeVal)->isSized()) ThrowException("Trying to allocate " + yyvsp[-3].TypeVal->getName() + @@ -1996,14 +2030,26 @@ case 121: yyval.InstVal = new AllocaInst(Ty, ArrSize); ; break;} -case 122: -#line 958 "llvmAsmParser.y" +case 127: +#line 972 "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 978 "llvmAsmParser.y" +{ + if (!yyvsp[-2].TypeVal->isPointerType()) + ThrowException("Can't load from nonpointer type: " + yyvsp[-2].TypeVal->getName()); + if (LoadInst::getIndexedType(yyvsp[-2].TypeVal, *yyvsp[0].ConstVector) == 0) + ThrowException("Invalid indices for load instruction!"); + + yyval.InstVal = new LoadInst(getVal(yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal), *yyvsp[0].ConstVector); + delete yyvsp[0].ConstVector; // Free the vector... + ; + break;} } /* the action file gets copied in in place of this dollarsign */ #line 543 "/usr/dcs/software/supported/encap/bison-1.28/share/bison.simple" @@ -2226,7 +2272,7 @@ yyerrhandle: } return 1; } -#line 964 "llvmAsmParser.y" +#line 988 "llvmAsmParser.y" int yyerror(const char *ErrorMsg) { ThrowException(string("Parse error: ") + ErrorMsg); diff --git a/lib/AsmParser/llvmAsmParser.h b/lib/AsmParser/llvmAsmParser.h index a639953b883..ae665fc4325 100644 --- a/lib/AsmParser/llvmAsmParser.h +++ b/lib/AsmParser/llvmAsmParser.h @@ -27,6 +27,7 @@ typedef union { Instruction::BinaryOps BinaryOpVal; Instruction::TermOps TermOpVal; Instruction::MemoryOps MemOpVal; + Instruction::OtherOps OtherOpVal; } YYSTYPE; #define ESINT64VAL 257 #define EUINT64VAL 258 @@ -57,31 +58,33 @@ typedef union { #define END 283 #define DECLARE 284 #define TO 285 -#define PHI 286 -#define CALL 287 -#define CAST 288 -#define RET 289 -#define BR 290 -#define SWITCH 291 -#define NOT 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 +#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 GETFIELD 306 +#define PUTFIELD 307 +#define PHI 308 +#define CALL 309 +#define CAST 310 +#define SHL 311 +#define SHR 312 extern YYSTYPE llvmAsmlval; diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y index 5e3d27378e1..af2ab106418 100644 --- a/lib/AsmParser/llvmAsmParser.y +++ b/lib/AsmParser/llvmAsmParser.y @@ -363,6 +363,7 @@ Module *RunVMAsmParser(const ToolCommandLine &Opts, FILE *F) { Instruction::BinaryOps BinaryOpVal; Instruction::TermOps TermOpVal; Instruction::MemoryOps MemOpVal; + Instruction::OtherOps OtherOpVal; } %type Module MethodList @@ -371,7 +372,7 @@ Module *RunVMAsmParser(const ToolCommandLine &Opts, FILE *F) { %type BBTerminatorInst %type Inst InstVal MemoryInst %type ConstVal -%type ConstVector +%type ConstVector UByteList %type ArgList ArgListH %type ArgVal %type PHIList @@ -404,7 +405,6 @@ Module *RunVMAsmParser(const ToolCommandLine &Opts, FILE *F) { %token IMPLEMENTATION TRUE FALSE BEGINTOK END DECLARE TO -%token PHI CALL CAST // Basic Block Terminating Operators %token RET BR SWITCH @@ -416,13 +416,15 @@ Module *RunVMAsmParser(const ToolCommandLine &Opts, FILE *F) { // Binary Operators %type BinaryOps // all the binary operators %token ADD SUB MUL DIV REM - -// Binary Comarators -%token SETLE SETGE SETLT SETGT SETEQ SETNE +%token SETLE SETGE SETLT SETGT SETEQ SETNE // Binary Comarators // Memory Instructions %token MALLOC ALLOCA FREE LOAD STORE GETFIELD PUTFIELD +// Other Operators +%type ShiftOps +%token PHI CALL CAST SHL SHR + %start Module %% @@ -461,6 +463,7 @@ TypesV : Types | VOID UnaryOps : NOT BinaryOps : ADD | SUB | MUL | DIV | REM BinaryOps : SETLE | SETGE | SETLT | SETGT | SETEQ | SETNE +ShiftOps : SHL | SHR // Valueine some types that allow classification if we only want a particular // thing... @@ -872,6 +875,10 @@ InstVal : BinaryOps Types ValueRef ',' ValueRef { if ($$ == 0) ThrowException("unary operator returned null!"); } + | ShiftOps Types ValueRef ',' Types ValueRef { + if ($5 != Type::UByteTy) ThrowException("Shift amount must be ubyte!"); + $$ = new ShiftInst($1, getVal($2, $3), getVal($5, $6)); + } | CAST Types ValueRef TO Types { $$ = new CastInst(getVal($2, $3), $5); } @@ -927,6 +934,13 @@ InstVal : BinaryOps Types ValueRef ',' ValueRef { $$ = $1; } +// UByteList - List of ubyte values for load and store instructions +UByteList : ',' ConstVector { + $$ = $2; +} | /* empty */ { + $$ = new vector(); +} + MemoryInst : MALLOC Types { const Type *Ty = PointerType::getPointerType($2); addConstValToConstantPool(new ConstPoolType(Ty)); @@ -961,6 +975,16 @@ MemoryInst : MALLOC Types { $$ = new FreeInst(getVal($2, $3)); } + | LOAD Types ValueRef UByteList { + if (!$2->isPointerType()) + ThrowException("Can't load from nonpointer type: " + $2->getName()); + if (LoadInst::getIndexedType($2, *$4) == 0) + ThrowException("Invalid indices for load instruction!"); + + $$ = new LoadInst(getVal($2, $3), *$4); + delete $4; // Free the vector... + } + %% int yyerror(const char *ErrorMsg) { ThrowException(string("Parse error: ") + ErrorMsg); diff --git a/lib/Bytecode/Reader/InstructionReader.cpp b/lib/Bytecode/Reader/InstructionReader.cpp index d08d19b6bd3..9dc5c6fc3da 100644 --- a/lib/Bytecode/Reader/InstructionReader.cpp +++ b/lib/Bytecode/Reader/InstructionReader.cpp @@ -105,10 +105,15 @@ 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) { + } + + Value *V; + switch (Raw.Opcode) { + case Instruction::Cast: Res = new CastInst(getValue(Raw.Ty, Raw.Arg1), getType(Raw.Arg2)); return false; - } else if (Raw.Opcode == Instruction::PHINode) { + + case Instruction::PHINode: { PHINode *PN = new PHINode(Raw.Ty); switch (Raw.NumOperands) { case 0: @@ -137,13 +142,23 @@ bool BytecodeParser::ParseInstruction(const uchar *&Buf, const uchar *EndBuf, } Res = PN; return false; - } else if (Raw.Opcode == Instruction::Ret) { + } + + case Instruction::Shl: + case Instruction::Shr: + Res = new ShiftInst((Instruction::OtherOps)Raw.Opcode, + getValue(Raw.Ty, Raw.Arg1), + getValue(Type::UByteTy, Raw.Arg2)); + return false; + case Instruction::Ret: if (Raw.NumOperands == 0) { Res = new ReturnInst(); return false; } else if (Raw.NumOperands == 1) { Res = new ReturnInst(getValue(Raw.Ty, Raw.Arg1)); return false; } - } else if (Raw.Opcode == Instruction::Br) { + break; + + case Instruction::Br: if (Raw.NumOperands == 1) { Res = new BranchInst((BasicBlock*)getValue(Type::LabelTy, Raw.Arg1)); return false; @@ -153,7 +168,9 @@ bool BytecodeParser::ParseInstruction(const uchar *&Buf, const uchar *EndBuf, getValue(Type::BoolTy , Raw.Arg3)); return false; } - } else if (Raw.Opcode == Instruction::Switch) { + break; + + case Instruction::Switch: { SwitchInst *I = new SwitchInst(getValue(Raw.Ty, Raw.Arg1), (BasicBlock*)getValue(Type::LabelTy, Raw.Arg2)); @@ -173,7 +190,9 @@ bool BytecodeParser::ParseInstruction(const uchar *&Buf, const uchar *EndBuf, delete Raw.VarArgs; return false; - } else if (Raw.Opcode == Instruction::Call) { + } + + case Instruction::Call: { Method *M = (Method*)getValue(Raw.Ty, Raw.Arg1); if (M == 0) return true; @@ -204,22 +223,58 @@ bool BytecodeParser::ParseInstruction(const uchar *&Buf, const uchar *EndBuf, Res = new CallInst(M, Params); return false; - } else if (Raw.Opcode == Instruction::Malloc) { + } + case Instruction::Malloc: if (Raw.NumOperands > 2) return true; - Value *Sz = Raw.NumOperands ? getValue(Type::UIntTy, Raw.Arg1) : 0; - Res = new MallocInst(Raw.Ty, Sz); + V = Raw.NumOperands ? getValue(Type::UIntTy, Raw.Arg1) : 0; + Res = new MallocInst(Raw.Ty, V); return false; - } else if (Raw.Opcode == Instruction::Alloca) { + + case Instruction::Alloca: if (Raw.NumOperands > 2) return true; - Value *Sz = Raw.NumOperands ? getValue(Type::UIntTy, Raw.Arg1) : 0; - Res = new AllocaInst(Raw.Ty, Sz); + V = Raw.NumOperands ? getValue(Type::UIntTy, Raw.Arg1) : 0; + Res = new AllocaInst(Raw.Ty, V); return false; - } else if (Raw.Opcode == Instruction::Free) { - Value *Val = getValue(Raw.Ty, Raw.Arg1); - if (!Val->getType()->isPointerType()) return true; - Res = new FreeInst(Val); + + case Instruction::Free: + V = getValue(Raw.Ty, Raw.Arg1); + if (!V->getType()->isPointerType()) return true; + Res = new FreeInst(V); + return false; + + case Instruction::Load: { + vector Idx; + switch (Raw.NumOperands) { + case 0: cerr << "Invalid load encountered!\n"; return true; + case 1: break; + case 2: V = getValue(Type::UByteTy, Raw.Arg2); + if (!V->isConstant()) return true; + Idx.push_back(V->castConstant()); + break; + case 3: V = getValue(Type::UByteTy, Raw.Arg2); + if (!V->isConstant()) return true; + Idx.push_back(V->castConstant()); + V = getValue(Type::UByteTy, Raw.Arg3); + if (!V->isConstant()) return true; + Idx.push_back(V->castConstant()); + break; + default: + V = getValue(Type::UByteTy, Raw.Arg2); + if (!V->isConstant()) return true; + Idx.push_back(V->castConstant()); + vector &args = *Raw.VarArgs; + for (unsigned i = 0, E = args.size(); i != E; ++i) { + V = getValue(Type::UByteTy, args[i]); + if (!V->isConstant()) return true; + Idx.push_back(V->castConstant()); + } + delete Raw.VarArgs; + break; + } + Res = new LoadInst(getValue(Raw.Ty, Raw.Arg1), Idx); return false; } + } // end switch(Raw.Opcode) cerr << "Unrecognized instruction! " << Raw.Opcode << " ADDR = 0x" << (void*)Buf << endl; diff --git a/lib/VMCore/iMemory.cpp b/lib/VMCore/iMemory.cpp new file mode 100644 index 00000000000..41c14b04d55 --- /dev/null +++ b/lib/VMCore/iMemory.cpp @@ -0,0 +1,47 @@ +//===-- iMemory.cpp - Implement Memory instructions --------------*- C++ -*--=// +// +// This file implements the various memory related classes defined in iMemory.h +// +//===----------------------------------------------------------------------===// + +#include "llvm/iMemory.h" +#include "llvm/ConstPoolVals.h" + +const Type *LoadInst::getIndexedType(const Type *Ptr, + const vector &Idx) { + if (!Ptr->isPointerType()) return 0; // Type isn't a pointer type! + + // Get the type pointed to... + Ptr = ((const PointerType*)Ptr)->getValueType(); + + if (Ptr->isStructType()) { + unsigned CurIDX = 0; + while (Ptr->isStructType()) { + if (Idx.size() == CurIDX) return 0; // Can't load a whole structure! + if (Idx[CurIDX]->getType() != Type::UByteTy) return 0; // Illegal idx + unsigned NextIdx = ((ConstPoolUInt*)Idx[CurIDX++])->getValue(); + + const StructType *ST = (const StructType *)Ptr; + Ptr = ST->getElementTypes()[NextIdx]; + } + return Ptr; + } else if (Ptr->isArrayType()) { + assert(0 && "Loading from arrays not implemented yet!"); + } else { + return (Idx.size() == 0) ? Ptr : 0; // Load directly through ptr + } +} + + +LoadInst::LoadInst(Value *Ptr, const vector &Idx, + const string &Name = "") + : Instruction(getIndexedType(Ptr->getType(), Idx), Load, Name) { + assert(getIndexedType(Ptr->getType(), Idx) && "Load operands invalid!"); + assert(Ptr->getType()->isPointerType() && "Can't free nonpointer!"); + Operands.reserve(1+Idx.size()); + Operands.push_back(Use(Ptr, this)); + + for (unsigned i = 0, E = Idx.size(); i != E; ++i) + Operands.push_back(Use(Idx[i], this)); +} +