diff options
Diffstat (limited to 'llvm/lib/Target/PIC16/PIC16TargetAsmInfo.h')
-rw-r--r-- | llvm/lib/Target/PIC16/PIC16TargetAsmInfo.h | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/llvm/lib/Target/PIC16/PIC16TargetAsmInfo.h b/llvm/lib/Target/PIC16/PIC16TargetAsmInfo.h index 305e74d5a30..4675bc9e9b9 100644 --- a/llvm/lib/Target/PIC16/PIC16TargetAsmInfo.h +++ b/llvm/lib/Target/PIC16/PIC16TargetAsmInfo.h @@ -14,21 +14,54 @@ #ifndef PIC16TARGETASMINFO_H #define PIC16TARGETASMINFO_H +#include "PIC16.h" #include "llvm/Target/TargetAsmInfo.h" - +#include <vector> +#include "llvm/Module.h" +#define DataBankSize 80 namespace llvm { // Forward declaration. class PIC16TargetMachine; + class GlobalVariable; + // PIC16 Splits the global data into mulitple udata and idata sections. + // Each udata and idata section needs to contain a list of globals that + // they contain, in order to avoid scanning over all the global values + // again and printing only those that match the current section. + // Keeping values inside the sections make printing a section much easier. + struct PIC16Section { + const Section *S_; // Connection to actual Section. + unsigned Size; // Total size of the objects contained. + std::vector<const GlobalVariable*> Items; + + PIC16Section (const Section *s) { S_ = s; Size = 0; } + }; + struct PIC16TargetAsmInfo : public TargetAsmInfo { + std::string getSectionNameForSym(const std::string &Sym) const; PIC16TargetAsmInfo(const PIC16TargetMachine &TM); + virtual ~PIC16TargetAsmInfo(); private: + mutable std::vector<PIC16Section *> BSSSections; + mutable std::vector<PIC16Section *> IDATASections; + const char *RomData8bitsDirective; const char *RomData16bitsDirective; const char *RomData32bitsDirective; const char *getRomDirective(unsigned size) const; virtual const char *getASDirective(unsigned size, unsigned AS) const; + const Section *getBSSSectionForGlobal(const GlobalVariable *GV) const; + const Section *getIDATASectionForGlobal(const GlobalVariable *GV) const; + virtual const Section *SelectSectionForGlobal(const GlobalValue *GV) const; + public: + void SetSectionForGVs(Module &M); + std::vector<PIC16Section *> getBSSSections() const { + return BSSSections; + } + std::vector<PIC16Section *> getIDATASections() const { + return IDATASections; + } }; } // namespace llvm |