diff options
author | Chris Lattner <sabre@nondot.org> | 2001-09-07 16:39:41 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2001-09-07 16:39:41 +0000 |
commit | e8fdde179d610ad4452b0cbed67d17b78ace4e38 (patch) | |
tree | 9d1a9aa711ecf3cd9e1f2736f02e407854a07f93 /lib/Bytecode/Writer/WriterInternals.h | |
parent | 1d670cc40299cb51198c58f9c0c97a9b54248760 (diff) | |
download | external_llvm-e8fdde179d610ad4452b0cbed67d17b78ace4e38.tar.gz external_llvm-e8fdde179d610ad4452b0cbed67d17b78ace4e38.tar.bz2 external_llvm-e8fdde179d610ad4452b0cbed67d17b78ace4e38.zip |
* Emit bytecode using a deque instead of a vector to be faster
* Internal rep no longer has a constant pool
* Support emission of recursive types
* Don't output a constant pool for an external method
* The bytecode writer is no longer a module analyzer
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@449 91177308-0d34-0410-b5e6-96231b3b80d8
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 } |