[llvm-commits] CVS: llvm/lib/Bytecode/Reader/InstructionReader.cpp Reader.cpp ReaderInternals.h
Chris Lattner
lattner at cs.uiuc.edu
Thu Oct 9 15:46:01 PDT 2003
Changes in directory llvm/lib/Bytecode/Reader:
InstructionReader.cpp updated: 1.56 -> 1.57
Reader.cpp updated: 1.76 -> 1.77
ReaderInternals.h updated: 1.55 -> 1.56
---
Log message:
Pass a vector around to reduce dynamic allocation
Throw the RawInst class in an anon namespace
---
Diffs of the changes: (+17 -13)
Index: llvm/lib/Bytecode/Reader/InstructionReader.cpp
diff -u llvm/lib/Bytecode/Reader/InstructionReader.cpp:1.56 llvm/lib/Bytecode/Reader/InstructionReader.cpp:1.57
--- llvm/lib/Bytecode/Reader/InstructionReader.cpp:1.56 Thu Oct 9 15:22:47 2003
+++ llvm/lib/Bytecode/Reader/InstructionReader.cpp Thu Oct 9 15:45:42 2003
@@ -14,15 +14,16 @@
#include "llvm/iPHINode.h"
#include "llvm/iOther.h"
-struct RawInst { // The raw fields out of the bytecode stream...
- unsigned NumOperands;
- unsigned Opcode;
- unsigned Type;
-
- RawInst(const unsigned char *&Buf, const unsigned char *EndBuf,
- std::vector<unsigned> &Args);
-
-};
+namespace {
+ struct RawInst { // The raw fields out of the bytecode stream...
+ unsigned NumOperands;
+ unsigned Opcode;
+ unsigned Type;
+
+ RawInst(const unsigned char *&Buf, const unsigned char *EndBuf,
+ std::vector<unsigned> &Args);
+ };
+}
@@ -102,8 +103,9 @@
Instruction *BytecodeParser::ParseInstruction(const unsigned char *&Buf,
- const unsigned char *EndBuf) {
- std::vector<unsigned> Args;
+ const unsigned char *EndBuf,
+ std::vector<unsigned> &Args) {
+ Args.clear();
RawInst RI(Buf, EndBuf, Args);
const Type *InstTy = getType(RI.Type);
Index: llvm/lib/Bytecode/Reader/Reader.cpp
diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.76 llvm/lib/Bytecode/Reader/Reader.cpp:1.77
--- llvm/lib/Bytecode/Reader/Reader.cpp:1.76 Thu Oct 9 15:41:16 2003
+++ llvm/lib/Bytecode/Reader/Reader.cpp Thu Oct 9 15:45:42 2003
@@ -200,7 +200,8 @@
BB = ParsedBasicBlocks[BlockNo];
while (Buf < EndBuf) {
- Instruction *Inst = ParseInstruction(Buf, EndBuf);
+ std::vector<unsigned> Args;
+ Instruction *Inst = ParseInstruction(Buf, EndBuf, Args);
insertValue(Inst, Values);
BB->getInstList().push_back(Inst);
BCR_TRACE(4, Inst);
Index: llvm/lib/Bytecode/Reader/ReaderInternals.h
diff -u llvm/lib/Bytecode/Reader/ReaderInternals.h:1.55 llvm/lib/Bytecode/Reader/ReaderInternals.h:1.56
--- llvm/lib/Bytecode/Reader/ReaderInternals.h:1.55 Thu Oct 9 15:22:47 2003
+++ llvm/lib/Bytecode/Reader/ReaderInternals.h Thu Oct 9 15:45:42 2003
@@ -149,7 +149,8 @@
unsigned BlockNo);
Instruction *ParseInstruction(const unsigned char *&Buf,
- const unsigned char *End);
+ const unsigned char *End,
+ std::vector<unsigned> &Args);
void ParseConstantPool(const unsigned char *&Buf, const unsigned char *EndBuf,
ValueTable &Tab, TypeValuesListTy &TypeTab);
More information about the llvm-commits
mailing list