mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-23 15:29:51 +00:00
f0144127b9
it is highly specific to the object file that will be generated in the end, this introduces a new TargetLoweringObjectFile interface that is implemented for each of ELF/MachO/COFF/Alpha/PIC16 and XCore. Though still is still a brutal and ugly refactoring, this is a major step towards goodness. This patch also: 1. fixes a bunch of dangling pointer problems in the PIC16 backend. 2. disables the TargetLowering copy ctor which PIC16 was accidentally using. 3. gets us closer to xcore having its own crazy target section flags and pic16 not having to shadow sections with its own objects. 4. fixes wierdness where ELF targets would set CStringSection but not CStringSection_. Factor the code better. 5. fixes some bugs in string lowering on ELF targets. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77294 91177308-0d34-0410-b5e6-96231b3b80d8
76 lines
2.5 KiB
C++
76 lines
2.5 KiB
C++
//===-- PIC16AsmPrinter.h - PIC16 LLVM assembly writer ----------*- C++ -*-===//
|
|
//
|
|
// 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"
|
|
#include "PIC16DebugInfo.h"
|
|
#include "PIC16TargetObjectFile.h"
|
|
#include "llvm/Analysis/DebugInfo.h"
|
|
#include "PIC16TargetAsmInfo.h"
|
|
#include "llvm/CodeGen/AsmPrinter.h"
|
|
#include "llvm/Support/CommandLine.h"
|
|
#include "llvm/Target/TargetAsmInfo.h"
|
|
#include "llvm/Target/TargetMachine.h"
|
|
#include <list>
|
|
#include <string>
|
|
|
|
namespace llvm {
|
|
class VISIBILITY_HIDDEN PIC16AsmPrinter : public AsmPrinter {
|
|
public:
|
|
explicit PIC16AsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
|
|
const TargetAsmInfo *T, bool V);
|
|
private:
|
|
virtual const char *getPassName() const {
|
|
return "PIC16 Assembly Printer";
|
|
}
|
|
|
|
bool runOnMachineFunction(MachineFunction &F);
|
|
void printOperand(const MachineInstr *MI, int opNum);
|
|
void printCCOperand(const MachineInstr *MI, int opNum);
|
|
bool printInstruction(const MachineInstr *MI); // definition autogenerated.
|
|
bool printMachineInstruction(const MachineInstr *MI);
|
|
void EmitFunctionDecls (Module &M);
|
|
void EmitUndefinedVars (Module &M);
|
|
void EmitDefinedVars (Module &M);
|
|
void EmitIData (Module &M);
|
|
void EmitUData (Module &M);
|
|
void EmitAutos (std::string FunctName);
|
|
void EmitRemainingAutos ();
|
|
void EmitRomData (Module &M);
|
|
void EmitFunctionFrame(MachineFunction &MF);
|
|
void printLibcallDecls(void);
|
|
protected:
|
|
bool doInitialization(Module &M);
|
|
bool doFinalization(Module &M);
|
|
|
|
/// PrintGlobalVariable - Emit the specified global variable and its
|
|
/// initializer to the output stream.
|
|
virtual void PrintGlobalVariable(const GlobalVariable *GV) {
|
|
// PIC16 doesn't use normal hooks for this.
|
|
}
|
|
|
|
private:
|
|
PIC16TargetObjectFile *PTOF;
|
|
PIC16TargetLowering *PTLI;
|
|
PIC16DbgInfo DbgInfo;
|
|
const PIC16TargetAsmInfo *PTAI;
|
|
std::list<const char *> LibcallDecls; // List of extern decls.
|
|
};
|
|
} // end of namespace
|
|
|
|
#endif
|