diff options
Diffstat (limited to 'courgette/assembly_program.h')
-rw-r--r-- | courgette/assembly_program.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/courgette/assembly_program.h b/courgette/assembly_program.h index e726f81..f7429201 100644 --- a/courgette/assembly_program.h +++ b/courgette/assembly_program.h @@ -12,12 +12,16 @@ #include "base/basictypes.h" #include "courgette/image_info.h" +#include "courgette/memory_allocator.h" namespace courgette { class EncodedProgram; class Instruction; +typedef std::vector<Instruction*, MemoryAllocator<Instruction*> > + InstructionVector; + // A Label is a symbolic reference to an address. Unlike a conventional // assembly language, we always know the address. The address will later be // stored in a table and the Label will be replaced with the index into the @@ -89,7 +93,7 @@ class AssemblyProgram { EncodedProgram* Encode() const; // Accessor for instruction list. - const std::vector<Instruction*>& instructions() const { + const InstructionVector& instructions() const { return instructions_; } @@ -101,7 +105,6 @@ class AssemblyProgram { // otherwise returns NULL. Label* InstructionRel32Label(const Instruction* instruction) const; - private: void Emit(Instruction* instruction) { instructions_.push_back(instruction); } @@ -118,7 +121,7 @@ class AssemblyProgram { uint64 image_base_; // Desired or mandated base address of image. - std::vector<Instruction*> instructions_; // All the instructions in program. + InstructionVector instructions_; // All the instructions in program. // These are lookup maps to find the label associated with a given address. // We have separate label spaces for addresses referenced by rel32 labels and |