Add a default constructor to get deterministic behavior.
[oota-llvm.git] / lib / Target / R600 / AMDGPUAsmPrinter.h
1 //===-- AMDGPUAsmPrinter.h - Print AMDGPU assembly code ---------*- C++ -*-===//
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 /// \file
11 /// \brief AMDGPU Assembly printer class.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef AMDGPU_ASMPRINTER_H
16 #define AMDGPU_ASMPRINTER_H
17
18 #include "llvm/CodeGen/AsmPrinter.h"
19 #include <string>
20 #include <vector>
21
22 namespace llvm {
23
24 class AMDGPUAsmPrinter : public AsmPrinter {
25 private:
26   struct SIProgramInfo {
27     SIProgramInfo() : NumSGPR(0), NumVGPR(0) {}
28     unsigned NumSGPR;
29     unsigned NumVGPR;
30   };
31
32   void getSIProgramInfo(SIProgramInfo &Out, MachineFunction &MF) const;
33   void findNumUsedRegistersSI(MachineFunction &MF,
34                               unsigned &NumSGPR,
35                               unsigned &NumVGPR) const;
36
37   /// \brief Emit register usage information so that the GPU driver
38   /// can correctly setup the GPU state.
39   void EmitProgramInfoR600(MachineFunction &MF);
40   void EmitProgramInfoSI(MachineFunction &MF, const SIProgramInfo &KernelInfo);
41
42 public:
43   explicit AMDGPUAsmPrinter(TargetMachine &TM, MCStreamer &Streamer);
44
45   virtual bool runOnMachineFunction(MachineFunction &MF);
46
47   virtual const char *getPassName() const {
48     return "AMDGPU Assembly Printer";
49   }
50
51   /// Implemented in AMDGPUMCInstLower.cpp
52   virtual void EmitInstruction(const MachineInstr *MI);
53
54 protected:
55   bool DisasmEnabled;
56   std::vector<std::string> DisasmLines, HexLines;
57   size_t DisasmLineMaxLen;
58 };
59
60 } // End anonymous llvm
61
62 #endif //AMDGPU_ASMPRINTER_H