"lldb/git@repo.hca.bsc.es:rferrer/llvm-epi-0.8.git" did not exist on "ebe6067a8cf420445cfb50bac9ed1fc699fcc328"
Newer
Older
Bruno Cardoso Lopes
committed
//===-- MachOEmitter.h - Target-independent Mach-O Emitter class ----------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef MACHOCODEEMITTER_H
#define MACHOCODEEMITTER_H
Bruno Cardoso Lopes
committed
#include "llvm/CodeGen/ObjectCodeEmitter.h"
#include <map>
Bruno Cardoso Lopes
committed
namespace llvm {
Bruno Cardoso Lopes
committed
class MachOWriter;
Bruno Cardoso Lopes
committed
/// MachOCodeEmitter - This class is used by the MachOWriter to emit the code
/// for functions to the Mach-O file.
Bruno Cardoso Lopes
committed
class MachOCodeEmitter : public ObjectCodeEmitter {
Bruno Cardoso Lopes
committed
MachOWriter &MOW;
/// Target machine description.
TargetMachine &TM;
/// is64Bit/isLittleEndian - This information is inferred from the target
/// machine directly, indicating what header values and flags to set.
bool is64Bit, isLittleEndian;
const TargetAsmInfo *TAI;
/// Relocations - These are the relocations that the function needs, as
/// emitted.
std::vector<MachineRelocation> Relocations;
Bruno Cardoso Lopes
committed
std::map<uint64_t, uintptr_t> Labels;
Bruno Cardoso Lopes
committed
public:
Bruno Cardoso Lopes
committed
MachOCodeEmitter(MachOWriter &mow, MachOSection &mos);
Bruno Cardoso Lopes
committed
virtual void startFunction(MachineFunction &MF);
virtual bool finishFunction(MachineFunction &MF);
virtual void addRelocation(const MachineRelocation &MR) {
Relocations.push_back(MR);
}
Bruno Cardoso Lopes
committed
Bruno Cardoso Lopes
committed
void emitConstantPool(MachineConstantPool *MCP);
void emitJumpTables(MachineJumpTableInfo *MJTI);
Bruno Cardoso Lopes
committed
virtual void emitLabel(uint64_t LabelID) {
Labels[LabelID] = getCurrentPCOffset();
Bruno Cardoso Lopes
committed
}
virtual uintptr_t getLabelAddress(uint64_t Label) const {
Bruno Cardoso Lopes
committed
return Labels.find(Label)->second;