Implementation of Store & GetElementPtr
authorChris Lattner <sabre@nondot.org>
Sun, 8 Jul 2001 23:22:50 +0000 (23:22 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 8 Jul 2001 23:22:50 +0000 (23:22 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Instruction.h
include/llvm/iMemory.h
lib/AsmParser/Lexer.cpp
lib/AsmParser/Lexer.l
lib/AsmParser/llvmAsmParser.cpp
lib/AsmParser/llvmAsmParser.h
lib/AsmParser/llvmAsmParser.y
lib/Bytecode/Reader/InstructionReader.cpp
lib/Bytecode/Writer/InstructionWriter.cpp
lib/VMCore/Type.cpp
lib/VMCore/iMemory.cpp

index cce9662122de771a286752a275bba9a61a4bf327..031730a9759b12d10ebcd06534162866c3889b87 100644 (file)
@@ -102,8 +102,7 @@ public:
     Alloca,                          // Stack management instruction
 
     Load, Store,                     // Memory manipulation instructions.
-
-    GetField, PutField,              // Structure manipulation instructions
+    GetElementPtr,                   // Get addr of Structure or Array element
 
     NumMemoryOps
   };
index dc8d7592364ceaf4d786b79b04a9be94c9cf3a84..feed3a2f8837951b417b1fae4617ea5757674ab0 100644 (file)
 #include "llvm/Instruction.h"
 #include "llvm/DerivedTypes.h"
 
+//===----------------------------------------------------------------------===//
+//                             AllocationInst Class
+//===----------------------------------------------------------------------===//
+//
+// AllocationInst - This class is the common base class of MallocInst and
+// AllocaInst.
+//
 class AllocationInst : public Instruction {
 public:
   AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy, 
@@ -38,6 +45,10 @@ public:
 };
 
 
+//===----------------------------------------------------------------------===//
+//                                MallocInst Class
+//===----------------------------------------------------------------------===//
+
 class MallocInst : public AllocationInst {
 public:
   MallocInst(const Type *Ty, Value *ArraySize = 0, const string &Name = "") 
@@ -51,6 +62,10 @@ public:
 };
 
 
+//===----------------------------------------------------------------------===//
+//                                AllocaInst Class
+//===----------------------------------------------------------------------===//
+
 class AllocaInst : public AllocationInst {
 public:
   AllocaInst(const Type *Ty, Value *ArraySize = 0, const string &Name = "") 
@@ -64,6 +79,10 @@ public:
 };
 
 
+//===----------------------------------------------------------------------===//
+//                                 FreeInst Class
+//===----------------------------------------------------------------------===//
+
 class FreeInst : public Instruction {
 public:
   FreeInst(Value *Ptr, const string &Name = "") 
@@ -79,8 +98,36 @@ public:
 };
 
 
-class LoadInst : public Instruction {
-  LoadInst(const LoadInst &LI) : Instruction(LI.getType(), Load) {
+//===----------------------------------------------------------------------===//
+//                              MemAccessInst Class
+//===----------------------------------------------------------------------===//
+//
+// MemAccessInst - Common base class of LoadInst, StoreInst, and
+// GetElementPtrInst...
+//
+class MemAccessInst : public Instruction {
+protected:
+  inline MemAccessInst(const Type *Ty, unsigned Opcode, const string &Nam = "") 
+    : Instruction(Ty, Opcode, Nam) {}
+public:
+  // 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<ConstPoolVal*> &Indices,
+                                   bool AllowStructLeaf = false);
+};
+
+
+//===----------------------------------------------------------------------===//
+//                                LoadInst Class
+//===----------------------------------------------------------------------===//
+
+class LoadInst : public MemAccessInst {
+  LoadInst(const LoadInst &LI) : MemAccessInst(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));
@@ -90,15 +137,43 @@ public:
           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<ConstPoolVal*> &);
+
+//===----------------------------------------------------------------------===//
+//                                StoreInst Class
+//===----------------------------------------------------------------------===//
+
+class StoreInst : public MemAccessInst {
+  StoreInst(const StoreInst &SI) : MemAccessInst(SI.getType(), Store) {
+    Operands.reserve(SI.Operands.size());
+    for (unsigned i = 0, E = SI.Operands.size(); i != E; ++i)
+      Operands.push_back(Use(SI.Operands[i], this));
+  }
+public:
+  StoreInst(Value *Val, Value *Ptr, const vector<ConstPoolVal*> &Idx,
+           const string &Name = "");
+  virtual Instruction *clone() const { return new StoreInst(*this); }
+  virtual const char *getOpcodeName() const { return "store"; }  
+};
+
+
+//===----------------------------------------------------------------------===//
+//                             GetElementPtrInst Class
+//===----------------------------------------------------------------------===//
+
+class GetElementPtrInst : public MemAccessInst {
+  GetElementPtrInst(const GetElementPtrInst &EPI)
+    : MemAccessInst(EPI.getType(), GetElementPtr) {
+    Operands.reserve(EPI.Operands.size());
+    for (unsigned i = 0, E = EPI.Operands.size(); i != E; ++i)
+      Operands.push_back(Use(EPI.Operands[i], this));
+  }
+public:
+  GetElementPtrInst(Value *Ptr, const vector<ConstPoolVal*> &Idx,
+                   const string &Name = "");
+  virtual Instruction *clone() const { return new GetElementPtrInst(*this); }
+  virtual const char *getOpcodeName() const { return "getelementptr"; }  
 };
 
 #endif // LLVM_IMEMORY_H
index 8773b8471edc41c36e8d175389edb455a0bec3b8..09d9e515fb3198014e21483d9d0b918710a7decd 100644 (file)
@@ -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 61
-#define YY_END_OF_BUFFER 62
-static yyconst short int yy_acclist[116] =
+#define YY_NUM_RULES 60
+#define YY_END_OF_BUFFER 61
+static yyconst short int yy_acclist[115] =
     {   0,
-       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,
+       61,   59,   60,   58,   59,   60,   58,   60,   59,   60,
+       59,   60,   59,   60,    8,   59,   60,   54,   59,   60,
+        1,   59,   60,   59,   60,   59,   60,   59,   60,   59,
+       60,   59,   60,   59,   60,   59,   60,   59,   60,   59,
+       60,   59,   60,   59,   60,   59,   60,   59,   60,   59,
+       60,   59,   60,   59,   60,   59,   60,   52,   51,   56,
+       55,   54,    1,    9,   43,   36,   53,   51,   57,   25,
        28,    3,   16,   27,   24,   37,   29,   42,   40,   41,
        26,   11,   38,   39,   47,   48,   18,    4,   22,   17,
        10,    2,    5,   20,   23,   12,   31,   35,   33,   34,
 
        32,   30,   14,   49,   13,   19,   46,   21,   45,   44,
-       15,    6,   50,   51,    7
+       15,    6,   50,    7
     } ;
 
-static yyconst short int yy_accept[202] =
+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,
@@ -335,23 +335,22 @@ static yyconst short int yy_accept[202] =
        58,   58,   59,   60,   60,   61,   62,   63,   64,   64,
        64,   65,   65,   65,   66,   66,   66,   66,   66,   66,
        66,   66,   66,   66,   66,   66,   66,   66,   66,   66,
-       66,   66,   66,   66,   66,   66,   66,   66,   66,   66,
-       67,   67,   67,   67,   67,   67,   67,   67,   68,   69,
-       70,   71,   71,   71,   71,   71,   71,   71,   72,   72,
-       73,   73,   73,   73,   73,   73,   74,   74,   74,   74,
-
-       74,   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
+       66,   66,   66,   66,   66,   66,   66,   66,   66,   67,
+       67,   67,   67,   67,   67,   67,   67,   68,   69,   70,
+       71,   71,   71,   71,   71,   71,   71,   72,   72,   73,
+       73,   73,   73,   73,   73,   74,   74,   74,   74,   74,
+
+       75,   76,   77,   78,   79,   79,   79,   80,   80,   81,
+       81,   82,   82,   82,   82,   82,   82,   82,   82,   82,
+       82,   82,   83,   84,   85,   85,   85,   85,   85,   86,
+       86,   86,   86,   87,   88,   88,   88,   88,   88,   88,
+       88,   88,   88,   88,   89,   90,   90,   91,   91,   91,
+       92,   92,   93,   93,   93,   94,   95,   95,   95,   96,
+       96,   97,   98,   99,  100,  101,  102,  103,  104,  105,
+      105,  106,  107,  107,  108,  108,  109,  109,  109,  110,
+      111,  112,  113,  113,  113,  113,  113,  113,  113,  113,
+      113,  113,  113,  113,  113,  114,  114,  115,  115
+
     } ;
 
 static yyconst int yy_ec[256] =
@@ -394,160 +393,160 @@ static yyconst int yy_meta[33] =
         4,    4
     } ;
 
-static yyconst short int yy_base[206] =
+static yyconst short int yy_base[204] =
     {   0,
-        0,    0,  395,  396,  396,  396,    0,  385,   26,  385,
+        0,    0,  391,  392,  392,  392,    0,  381,   26,  381,
        27,    0,   28,   40,   29,   35,   34,   42,   30,   38,
-       56,   60,   52,   55,   61,   81,   65,  104,   63,  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,  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,
-
-      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,
-
-      335,  338,  341,  346,   53
+       56,   60,   52,   55,   61,   81,   65,  104,   63,  384,
+      378,  392,    0,  378,  377,  376,   69,    0,   32,   72,
+      374,   78,   71,  373,   91,   89,   73,   75,   92,   99,
+       98,  105,  106,  108,  113,  116,  118,  117,  124,  121,
+      126,  127,  129,  130,  133,  134,  138,  143,  372,   76,
+      142,  137,  145,  151,  154,  156,  392,    0,  372,  370,
+      155,  161,  159,  162,  164,  167,  369,  172,  368,  168,
+      174,  179,  181,  177,  367,  184,  189,  191,  182,  366,
+
+      365,  364,  363,  362,  192,  212,  361,  180,  360,  196,
+      359,  195,  198,  200,  202,  203,  215,  205,  224,  226,
+      227,  358,  357,  356,  207,  231,  210,  217,  355,  232,
+      233,  234,  354,  353,  235,  238,  237,  241,  246,  248,
+      250,  251,  255,  352,  351,  256,  350,  258,  261,  349,
+      268,  348,  263,  267,  347,  346,  271,  264,  345,  275,
+      344,  343,  342,  341,  340,  335,  330,  325,  321,  272,
+      316,  315,  274,  314,  282,  310,  283,  284,  307,  306,
+      305,  208,  285,  286,  287,  289,  292,  294,  297,  298,
+      301,  303,  302,  304,  201,  309,   74,  392,  331,  334,
+
+      337,  342,   53
     } ;
 
-static yyconst short int yy_def[206] =
+static yyconst short int yy_def[204] =
     {   0,
-      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,
-
-      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,
-
-      200,  200,  200,  200,  200
+      198,    1,  198,  198,  198,  198,  199,  200,  201,  198,
+      200,  202,  200,  200,  200,  200,  200,  200,  200,  200,
+      200,  200,  200,  200,  200,  200,  200,  200,  200,  199,
+      200,  198,  203,  198,  198,  198,  200,  202,  200,  200,
+      200,  200,  200,  200,  200,  200,  200,  200,  200,  200,
+      200,  200,  200,  200,  200,  200,  200,  200,  200,  200,
+      200,  200,  200,  200,  200,  200,  200,  200,  200,  200,
+      200,  200,  200,  200,  200,  200,  198,  203,  198,  200,
+      200,  200,  200,  200,  200,  200,  200,  200,  200,  200,
+      200,  200,  200,  200,  200,  200,  200,  200,  200,  200,
+
+      200,  200,  200,  200,  200,  200,  200,  200,  200,  200,
+      200,  200,  200,  200,  200,  200,  200,  200,  200,  200,
+      200,  200,  200,  200,  200,  200,  200,  200,  200,  200,
+      200,  200,  200,  200,  200,  200,  200,  200,  200,  200,
+      200,  200,  200,  200,  200,  200,  200,  200,  200,  200,
+      200,  200,  200,  200,  200,  200,  200,  200,  200,  200,
+      200,  200,  200,  200,  200,  200,  200,  200,  200,  200,
+      200,  200,  200,  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,
+
+      198,  198,  198
     } ;
 
-static yyconst short int yy_nxt[429] =
+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,
        22,   23,    8,   24,    8,   25,   26,   27,   28,   29,
         8,    8,   34,   35,   37,   32,   32,   32,   32,   45,
-       32,   39,   32,   32,   53,   81,   32,   40,   32,   46,
-       32,   41,   50,   47,   42,   49,   79,   48,   54,   55,
+       32,   39,   32,   32,   53,   80,   32,   40,   32,   46,
+       32,   41,   50,   47,   42,   49,   78,   48,   54,   55,
        32,   51,   43,   32,   32,   44,   56,   52,   32,   32,
-       58,   32,   61,   32,   60,   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,   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,
-      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,
-
-      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,
-
-      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,
+       58,   32,   61,   32,   60,   62,   37,   32,   57,   32,
+       32,   32,   32,   32,   32,   76,   32,   69,   59,   32,
+       70,   81,   63,   83,   82,   64,   71,   32,   65,   32,
+
+       32,   86,   87,   88,  113,   89,   32,   32,   66,   67,
+       84,   68,   32,   32,   32,   72,   32,   85,   90,   92,
+       91,   32,   73,   74,   32,   32,   32,   96,   97,   32,
+       75,   94,   32,   93,   32,   32,   99,   32,   32,   98,
+       95,   32,   32,  100,  102,   32,   32,  103,  101,  111,
+       32,   32,  107,   32,  104,  108,  110,  106,  109,   32,
+      105,  112,   32,   32,   32,  114,  116,   32,  115,   32,
+       32,  118,   32,  117,  119,   32,   32,  120,  122,  121,
+       32,  123,   32,  126,  128,   32,  125,   32,   32,   32,
+       32,  124,   32,  129,  127,  130,  131,   32,  132,   32,
+
+       32,  135,  133,   32,   32,  141,   32,  134,   32,   32,
+       32,   32,  144,   32,  145,   32,   32,  153,   32,  136,
+       32,  142,  143,   32,  155,   32,  137,  149,  138,  146,
+      147,  139,   32,  140,   32,   32,  148,  150,  151,   32,
+       32,   32,   32,   32,  156,   32,   32,  158,  152,   32,
+      154,  157,  161,  159,   32,  163,   32,  160,   32,   32,
+      165,  162,  167,   32,   32,  169,   32,  170,  164,   32,
+      171,   32,   32,  166,  172,   32,   32,  168,  174,   32,
+       32,  176,   32,   32,  178,  177,  173,  179,  175,  180,
+       32,   32,   32,   32,   32,   32,  182,   32,  184,  185,
+
+       32,  181,   32,  183,  190,   32,   32,  186,  187,   32,
+       32,   32,   32,   32,   32,   32,  188,   32,   32,  189,
+      191,  194,   32,   32,   32,  192,  196,  195,  193,   32,
+      197,   30,   30,   32,   30,   30,   30,   31,   32,   31,
+       33,   33,   38,   32,   38,   38,   38,   38,   32,   32,
        32,   32,   32,   32,   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,  200,    3,  200,  200,  200,  200,
+       32,   32,   32,   32,   32,   32,   32,   32,   32,   79,
+       32,   32,   32,   36,   35,   79,   32,   77,   36,   32,
+      198,    3,  198,  198,  198,  198,  198,  198,  198,  198,
 
-      200,  200,  200,  200,  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,  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[429] =
+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,  205,   16,   20,   20,
+       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,  199,   24,   48,   29,   42,   27,   22,   26,
+       40,   47,  197,   48,   70,   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,   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,
-
-       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,
-
-      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,
-
-      200,  200,  200,  200,  200,  200,  200,  200,  200,  200,
-      200,  200,  200,  200,  200,  200,  200,  200,  200,  200,
-      200,  200,  200,  200,  200,  200,  200,  200
+       49,   46,   47,   48,   70,   49,   51,   50,   26,   26,
+       45,   26,   28,   52,   53,   28,   54,   45,   50,   52,
+       51,   55,   28,   28,   56,   58,   57,   56,   57,   60,
+       28,   54,   59,   53,   61,   62,   58,   63,   64,   57,
+       55,   65,   66,   59,   61,   72,   67,   62,   60,   67,
+       71,   68,   65,   73,   62,   65,   66,   64,   65,   74,
+       63,   68,   75,   81,   76,   71,   73,   83,   72,   82,
+       84,   75,   85,   74,   76,   86,   90,   81,   83,   82,
+       88,   84,   91,   88,   91,   94,   86,   92,  108,   93,
+       99,   85,   96,   92,   90,   93,   94,   97,   96,   98,
+
+      105,   99,   97,  112,  110,  108,  113,   98,  114,  195,
+      115,  116,  113,  118,  114,  125,  182,  125,  127,  105,
+      106,  110,  112,  117,  127,  128,  106,  118,  106,  115,
+      116,  106,  119,  106,  120,  121,  117,  119,  120,  126,
+      130,  131,  132,  135,  128,  137,  136,  131,  121,  138,
+      126,  130,  136,  132,  139,  138,  140,  135,  141,  142,
+      139,  137,  140,  143,  146,  142,  148,  143,  138,  149,
+      146,  153,  158,  139,  148,  154,  151,  141,  151,  157,
+      170,  154,  173,  160,  158,  157,  149,  160,  153,  170,
+      175,  177,  178,  183,  184,  185,  175,  186,  178,  183,
+
+      187,  173,  188,  177,  188,  189,  190,  184,  185,  191,
+      193,  192,  194,  181,  180,  179,  186,  196,  176,  187,
+      189,  192,  174,  172,  171,  190,  194,  193,  191,  169,
+      196,  199,  199,  168,  199,  199,  199,  200,  167,  200,
+      201,  201,  202,  166,  202,  202,  202,  202,  165,  164,
+      163,  162,  161,  159,  156,  155,  152,  150,  147,  145,
+      144,  134,  133,  129,  124,  123,  122,  111,  109,  107,
+      104,  103,  102,  101,  100,   95,   89,   87,   80,   79,
+       69,   44,   41,   36,   35,   34,   31,   30,   10,    8,
+        3,  198,  198,  198,  198,  198,  198,  198,  198,  198,
+
+      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;
@@ -615,7 +614,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 619 "Lexer.cpp"
+#line 618 "Lexer.cpp"
 
 /* Macros after this point can all be overridden by user definitions in
  * section 1.
@@ -769,7 +768,7 @@ YY_DECL
 #line 83 "Lexer.l"
 
 
-#line 773 "Lexer.cpp"
+#line 772 "Lexer.cpp"
 
        if ( yy_init )
                {
@@ -817,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 >= 201 )
+                               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 != 200 );
+               while ( yy_current_state != 198 );
 
 yy_find_action:
                yy_current_state = *--yy_state_ptr;
@@ -1107,44 +1106,39 @@ YY_RULE_SETUP
 case 50:
 YY_RULE_SETUP
 #line 146 "Lexer.l"
-{ RET_TOK(MemOpVal, GetField, GETFIELD); }
+{ RET_TOK(MemOpVal, GetElementPtr, GETELEMENTPTR); }
        YY_BREAK
 case 51:
 YY_RULE_SETUP
-#line 147 "Lexer.l"
-{ RET_TOK(MemOpVal, PutField, PUTFIELD); }
+#line 149 "Lexer.l"
+{ llvmAsmlval.StrVal = strdup(yytext+1); return VAR_ID; }
        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 54:
+case 53:
 YY_RULE_SETUP
-#line 157 "Lexer.l"
+#line 156 "Lexer.l"
 { 
                   yytext[strlen(yytext)-1] = 0;           // nuke end quote
                  llvmAsmlval.StrVal = strdup(yytext+1);  // Nuke start quote 
                  return STRINGCONSTANT;
                 }
        YY_BREAK
-case 55:
+case 54:
 YY_RULE_SETUP
-#line 164 "Lexer.l"
+#line 163 "Lexer.l"
 { llvmAsmlval.UInt64Val = atoull(yytext); return EUINT64VAL; }
        YY_BREAK
-case 56:
+case 55:
 YY_RULE_SETUP
-#line 165 "Lexer.l"
+#line 164 "Lexer.l"
 { 
                   uint64_t Val = atoull(yytext+1);
                  // +1:  we have bigger negative range
@@ -1154,14 +1148,14 @@ YY_RULE_SETUP
                  return ESINT64VAL; 
                 }
        YY_BREAK
-case 57:
+case 56:
 YY_RULE_SETUP
-#line 175 "Lexer.l"
+#line 174 "Lexer.l"
 { llvmAsmlval.UIntVal = atoull(yytext+1); return UINTVAL; }
        YY_BREAK
-case 58:
+case 57:
 YY_RULE_SETUP
-#line 176 "Lexer.l"
+#line 175 "Lexer.l"
 {
                   uint64_t Val = atoull(yytext+2);
                  // +1:  we have bigger negative range
@@ -1171,22 +1165,22 @@ YY_RULE_SETUP
                  return SINTVAL;
                 }
        YY_BREAK
-case 59:
+case 58:
 YY_RULE_SETUP
-#line 186 "Lexer.l"
+#line 185 "Lexer.l"
 { /* Ignore whitespace */ }
        YY_BREAK
-case 60:
+case 59:
 YY_RULE_SETUP
-#line 187 "Lexer.l"
+#line 186 "Lexer.l"
 { /*printf("'%s'", yytext);*/ return yytext[0]; }
        YY_BREAK
-case 61:
+case 60:
 YY_RULE_SETUP
-#line 189 "Lexer.l"
+#line 188 "Lexer.l"
 YY_FATAL_ERROR( "flex scanner jammed" );
        YY_BREAK
-#line 1191 "Lexer.cpp"
+#line 1185 "Lexer.cpp"
                        case YY_STATE_EOF(INITIAL):
                                yyterminate();
 
@@ -1475,7 +1469,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 >= 201 )
+                       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];
@@ -1505,11 +1499,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 >= 201 )
+               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 == 200);
+       yy_is_jam = (yy_current_state == 198);
        if ( ! yy_is_jam )
                *yy_state_ptr++ = yy_current_state;
 
@@ -2070,5 +2064,5 @@ int main()
        return 0;
        }
 #endif
-#line 189 "Lexer.l"
+#line 188 "Lexer.l"
 
index c0bd75cf797174012dedfa0395d4755609883431..91fc1b69c96c659da93738574b007bfdfd17b73c 100644 (file)
@@ -143,8 +143,7 @@ alloca          { RET_TOK(MemOpVal, Alloca, ALLOCA); }
 free            { RET_TOK(MemOpVal, Free, FREE); }
 load            { RET_TOK(MemOpVal, Load, LOAD); }
 store           { RET_TOK(MemOpVal, Store, STORE); }
-getfield        { RET_TOK(MemOpVal, GetField, GETFIELD); }
-putfield        { RET_TOK(MemOpVal, PutField, PUTFIELD); }
+getelementptr   { RET_TOK(MemOpVal, GetElementPtr, GETELEMENTPTR); }
 
 
 {VarID}         { llvmAsmlval.StrVal = strdup(yytext+1); return VAR_ID; }
index 5d384ec56ec7bcc1e0741a32bebda4b014b4043a..95b9721995902bf2efe319a1622adcf4b6704637 100644 (file)
 #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
+#define        GETELEMENTPTR   306
+#define        PHI     307
+#define        CALL    308
+#define        CAST    309
+#define        SHL     310
+#define        SHR     311
 
 #line 13 "llvmAsmParser.y"
 
@@ -434,26 +433,26 @@ typedef union {
 
 
 
-#define        YYFINAL         248
+#define        YYFINAL         260
 #define        YYFLAG          -32768
-#define        YYNTBASE        69
+#define        YYNTBASE        68
 
-#define YYTRANSLATE(x) ((unsigned)(x) <= 312 ? yytranslate[x] : 107)
+#define YYTRANSLATE(x) ((unsigned)(x) <= 311 ? yytranslate[x] : 106)
 
 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,    66,
-    67,    68,     2,    65,     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,     2,
-    59,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+    58,     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,
-    60,     2,    61,     2,     2,     2,     2,     2,     2,     2,
+    59,     2,    60,     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,    62,
-     2,     2,    63,     2,    64,     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,     2,
      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
@@ -472,7 +471,7 @@ static const char yytranslate[] = {     0,
     27,    28,    29,    30,    31,    32,    33,    34,    35,    36,
     37,    38,    39,    40,    41,    42,    43,    44,    45,    46,
     47,    48,    49,    50,    51,    52,    53,    54,    55,    56,
-    57,    58
+    57
 };
 
 #if YYDEBUG != 0
@@ -488,52 +487,53 @@ static const short yyprhs[] = {     0,
    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
+   334,   339,   341,   342,   348,   352,   359,   365,   368,   375,
+   377,   380,   381,   384,   390,   393,   399,   403,   408,   416
 };
 
 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,    71,     0,     7,     0,    35,
+     0,    20,     0,    21,     0,    70,     0,     7,     0,    35,
      0,    36,     0,    37,     0,    38,     0,    39,     0,    40,
      0,    41,     0,    42,     0,    43,     0,    44,     0,    45,
-     0,    46,     0,    57,     0,    58,     0,    15,     0,    13,
+     0,    46,     0,    56,     0,    57,     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
+     0,    10,     0,    75,     0,    76,     0,    22,    58,     0,
+     0,    75,    69,     0,    76,     4,     0,     8,    26,     0,
+     8,    27,     0,    19,    24,     0,    20,    70,     0,    59,
+    70,    60,    59,    80,    60,     0,    59,    70,    60,    59,
+    60,     0,    59,     4,    61,    70,    60,    59,    80,    60,
+     0,    59,     4,    61,    70,    60,    59,    60,     0,    62,
+    93,    63,    62,    80,    63,     0,    62,    63,    62,    63,
+     0,    80,    64,    79,     0,    79,     0,    81,    78,    79,
+     0,     0,    83,     0,    83,    90,     0,    81,    25,     0,
+    22,     0,     0,    70,    84,     0,    85,    64,    86,     0,
+    85,     0,    86,     0,     0,    71,    24,    65,    87,    66,
+     0,    88,    81,    28,     0,    94,    29,     0,     3,     0,
+     4,     0,    26,     0,    27,     0,    24,     0,    68,     0,
+    22,     0,    91,     0,    92,     0,    71,    65,    93,    66,
+     0,    71,    65,    66,     0,    59,    70,    60,     0,    59,
+     4,    61,    70,    60,     0,    62,    93,    63,     0,    62,
+    63,     0,    70,    67,     0,    70,     0,    93,    64,    70,
+     0,    94,    95,     0,    89,    95,     0,    96,    97,     0,
+    23,    96,    97,     0,    96,    99,     0,     0,    32,    70,
+    92,     0,    32,     7,     0,    33,    21,    92,     0,    33,
+     8,    92,    64,    21,    92,    64,    21,    92,     0,    34,
+    77,    92,    64,    21,    92,    59,    98,    60,     0,    98,
+    77,    91,    64,    21,    92,     0,    77,    91,    64,    21,
+    92,     0,    78,   103,     0,    70,    59,    92,    64,    92,
+    60,     0,   100,    64,    59,    92,    64,    92,    60,     0,
+    70,    92,     0,   101,    64,    70,    92,     0,   101,     0,
+     0,    73,    70,    92,    64,    92,     0,    72,    70,    92,
+     0,    74,    70,    92,    64,    70,    92,     0,    55,    70,
+    92,    31,    70,     0,    53,   100,     0,    54,    70,    92,
+    65,   102,    66,     0,   105,     0,    64,    80,     0,     0,
+    47,    70,     0,    47,    70,    64,    14,    92,     0,    48,
+    70,     0,    48,    70,    64,    14,    92,     0,    49,    70,
+    92,     0,    50,    70,    92,   104,     0,    51,    70,    92,
+    64,    70,    92,   104,     0,    52,    70,    92,   104,     0
 };
 
 #endif
@@ -552,7 +552,7 @@ static const short yyrline[] = { 0,
    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
+   938,   940,   944,   949,   958,   963,   972,   978,   987,   999
 };
 #endif
 
@@ -565,8 +565,8 @@ static const char * const yytname[] = {   "$","error","$undefined.","ESINT64VAL"
 "LABELSTR","STRINGCONSTANT","IMPLEMENTATION","TRUE","FALSE","BEGINTOK","END",
 "DECLARE","TO","RET","BR","SWITCH","NOT","ADD","SUB","MUL","DIV","REM","SETLE",
 "SETGE","SETLT","SETGT","SETEQ","SETNE","MALLOC","ALLOCA","FREE","LOAD","STORE",
-"GETFIELD","PUTFIELD","PHI","CALL","CAST","SHL","SHR","'='","'['","']'","'x'",
-"'{'","'}'","','","'('","')'","'*'","INTVAL","EINT64VAL","Types","TypesV","UnaryOps",
+"GETELEMENTPTR","PHI","CALL","CAST","SHL","SHR","'='","'['","']'","'x'","'{'",
+"'}'","','","'('","')'","'*'","INTVAL","EINT64VAL","Types","TypesV","UnaryOps",
 "BinaryOps","ShiftOps","SIntType","UIntType","IntType","OptAssign","ConstVal",
 "ConstVector","ConstPool","Module","MethodList","OptVAR_ID","ArgVal","ArgListH",
 "ArgList","MethodHeaderH","MethodHeader","Method","ConstValueRef","ValueRef",
@@ -577,19 +577,19 @@ static const char * const yytname[] = {   "$","error","$undefined.","ESINT64VAL"
 #endif
 
 static const short yyr1[] = {     0,
-    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
+    68,    68,    69,    69,    70,    70,    70,    70,    70,    70,
+    70,    70,    70,    70,    70,    70,    70,    70,    71,    71,
+    72,    73,    73,    73,    73,    73,    73,    73,    73,    73,
+    73,    73,    74,    74,    75,    75,    75,    75,    76,    76,
+    76,    76,    77,    77,    78,    78,    79,    79,    79,    79,
+    79,    79,    79,    79,    79,    79,    79,    79,    80,    80,
+    81,    81,    82,    83,    83,    84,    84,    85,    86,    86,
+    87,    87,    88,    89,    90,    91,    91,    91,    91,    91,
+    92,    92,    92,    70,    70,    70,    70,    70,    70,    70,
+    70,    93,    93,    94,    94,    95,    95,    96,    96,    97,
+    97,    97,    97,    97,    98,    98,    99,   100,   100,   101,
+   101,   102,   102,   103,   103,   103,   103,   103,   103,   103,
+   104,   104,   105,   105,   105,   105,   105,   105,   105,   105
 };
 
 static const short yyr2[] = {     0,
@@ -604,8 +604,8 @@ static const short yyr2[] = {     0,
      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
+     4,     1,     0,     5,     3,     6,     5,     2,     6,     1,
+     2,     0,     2,     5,     2,     5,     3,     4,     7,     4
 };
 
 static const short yydefact[] = {    62,
@@ -622,182 +622,178 @@ static const short yydefact[] = {    62,
      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
+     0,     0,     0,     0,     0,     0,     0,     0,    33,    34,
+     0,     0,     0,   107,   120,    19,     0,    58,     0,    88,
+    66,    68,     0,    73,   100,     0,   102,     0,   123,   125,
+    19,    19,    19,    19,    19,   118,    19,    19,    19,    19,
+    19,     0,    54,    60,     0,     0,    69,     0,     0,     0,
+     0,   127,   122,     0,   122,     0,     0,     0,     0,   115,
+     0,     0,     0,    53,     0,    57,     0,     0,     0,     0,
+     0,   128,     0,   130,     0,     0,   113,     0,     0,     0,
+    56,     0,    59,     0,     0,   124,   126,   121,    19,     0,
+     0,    19,   112,     0,   117,   114,    19,    55,     0,     0,
+   122,     0,     0,   110,     0,   119,   116,     0,     0,     0,
+   129,   108,     0,    19,   103,     0,   104,     0,   109,   111,
+     0,     0,     0,     0,   106,     0,   105,     0,     0,     0
 };
 
 static const short yydefgoto[] = {    31,
-    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
+    82,    61,    59,   141,   142,   143,    54,    55,   117,     5,
+   174,   175,     1,   258,     2,   152,   106,   107,   108,    34,
+    35,    36,    37,    38,    62,    39,    68,    69,    97,   240,
+    98,   166,   223,   224,   144,   202,   145
 };
 
 static const short yypact[] = {-32768,
-    19,   342,   -51,-32768,    99,-32768,-32768,-32768,-32768,-32768,
+    70,   321,    -6,-32768,    90,-32768,-32768,-32768,-32768,-32768,
 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-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
+-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   381,   235,
+-32768,    45,   -20,-32768,    98,-32768,-32768,-32768,    93,-32768,
+    67,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,    56,
+   321,   406,   296,   181,   142,-32768,    97,   -14,    96,-32768,
+    46,   123,-32768,   101,   210,   122,-32768,-32768,   135,-32768,
+-32768,-32768,-32768,-32768,    46,   111,    29,   112,   129,-32768,
+-32768,-32768,-32768,   321,-32768,-32768,   321,   321,-32768,    79,
+-32768,   135,   466,    13,   268,   461,-32768,-32768,   321,   118,
+   125,   119,    47,    46,    10,   126,-32768,   131,-32768,-32768,
+   133,     4,    52,    52,-32768,-32768,    52,-32768,-32768,-32768,
+-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   321,
+   321,   321,   321,   321,   321,   321,   321,   321,-32768,-32768,
+   321,   321,   321,-32768,-32768,    48,     3,-32768,    90,-32768,
+-32768,-32768,   321,-32768,-32768,   138,-32768,   139,   106,   115,
+     4,     4,     4,     4,     0,   140,     4,     4,     4,     4,
+     4,   148,-32768,-32768,    99,   132,-32768,   178,   189,   197,
+   221,-32768,   194,   196,   194,    52,   204,   199,   234,-32768,
+   202,   203,    28,-32768,    90,-32768,    52,    52,    52,    52,
+    90,-32768,   321,-32768,   206,    52,   321,   321,    52,   321,
+-32768,   100,-32768,   207,   209,-32768,-32768,   211,     4,    52,
+   222,     4,   223,   208,    46,-32768,     4,-32768,   252,   268,
+   194,   225,    52,-32768,   321,-32768,-32768,    52,    57,   435,
+-32768,-32768,   228,     4,-32768,   226,-32768,    57,-32768,-32768,
+   270,   229,    52,   271,-32768,    52,-32768,   289,   295,-32768
 };
 
 static const short yypgoto[] = {-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
+-32768,    -2,   294,-32768,-32768,-32768,   -93,   -92,  -205,   -63,
+    -4,  -129,   285,-32768,-32768,-32768,-32768,   168,-32768,-32768,
+-32768,-32768,  -215,   -44,     1,-32768,   305,   279,   257,-32768,
+-32768,-32768,-32768,-32768,-32768,  -180,-32768
 };
 
 
-#define        YYLAST          552
+#define        YYLAST          528
 
 
 static const short yytable[] = {    32,
-    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,
+    56,   115,   116,    64,   204,    96,     6,     7,     8,     9,
+    41,    42,    43,    44,    45,    46,    47,    48,    49,   176,
+   113,    50,    51,   246,   239,    25,    58,    26,    96,    27,
+    28,   151,   252,   114,   248,    41,    42,    43,    44,    45,
+    46,    47,    48,    49,    65,    85,    50,    51,    75,    77,
+   241,    40,    63,    79,     6,     7,     8,     9,   186,     6,
+     7,    52,   173,   212,    53,    90,    63,   155,   156,   157,
+    63,   218,   158,    25,   -19,    26,    63,    27,    28,    74,
+    26,   103,    27,    28,   104,   105,    52,   211,   100,    53,
+   112,     3,    72,    73,     4,    63,   146,    41,    42,    43,
+    44,    45,    46,    47,    48,    49,   150,   172,    50,    51,
+   -19,    63,    63,    63,    63,    67,   182,   183,   184,   185,
+    67,    70,   188,   189,   190,   191,   192,   159,   160,   161,
+   162,   163,   164,   165,   167,   168,   115,   116,   169,   170,
+   171,   205,    87,     3,   109,    83,   115,   116,    52,    91,
+   105,    53,   214,   215,   216,   217,     3,    84,   194,   228,
+    65,   221,   195,   195,   226,    88,    93,    94,    95,   180,
+   -19,    99,    63,   101,   231,   232,   147,   234,   181,   -19,
+   149,    63,   237,    80,    81,    86,    87,   148,   243,   153,
+   213,   102,    87,   245,   196,   195,   154,   -20,   197,   250,
+   219,   178,   179,   187,   222,   225,   193,   227,   255,   198,
+   199,   257,     6,     7,     8,     9,    10,    11,    12,    13,
     14,    15,    16,    17,    18,    19,    20,    21,    22,    23,
-    24,    25,   231,    26,   220,    27,    28,     6,     7,     8,
+    24,    25,   244,    26,   200,    27,    28,     6,     7,     8,
      9,    10,    11,    12,    13,    14,    15,    16,    17,    18,
-    19,    20,    21,    22,    23,    24,    25,   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,    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,
+    19,    20,    21,    22,    23,    24,    25,   201,    26,   203,
+    27,    28,   206,   207,   208,   209,   210,   230,    29,   220,
+   229,    30,   238,   236,   195,    89,    42,    43,    44,    45,
+    46,    47,    48,    49,   242,   233,   235,   249,   259,   251,
+   253,   256,   254,    29,   260,    33,    30,    60,     6,     7,
+     8,     9,    10,    11,    12,    13,    14,    15,    16,    17,
+    18,    19,    20,    21,    22,    23,    24,    25,    66,    26,
+   177,    27,    28,     6,     7,     8,     9,    10,    11,    12,
+    13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
+    23,    24,    25,    71,    26,    92,    27,    28,   110,     0,
+     0,     0,     0,     0,    29,     0,     0,    30,    78,     0,
      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,    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
+     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,    29,
+     0,     0,    30,    42,    43,    44,    45,    46,    47,    48,
+    49,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,    29,     0,     0,    30,     6,     7,
+     8,     9,   111,    11,    12,    13,    14,    15,    16,    17,
+    18,    19,    20,    21,    22,    23,    24,    25,     0,    26,
+     0,    27,    28,     0,   247,   118,   119,   120,   121,   122,
+   123,   124,   125,   126,   127,   128,   129,   130,   131,   132,
+   133,   134,   135,   136,   137,   138,   139,   140,     0,     0,
+     0,     0,     0,     0,    29,     0,     0,    30
 };
 
 static const short yycheck[] = {     2,
-     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,
+     5,    95,    95,    24,   185,    69,     3,     4,     5,     6,
+     8,     9,    10,    11,    12,    13,    14,    15,    16,   149,
+     8,    19,    20,   239,   230,    22,    29,    24,    92,    26,
+    27,    22,   248,    21,   240,     8,     9,    10,    11,    12,
+    13,    14,    15,    16,    65,    60,    19,    20,    51,    52,
+   231,    58,    67,    53,     3,     4,     5,     6,    59,     3,
+     4,    59,    60,   193,    62,    65,    67,   112,   113,   114,
+    67,   201,   117,    22,    65,    24,    67,    26,    27,    24,
+    24,    84,    26,    27,    87,    88,    59,    60,    60,    62,
+    93,    22,    26,    27,    25,    67,    99,     8,     9,    10,
+    11,    12,    13,    14,    15,    16,    60,    60,    19,    20,
+    65,    67,    67,    67,    67,    23,   161,   162,   163,   164,
+    23,    29,   167,   168,   169,   170,   171,   130,   131,   132,
+   133,   134,   135,   136,   137,   138,   230,   230,   141,   142,
+   143,   186,    64,    22,    66,     4,   240,   240,    59,    28,
+   153,    62,   197,   198,   199,   200,    22,    61,    60,    60,
+    65,   206,    64,    64,   209,    65,    32,    33,    34,    64,
+    65,    61,    67,    62,   219,   220,    59,   222,    64,    65,
+    62,    67,   227,     3,     4,    63,    64,    63,   233,    64,
+   195,    63,    64,   238,    63,    64,    66,    65,    21,   244,
+   203,    64,    64,    64,   207,   208,    59,   210,   253,    21,
+    14,   256,     3,     4,     5,     6,     7,     8,     9,    10,
     11,    12,    13,    14,    15,    16,    17,    18,    19,    20,
-    21,    22,    61,    24,    65,    26,    27,     3,     4,     5,
+    21,    22,   235,    24,    14,    26,    27,     3,     4,     5,
      6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
-    16,    17,    18,    19,    20,    21,    22,    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,    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,
+    16,    17,    18,    19,    20,    21,    22,    64,    24,    64,
+    26,    27,    59,    65,    31,    64,    64,    59,    59,    64,
+    64,    62,    21,    66,    64,    66,     9,    10,    11,    12,
+    13,    14,    15,    16,    60,    64,    64,    60,     0,    64,
+    21,    21,    64,    59,     0,     2,    62,    63,     3,     4,
+     5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
+    15,    16,    17,    18,    19,    20,    21,    22,    34,    24,
+   153,    26,    27,     3,     4,     5,     6,     7,     8,     9,
+    10,    11,    12,    13,    14,    15,    16,    17,    18,    19,
+    20,    21,    22,    39,    24,    67,    26,    27,    92,    -1,
+    -1,    -1,    -1,    -1,    59,    -1,    -1,    62,    63,    -1,
     -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,    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
+    -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,     3,     4,
+     5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
+    15,    16,    17,    18,    19,    20,    21,    22,    -1,    24,
+    -1,    26,    27,    -1,    -1,    -1,    -1,    -1,    -1,    59,
+    -1,    -1,    62,     9,    10,    11,    12,    13,    14,    15,
+    16,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+    -1,    -1,    -1,    -1,    59,    -1,    -1,    62,     3,     4,
+     5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
+    15,    16,    17,    18,    19,    20,    21,    22,    -1,    24,
+    -1,    26,    27,    -1,    60,    35,    36,    37,    38,    39,
+    40,    41,    42,    43,    44,    45,    46,    47,    48,    49,
+    50,    51,    52,    53,    54,    55,    56,    57,    -1,    -1,
+    -1,    -1,    -1,    -1,    59,    -1,    -1,    62
 };
 /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
 #line 3 "/usr/dcs/software/supported/encap/bison-1.28/share/bison.simple"
@@ -1881,8 +1877,8 @@ case 110:
 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));
+    yyval.ValueList = yyvsp[-3].ValueList;
+    yyvsp[-3].ValueList->push_back(getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal));
   ;
     break;}
 case 113:
@@ -2050,6 +2046,33 @@ case 128:
     delete yyvsp[0].ConstVector;   // Free the vector...
   ;
     break;}
+case 129:
+#line 987 "llvmAsmParser.y"
+{
+    if (!yyvsp[-2].TypeVal->isPointerType())
+      ThrowException("Can't store to a nonpointer type: " + yyvsp[-2].TypeVal->getName());
+    const Type *ElTy = StoreInst::getIndexedType(yyvsp[-2].TypeVal, *yyvsp[0].ConstVector);
+    if (ElTy == 0)
+      ThrowException("Can't store into that field list!");
+    if (ElTy != yyvsp[-5].TypeVal)
+      ThrowException("Can't store '" + yyvsp[-5].TypeVal->getName() + "' into space of type '"+
+                    ElTy->getName() + "'!");
+    yyval.InstVal = new StoreInst(getVal(yyvsp[-5].TypeVal, yyvsp[-4].ValIDVal), getVal(yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal), *yyvsp[0].ConstVector);
+    delete yyvsp[0].ConstVector;
+  ;
+    break;}
+case 130:
+#line 999 "llvmAsmParser.y"
+{
+    if (!yyvsp[-2].TypeVal->isPointerType())
+      ThrowException("getelementptr insn requires pointer operand!");
+    if (!GetElementPtrInst::getIndexedType(yyvsp[-2].TypeVal, *yyvsp[0].ConstVector, true))
+      ThrowException("Can't get element ptr '" + yyvsp[-2].TypeVal->getName() + "'!");
+    yyval.InstVal = new GetElementPtrInst(getVal(yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal), *yyvsp[0].ConstVector);
+    delete yyvsp[0].ConstVector;
+    addConstValToConstantPool(new ConstPoolType(yyval.InstVal->getType()));
+  ;
+    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"
@@ -2272,7 +2295,7 @@ yyerrhandle:
     }
   return 1;
 }
-#line 988 "llvmAsmParser.y"
+#line 1009 "llvmAsmParser.y"
 
 int yyerror(const char *ErrorMsg) {
   ThrowException(string("Parse error: ") + ErrorMsg);
index ae665fc43259513026f35f6bd0f6a1b361684367..b4c0ee7c99bea8288953b608bfa3ec74edde6250 100644 (file)
@@ -78,13 +78,12 @@ typedef union {
 #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
+#define        GETELEMENTPTR   306
+#define        PHI     307
+#define        CALL    308
+#define        CAST    309
+#define        SHL     310
+#define        SHR     311
 
 
 extern YYSTYPE llvmAsmlval;
index af2ab106418f66d011c4caef07cc317339d05911..1b10042e03735451b0d7d88a0653d151f75752b4 100644 (file)
@@ -376,7 +376,7 @@ Module *RunVMAsmParser(const ToolCommandLine &Opts, FILE *F) {
 %type <MethodArgList> ArgList ArgListH
 %type <MethArgVal>    ArgVal
 %type <PHIList>       PHIList
-%type <ValueList>     ValueRefList ValueRefListE
+%type <ValueList>     ValueRefList ValueRefListE  // For call param lists
 %type <TypeList>      TypeList
 %type <JumpTable>     JumpTable
 
@@ -419,7 +419,7 @@ Module *RunVMAsmParser(const ToolCommandLine &Opts, FILE *F) {
 %token <BinaryOpVal> SETLE SETGE SETLT SETGT SETEQ SETNE  // Binary Comarators
 
 // Memory Instructions
-%token <MemoryOpVal> MALLOC ALLOCA FREE LOAD STORE GETFIELD PUTFIELD
+%token <MemoryOpVal> MALLOC ALLOCA FREE LOAD STORE GETELEMENTPTR
 
 // Other Operators
 %type  <OtherOpVal> ShiftOps
@@ -857,9 +857,9 @@ ValueRefList : Types ValueRef {    // Used for call statements...
     $$ = new list<Value*>();
     $$->push_back(getVal($1, $2));
   }
-  | ValueRefList ',' ValueRef {
+  | ValueRefList ',' Types ValueRef {
     $$ = $1;
-    $1->push_back(getVal($1->front()->getType(), $3));
+    $1->push_back(getVal($3, $4));
   }
 
 // ValueRefListE - Just like ValueRefList, except that it may also be empty!
@@ -984,6 +984,27 @@ MemoryInst : MALLOC Types {
     $$ = new LoadInst(getVal($2, $3), *$4);
     delete $4;   // Free the vector...
   }
+  | STORE Types ValueRef ',' Types ValueRef UByteList {
+    if (!$5->isPointerType())
+      ThrowException("Can't store to a nonpointer type: " + $5->getName());
+    const Type *ElTy = StoreInst::getIndexedType($5, *$7);
+    if (ElTy == 0)
+      ThrowException("Can't store into that field list!");
+    if (ElTy != $2)
+      ThrowException("Can't store '" + $2->getName() + "' into space of type '"+
+                    ElTy->getName() + "'!");
+    $$ = new StoreInst(getVal($2, $3), getVal($5, $6), *$7);
+    delete $7;
+  }
+  | GETELEMENTPTR Types ValueRef UByteList {
+    if (!$2->isPointerType())
+      ThrowException("getelementptr insn requires pointer operand!");
+    if (!GetElementPtrInst::getIndexedType($2, *$4, true))
+      ThrowException("Can't get element ptr '" + $2->getName() + "'!");
+    $$ = new GetElementPtrInst(getVal($2, $3), *$4);
+    delete $4;
+    addConstValToConstantPool(new ConstPoolType($$->getType()));
+  }
 
 %%
 int yyerror(const char *ErrorMsg) {
index 9dc5c6fc3dabdea5236aed50c98b304f11e7908a..3af40f2d8134876429951a58a411a86093c89642 100644 (file)
@@ -242,7 +242,8 @@ bool BytecodeParser::ParseInstruction(const uchar *&Buf, const uchar *EndBuf,
     Res = new FreeInst(V);
     return false;
 
-  case Instruction::Load: {
+  case Instruction::Load:
+  case Instruction::GetElementPtr: {
     vector<ConstPoolVal*> Idx;
     switch (Raw.NumOperands) {
     case 0: cerr << "Invalid load encountered!\n"; return true;
@@ -271,7 +272,39 @@ bool BytecodeParser::ParseInstruction(const uchar *&Buf, const uchar *EndBuf,
       delete Raw.VarArgs; 
       break;
     }
-    Res = new LoadInst(getValue(Raw.Ty, Raw.Arg1), Idx);
+    if (Raw.Opcode == Instruction::Load)
+      Res = new LoadInst(getValue(Raw.Ty, Raw.Arg1), Idx);
+    else if (Raw.Opcode == Instruction::GetElementPtr)
+      Res = new GetElementPtrInst(getValue(Raw.Ty, Raw.Arg1), Idx);
+    else
+      abort();
+    return false;
+  }
+  case Instruction::Store: {
+    vector<ConstPoolVal*> Idx;
+    switch (Raw.NumOperands) {
+    case 0: 
+    case 1: cerr << "Invalid store encountered!\n"; return true;
+    case 2: break;
+    case 3: V = getValue(Type::UByteTy, Raw.Arg3);
+            if (!V->isConstant()) return true;
+            Idx.push_back(V->castConstant());
+            break;
+    default:
+      vector<unsigned> &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;
+    }
+
+    const Type *ElType = StoreInst::getIndexedType(Raw.Ty, Idx);
+    if (ElType == 0) return true;
+    Res = new StoreInst(getValue(ElType, Raw.Arg1), getValue(Raw.Ty, Raw.Arg2),
+                       Idx);
     return false;
   }
   }  // end switch(Raw.Opcode) 
index 34d95682bfe2af32b1f0ce38cac156bae14a1804..73969e65df7fb0d4b31e3cbf5f3cfefabc0b3102 100644 (file)
@@ -135,10 +135,19 @@ bool BytecodeWriter::processInstruction(const Instruction *I) {
   // the first param is actually interesting).  But if we have no arguments
   // we take the type of the instruction itself.  
   //
-  const Type *Ty = NumOperands ? I->getOperand(0)->getType() : I->getType();
-  if (I->getOpcode() == Instruction::Malloc || 
-      I->getOpcode() == Instruction::Alloca)
+  const Type *Ty;
+  switch (I->getOpcode()) {
+  case Instruction::Malloc:
+  case Instruction::Alloca:
     Ty = I->getType();  // Malloc & Alloca ALWAYS want to encode the return type
+    break;
+  case Instruction::Store:
+    Ty = I->getOperand(1)->getType();  // Encode the pointer type...
+    break;
+  default:              // Otherwise use the default behavior...
+    Ty = NumOperands ? I->getOperand(0)->getType() : I->getType();
+    break;
+  }
 
   unsigned Type;
   int Slot = Table.getValSlot(Ty);
@@ -184,8 +193,8 @@ bool BytecodeWriter::processInstruction(const Instruction *I) {
     break;
   }
 
-  // If we weren't handled before here, we either have a large number of operands
-  // or a large operand index that we are refering to.
+  // If we weren't handled before here, we either have a large number of
+  // operands or a large operand index that we are refering to.
   outputInstructionFormat0(I, Table, Type, Out);
   return false;
 }
index 5ae2cf9761c88842118c7eaeb251a63f23de0df7..0b272f0bb57e48370a6b140fee6e2f291caa194c 100644 (file)
@@ -208,6 +208,7 @@ const MethodType *MethodType::getMethodType(const Type *ReturnType,
 
 const ArrayType *ArrayType::getArrayType(const Type *ElementType, 
                                         int NumElements = -1) {
+  assert(ElementType && "Can't get array of null types!");
   static vector<const ArrayType*> ExistingTypesCache;
 
   // Search cache for value...
@@ -287,6 +288,7 @@ const StructType *StructType::getStructType(const ElementTypes &ETypes) {
 
 
 const PointerType *PointerType::getPointerType(const Type *ValueType) {
+  assert(ValueType && "Can't get a pointer to <null> type!");
   static vector<const PointerType*> ExistingTypesCache;
 
   // Search cache for value...
index 41c14b04d55b4d22e75680c49bd58f32570ea8de..4403224b880e0c5bbc72f8f86696f363e9fe6cf2 100644 (file)
@@ -7,8 +7,19 @@
 #include "llvm/iMemory.h"
 #include "llvm/ConstPoolVals.h"
 
-const Type *LoadInst::getIndexedType(const Type *Ptr, 
-                                    const vector<ConstPoolVal*> &Idx) {
+//===----------------------------------------------------------------------===//
+//                        MemAccessInst Implementation
+//===----------------------------------------------------------------------===//
+
+// 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.
+//
+const Type *MemAccessInst::getIndexedType(const Type *Ptr, 
+                                         const vector<ConstPoolVal*> &Idx,
+                                         bool AllowStructLeaf = false) {
   if (!Ptr->isPointerType()) return 0;   // Type isn't a pointer type!
  
   // Get the type pointed to...
@@ -17,7 +28,8 @@ const Type *LoadInst::getIndexedType(const Type *Ptr,
   if (Ptr->isStructType()) {
     unsigned CurIDX = 0;
     while (Ptr->isStructType()) {
-      if (Idx.size() == CurIDX) return 0;       // Can't load a whole structure!
+      if (Idx.size() == CurIDX) 
+       return AllowStructLeaf ? Ptr : 0;   // Can't load a whole structure!?!?
       if (Idx[CurIDX]->getType() != Type::UByteTy) return 0; // Illegal idx
       unsigned NextIdx = ((ConstPoolUInt*)Idx[CurIDX++])->getValue();
       
@@ -33,11 +45,49 @@ const Type *LoadInst::getIndexedType(const Type *Ptr,
 }
 
 
+//===----------------------------------------------------------------------===//
+//                           LoadInst Implementation
+//===----------------------------------------------------------------------===//
+
 LoadInst::LoadInst(Value *Ptr, const vector<ConstPoolVal*> &Idx,
                   const string &Name = "")
-  : Instruction(getIndexedType(Ptr->getType(), Idx), Load, Name) {
+  : MemAccessInst(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));
+}
+
+
+//===----------------------------------------------------------------------===//
+//                           StoreInst Implementation
+//===----------------------------------------------------------------------===//
+
+StoreInst::StoreInst(Value *Val, Value *Ptr, const vector<ConstPoolVal*> &Idx,
+                    const string &Name = "")
+  : MemAccessInst(Type::VoidTy, Store, Name) {
+  assert(getIndexedType(Ptr->getType(), Idx) && "Store operands invalid!");
+  
+  Operands.reserve(2+Idx.size());
+  Operands.push_back(Use(Val, this));
+  Operands.push_back(Use(Ptr, this));
+
+  for (unsigned i = 0, E = Idx.size(); i != E; ++i)
+    Operands.push_back(Use(Idx[i], this));
+}
+
+
+//===----------------------------------------------------------------------===//
+//                       GetElementPtrInst Implementation
+//===----------------------------------------------------------------------===//
+
+GetElementPtrInst::GetElementPtrInst(Value *Ptr, 
+                                    const vector<ConstPoolVal*> &Idx,
+                                    const string &Name = "")
+  : MemAccessInst(PointerType::getPointerType(getIndexedType(Ptr->getType(), Idx, true)), GetElementPtr, Name) {
+  assert(getIndexedType(Ptr->getType(), Idx, true) && "gep operands invalid!");
   Operands.reserve(1+Idx.size());
   Operands.push_back(Use(Ptr, this));