#define LLVM_TARGET_PIC16_TARGETOBJECTFILE_H
#include "llvm/Target/TargetLoweringObjectFile.h"
+#include "llvm/ADT/StringMap.h"
#include <vector>
+#include <string>
namespace llvm {
class GlobalVariable;
class Module;
class PIC16TargetMachine;
+ class MCSectionPIC16;
enum { DataBankSize = 80 };
/// again and printing only those that match the current section.
/// Keeping values inside the sections make printing a section much easier.
///
- /// FIXME: Reimplement by inheriting from MCSection.
+ /// FIXME: MOVE ALL THIS STUFF TO MCSectionPIC16.
///
struct PIC16Section {
- const MCSection *S_; // Connection to actual Section.
+ const MCSectionPIC16 *S_; // Connection to actual Section.
unsigned Size; // Total size of the objects contained.
bool SectionPrinted;
std::vector<const GlobalVariable*> Items;
- PIC16Section(const MCSection *s) {
+ PIC16Section(const MCSectionPIC16 *s) {
S_ = s;
Size = 0;
SectionPrinted = false;
};
class PIC16TargetObjectFile : public TargetLoweringObjectFile {
+ /// SectionsByName - Bindings of names to allocated sections.
+ mutable StringMap<MCSectionPIC16*> SectionsByName;
+
const TargetMachine *TM;
+
+ const MCSectionPIC16 *getPIC16Section(const char *Name,
+ SectionKind K,
+ int Address = -1,
+ int Color = -1) const;
public:
mutable std::vector<PIC16Section*> BSSSections;
mutable std::vector<PIC16Section*> IDATASections;
mutable std::vector<PIC16Section*> ROSections;
mutable PIC16Section *ExternalVarDecls;
mutable PIC16Section *ExternalVarDefs;
-
+
+ PIC16TargetObjectFile();
~PIC16TargetObjectFile();
void Initialize(MCContext &Ctx, const TargetMachine &TM);
- /// getSpecialCasedSectionGlobals - Allow the target to completely override
- /// section assignment of a global.
virtual const MCSection *
- getSpecialCasedSectionGlobals(const GlobalValue *GV, Mangler *Mang,
- SectionInfo Info) const;
+ getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
+ Mangler *Mang, const TargetMachine &TM) const;
+
virtual const MCSection *SelectSectionForGlobal(const GlobalValue *GV,
- SectionInfo Info,
+ SectionKind Kind,
Mangler *Mang,
const TargetMachine&) const;
+
+ const MCSection *getSectionForFunction(const std::string &FnName) const;
+ const MCSection *getSectionForFunctionFrame(const std::string &FnName)const;
+
+
private:
std::string getSectionNameForSym(const std::string &Sym) const;