blob: 60ad2c7f8f9b5a7e6e3852f3e1553615f635879e [file] [log] [blame]
Sanjiv Gupta89ec31a2009-08-13 16:37:05 +00001//===-- PIC16AsmPrinter.cpp - PIC16 LLVM assembly writer ------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file contains a printer that converts from our internal representation
11// of machine-dependent LLVM code to PIC16 assembly language.
12//
13//===----------------------------------------------------------------------===//
14
15#include "PIC16AsmPrinter.h"
Chris Lattner6362cbe2009-08-15 06:13:40 +000016#include "MCSectionPIC16.h"
Chris Lattner7b26fce2009-08-22 20:48:53 +000017#include "PIC16MCAsmInfo.h"
Sanjiv Gupta89ec31a2009-08-13 16:37:05 +000018#include "llvm/DerivedTypes.h"
19#include "llvm/Function.h"
20#include "llvm/Module.h"
21#include "llvm/CodeGen/DwarfWriter.h"
22#include "llvm/CodeGen/MachineFrameInfo.h"
23#include "llvm/CodeGen/DwarfWriter.h"
24#include "llvm/CodeGen/MachineModuleInfo.h"
Chris Lattner4b7dadb2009-08-19 05:49:37 +000025#include "llvm/MC/MCStreamer.h"
Chris Lattner4cd44982009-09-13 17:14:04 +000026#include "llvm/MC/MCSymbol.h"
Sanjiv Gupta89ec31a2009-08-13 16:37:05 +000027#include "llvm/Target/TargetRegistry.h"
28#include "llvm/Target/TargetLoweringObjectFile.h"
29#include "llvm/Support/ErrorHandling.h"
30#include "llvm/Support/FormattedStream.h"
31#include "llvm/Support/Mangler.h"
32#include <cstring>
33using namespace llvm;
34
35#include "PIC16GenAsmWriter.inc"
36
37PIC16AsmPrinter::PIC16AsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
Chris Lattner7b26fce2009-08-22 20:48:53 +000038 const MCAsmInfo *T, bool V)
Chris Lattner757dd1c2009-08-22 20:56:12 +000039: AsmPrinter(O, TM, T, V), DbgInfo(O, T) {
Sanjiv Gupta89ec31a2009-08-13 16:37:05 +000040 PTLI = static_cast<PIC16TargetLowering*>(TM.getTargetLowering());
Chris Lattnere9a75a62009-08-22 21:43:10 +000041 PMAI = static_cast<const PIC16MCAsmInfo*>(T);
Sanjiv Gupta89ec31a2009-08-13 16:37:05 +000042 PTOF = (PIC16TargetObjectFile*)&PTLI->getObjFileLowering();
43}
44
45bool PIC16AsmPrinter::printMachineInstruction(const MachineInstr *MI) {
Devang Patel051454a2009-10-06 02:19:11 +000046 processDebugLoc(MI, true);
Sanjiv Gupta89ec31a2009-08-13 16:37:05 +000047 printInstruction(MI);
Chris Lattner321bc992009-09-09 23:14:36 +000048 if (VerboseAsm && !MI->getDebugLoc().isUnknown())
49 EmitComments(*MI);
50 O << '\n';
Devang Patel051454a2009-10-06 02:19:11 +000051 processDebugLoc(MI, false);
Sanjiv Gupta89ec31a2009-08-13 16:37:05 +000052 return true;
53}
54
55/// runOnMachineFunction - This emits the frame section, autos section and
56/// assembly for each instruction. Also takes care of function begin debug
57/// directive and file begin debug directive (if required) for the function.
58///
59bool PIC16AsmPrinter::runOnMachineFunction(MachineFunction &MF) {
60 this->MF = &MF;
61
62 // This calls the base class function required to be called at beginning
63 // of runOnMachineFunction.
64 SetupMachineFunction(MF);
65
66 // Get the mangled name.
67 const Function *F = MF.getFunction();
68 CurrentFnName = Mang->getMangledName(F);
69
70 // Emit the function frame (args and temps).
71 EmitFunctionFrame(MF);
72
73 DbgInfo.BeginFunction(MF);
74
75 // Emit the autos section of function.
Chris Lattner6af22f02009-08-21 23:08:09 +000076 EmitAutos(CurrentFnName);
Sanjiv Gupta89ec31a2009-08-13 16:37:05 +000077
78 // Now emit the instructions of function in its code section.
79 const MCSection *fCodeSection =
Chris Lattner773416e2009-08-21 23:12:15 +000080 getObjFileLowering().getSectionForFunction(CurrentFnName);
Sanjiv Gupta89ec31a2009-08-13 16:37:05 +000081 // Start the Code Section.
82 O << "\n";
Chris Lattner4b7dadb2009-08-19 05:49:37 +000083 OutStreamer.SwitchSection(fCodeSection);
Chris Lattner773416e2009-08-21 23:12:15 +000084
85 // Emit the frame address of the function at the beginning of code.
86 O << "\tretlw low(" << PAN::getFrameLabel(CurrentFnName) << ")\n";
87 O << "\tretlw high(" << PAN::getFrameLabel(CurrentFnName) << ")\n";
Sanjiv Gupta89ec31a2009-08-13 16:37:05 +000088
89 // Emit function start label.
90 O << CurrentFnName << ":\n";
Chris Lattner773416e2009-08-21 23:12:15 +000091
Sanjiv Gupta89ec31a2009-08-13 16:37:05 +000092 DebugLoc CurDL;
93 O << "\n";
94 // Print out code for the function.
95 for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
96 I != E; ++I) {
97
98 // Print a label for the basic block.
99 if (I != MF.begin()) {
Chris Lattner4dc75de2009-09-14 03:15:54 +0000100 EmitBasicBlockStart(I);
Sanjiv Gupta89ec31a2009-08-13 16:37:05 +0000101 O << '\n';
102 }
103
104 // Print a basic block.
105 for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
106 II != E; ++II) {
107
108 // Emit the line directive if source line changed.
109 const DebugLoc DL = II->getDebugLoc();
110 if (!DL.isUnknown() && DL != CurDL) {
111 DbgInfo.ChangeDebugLoc(MF, DL);
112 CurDL = DL;
113 }
114
115 // Print the assembly for the instruction.
116 printMachineInstruction(II);
117 }
118 }
119
120 // Emit function end debug directives.
121 DbgInfo.EndFunction(MF);
122
123 return false; // we didn't modify anything.
124}
125
126
127// printOperand - print operand of insn.
128void PIC16AsmPrinter::printOperand(const MachineInstr *MI, int opNum) {
129 const MachineOperand &MO = MI->getOperand(opNum);
130
131 switch (MO.getType()) {
132 case MachineOperand::MO_Register:
Chris Lattnereb2cc682009-09-13 20:31:40 +0000133 O << getRegisterName(MO.getReg());
Sanjiv Gupta89ec31a2009-08-13 16:37:05 +0000134 return;
135
136 case MachineOperand::MO_Immediate:
137 O << (int)MO.getImm();
138 return;
139
140 case MachineOperand::MO_GlobalAddress: {
141 std::string Sname = Mang->getMangledName(MO.getGlobal());
142 // FIXME: currently we do not have a memcpy def coming in the module
143 // by any chance, as we do not link in those as .bc lib. So these calls
144 // are always external and it is safe to emit an extern.
145 if (PAN::isMemIntrinsic(Sname)) {
146 LibcallDecls.push_back(createESName(Sname));
147 }
Chris Lattner773416e2009-08-21 23:12:15 +0000148
Sanjiv Gupta89ec31a2009-08-13 16:37:05 +0000149 O << Sname;
150 break;
151 }
152 case MachineOperand::MO_ExternalSymbol: {
153 const char *Sname = MO.getSymbolName();
154
155 // If its a libcall name, record it to decls section.
156 if (PAN::getSymbolTag(Sname) == PAN::LIBCALL) {
Chris Lattner773416e2009-08-21 23:12:15 +0000157 LibcallDecls.push_back(Sname);
Sanjiv Gupta89ec31a2009-08-13 16:37:05 +0000158 }
159
160 // Record a call to intrinsic to print the extern declaration for it.
161 std::string Sym = Sname;
162 if (PAN::isMemIntrinsic(Sym)) {
163 Sym = PAN::addPrefix(Sym);
164 LibcallDecls.push_back(createESName(Sym));
165 }
Chris Lattner773416e2009-08-21 23:12:15 +0000166
167 O << Sym;
168 break;
Sanjiv Gupta89ec31a2009-08-13 16:37:05 +0000169 }
170 case MachineOperand::MO_MachineBasicBlock:
Chris Lattner4cd44982009-09-13 17:14:04 +0000171 GetMBBSymbol(MO.getMBB()->getNumber())->print(O, MAI);
Sanjiv Gupta89ec31a2009-08-13 16:37:05 +0000172 return;
173
174 default:
175 llvm_unreachable(" Operand type not supported.");
176 }
177}
178
179/// printCCOperand - Print the cond code operand.
180///
181void PIC16AsmPrinter::printCCOperand(const MachineInstr *MI, int opNum) {
182 int CC = (int)MI->getOperand(opNum).getImm();
183 O << PIC16CondCodeToString((PIC16CC::CondCodes)CC);
184}
185
186// This function is used to sort the decls list.
187// should return true if s1 should come before s2.
188static bool is_before(const char *s1, const char *s2) {
189 return strcmp(s1, s2) <= 0;
190}
191
192// This is used by list::unique below.
193// unique will filter out duplicates if it knows them.
194static bool is_duplicate(const char *s1, const char *s2) {
195 return !strcmp(s1, s2);
196}
197
198/// printLibcallDecls - print the extern declarations for compiler
199/// intrinsics.
200///
201void PIC16AsmPrinter::printLibcallDecls() {
202 // If no libcalls used, return.
203 if (LibcallDecls.empty()) return;
204
Chris Lattnere9a75a62009-08-22 21:43:10 +0000205 O << MAI->getCommentString() << "External decls for libcalls - BEGIN." <<"\n";
Sanjiv Gupta89ec31a2009-08-13 16:37:05 +0000206 // Remove duplicate entries.
207 LibcallDecls.sort(is_before);
208 LibcallDecls.unique(is_duplicate);
209
210 for (std::list<const char*>::const_iterator I = LibcallDecls.begin();
211 I != LibcallDecls.end(); I++) {
Chris Lattnere9a75a62009-08-22 21:43:10 +0000212 O << MAI->getExternDirective() << *I << "\n";
213 O << MAI->getExternDirective() << PAN::getArgsLabel(*I) << "\n";
214 O << MAI->getExternDirective() << PAN::getRetvalLabel(*I) << "\n";
Sanjiv Gupta89ec31a2009-08-13 16:37:05 +0000215 }
Chris Lattnere9a75a62009-08-22 21:43:10 +0000216 O << MAI->getCommentString() << "External decls for libcalls - END." <<"\n";
Sanjiv Gupta89ec31a2009-08-13 16:37:05 +0000217}
218
Bob Wilson64c8d5a2009-09-30 21:44:42 +0000219/// doInitialization - Perform Module level initializations here.
Sanjiv Gupta89ec31a2009-08-13 16:37:05 +0000220/// One task that we do here is to sectionize all global variables.
221/// The MemSelOptimizer pass depends on the sectionizing.
222///
223bool PIC16AsmPrinter::doInitialization(Module &M) {
224 bool Result = AsmPrinter::doInitialization(M);
225
226 // FIXME:: This is temporary solution to generate the include file.
227 // The processor should be passed to llc as in input and the header file
228 // should be generated accordingly.
229 O << "\n\t#include P16F1937.INC\n";
230
231 // Set the section names for all globals.
232 for (Module::global_iterator I = M.global_begin(), E = M.global_end();
233 I != E; ++I)
234 if (!I->isDeclaration() && !I->hasAvailableExternallyLinkage()) {
235 const MCSection *S = getObjFileLowering().SectionForGlobal(I, Mang, TM);
236
237 I->setSection(((const MCSectionPIC16*)S)->getName());
238 }
239
240 DbgInfo.BeginModule(M);
241 EmitFunctionDecls(M);
242 EmitUndefinedVars(M);
243 EmitDefinedVars(M);
244 EmitIData(M);
245 EmitUData(M);
246 EmitRomData(M);
247 return Result;
248}
249
250/// Emit extern decls for functions imported from other modules, and emit
251/// global declarations for function defined in this module and which are
252/// available to other modules.
253///
254void PIC16AsmPrinter::EmitFunctionDecls(Module &M) {
255 // Emit declarations for external functions.
Chris Lattnere9a75a62009-08-22 21:43:10 +0000256 O <<"\n"<<MAI->getCommentString() << "Function Declarations - BEGIN." <<"\n";
Sanjiv Gupta89ec31a2009-08-13 16:37:05 +0000257 for (Module::iterator I = M.begin(), E = M.end(); I != E; I++) {
258 if (I->isIntrinsic())
259 continue;
260
261 std::string Name = Mang->getMangledName(I);
262 if (Name.compare("@abort") == 0)
263 continue;
264
265 if (!I->isDeclaration() && !I->hasExternalLinkage())
266 continue;
267
268 // Do not emit memcpy, memset, and memmove here.
269 // Calls to these routines can be generated in two ways,
270 // 1. User calling the standard lib function
271 // 2. Codegen generating these calls for llvm intrinsics.
272 // In the first case a prototype is alread availale, while in
273 // second case the call is via and externalsym and the prototype is missing.
274 // So declarations for these are currently always getting printing by
275 // tracking both kind of references in printInstrunction.
276 if (I->isDeclaration() && PAN::isMemIntrinsic(Name)) continue;
277
Chris Lattnere9a75a62009-08-22 21:43:10 +0000278 const char *directive = I->isDeclaration() ? MAI->getExternDirective() :
279 MAI->getGlobalDirective();
Chris Lattner773416e2009-08-21 23:12:15 +0000280
Sanjiv Gupta89ec31a2009-08-13 16:37:05 +0000281 O << directive << Name << "\n";
282 O << directive << PAN::getRetvalLabel(Name) << "\n";
283 O << directive << PAN::getArgsLabel(Name) << "\n";
284 }
285
Chris Lattnere9a75a62009-08-22 21:43:10 +0000286 O << MAI->getCommentString() << "Function Declarations - END." <<"\n";
Sanjiv Gupta89ec31a2009-08-13 16:37:05 +0000287}
288
289// Emit variables imported from other Modules.
290void PIC16AsmPrinter::EmitUndefinedVars(Module &M) {
291 std::vector<const GlobalVariable*> Items = PTOF->ExternalVarDecls->Items;
292 if (!Items.size()) return;
293
Chris Lattnere9a75a62009-08-22 21:43:10 +0000294 O << "\n" << MAI->getCommentString() << "Imported Variables - BEGIN" << "\n";
Sanjiv Gupta89ec31a2009-08-13 16:37:05 +0000295 for (unsigned j = 0; j < Items.size(); j++) {
Chris Lattnere9a75a62009-08-22 21:43:10 +0000296 O << MAI->getExternDirective() << Mang->getMangledName(Items[j]) << "\n";
Sanjiv Gupta89ec31a2009-08-13 16:37:05 +0000297 }
Chris Lattnere9a75a62009-08-22 21:43:10 +0000298 O << MAI->getCommentString() << "Imported Variables - END" << "\n";
Sanjiv Gupta89ec31a2009-08-13 16:37:05 +0000299}
300
301// Emit variables defined in this module and are available to other modules.
302void PIC16AsmPrinter::EmitDefinedVars(Module &M) {
303 std::vector<const GlobalVariable*> Items = PTOF->ExternalVarDefs->Items;
304 if (!Items.size()) return;
305
Chris Lattnere9a75a62009-08-22 21:43:10 +0000306 O << "\n" << MAI->getCommentString() << "Exported Variables - BEGIN" << "\n";
Sanjiv Gupta89ec31a2009-08-13 16:37:05 +0000307 for (unsigned j = 0; j < Items.size(); j++) {
Chris Lattnere9a75a62009-08-22 21:43:10 +0000308 O << MAI->getGlobalDirective() << Mang->getMangledName(Items[j]) << "\n";
Sanjiv Gupta89ec31a2009-08-13 16:37:05 +0000309 }
Chris Lattnere9a75a62009-08-22 21:43:10 +0000310 O << MAI->getCommentString() << "Exported Variables - END" << "\n";
Sanjiv Gupta89ec31a2009-08-13 16:37:05 +0000311}
312
313// Emit initialized data placed in ROM.
314void PIC16AsmPrinter::EmitRomData(Module &M) {
315 // Print ROM Data section.
316 const std::vector<PIC16Section*> &ROSections = PTOF->ROSections;
317 for (unsigned i = 0; i < ROSections.size(); i++) {
318 const std::vector<const GlobalVariable*> &Items = ROSections[i]->Items;
319 if (!Items.size()) continue;
320 O << "\n";
Chris Lattner4b7dadb2009-08-19 05:49:37 +0000321 OutStreamer.SwitchSection(PTOF->ROSections[i]->S_);
Sanjiv Gupta89ec31a2009-08-13 16:37:05 +0000322 for (unsigned j = 0; j < Items.size(); j++) {
323 O << Mang->getMangledName(Items[j]);
324 Constant *C = Items[j]->getInitializer();
325 int AddrSpace = Items[j]->getType()->getAddressSpace();
326 EmitGlobalConstant(C, AddrSpace);
327 }
328 }
329}
330
331bool PIC16AsmPrinter::doFinalization(Module &M) {
332 printLibcallDecls();
333 EmitRemainingAutos();
334 DbgInfo.EndModule(M);
335 O << "\n\t" << "END\n";
336 return AsmPrinter::doFinalization(M);
337}
338
339void PIC16AsmPrinter::EmitFunctionFrame(MachineFunction &MF) {
340 const Function *F = MF.getFunction();
341 std::string FuncName = Mang->getMangledName(F);
342 const TargetData *TD = TM.getTargetData();
343 // Emit the data section name.
344 O << "\n";
Chris Lattner6af22f02009-08-21 23:08:09 +0000345
Sanjiv Gupta89ec31a2009-08-13 16:37:05 +0000346 const MCSection *fPDataSection =
Chris Lattner6af22f02009-08-21 23:08:09 +0000347 getObjFileLowering().getSectionForFunctionFrame(CurrentFnName);
Chris Lattner4b7dadb2009-08-19 05:49:37 +0000348 OutStreamer.SwitchSection(fPDataSection);
Sanjiv Gupta89ec31a2009-08-13 16:37:05 +0000349
350 // Emit function frame label
351 O << PAN::getFrameLabel(CurrentFnName) << ":\n";
352
353 const Type *RetType = F->getReturnType();
354 unsigned RetSize = 0;
355 if (RetType->getTypeID() != Type::VoidTyID)
356 RetSize = TD->getTypeAllocSize(RetType);
357
358 //Emit function return value space
359 // FIXME: Do not emit RetvalLable when retsize is zero. To do this
360 // we will need to avoid printing a global directive for Retval label
361 // in emitExternandGloblas.
362 if(RetSize > 0)
363 O << PAN::getRetvalLabel(CurrentFnName) << " RES " << RetSize << "\n";
364 else
365 O << PAN::getRetvalLabel(CurrentFnName) << ": \n";
366
367 // Emit variable to hold the space for function arguments
368 unsigned ArgSize = 0;
369 for (Function::const_arg_iterator argi = F->arg_begin(),
370 arge = F->arg_end(); argi != arge ; ++argi) {
371 const Type *Ty = argi->getType();
372 ArgSize += TD->getTypeAllocSize(Ty);
373 }
374
375 O << PAN::getArgsLabel(CurrentFnName) << " RES " << ArgSize << "\n";
376
377 // Emit temporary space
378 int TempSize = PTLI->GetTmpSize();
379 if (TempSize > 0)
380 O << PAN::getTempdataLabel(CurrentFnName) << " RES " << TempSize << '\n';
381}
382
383void PIC16AsmPrinter::EmitIData(Module &M) {
384
385 // Print all IDATA sections.
386 const std::vector<PIC16Section*> &IDATASections = PTOF->IDATASections;
387 for (unsigned i = 0; i < IDATASections.size(); i++) {
388 O << "\n";
389 if (IDATASections[i]->S_->getName().find("llvm.") != std::string::npos)
390 continue;
Chris Lattner4b7dadb2009-08-19 05:49:37 +0000391 OutStreamer.SwitchSection(IDATASections[i]->S_);
Sanjiv Gupta89ec31a2009-08-13 16:37:05 +0000392 std::vector<const GlobalVariable*> Items = IDATASections[i]->Items;
393 for (unsigned j = 0; j < Items.size(); j++) {
394 std::string Name = Mang->getMangledName(Items[j]);
395 Constant *C = Items[j]->getInitializer();
396 int AddrSpace = Items[j]->getType()->getAddressSpace();
397 O << Name;
398 EmitGlobalConstant(C, AddrSpace);
399 }
400 }
401}
402
403void PIC16AsmPrinter::EmitUData(Module &M) {
404 const TargetData *TD = TM.getTargetData();
405
406 // Print all BSS sections.
407 const std::vector<PIC16Section*> &BSSSections = PTOF->BSSSections;
408 for (unsigned i = 0; i < BSSSections.size(); i++) {
409 O << "\n";
Chris Lattner4b7dadb2009-08-19 05:49:37 +0000410 OutStreamer.SwitchSection(BSSSections[i]->S_);
Sanjiv Gupta89ec31a2009-08-13 16:37:05 +0000411 std::vector<const GlobalVariable*> Items = BSSSections[i]->Items;
412 for (unsigned j = 0; j < Items.size(); j++) {
413 std::string Name = Mang->getMangledName(Items[j]);
414 Constant *C = Items[j]->getInitializer();
415 const Type *Ty = C->getType();
416 unsigned Size = TD->getTypeAllocSize(Ty);
417
418 O << Name << " RES " << Size << "\n";
419 }
420 }
421}
422
Chris Lattner6af22f02009-08-21 23:08:09 +0000423void PIC16AsmPrinter::EmitAutos(std::string FunctName) {
Sanjiv Gupta89ec31a2009-08-13 16:37:05 +0000424 // Section names for all globals are already set.
425 const TargetData *TD = TM.getTargetData();
426
427 // Now print Autos section for this function.
Chris Lattner6af22f02009-08-21 23:08:09 +0000428 std::string SectionName = PAN::getAutosSectionName(FunctName);
Sanjiv Gupta89ec31a2009-08-13 16:37:05 +0000429 const std::vector<PIC16Section*> &AutosSections = PTOF->AutosSections;
430 for (unsigned i = 0; i < AutosSections.size(); i++) {
431 O << "\n";
432 if (AutosSections[i]->S_->getName() == SectionName) {
433 // Set the printing status to true
434 AutosSections[i]->setPrintedStatus(true);
Chris Lattner4b7dadb2009-08-19 05:49:37 +0000435 OutStreamer.SwitchSection(AutosSections[i]->S_);
Sanjiv Gupta89ec31a2009-08-13 16:37:05 +0000436 const std::vector<const GlobalVariable*> &Items = AutosSections[i]->Items;
437 for (unsigned j = 0; j < Items.size(); j++) {
438 std::string VarName = Mang->getMangledName(Items[j]);
439 Constant *C = Items[j]->getInitializer();
440 const Type *Ty = C->getType();
441 unsigned Size = TD->getTypeAllocSize(Ty);
442 // Emit memory reserve directive.
443 O << VarName << " RES " << Size << "\n";
444 }
445 break;
446 }
447 }
448}
449
450// Print autos that were not printed during the code printing of functions.
451// As the functions might themselves would have got deleted by the optimizer.
452void PIC16AsmPrinter::EmitRemainingAutos() {
453 const TargetData *TD = TM.getTargetData();
454
455 // Now print Autos section for this function.
456 std::vector <PIC16Section *>AutosSections = PTOF->AutosSections;
457 for (unsigned i = 0; i < AutosSections.size(); i++) {
458
459 // if the section is already printed then don't print again
460 if (AutosSections[i]->isPrinted())
461 continue;
462
463 // Set status as printed
464 AutosSections[i]->setPrintedStatus(true);
465
466 O << "\n";
Chris Lattner4b7dadb2009-08-19 05:49:37 +0000467 OutStreamer.SwitchSection(AutosSections[i]->S_);
Sanjiv Gupta89ec31a2009-08-13 16:37:05 +0000468 const std::vector<const GlobalVariable*> &Items = AutosSections[i]->Items;
469 for (unsigned j = 0; j < Items.size(); j++) {
470 std::string VarName = Mang->getMangledName(Items[j]);
471 Constant *C = Items[j]->getInitializer();
472 const Type *Ty = C->getType();
473 unsigned Size = TD->getTypeAllocSize(Ty);
474 // Emit memory reserve directive.
475 O << VarName << " RES " << Size << "\n";
476 }
477 }
478}
479
480
481extern "C" void LLVMInitializePIC16AsmPrinter() {
482 RegisterAsmPrinter<PIC16AsmPrinter> X(ThePIC16Target);
483}
484
485