diff options
Diffstat (limited to 'lib/Bytecode/Writer/WriterInternals.h')
-rw-r--r-- | lib/Bytecode/Writer/WriterInternals.h | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/lib/Bytecode/Writer/WriterInternals.h b/lib/Bytecode/Writer/WriterInternals.h index 41f0b4de75..ff49c1d7fb 100644 --- a/lib/Bytecode/Writer/WriterInternals.h +++ b/lib/Bytecode/Writer/WriterInternals.h @@ -14,22 +14,22 @@ #include "llvm/Bytecode/Writer.h" #include "llvm/Bytecode/Format.h" -#include "llvm/Bytecode/Primitives.h" #include "llvm/Analysis/SlotCalculator.h" -#include "llvm/Support/DataTypes.h" +#include "llvm/Bytecode/Primitives.h" #include "llvm/Instruction.h" +#include <deque> -class BytecodeWriter : public ModuleAnalyzer { - vector<unsigned char> &Out; +class BytecodeWriter { + deque<unsigned char> &Out; SlotCalculator Table; public: - BytecodeWriter(vector<unsigned char> &o, const Module *M); + BytecodeWriter(deque<unsigned char> &o, const Module *M); protected: - virtual bool processConstPool(const ConstantPool &CP, bool isMethod); - virtual bool processMethod(const Method *M); - virtual bool processBasicBlock(const BasicBlock *BB); - virtual bool processInstruction(const Instruction *I); + void outputConstants(bool isMethod); + void processMethod(const Method *M); + void processBasicBlock(const BasicBlock *BB); + void processInstruction(const Instruction *I); private : inline void outputSignature() { @@ -51,12 +51,12 @@ private : // class BytecodeBlock { unsigned Loc; - vector<unsigned char> &Out; + deque<unsigned char> &Out; BytecodeBlock(const BytecodeBlock &); // do not implement void operator=(const BytecodeBlock &); // do not implement public: - inline BytecodeBlock(unsigned ID, vector<unsigned char> &o) : Out(o) { + inline BytecodeBlock(unsigned ID, deque<unsigned char> &o) : Out(o) { output(ID, Out); output((unsigned)0, Out); // Reserve the space for the block size... Loc = Out.size(); @@ -64,7 +64,8 @@ public: inline ~BytecodeBlock() { // Do backpatch when block goes out // of scope... - // cerr << "OldLoc = " << Loc << " NewLoc = " << NewLoc << " diff = " << (NewLoc-Loc) << endl; + //cerr << "OldLoc = " << Loc << " NewLoc = " << NewLoc << " diff = " + // << (NewLoc-Loc) << endl; output((unsigned)(Out.size()-Loc), Out, (int)Loc-4); align32(Out); // Blocks must ALWAYS be aligned } |