diff options
Diffstat (limited to 'lib/Bytecode/Reader')
-rw-r--r-- | lib/Bytecode/Reader/InstructionReader.cpp | 18 | ||||
-rw-r--r-- | lib/Bytecode/Reader/ReaderInternals.h | 7 |
2 files changed, 11 insertions, 14 deletions
diff --git a/lib/Bytecode/Reader/InstructionReader.cpp b/lib/Bytecode/Reader/InstructionReader.cpp index fd919c92a2..dac7d37415 100644 --- a/lib/Bytecode/Reader/InstructionReader.cpp +++ b/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; } diff --git a/lib/Bytecode/Reader/ReaderInternals.h b/lib/Bytecode/Reader/ReaderInternals.h index 3bb0472674..fffcdb83c7 100644 --- a/lib/Bytecode/Reader/ReaderInternals.h +++ b/lib/Bytecode/Reader/ReaderInternals.h @@ -94,16 +94,9 @@ public: struct InstPlaceHolderHelper : public Instruction { InstPlaceHolderHelper(const Type *Ty) : Instruction(Ty, UserOp1, "") {} - inline virtual void dropAllReferences() {} virtual string getOpcode() const { return "placeholder"; } virtual Instruction *clone() const { abort(); return 0; } - - // No "operands"... - virtual Value *getOperand(unsigned i) { return 0; } - virtual const Value *getOperand(unsigned i) const { return 0; } - virtual bool setOperand(unsigned i, Value *Val) { return false; } - virtual unsigned getNumOperands() const { return 0; } }; struct BBPlaceHolderHelper : public BasicBlock { |