mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-07 12:28:24 +00:00
Clean up code, no functionality changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22382 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -40,7 +40,13 @@
|
||||
#include "llvm/Support/Mangler.h"
|
||||
using namespace llvm;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// ELFCodeEmitter Implementation
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace llvm {
|
||||
/// ELFCodeEmitter - This class is used by the ELFWriter to emit the code for
|
||||
/// functions to the ELF file.
|
||||
class ELFCodeEmitter : public MachineCodeEmitter {
|
||||
ELFWriter &EW;
|
||||
std::vector<unsigned char> &OutputBuffer;
|
||||
@@ -48,7 +54,51 @@ namespace llvm {
|
||||
public:
|
||||
ELFCodeEmitter(ELFWriter &ew) : EW(ew), OutputBuffer(EW.OutputBuffer) {}
|
||||
|
||||
void startFunction(MachineFunction &F) {
|
||||
void startFunction(MachineFunction &F);
|
||||
void finishFunction(MachineFunction &F);
|
||||
|
||||
void emitConstantPool(MachineConstantPool *MCP) {
|
||||
if (MCP->isEmpty()) return;
|
||||
assert(0 && "unimp");
|
||||
}
|
||||
virtual void emitByte(unsigned char B) {
|
||||
OutputBuffer.push_back(B);
|
||||
}
|
||||
virtual void emitWordAt(unsigned W, unsigned *Ptr) {
|
||||
assert(0 && "ni");
|
||||
}
|
||||
virtual void emitWord(unsigned W) {
|
||||
assert(0 && "ni");
|
||||
}
|
||||
virtual uint64_t getCurrentPCValue() {
|
||||
return OutputBuffer.size();
|
||||
}
|
||||
virtual uint64_t getCurrentPCOffset() {
|
||||
return OutputBuffer.size()-FnStart;
|
||||
}
|
||||
void addRelocation(const MachineRelocation &MR) {
|
||||
assert(0 && "relo not handled yet!");
|
||||
}
|
||||
virtual uint64_t getConstantPoolEntryAddress(unsigned Index) {
|
||||
assert(0 && "CP not implementated yet!");
|
||||
}
|
||||
|
||||
/// JIT SPECIFIC FUNCTIONS - DO NOT IMPLEMENT THESE HERE!
|
||||
void startFunctionStub(unsigned StubSize) {
|
||||
assert(0 && "JIT specific function called!");
|
||||
abort();
|
||||
}
|
||||
void *finishFunctionStub(const Function *F) {
|
||||
assert(0 && "JIT specific function called!");
|
||||
abort();
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/// startFunction - This callback is invoked when a new machine function is
|
||||
/// about to be emitted.
|
||||
void ELFCodeEmitter::startFunction(MachineFunction &F) {
|
||||
// Align the output buffer to the appropriate alignment.
|
||||
unsigned Align = 16; // FIXME: GENERICIZE!!
|
||||
ELFWriter::ELFSection &TextSection = EW.SectionList.back();
|
||||
@@ -67,7 +117,10 @@ namespace llvm {
|
||||
|
||||
FnStart = OutputBuffer.size();
|
||||
}
|
||||
void finishFunction(MachineFunction &F) {
|
||||
|
||||
/// finishFunction - This callback is invoked after the function is completely
|
||||
/// finished.
|
||||
void ELFCodeEmitter::finishFunction(MachineFunction &F) {
|
||||
// We now know the size of the function, add a symbol to represent it.
|
||||
ELFWriter::ELFSym FnSym(F.getFunction());
|
||||
|
||||
@@ -98,44 +151,9 @@ namespace llvm {
|
||||
EW.SymbolTable.push_back(FnSym);
|
||||
}
|
||||
|
||||
void emitConstantPool(MachineConstantPool *MCP) {
|
||||
if (MCP->isEmpty()) return;
|
||||
assert(0 && "unimp");
|
||||
}
|
||||
virtual void emitByte(unsigned char B) {
|
||||
OutputBuffer.push_back(B);
|
||||
}
|
||||
virtual void emitWordAt(unsigned W, unsigned *Ptr) {
|
||||
assert(0 && "ni");
|
||||
}
|
||||
virtual void emitWord(unsigned W) {
|
||||
assert(0 && "ni");
|
||||
}
|
||||
virtual uint64_t getCurrentPCValue() {
|
||||
return OutputBuffer.size();
|
||||
}
|
||||
virtual uint64_t getCurrentPCOffset() {
|
||||
return OutputBuffer.size()-FnStart;
|
||||
}
|
||||
void addRelocation(const MachineRelocation &MR) {
|
||||
assert(0 && "relo not handled yet!");
|
||||
}
|
||||
virtual uint64_t getConstantPoolEntryAddress(unsigned Index) {
|
||||
assert(0 && "CP not implementated yet!");
|
||||
}
|
||||
/// JIT SPECIFIC FUNCTIONS
|
||||
void startFunctionStub(unsigned StubSize) {
|
||||
assert(0 && "JIT specific function called!");
|
||||
abort();
|
||||
}
|
||||
void *finishFunctionStub(const Function *F) {
|
||||
assert(0 && "JIT specific function called!");
|
||||
abort();
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// ELFWriter Implementation
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
ELFWriter::ELFWriter(std::ostream &o, TargetMachine &tm) : O(o), TM(tm) {
|
||||
e_machine = 0; // e_machine defaults to 'No Machine'
|
||||
|
Reference in New Issue
Block a user