1 //===-- PTXAsmPrinter.h - Print machine code to a PTX file ----------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // PTX Assembly printer class.
12 //===----------------------------------------------------------------------===//
14 #ifndef PTXASMPRINTER_H
15 #define PTXASMPRINTER_H
18 #include "PTXTargetMachine.h"
19 #include "llvm/ADT/StringMap.h"
20 #include "llvm/CodeGen/AsmPrinter.h"
21 #include "llvm/Support/Compiler.h"
27 class LLVM_LIBRARY_VISIBILITY PTXAsmPrinter : public AsmPrinter {
29 explicit PTXAsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
30 : AsmPrinter(TM, Streamer) {}
32 const char *getPassName() const { return "PTX Assembly Printer"; }
34 bool doFinalization(Module &M);
36 virtual void EmitStartOfAsmFile(Module &M);
37 virtual void EmitFunctionBodyStart();
38 virtual void EmitFunctionBodyEnd();
39 virtual void EmitFunctionEntryLabel();
40 virtual void EmitInstruction(const MachineInstr *MI);
42 unsigned GetOrCreateSourceID(StringRef FileName,
45 MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol);
46 MCOperand lowerOperand(const MachineOperand &MO);
49 void EmitVariableDeclaration(const GlobalVariable *gv);
50 void EmitFunctionDeclaration();
52 StringMap<unsigned> SourceIdMap;
53 }; // class PTXAsmPrinter