2008-05-13 09:02:57 +00:00
|
|
|
//=====-- PIC16TargetAsmInfo.h - PIC16 asm properties ---------*- C++ -*--====//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file contains the declaration of the PIC16TargetAsmInfo class.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef PIC16TARGETASMINFO_H
|
|
|
|
#define PIC16TARGETASMINFO_H
|
|
|
|
|
2009-05-06 08:02:01 +00:00
|
|
|
#include "PIC16.h"
|
2008-05-13 09:02:57 +00:00
|
|
|
#include "llvm/Target/TargetAsmInfo.h"
|
2009-05-06 08:02:01 +00:00
|
|
|
#include <vector>
|
|
|
|
#include "llvm/Module.h"
|
|
|
|
#define DataBankSize 80
|
2008-05-13 09:02:57 +00:00
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
// Forward declaration.
|
|
|
|
class PIC16TargetMachine;
|
2009-05-06 08:02:01 +00:00
|
|
|
class GlobalVariable;
|
2008-05-13 09:02:57 +00:00
|
|
|
|
2009-05-06 08:02:01 +00:00
|
|
|
// 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; }
|
|
|
|
};
|
|
|
|
|
2008-05-13 09:02:57 +00:00
|
|
|
struct PIC16TargetAsmInfo : public TargetAsmInfo {
|
2009-05-06 08:02:01 +00:00
|
|
|
std::string getSectionNameForSym(const std::string &Sym) const;
|
2008-05-13 09:02:57 +00:00
|
|
|
PIC16TargetAsmInfo(const PIC16TargetMachine &TM);
|
2009-05-06 08:02:01 +00:00
|
|
|
mutable std::vector<PIC16Section *> BSSSections;
|
|
|
|
mutable std::vector<PIC16Section *> IDATASections;
|
2009-05-10 05:23:47 +00:00
|
|
|
virtual ~PIC16TargetAsmInfo();
|
|
|
|
|
|
|
|
private:
|
2009-01-30 04:25:10 +00:00
|
|
|
const char *RomData8bitsDirective;
|
|
|
|
const char *RomData16bitsDirective;
|
|
|
|
const char *RomData32bitsDirective;
|
2009-02-02 16:53:06 +00:00
|
|
|
const char *getRomDirective(unsigned size) const;
|
|
|
|
virtual const char *getASDirective(unsigned size, unsigned AS) const;
|
2009-05-06 08:02:01 +00:00
|
|
|
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;
|
|
|
|
}
|
2008-05-13 09:02:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace llvm
|
|
|
|
|
|
|
|
#endif
|