diff options
| author | Chris Lattner <sabre@nondot.org> | 2001-07-07 08:36:50 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2001-07-07 08:36:50 +0000 |
| commit | a073acb22d6262e40bef357279fd61ab0ef8b642 (patch) | |
| tree | b9a1ef2336895d1d3d250a339370d84b6b99f8d1 /llvm/lib/Bytecode/Reader/InstructionReader.cpp | |
| parent | 37099990b3d340de8cfa635cd8559ef79e8b2c5f (diff) | |
| download | bcm5719-llvm-a073acb22d6262e40bef357279fd61ab0ef8b642.tar.gz bcm5719-llvm-a073acb22d6262e40bef357279fd61ab0ef8b642.zip | |
Changed the fundemental architecture of Operands for Instructions. Now
Operands are maintained as a vector<Use> in the User class, and operator
iterators are provided as before. Getting an operand no longer requires
a virtual function call.
WARNING: getOperand(x) where x >= getNumOperands() will now assert instead
of returning null!
llvm-svn: 149
Diffstat (limited to 'llvm/lib/Bytecode/Reader/InstructionReader.cpp')
| -rw-r--r-- | llvm/lib/Bytecode/Reader/InstructionReader.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/llvm/lib/Bytecode/Reader/InstructionReader.cpp b/llvm/lib/Bytecode/Reader/InstructionReader.cpp index fd919c92a26..dac7d374158 100644 --- a/llvm/lib/Bytecode/Reader/InstructionReader.cpp +++ b/llvm/lib/Bytecode/Reader/InstructionReader.cpp @@ -80,8 +80,11 @@ bool BytecodeParser::ParseRawInst(const uchar *&Buf, const uchar *EndBuf, break; } - //cerr << "NO: " << Result.NumOperands << " opcode: " << Result.Opcode - // << " Ty: " << Result.Ty->getName() << " arg1: " << Result.Arg1 << endl; +#if 0 + cerr << "NO: " << Result.NumOperands << " opcode: " << Result.Opcode + << " Ty: " << Result.Ty->getName() << " arg1: " << Result.Arg1 + << " arg2: " << Result.Arg2 << " arg3: " << Result.Arg3 << endl; +#endif return false; } @@ -198,13 +201,13 @@ bool BytecodeParser::ParseInstruction(const uchar *&Buf, const uchar *EndBuf, return false; } else if (Raw.Opcode == Instruction::Malloc) { if (Raw.NumOperands > 2) return true; - Value *Sz = (Raw.NumOperands == 2) ? getValue(Type::UIntTy, Raw.Arg2) : 0; - Res = new MallocInst((ConstPoolType*)getValue(Type::TypeTy, Raw.Arg1), Sz); + Value *Sz = Raw.NumOperands ? getValue(Type::UIntTy, Raw.Arg1) : 0; + Res = new MallocInst(Raw.Ty, Sz); return false; } else if (Raw.Opcode == Instruction::Alloca) { if (Raw.NumOperands > 2) return true; - Value *Sz = (Raw.NumOperands == 2) ? getValue(Type::UIntTy, Raw.Arg2) : 0; - Res = new AllocaInst((ConstPoolType*)getValue(Type::TypeTy, Raw.Arg1), Sz); + Value *Sz = Raw.NumOperands ? getValue(Type::UIntTy, Raw.Arg1) : 0; + Res = new AllocaInst(Raw.Ty, Sz); return false; } else if (Raw.Opcode == Instruction::Free) { Value *Val = getValue(Raw.Ty, Raw.Arg1); @@ -213,6 +216,7 @@ bool BytecodeParser::ParseInstruction(const uchar *&Buf, const uchar *EndBuf, return false; } - cerr << "Unrecognized instruction! " << Raw.Opcode << endl; + cerr << "Unrecognized instruction! " << Raw.Opcode + << " ADDR = 0x" << (void*)Buf << endl; return true; } |

