1 //===-- AMDGPUCodeEmitter.h - AMDGPU Code Emitter interface -----*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 // 9 /// \file 10 /// CodeEmitter interface for SI codegen. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #ifndef LLVM_LIB_TARGET_AMDGPU_MCTARGETDESC_AMDGPUMCCODEEMITTER_H 15 #define LLVM_LIB_TARGET_AMDGPU_MCTARGETDESC_AMDGPUMCCODEEMITTER_H 16 17 #include "llvm/ADT/APInt.h" 18 #include "llvm/MC/MCCodeEmitter.h" 19 20 namespace llvm { 21 22 class MCInst; 23 class MCInstrInfo; 24 class MCOperand; 25 class MCSubtargetInfo; 26 class FeatureBitset; 27 28 class AMDGPUMCCodeEmitter : public MCCodeEmitter { 29 virtual void anchor(); 30 31 protected: 32 const MCInstrInfo &MCII; 33 AMDGPUMCCodeEmitter(const MCInstrInfo & mcii)34 AMDGPUMCCodeEmitter(const MCInstrInfo &mcii) : MCII(mcii) {} 35 36 public: 37 void getBinaryCodeForInstr(const MCInst &MI, SmallVectorImpl<MCFixup> &Fixups, 38 APInt &Inst, APInt &Scratch, 39 const MCSubtargetInfo &STI) const; 40 41 virtual void getMachineOpValue(const MCInst &MI, const MCOperand &MO, 42 APInt &Op, SmallVectorImpl<MCFixup> &Fixups, 43 const MCSubtargetInfo &STI) const = 0; 44 45 virtual void getSOPPBrEncoding(const MCInst &MI, unsigned OpNo, APInt &Op, 46 SmallVectorImpl<MCFixup> &Fixups, 47 const MCSubtargetInfo &STI) const = 0; 48 49 virtual void getSMEMOffsetEncoding(const MCInst &MI, unsigned OpNo, APInt &Op, 50 SmallVectorImpl<MCFixup> &Fixups, 51 const MCSubtargetInfo &STI) const = 0; 52 53 virtual void getSDWASrcEncoding(const MCInst &MI, unsigned OpNo, APInt &Op, 54 SmallVectorImpl<MCFixup> &Fixups, 55 const MCSubtargetInfo &STI) const = 0; 56 57 virtual void getSDWAVopcDstEncoding(const MCInst &MI, unsigned OpNo, 58 APInt &Op, 59 SmallVectorImpl<MCFixup> &Fixups, 60 const MCSubtargetInfo &STI) const = 0; 61 62 virtual void getAVOperandEncoding(const MCInst &MI, unsigned OpNo, APInt &Op, 63 SmallVectorImpl<MCFixup> &Fixups, 64 const MCSubtargetInfo &STI) const = 0; 65 }; 66 67 } // End namespace llvm 68 69 #endif 70