Implement _CONFIG macro to allow users to se to configuration settings on the part.
Implement _section macro to allow users to place objects in specific sections.
Implement _address macro to allow users to place objects at a particular address.
Placing objects at a memory address:
crate a unique section name from varname, address, object type and put that section at specified address. Mark this section a full (size = banksize) so that other objects do not compete for it while placing objects to sections in AsmPrinter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74822 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/PIC16/PIC16AsmPrinter.cpp b/lib/Target/PIC16/PIC16AsmPrinter.cpp
index 1fc1cc1..a33fef3 100644
--- a/lib/Target/PIC16/PIC16AsmPrinter.cpp
+++ b/lib/Target/PIC16/PIC16AsmPrinter.cpp
@@ -272,18 +272,19 @@
// Emit initialized data placed in ROM.
void PIC16AsmPrinter::EmitRomData (Module &M)
{
-
- std::vector<const GlobalVariable*> Items = PTAI->ROSection->Items;
- if (! Items.size()) return;
-
- // Print ROData ection.
- O << "\n";
- SwitchToSection(PTAI->ROSection->S_);
- for (unsigned j = 0; j < Items.size(); j++) {
- O << Mang->getValueName(Items[j]);
- Constant *C = Items[j]->getInitializer();
- int AddrSpace = Items[j]->getType()->getAddressSpace();
- EmitGlobalConstant(C, AddrSpace);
+ // Print ROM Data section.
+ std::vector <PIC16Section *>ROSections = PTAI->ROSections;
+ for (unsigned i = 0; i < ROSections.size(); i++) {
+ std::vector<const GlobalVariable*> Items = ROSections[i]->Items;
+ if (! Items.size()) continue;
+ O << "\n";
+ SwitchToSection(PTAI->ROSections[i]->S_);
+ for (unsigned j = 0; j < Items.size(); j++) {
+ O << Mang->getValueName(Items[j]);
+ Constant *C = Items[j]->getInitializer();
+ int AddrSpace = Items[j]->getType()->getAddressSpace();
+ EmitGlobalConstant(C, AddrSpace);
+ }
}
}