summaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/ELFCodeEmitter.h
diff options
context:
space:
mode:
authorrdivacky <rdivacky@FreeBSD.org>2009-10-14 17:57:32 +0000
committerrdivacky <rdivacky@FreeBSD.org>2009-10-14 17:57:32 +0000
commitcd749a9c07f1de2fb8affde90537efa4bc3e7c54 (patch)
treeb21f6de4e08b89bb7931806bab798fc2a5e3a686 /lib/CodeGen/ELFCodeEmitter.h
parent72621d11de5b873f1695f391eb95f0b336c3d2d4 (diff)
downloadFreeBSD-src-cd749a9c07f1de2fb8affde90537efa4bc3e7c54.zip
FreeBSD-src-cd749a9c07f1de2fb8affde90537efa4bc3e7c54.tar.gz
Update llvm to r84119.
Diffstat (limited to 'lib/CodeGen/ELFCodeEmitter.h')
-rw-r--r--lib/CodeGen/ELFCodeEmitter.h102
1 files changed, 24 insertions, 78 deletions
diff --git a/lib/CodeGen/ELFCodeEmitter.h b/lib/CodeGen/ELFCodeEmitter.h
index 982aebf..b5e9c84 100644
--- a/lib/CodeGen/ELFCodeEmitter.h
+++ b/lib/CodeGen/ELFCodeEmitter.h
@@ -10,7 +10,7 @@
#ifndef ELFCODEEMITTER_H
#define ELFCODEEMITTER_H
-#include "llvm/CodeGen/MachineCodeEmitter.h"
+#include "llvm/CodeGen/ObjectCodeEmitter.h"
#include <vector>
namespace llvm {
@@ -19,7 +19,7 @@ namespace llvm {
/// ELFCodeEmitter - This class is used by the ELFWriter to
/// emit the code for functions to the ELF file.
- class ELFCodeEmitter : public MachineCodeEmitter {
+ class ELFCodeEmitter : public ObjectCodeEmitter {
ELFWriter &EW;
/// Target machine description
@@ -28,102 +28,48 @@ namespace llvm {
/// Section containing code for functions
ELFSection *ES;
- /// Relocations - These are the relocations that the function needs, as
- /// emitted.
+ /// Relocations - Record relocations needed by the current function
std::vector<MachineRelocation> Relocations;
- /// CPLocations - This is a map of constant pool indices to offsets from the
- /// start of the section for that constant pool index.
- std::vector<uintptr_t> CPLocations;
+ /// JTRelocations - Record relocations needed by the relocation
+ /// section.
+ std::vector<MachineRelocation> JTRelocations;
- /// CPSections - This is a map of constant pool indices to the MachOSection
- /// containing the constant pool entry for that index.
- std::vector<unsigned> CPSections;
-
- /// JTLocations - This is a map of jump table indices to offsets from the
- /// start of the section for that jump table index.
- std::vector<uintptr_t> JTLocations;
-
- /// MBBLocations - This vector is a mapping from MBB ID's to their address.
- /// It is filled in by the StartMachineBasicBlock callback and queried by
- /// the getMachineBasicBlockAddress callback.
- std::vector<uintptr_t> MBBLocations;
-
- /// FnStartPtr - Pointer to the start location of the current function
- /// in the buffer
- uint8_t *FnStartPtr;
-
- /// JumpTableSectionIdx - Holds the index of the Jump Table Section
- unsigned JumpTableSectionIdx;
+ /// FnStartPtr - Function offset from the beginning of ELFSection 'ES'
+ uintptr_t FnStartOff;
public:
- explicit ELFCodeEmitter(ELFWriter &ew) : EW(ew), TM(EW.TM),
- JumpTableSectionIdx(0) {}
-
- void startFunction(MachineFunction &F);
- bool finishFunction(MachineFunction &F);
+ explicit ELFCodeEmitter(ELFWriter &ew) : EW(ew), TM(EW.TM) {}
+ /// addRelocation - Register new relocations for this function
void addRelocation(const MachineRelocation &MR) {
Relocations.push_back(MR);
}
- virtual void StartMachineBasicBlock(MachineBasicBlock *MBB) {
- if (MBBLocations.size() <= (unsigned)MBB->getNumber())
- MBBLocations.resize((MBB->getNumber()+1)*2);
- MBBLocations[MBB->getNumber()] = getCurrentPCOffset();
- }
+ /// emitConstantPool - For each constant pool entry, figure out which
+ /// section the constant should live in and emit data to it
+ void emitConstantPool(MachineConstantPool *MCP);
- virtual uintptr_t getConstantPoolEntryAddress(unsigned Index) const {
- assert(CPLocations.size() > Index && "CP not emitted!");
- return CPLocations[Index];
- }
+ /// emitJumpTables - Emit all the jump tables for a given jump table
+ /// info and record them to the appropriate section.
+ void emitJumpTables(MachineJumpTableInfo *MJTI);
- virtual uintptr_t getJumpTableEntryAddress(unsigned Index) const {
- assert(JTLocations.size() > Index && "JT not emitted!");
- return JTLocations[Index];
- }
+ void startFunction(MachineFunction &F);
+ bool finishFunction(MachineFunction &F);
- virtual uintptr_t getMachineBasicBlockAddress(MachineBasicBlock *MBB) const {
- assert(MBBLocations.size() > (unsigned)MBB->getNumber() &&
- MBBLocations[MBB->getNumber()] && "MBB not emitted!");
- return MBBLocations[MBB->getNumber()];
+ /// emitLabel - Emits a label
+ virtual void emitLabel(uint64_t LabelID) {
+ assert("emitLabel not implemented");
}
+ /// getLabelAddress - Return the address of the specified LabelID,
+ /// only usable after the LabelID has been emitted.
virtual uintptr_t getLabelAddress(uint64_t Label) const {
- assert(0 && "Label address not implementated yet!");
- abort();
+ assert("getLabelAddress not implemented");
return 0;
}
- virtual void emitLabel(uint64_t LabelID) {
- assert(0 && "emit Label not implementated yet!");
- abort();
- }
-
- /// emitConstantPool - For each constant pool entry, figure out which section
- /// the constant should live in and emit the constant.
- void emitConstantPool(MachineConstantPool *MCP);
-
- /// emitJumpTables - Emit all the jump tables for a given jump table info
- /// record to the appropriate section.
- void emitJumpTables(MachineJumpTableInfo *MJTI);
-
virtual void setModuleInfo(llvm::MachineModuleInfo* MMI) {}
- /// JIT SPECIFIC FUNCTIONS - DO NOT IMPLEMENT THESE HERE!
- void startGVStub(const GlobalValue* F, unsigned StubSize,
- unsigned Alignment = 1) {
- assert(0 && "JIT specific function called!");
- abort();
- }
- void startGVStub(const GlobalValue* F, void *Buffer, unsigned StubSize) {
- assert(0 && "JIT specific function called!");
- abort();
- }
- void *finishGVStub(const GlobalValue *F) {
- assert(0 && "JIT specific function called!");
- abort();
- return 0;
- }
}; // end class ELFCodeEmitter
} // end namespace llvm
OpenPOWER on IntegriCloud