mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-13 14:35:54 +00:00
Pass a vector around to reduce dynamic allocation
Throw the RawInst class in an anon namespace llvm-svn: 8990
This commit is contained in:
parent
b876f55b76
commit
85f5b18995
@ -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 @@ RawInst::RawInst(const unsigned char *&Buf, const unsigned char *EndBuf,
|
||||
|
||||
|
||||
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);
|
||||
|
||||
|
@ -200,7 +200,8 @@ BasicBlock *BytecodeParser::ParseBasicBlock(const unsigned char *&Buf,
|
||||
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);
|
||||
|
@ -149,7 +149,8 @@ private:
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user