aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Target')
-rw-r--r--lib/Target/PIC16/PIC16AsmPrinter.cpp41
-rw-r--r--lib/Target/PIC16/PIC16AsmPrinter.h1
-rw-r--r--lib/Target/PIC16/PIC16TargetAsmInfo.cpp32
-rw-r--r--lib/Target/PIC16/PIC16TargetAsmInfo.h6
4 files changed, 38 insertions, 42 deletions
diff --git a/lib/Target/PIC16/PIC16AsmPrinter.cpp b/lib/Target/PIC16/PIC16AsmPrinter.cpp
index dc91128..63ad6e4 100644
--- a/lib/Target/PIC16/PIC16AsmPrinter.cpp
+++ b/lib/Target/PIC16/PIC16AsmPrinter.cpp
@@ -242,48 +242,11 @@ void PIC16AsmPrinter::EmitInitData (Module &M) {
continue;
O << name;
- EmitGlobalConstant(C);
+ EmitGlobalConstant(C, AddrSpace);
}
}
}
-void PIC16AsmPrinter::EmitConstantValueOnly(const Constant* CV) {
- if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) {
- unsigned BitWidth = CI->getBitWidth();
- int Val = CI->getZExtValue();
- if (BitWidth == 8) {
- // Expecting db directive here. In case of romdata we need to pad the
- // word with zeros.
- if (IsRomData)
- O << 0 <<", ";
- O << Val;
- }
- else if (BitWidth == 16) {
- unsigned Element1, Element2;
- Element1 = 0x00ff & Val;
- Element2 = 0x00ff & (Val >> 8);
- if (IsRomData)
- O << 0 <<", "<<Element1 <<", "<< 0 <<", "<< Element2;
- else
- O << Element1 <<", "<< Element2;
- }
- else if (BitWidth == 32) {
- unsigned Element1, Element2, Element3, Element4;
- Element1 = 0x00ff & Val;
- Element2 = 0x00ff & (Val >> 8);
- Element3 = 0x00ff & (Val >> 16);
- Element4 = 0x00ff & (Val >> 24);
- if (IsRomData)
- O << 0 <<", "<< Element1 <<", "<< 0 <<", "<< Element2 <<", "<< 0
- <<", "<< Element3 <<", "<< 0 <<", "<< Element4;
- else
- O << Element1 <<", "<< Element2 <<", "<< Element3 <<", "<< Element4;
- }
- return;
- }
- AsmPrinter::EmitConstantValueOnly(CV);
-}
-
void PIC16AsmPrinter::EmitRomData (Module &M)
{
SwitchToSection(TAI->getReadOnlySection());
@@ -308,7 +271,7 @@ void PIC16AsmPrinter::EmitRomData (Module &M)
continue;
O << name;
- EmitGlobalConstant(C);
+ EmitGlobalConstant(C, AddrSpace);
O << "\n";
}
}
diff --git a/lib/Target/PIC16/PIC16AsmPrinter.h b/lib/Target/PIC16/PIC16AsmPrinter.h
index 876e4be..ce79afd 100644
--- a/lib/Target/PIC16/PIC16AsmPrinter.h
+++ b/lib/Target/PIC16/PIC16AsmPrinter.h
@@ -43,7 +43,6 @@ namespace llvm {
void EmitInitData (Module &M);
void EmitUnInitData (Module &M);
void EmitRomData (Module &M);
- virtual void EmitConstantValueOnly(const Constant *CV);
void emitFunctionData(MachineFunction &MF);
void emitFunctionTempData(MachineFunction &MF, unsigned &FrameSize);
diff --git a/lib/Target/PIC16/PIC16TargetAsmInfo.cpp b/lib/Target/PIC16/PIC16TargetAsmInfo.cpp
index 8e2392e..b86576b 100644
--- a/lib/Target/PIC16/PIC16TargetAsmInfo.cpp
+++ b/lib/Target/PIC16/PIC16TargetAsmInfo.cpp
@@ -22,8 +22,11 @@ PIC16TargetAsmInfo(const PIC16TargetMachine &TM)
: TargetAsmInfo(TM) {
CommentString = ";";
Data8bitsDirective = " db ";
- Data16bitsDirective = " db ";
- Data32bitsDirective = " db ";
+ Data16bitsDirective = " dw ";
+ Data32bitsDirective = " dl ";
+ RomData8bitsDirective = " dw ";
+ RomData16bitsDirective = " rom_di ";
+ RomData8bitsDirective = " rom_dl ";
ZeroDirective = NULL;
AsciiDirective = " dt ";
AscizDirective = NULL;
@@ -33,3 +36,28 @@ PIC16TargetAsmInfo(const PIC16TargetMachine &TM)
DataSection = getNamedSection("idata.# IDATA", SectionFlags::Writeable);
SwitchToSectionDirective = "";
}
+
+const char *PIC16TargetAsmInfo::getData8bitsDirective(unsigned AddrSpace)
+ const {
+ if (AddrSpace == PIC16ISD::ROM_SPACE)
+ return RomData8bitsDirective;
+ else
+ return Data8bitsDirective;
+ }
+
+const char *PIC16TargetAsmInfo::getData16bitsDirective(unsigned AddrSpace)
+ const {
+ if (AddrSpace == PIC16ISD::ROM_SPACE)
+ return RomData16bitsDirective;
+ else
+ return Data16bitsDirective;
+ }
+
+const char *PIC16TargetAsmInfo::getData32bitsDirective(unsigned AddrSpace)
+ const {
+ if (AddrSpace == PIC16ISD::ROM_SPACE)
+ return RomData32bitsDirective;
+ else
+ return Data32bitsDirective;
+ }
+
diff --git a/lib/Target/PIC16/PIC16TargetAsmInfo.h b/lib/Target/PIC16/PIC16TargetAsmInfo.h
index 88de79f..b75699b 100644
--- a/lib/Target/PIC16/PIC16TargetAsmInfo.h
+++ b/lib/Target/PIC16/PIC16TargetAsmInfo.h
@@ -23,7 +23,13 @@ namespace llvm {
struct PIC16TargetAsmInfo : public TargetAsmInfo {
PIC16TargetAsmInfo(const PIC16TargetMachine &TM);
+ const char *RomData8bitsDirective;
+ const char *RomData16bitsDirective;
+ const char *RomData32bitsDirective;
public :
+ virtual const char *getData8bitsDirective(unsigned AddrSpace = 0) const;
+ virtual const char *getData16bitsDirective(unsigned AddrSpace = 0) const;
+ virtual const char *getData32bitsDirective(unsigned AddrSpace = 0) const;
};
} // namespace llvm