2008-11-19 12:12:49 +00:00
|
|
|
//===-- PIC16AsmPrinter.h - PIC16 LLVM assembly writer ------------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file contains a printer that converts from our internal representation
|
|
|
|
// of machine-dependent LLVM code to PIC16 assembly language.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef PIC16ASMPRINTER_H
|
|
|
|
#define PIC16ASMPRINTER_H
|
|
|
|
|
|
|
|
#include "PIC16.h"
|
|
|
|
#include "PIC16TargetMachine.h"
|
2009-05-22 13:58:45 +00:00
|
|
|
#include "PIC16DebugInfo.h"
|
|
|
|
#include "llvm/Analysis/DebugInfo.h"
|
2009-05-13 15:13:17 +00:00
|
|
|
#include "PIC16TargetAsmInfo.h"
|
2008-11-19 12:12:49 +00:00
|
|
|
#include "llvm/CodeGen/AsmPrinter.h"
|
|
|
|
#include "llvm/Support/CommandLine.h"
|
|
|
|
#include "llvm/Target/TargetAsmInfo.h"
|
|
|
|
#include "llvm/Target/TargetMachine.h"
|
2009-05-11 06:01:38 +00:00
|
|
|
#include <list>
|
|
|
|
#include <string>
|
2008-11-19 12:12:49 +00:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
struct VISIBILITY_HIDDEN PIC16AsmPrinter : public AsmPrinter {
|
2009-07-15 23:17:20 +00:00
|
|
|
explicit PIC16AsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
|
2009-07-01 01:48:54 +00:00
|
|
|
const TargetAsmInfo *T, bool V)
|
|
|
|
: AsmPrinter(O, TM, T, V), DbgInfo(O, T) {
|
2009-07-15 23:17:20 +00:00
|
|
|
PTLI = static_cast<const PIC16TargetLowering *> (TM.getTargetLowering());
|
2009-05-13 15:13:17 +00:00
|
|
|
PTAI = static_cast<const PIC16TargetAsmInfo *> (T);
|
2008-11-19 12:12:49 +00:00
|
|
|
}
|
|
|
|
private :
|
|
|
|
virtual const char *getPassName() const {
|
|
|
|
return "PIC16 Assembly Printer";
|
|
|
|
}
|
|
|
|
|
|
|
|
bool runOnMachineFunction(MachineFunction &F);
|
|
|
|
void printOperand(const MachineInstr *MI, int opNum);
|
2009-01-13 19:18:47 +00:00
|
|
|
void printCCOperand(const MachineInstr *MI, int opNum);
|
2008-11-19 12:12:49 +00:00
|
|
|
bool printInstruction(const MachineInstr *MI); // definition autogenerated.
|
|
|
|
bool printMachineInstruction(const MachineInstr *MI);
|
2009-05-13 15:13:17 +00:00
|
|
|
void EmitFunctionDecls (Module &M);
|
|
|
|
void EmitUndefinedVars (Module &M);
|
|
|
|
void EmitDefinedVars (Module &M);
|
2009-05-12 17:07:27 +00:00
|
|
|
void EmitIData (Module &M);
|
|
|
|
void EmitUData (Module &M);
|
2009-05-28 18:24:11 +00:00
|
|
|
void EmitAutos (std::string FunctName);
|
2009-06-09 15:31:19 +00:00
|
|
|
void EmitRemainingAutos ();
|
2008-11-19 12:12:49 +00:00
|
|
|
void EmitRomData (Module &M);
|
2009-05-28 18:24:11 +00:00
|
|
|
void EmitFunctionFrame(MachineFunction &MF);
|
2009-05-13 15:13:17 +00:00
|
|
|
void printLibcallDecls(void);
|
2008-11-19 12:12:49 +00:00
|
|
|
protected:
|
|
|
|
bool doInitialization(Module &M);
|
|
|
|
bool doFinalization(Module &M);
|
|
|
|
|
|
|
|
private:
|
2009-04-06 10:54:50 +00:00
|
|
|
PIC16TargetLowering *PTLI;
|
2009-05-22 13:58:45 +00:00
|
|
|
PIC16DbgInfo DbgInfo;
|
2009-05-13 15:13:17 +00:00
|
|
|
const PIC16TargetAsmInfo *PTAI;
|
|
|
|
std::list<const char *> LibcallDecls; // List of extern decls.
|
2008-11-19 12:12:49 +00:00
|
|
|
};
|
|
|
|
} // end of namespace
|
|
|
|
|
|
|
|
#endif
|