LLVM API Documentation
00001 //===-- PIC16AsmPrinter.h - PIC16 LLVM assembly writer ----------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file contains a printer that converts from our internal representation 00011 // of machine-dependent LLVM code to PIC16 assembly language. 00012 // 00013 //===----------------------------------------------------------------------===// 00014 00015 #ifndef PIC16ASMPRINTER_H 00016 #define PIC16ASMPRINTER_H 00017 00018 #include "PIC16.h" 00019 #include "PIC16TargetMachine.h" 00020 #include "PIC16DebugInfo.h" 00021 #include "PIC16TargetObjectFile.h" 00022 #include "llvm/Analysis/DebugInfo.h" 00023 #include "PIC16TargetAsmInfo.h" 00024 #include "llvm/CodeGen/AsmPrinter.h" 00025 #include "llvm/Support/CommandLine.h" 00026 #include "llvm/Target/TargetAsmInfo.h" 00027 #include "llvm/Target/TargetMachine.h" 00028 #include <list> 00029 #include <string> 00030 00031 namespace llvm { 00032 class VISIBILITY_HIDDEN PIC16AsmPrinter : public AsmPrinter { 00033 public: 00034 explicit PIC16AsmPrinter(formatted_raw_ostream &O, TargetMachine &TM, 00035 const TargetAsmInfo *T, bool V); 00036 private: 00037 virtual const char *getPassName() const { 00038 return "PIC16 Assembly Printer"; 00039 } 00040 00041 PIC16TargetObjectFile &getObjFileLowering() const { 00042 return (PIC16TargetObjectFile &)AsmPrinter::getObjFileLowering(); 00043 } 00044 00045 bool runOnMachineFunction(MachineFunction &F); 00046 void printOperand(const MachineInstr *MI, int opNum); 00047 void printCCOperand(const MachineInstr *MI, int opNum); 00048 void printInstruction(const MachineInstr *MI); // definition autogenerated. 00049 bool printMachineInstruction(const MachineInstr *MI); 00050 void EmitFunctionDecls (Module &M); 00051 void EmitUndefinedVars (Module &M); 00052 void EmitDefinedVars (Module &M); 00053 void EmitIData (Module &M); 00054 void EmitUData (Module &M); 00055 void EmitAutos (std::string FunctName); 00056 void EmitRemainingAutos (); 00057 void EmitRomData (Module &M); 00058 void EmitFunctionFrame(MachineFunction &MF); 00059 void printLibcallDecls(); 00060 protected: 00061 bool doInitialization(Module &M); 00062 bool doFinalization(Module &M); 00063 00064 /// PrintGlobalVariable - Emit the specified global variable and its 00065 /// initializer to the output stream. 00066 virtual void PrintGlobalVariable(const GlobalVariable *GV) { 00067 // PIC16 doesn't use normal hooks for this. 00068 } 00069 00070 private: 00071 PIC16TargetObjectFile *PTOF; 00072 PIC16TargetLowering *PTLI; 00073 PIC16DbgInfo DbgInfo; 00074 const PIC16TargetAsmInfo *PTAI; 00075 std::list<const char *> LibcallDecls; // List of extern decls. 00076 }; 00077 } // end of namespace 00078 00079 #endif