diff options
author | Chris Lattner <sabre@nondot.org> | 2006-05-02 18:27:26 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-05-02 18:27:26 +0000 |
commit | 43b429b05989075b60693d57395c99b0ad789f8d (patch) | |
tree | f2dd7751b959984c5583189487fbd5bb0ff3caf9 /lib/CodeGen/ELFWriter.cpp | |
parent | 426cd7c25fc3f5d064f9e88af0ecad26c836135a (diff) |
Refactor the machine code emitter interface to pull the pointers for the current
code emission location into the base class, instead of being in the derived classes.
This change means that low-level methods like emitByte/emitWord now are no longer
virtual (yaay for speed), and we now have a framework to support growable code
segments. This implements feature request #1 of PR469.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28059 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/ELFWriter.cpp')
-rw-r--r-- | lib/CodeGen/ELFWriter.cpp | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/lib/CodeGen/ELFWriter.cpp b/lib/CodeGen/ELFWriter.cpp index a802c1aa79..c03b6272b5 100644 --- a/lib/CodeGen/ELFWriter.cpp +++ b/lib/CodeGen/ELFWriter.cpp @@ -56,24 +56,12 @@ namespace llvm { ELFCodeEmitter(ELFWriter &ew) : EW(ew), OutBuffer(0) {} void startFunction(MachineFunction &F); - void finishFunction(MachineFunction &F); + bool finishFunction(MachineFunction &F); void emitConstantPool(MachineConstantPool *MCP) { if (MCP->isEmpty()) return; assert(0 && "unimp"); } - virtual void emitByte(unsigned char B) { - OutBuffer->push_back(B); - } - virtual void emitWord(unsigned W) { - assert(0 && "ni"); - } - virtual uint64_t getCurrentPCValue() { - return OutBuffer->size(); - } - virtual uint64_t getCurrentPCOffset() { - return OutBuffer->size()-FnStart; - } void addRelocation(const MachineRelocation &MR) { assert(0 && "relo not handled yet!"); } @@ -113,6 +101,10 @@ void ELFCodeEmitter::startFunction(MachineFunction &F) { ELFWriter::ELFSection::SHF_EXECINSTR | ELFWriter::ELFSection::SHF_ALLOC); OutBuffer = &ES->SectionData; + std::cerr << "FIXME: This code needs to be updated for changes in the" + << " CodeEmitter interfaces. In particular, this should set " + << "BufferBegin/BufferEnd/CurBufferPtr, not deal with OutBuffer!"; + abort(); // Upgrade the section alignment if required. if (ES->Align < Align) ES->Align = Align; @@ -127,7 +119,7 @@ void ELFCodeEmitter::startFunction(MachineFunction &F) { /// finishFunction - This callback is invoked after the function is completely /// finished. -void ELFCodeEmitter::finishFunction(MachineFunction &F) { +bool ELFCodeEmitter::finishFunction(MachineFunction &F) { // We now know the size of the function, add a symbol to represent it. ELFWriter::ELFSym FnSym(F.getFunction()); @@ -157,6 +149,7 @@ void ELFCodeEmitter::finishFunction(MachineFunction &F) { // Finally, add it to the symtab. EW.SymbolTable.push_back(FnSym); + return false; } //===----------------------------------------------------------------------===// |