2012-12-12 05:25:42 +08:00
|
|
|
//===-- AMDGPUInstPrinter.h - AMDGPU MC Inst -> ASM interface ---*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
/// \file
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2016-03-11 16:00:27 +08:00
|
|
|
#ifndef LLVM_LIB_TARGET_AMDGPU_INSTPRINTER_AMDGPUINSTPRINTER_H
|
|
|
|
#define LLVM_LIB_TARGET_AMDGPU_INSTPRINTER_AMDGPUINSTPRINTER_H
|
2012-12-12 05:25:42 +08:00
|
|
|
|
|
|
|
#include "llvm/MC/MCInstPrinter.h"
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
class AMDGPUInstPrinter : public MCInstPrinter {
|
|
|
|
public:
|
AMDGPU: Add R600InstPrinter class
Summary:
This is step towards separating the GCN and R600 tablegen'd code.
This is a little awkward for now, because the R600 functions won't have the
MCSubtargetInfo parameter, so we need to have AMDMGPUInstPrinter
delegate to R600InstPrinter, but once the tablegen'd code is split,
we will be able to drop the delegation and use R600InstPrinter directly.
Reviewers: arsenm
Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits
Differential Revision: https://reviews.llvm.org/D36444
llvm-svn: 311128
2017-08-18 06:20:04 +08:00
|
|
|
AMDGPUInstPrinter(const MCAsmInfo &MAI,
|
|
|
|
const MCInstrInfo &MII, const MCRegisterInfo &MRI)
|
2012-12-12 05:25:42 +08:00
|
|
|
: MCInstPrinter(MAI, MII, MRI) {}
|
|
|
|
|
|
|
|
//Autogenerated by tblgen
|
2016-09-27 22:42:48 +08:00
|
|
|
void printInstruction(const MCInst *MI, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
2012-12-12 05:25:42 +08:00
|
|
|
static const char *getRegisterName(unsigned RegNo);
|
|
|
|
|
2015-03-28 04:36:02 +08:00
|
|
|
void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot,
|
|
|
|
const MCSubtargetInfo &STI) override;
|
2015-04-08 09:09:26 +08:00
|
|
|
static void printRegOperand(unsigned RegNo, raw_ostream &O,
|
|
|
|
const MCRegisterInfo &MRI);
|
2012-12-12 05:25:42 +08:00
|
|
|
|
|
|
|
private:
|
2016-10-13 02:00:51 +08:00
|
|
|
void printU4ImmOperand(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
2014-04-16 06:32:49 +08:00
|
|
|
void printU8ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
|
2016-09-27 22:42:48 +08:00
|
|
|
void printU16ImmOperand(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
2016-03-09 20:29:31 +08:00
|
|
|
void printU4ImmDecOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
|
2014-10-11 06:16:07 +08:00
|
|
|
void printU8ImmDecOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
|
|
|
|
void printU16ImmDecOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
|
2017-11-28 01:14:35 +08:00
|
|
|
void printS13ImmDecOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
|
2016-09-27 22:42:48 +08:00
|
|
|
void printU32ImmOperand(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printNamedBit(const MCInst *MI, unsigned OpNo, raw_ostream &O,
|
2016-07-06 06:06:56 +08:00
|
|
|
StringRef BitName);
|
2014-08-05 22:48:12 +08:00
|
|
|
void printOffen(const MCInst *MI, unsigned OpNo, raw_ostream &O);
|
|
|
|
void printIdxen(const MCInst *MI, unsigned OpNo, raw_ostream &O);
|
|
|
|
void printAddr64(const MCInst *MI, unsigned OpNo, raw_ostream &O);
|
|
|
|
void printMBUFOffset(const MCInst *MI, unsigned OpNo, raw_ostream &O);
|
2016-09-27 22:42:48 +08:00
|
|
|
void printOffset(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
2017-06-21 03:54:14 +08:00
|
|
|
void printOffsetS13(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
|
|
|
|
2016-09-27 22:42:48 +08:00
|
|
|
void printOffset0(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
|
|
|
void printOffset1(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
2016-11-01 00:07:39 +08:00
|
|
|
void printSMRDOffset8(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printSMRDOffset20(const MCInst *MI, unsigned OpNo,
|
2016-09-27 22:42:48 +08:00
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printSMRDLiteralOffset(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printGDS(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
|
|
|
void printGLC(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
|
|
|
void printSLC(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
|
|
|
void printTFE(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
|
|
|
void printDMask(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
|
|
|
void printUNorm(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
|
|
|
void printDA(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
|
|
|
void printR128(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
2016-12-06 04:31:49 +08:00
|
|
|
void printLWE(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printExpCompr(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printExpVM(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
2017-06-23 00:29:22 +08:00
|
|
|
void printDFMT(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printNFMT(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
2016-12-06 04:31:49 +08:00
|
|
|
|
2014-04-16 06:32:42 +08:00
|
|
|
void printRegOperand(unsigned RegNo, raw_ostream &O);
|
2016-09-27 22:42:48 +08:00
|
|
|
void printVOPDst(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
2018-03-17 00:38:04 +08:00
|
|
|
void printVINTRPDst(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
2016-12-10 08:39:12 +08:00
|
|
|
void printImmediate16(uint32_t Imm, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
2017-02-28 02:49:11 +08:00
|
|
|
void printImmediateV216(uint32_t Imm, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
2016-10-29 12:05:06 +08:00
|
|
|
void printImmediate32(uint32_t Imm, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
|
|
|
void printImmediate64(uint64_t Imm, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
2016-09-27 22:42:48 +08:00
|
|
|
void printOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
|
|
|
void printOperandAndFPInputMods(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printOperandAndIntInputMods(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printDPPCtrl(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
|
|
|
void printRowMask(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
|
|
|
void printBankMask(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printBoundCtrl(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
2016-04-26 21:33:56 +08:00
|
|
|
void printSDWASel(const MCInst *MI, unsigned OpNo, raw_ostream &O);
|
2016-09-27 22:42:48 +08:00
|
|
|
void printSDWADstSel(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printSDWASrc0Sel(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printSDWASrc1Sel(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printSDWADstUnused(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
2017-07-21 21:54:11 +08:00
|
|
|
void printPackedModifier(const MCInst *MI, StringRef Name, unsigned Mod,
|
|
|
|
raw_ostream &O);
|
2017-02-28 02:49:11 +08:00
|
|
|
void printOpSel(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printOpSelHi(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printNegLo(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printNegHi(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
2016-09-27 22:42:48 +08:00
|
|
|
void printInterpSlot(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
2016-12-15 00:36:12 +08:00
|
|
|
void printInterpAttr(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printInterpAttrChan(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
|
2016-10-13 02:00:51 +08:00
|
|
|
void printVGPRIndexMode(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
2016-09-27 22:42:48 +08:00
|
|
|
void printMemOperand(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
2016-12-06 04:31:49 +08:00
|
|
|
|
|
|
|
|
|
|
|
template <unsigned N>
|
|
|
|
void printExpSrcN(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printExpSrc0(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printExpSrc1(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printExpSrc2(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printExpSrc3(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printExpTgt(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
|
AMDGPU: Add R600InstPrinter class
Summary:
This is step towards separating the GCN and R600 tablegen'd code.
This is a little awkward for now, because the R600 functions won't have the
MCSubtargetInfo parameter, so we need to have AMDMGPUInstPrinter
delegate to R600InstPrinter, but once the tablegen'd code is split,
we will be able to drop the delegation and use R600InstPrinter directly.
Reviewers: arsenm
Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits
Differential Revision: https://reviews.llvm.org/D36444
llvm-svn: 311128
2017-08-18 06:20:04 +08:00
|
|
|
public:
|
2014-03-18 06:23:09 +08:00
|
|
|
static void printIfSet(const MCInst *MI, unsigned OpNo, raw_ostream &O,
|
|
|
|
StringRef Asm, StringRef Default = "");
|
2016-09-27 22:42:48 +08:00
|
|
|
static void printIfSet(const MCInst *MI, unsigned OpNo, raw_ostream &O,
|
|
|
|
char Asm);
|
AMDGPU: Add R600InstPrinter class
Summary:
This is step towards separating the GCN and R600 tablegen'd code.
This is a little awkward for now, because the R600 functions won't have the
MCSubtargetInfo parameter, so we need to have AMDMGPUInstPrinter
delegate to R600InstPrinter, but once the tablegen'd code is split,
we will be able to drop the delegation and use R600InstPrinter directly.
Reviewers: arsenm
Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits
Differential Revision: https://reviews.llvm.org/D36444
llvm-svn: 311128
2017-08-18 06:20:04 +08:00
|
|
|
protected:
|
2016-09-27 22:42:48 +08:00
|
|
|
void printAbs(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
2017-08-07 21:14:12 +08:00
|
|
|
void printHigh(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
2016-09-27 22:42:48 +08:00
|
|
|
void printClamp(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
|
|
|
void printClampSI(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
|
|
|
void printOModSI(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
|
|
|
void printLiteral(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
|
|
|
void printLast(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
|
|
|
void printNeg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
|
|
|
void printOMOD(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
|
|
|
void printRel(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
|
|
|
void printUpdateExecMask(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printUpdatePred(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printWrite(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
|
|
|
void printBankSwizzle(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printRSel(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
|
|
|
void printCT(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
|
|
|
void printKCache(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
|
|
|
void printSendMsg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
2017-06-01 00:26:47 +08:00
|
|
|
void printSwizzle(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
2016-09-27 22:42:48 +08:00
|
|
|
void printWaitFlag(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printHwreg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
2012-12-12 05:25:42 +08:00
|
|
|
};
|
|
|
|
|
AMDGPU: Add R600InstPrinter class
Summary:
This is step towards separating the GCN and R600 tablegen'd code.
This is a little awkward for now, because the R600 functions won't have the
MCSubtargetInfo parameter, so we need to have AMDMGPUInstPrinter
delegate to R600InstPrinter, but once the tablegen'd code is split,
we will be able to drop the delegation and use R600InstPrinter directly.
Reviewers: arsenm
Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits
Differential Revision: https://reviews.llvm.org/D36444
llvm-svn: 311128
2017-08-18 06:20:04 +08:00
|
|
|
// FIXME: R600 specific parts of AMDGPUInstrPrinter should be moved here, and
|
|
|
|
// MCTargetDesc should be using R600InstPrinter for the R600 target.
|
|
|
|
class R600InstPrinter : public AMDGPUInstPrinter {
|
|
|
|
public:
|
|
|
|
R600InstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII,
|
|
|
|
const MCRegisterInfo &MRI)
|
|
|
|
: AMDGPUInstPrinter(MAI, MII, MRI) {}
|
|
|
|
|
|
|
|
void printAbs(const MCInst *MI, unsigned OpNo, raw_ostream &O);
|
|
|
|
void printBankSwizzle(const MCInst *MI, unsigned OpNo, raw_ostream &O);
|
|
|
|
void printClamp(const MCInst *MI, unsigned OpNo, raw_ostream &O);
|
|
|
|
void printCT(const MCInst *MI, unsigned OpNo, raw_ostream &O);
|
|
|
|
void printKCache(const MCInst *MI, unsigned OpNo, raw_ostream &O);
|
|
|
|
void printLast(const MCInst *MI, unsigned OpNo, raw_ostream &O);
|
|
|
|
void printLiteral(const MCInst *MI, unsigned OpNo, raw_ostream &O);
|
|
|
|
void printMemOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
|
|
|
|
void printNeg(const MCInst *MI, unsigned OpNo, raw_ostream &O);
|
|
|
|
void printOMOD(const MCInst *MI, unsigned OpNo, raw_ostream &O);
|
|
|
|
void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
|
|
|
|
void printRel(const MCInst *MI, unsigned OpNo, raw_ostream &O);
|
|
|
|
void printRSel(const MCInst *MI, unsigned OpNo, raw_ostream &O);
|
|
|
|
void printUpdateExecMask(const MCInst *MI, unsigned OpNo, raw_ostream &O);
|
|
|
|
void printUpdatePred(const MCInst *MI, unsigned OpNo, raw_ostream &O);
|
|
|
|
void printWrite(const MCInst *MI, unsigned OpNo, raw_ostream &O);
|
|
|
|
};
|
|
|
|
|
2012-12-12 05:25:42 +08:00
|
|
|
} // End namespace llvm
|
|
|
|
|
2014-08-14 00:26:38 +08:00
|
|
|
#endif
|