freebsd-dev/lib/CodeGen/ELFCodeEmitter.h

79 lines
2.4 KiB
C
Raw Normal View History

//===-- lib/CodeGen/ELFCodeEmitter.h ----------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef ELFCODEEMITTER_H
#define ELFCODEEMITTER_H
2009-10-14 17:57:32 +00:00
#include "llvm/CodeGen/ObjectCodeEmitter.h"
#include <vector>
namespace llvm {
2009-07-04 13:58:26 +00:00
class ELFWriter;
class ELFSection;
/// ELFCodeEmitter - This class is used by the ELFWriter to
/// emit the code for functions to the ELF file.
2009-10-14 17:57:32 +00:00
class ELFCodeEmitter : public ObjectCodeEmitter {
ELFWriter &EW;
/// Target machine description
TargetMachine &TM;
/// Section containing code for functions
ELFSection *ES;
2009-10-14 17:57:32 +00:00
/// Relocations - Record relocations needed by the current function
std::vector<MachineRelocation> Relocations;
2009-10-14 17:57:32 +00:00
/// JTRelocations - Record relocations needed by the relocation
/// section.
std::vector<MachineRelocation> JTRelocations;
2009-06-27 10:44:33 +00:00
2009-10-14 17:57:32 +00:00
/// FnStartPtr - Function offset from the beginning of ELFSection 'ES'
uintptr_t FnStartOff;
public:
2009-10-14 17:57:32 +00:00
explicit ELFCodeEmitter(ELFWriter &ew) : EW(ew), TM(EW.TM) {}
2009-10-14 17:57:32 +00:00
/// addRelocation - Register new relocations for this function
void addRelocation(const MachineRelocation &MR) {
Relocations.push_back(MR);
}
2009-10-14 17:57:32 +00:00
/// emitConstantPool - For each constant pool entry, figure out which
/// section the constant should live in and emit data to it
void emitConstantPool(MachineConstantPool *MCP);
2009-10-14 17:57:32 +00:00
/// emitJumpTables - Emit all the jump tables for a given jump table
/// info and record them to the appropriate section.
void emitJumpTables(MachineJumpTableInfo *MJTI);
2009-06-27 10:44:33 +00:00
2009-10-14 17:57:32 +00:00
void startFunction(MachineFunction &F);
bool finishFunction(MachineFunction &F);
2009-10-14 17:57:32 +00:00
/// emitLabel - Emits a label
2010-03-16 16:51:38 +00:00
virtual void emitLabel(MCSymbol *Label) {
2009-10-14 17:57:32 +00:00
assert("emitLabel not implemented");
}
2009-10-14 17:57:32 +00:00
/// getLabelAddress - Return the address of the specified LabelID,
/// only usable after the LabelID has been emitted.
2010-03-16 16:51:38 +00:00
virtual uintptr_t getLabelAddress(MCSymbol *Label) const {
2009-10-14 17:57:32 +00:00
assert("getLabelAddress not implemented");
return 0;
}
2009-07-04 13:58:26 +00:00
virtual void setModuleInfo(llvm::MachineModuleInfo* MMI) {}
}; // end class ELFCodeEmitter
} // end namespace llvm
#endif