PIC16TargetObjectFile.h [plain text]
#ifndef LLVM_TARGET_PIC16_TARGETOBJECTFILE_H
#define LLVM_TARGET_PIC16_TARGETOBJECTFILE_H
#include "PIC16.h"
#include "PIC16ABINames.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/ADT/StringMap.h"
#include <vector>
#include <string>
namespace llvm {
class GlobalVariable;
class Module;
class PIC16TargetMachine;
class PIC16Section;
enum { DataBankSize = 80 };
class PIC16TargetObjectFile : public TargetLoweringObjectFile {
mutable StringMap<PIC16Section*> SectionsByName;
const TargetMachine *TM;
mutable std::vector<PIC16Section *> UDATASections_;
mutable std::vector<PIC16Section *> IDATASections_;
mutable PIC16Section * ROMDATASection_;
mutable PIC16Section * SHAREDUDATASection_;
mutable std::vector<PIC16Section *> AUTOSections_;
mutable std::vector<PIC16Section *> USERSections_;
PIC16Section *getPIC16Section(const std::string &Name,
PIC16SectionType Ty,
const std::string &Address = "",
int Color = -1) const;
PIC16Section *getPIC16DataSection(const std::string &Name,
PIC16SectionType Ty,
const std::string &Address = "",
int Color = -1) const;
PIC16Section *getPIC16AutoSection(const std::string &Name,
PIC16SectionType Ty = UDATA_OVR,
const std::string &Address = "",
int Color = -1) const;
PIC16Section *getPIC16UserSection(const std::string &Name,
PIC16SectionType Ty,
const std::string &Address = "",
int Color = -1) const;
const MCSection *allocateUDATA(const GlobalVariable *GV) const;
const MCSection *allocateIDATA(const GlobalVariable *GV) const;
const MCSection *allocateROMDATA(const GlobalVariable *GV) const;
const MCSection *allocateAUTO(const GlobalVariable *GV) const;
const MCSection *allocateInGivenSection(const GlobalVariable *GV) const;
const MCSection *allocateAtGivenAddress(const GlobalVariable *GV,
const std::string &Addr) const;
const MCSection *allocateSHARED(const GlobalVariable *GV,
Mangler *Mang) const;
public:
PIC16TargetObjectFile();
~PIC16TargetObjectFile();
void Initialize(MCContext &Ctx, const TargetMachine &TM);
PIC16Section *findPIC16Section(const std::string &Name);
virtual const MCSection *
getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
Mangler *Mang, const TargetMachine &TM) const;
virtual const MCSection *SelectSectionForGlobal(const GlobalValue *GV,
SectionKind Kind,
Mangler *Mang,
const TargetMachine&) const;
const PIC16Section *SectionForCode (const std::string &FnName,
bool isISR) const;
const PIC16Section *SectionForFrame (const std::string &FnName) const;
const std::vector<PIC16Section *> &UDATASections() const {
return UDATASections_;
}
const std::vector<PIC16Section *> &IDATASections() const {
return IDATASections_;
}
const PIC16Section *ROMDATASection() const {
return ROMDATASection_;
}
const PIC16Section *SHAREDUDATASection() const {
return SHAREDUDATASection_;
}
const std::vector<PIC16Section *> &AUTOSections() const {
return AUTOSections_;
}
const std::vector<PIC16Section *> &USERSections() const {
return USERSections_;
}
};
}
#endif