diff options
author | Chris Lattner <sabre@nondot.org> | 2001-07-08 23:22:50 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2001-07-08 23:22:50 +0000 |
commit | ab5ac6bb384ec1e4f1cbc4e0ad0fb32d39eb7ff3 (patch) | |
tree | 1f05b07519bbc5138edde0c8dc04302c47d1f987 | |
parent | 0bd654a049490a56b6c39f56acf7c8e634085c23 (diff) |
Implementation of Store & GetElementPtr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/Instruction.h | 3 | ||||
-rw-r--r-- | include/llvm/iMemory.h | 95 | ||||
-rw-r--r-- | lib/AsmParser/Lexer.cpp | 370 | ||||
-rw-r--r-- | lib/AsmParser/Lexer.l | 3 | ||||
-rw-r--r-- | lib/AsmParser/llvmAsmParser.cpp | 475 | ||||
-rw-r--r-- | lib/AsmParser/llvmAsmParser.h | 13 | ||||
-rw-r--r-- | lib/AsmParser/llvmAsmParser.y | 29 | ||||
-rw-r--r-- | lib/Bytecode/Reader/InstructionReader.cpp | 37 | ||||
-rw-r--r-- | lib/Bytecode/Writer/InstructionWriter.cpp | 19 | ||||
-rw-r--r-- | lib/VMCore/Type.cpp | 2 | ||||
-rw-r--r-- | lib/VMCore/iMemory.cpp | 60 |
11 files changed, 655 insertions, 451 deletions
diff --git a/include/llvm/Instruction.h b/include/llvm/Instruction.h index cce9662122..031730a975 100644 --- a/include/llvm/Instruction.h +++ b/include/llvm/Instruction.h @@ -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 }; diff --git a/include/llvm/iMemory.h b/include/llvm/iMemory.h index dc8d759236..feed3a2f88 100644 --- a/include/llvm/iMemory.h +++ b/include/llvm/iMemory.h @@ -11,6 +11,13 @@ #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 diff --git a/lib/AsmParser/Lexer.cpp b/lib/AsmParser/Lexer.cpp index 8773b8471e..09d9e515fb 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 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" diff --git a/lib/AsmParser/Lexer.l b/lib/AsmParser/Lexer.l index c0bd75cf79..91fc1b69c9 100644 --- a/lib/AsmParser/Lexer.l +++ b/lib/AsmParser/Lexer.l @@ -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; } diff --git a/lib/AsmParser/llvmAsmParser.cpp b/lib/AsmParser/llvmAsmParser.cpp index 5d384ec56e..95b9721995 100644 --- a/lib/AsmParser/llvmAsmParser.cpp +++ b/lib/AsmParser/llvmAsmParser.cpp @@ -60,13 +60,12 @@ #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, |