2013-11-10 09:03:59 +08:00
|
|
|
//===-- AMDGPUAsmPrinter.h - Print AMDGPU assembly code ---------*- C++ -*-===//
|
2012-12-12 05:25:42 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
/// \file
|
|
|
|
/// \brief AMDGPU Assembly printer class.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef AMDGPU_ASMPRINTER_H
|
|
|
|
#define AMDGPU_ASMPRINTER_H
|
|
|
|
|
|
|
|
#include "llvm/CodeGen/AsmPrinter.h"
|
2013-10-12 13:02:51 +08:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2012-12-12 05:25:42 +08:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
class AMDGPUAsmPrinter : public AsmPrinter {
|
2013-12-05 13:15:35 +08:00
|
|
|
private:
|
|
|
|
struct SIProgramInfo {
|
2013-12-06 00:21:17 +08:00
|
|
|
SIProgramInfo() : NumSGPR(0), NumVGPR(0) {}
|
2013-12-05 13:15:35 +08:00
|
|
|
unsigned NumSGPR;
|
|
|
|
unsigned NumVGPR;
|
|
|
|
};
|
|
|
|
|
|
|
|
void getSIProgramInfo(SIProgramInfo &Out, MachineFunction &MF) const;
|
|
|
|
void findNumUsedRegistersSI(MachineFunction &MF,
|
|
|
|
unsigned &NumSGPR,
|
|
|
|
unsigned &NumVGPR) const;
|
|
|
|
|
|
|
|
/// \brief Emit register usage information so that the GPU driver
|
|
|
|
/// can correctly setup the GPU state.
|
|
|
|
void EmitProgramInfoR600(MachineFunction &MF);
|
|
|
|
void EmitProgramInfoSI(MachineFunction &MF, const SIProgramInfo &KernelInfo);
|
2012-12-12 05:25:42 +08:00
|
|
|
|
|
|
|
public:
|
2013-10-12 13:02:51 +08:00
|
|
|
explicit AMDGPUAsmPrinter(TargetMachine &TM, MCStreamer &Streamer);
|
2012-12-12 05:25:42 +08:00
|
|
|
|
|
|
|
virtual bool runOnMachineFunction(MachineFunction &MF);
|
|
|
|
|
|
|
|
virtual const char *getPassName() const {
|
|
|
|
return "AMDGPU Assembly Printer";
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Implemented in AMDGPUMCInstLower.cpp
|
|
|
|
virtual void EmitInstruction(const MachineInstr *MI);
|
2013-10-12 13:02:51 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
bool DisasmEnabled;
|
|
|
|
std::vector<std::string> DisasmLines, HexLines;
|
|
|
|
size_t DisasmLineMaxLen;
|
2012-12-12 05:25:42 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End anonymous llvm
|
|
|
|
|
|
|
|
#endif //AMDGPU_ASMPRINTER_H
|