LLVM  13.0.0git
Classes | Macros | Functions | Variables
AMDGPUAsmParser.cpp File Reference
#include "AMDKernelCodeT.h"
#include "MCTargetDesc/AMDGPUMCTargetDesc.h"
#include "MCTargetDesc/AMDGPUTargetStreamer.h"
#include "SIDefines.h"
#include "SIInstrInfo.h"
#include "SIRegisterInfo.h"
#include "TargetInfo/AMDGPUTargetInfo.h"
#include "Utils/AMDGPUAsmUtils.h"
#include "Utils/AMDGPUBaseInfo.h"
#include "Utils/AMDKernelCodeTUtils.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/SmallBitVector.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/ADT/Twine.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCParser/MCAsmParser.h"
#include "llvm/MC/MCParser/MCParsedAsmOperand.h"
#include "llvm/MC/MCParser/MCTargetAsmParser.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/Support/AMDGPUMetadata.h"
#include "llvm/Support/AMDHSAKernelDescriptor.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/MachineValueType.h"
#include "llvm/Support/TargetParser.h"
#include "llvm/Support/TargetRegistry.h"
#include "AMDGPUGenAsmMatcher.inc"
Include dependency graph for AMDGPUAsmParser.cpp:

Go to the source code of this file.

Classes

struct  RegInfo
 

Macros

#define PARSE_BITS_ENTRY(FIELD, ENTRY, VALUE, RANGE)
 
#define GET_REGISTER_MATCHER
 
#define GET_MATCHER_IMPLEMENTATION
 
#define GET_MNEMONIC_SPELL_CHECKER
 
#define GET_MNEMONIC_CHECKER
 
Auto-generated Match Functions

{

#define GET_ASSEMBLER_HEADER
 

Functions

static const fltSemanticsgetFltSemantics (unsigned Size)
 
static const fltSemanticsgetFltSemantics (MVT VT)
 
static const fltSemanticsgetOpFltSemantics (uint8_t OperandType)
 
static bool canLosslesslyConvertToFPType (APFloat &FPLiteral, MVT VT)
 
static bool isSafeTruncation (int64_t Val, unsigned Size)
 
static bool isInlineableLiteralOp16 (int64_t Val, MVT VT, bool HasInv2Pi)
 
static bool isInlineValue (unsigned Reg)
 
static int getRegClass (RegisterKind Is, unsigned RegWidth)
 
static unsigned getSpecialRegForName (StringRef RegName)
 
static bool isRegularReg (RegisterKind Kind)
 
static const RegInfogetRegularRegInfo (StringRef Str)
 
static bool getRegNum (StringRef Str, unsigned &Num)
 
static ArrayRef< unsigned > getAllVariants ()
 
static bool IsMovrelsSDWAOpcode (const unsigned Opcode)
 
static bool IsRevOpcode (const unsigned Opcode)
 
static int IsAGPROperand (const MCInst &Inst, uint16_t NameIdx, const MCRegisterInfo *MRI)
 
static std::string AMDGPUMnemonicSpellCheck (StringRef S, const FeatureBitset &FBS, unsigned VariantID=0)
 
static bool AMDGPUCheckMnemonic (StringRef Mnemonic, const FeatureBitset &AvailableFeatures, unsigned VariantID)
 
static void addOptionalImmOperand (MCInst &Inst, const OperandVector &Operands, AMDGPUAsmParser::OptionalImmIndexMap &OptionalIdx, AMDGPUOperand::ImmTy ImmT, int64_t Default=0)
 
static bool encodeCnt (const AMDGPU::IsaVersion ISA, int64_t &IntVal, int64_t CntVal, bool Saturate, unsigned(*encode)(const IsaVersion &Version, unsigned, unsigned), unsigned(*decode)(const IsaVersion &Version, unsigned))
 
static LLVM_READNONE unsigned encodeBitmaskPerm (const unsigned AndMask, const unsigned OrMask, const unsigned XorMask)
 
static bool ConvertOmodMul (int64_t &Mul)
 
static bool ConvertOmodDiv (int64_t &Div)
 
static bool ConvertBoundCtrl (int64_t &BoundCtrl)
 
static bool isRegOrImmWithInputMods (const MCInstrDesc &Desc, unsigned OpNum)
 
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAMDGPUAsmParser ()
 Force static initialization. More...
 

Variables

static constexpr RegInfo RegularRegisters []
 
static const OptionalOperand AMDGPUOptionalOperandTable []
 

Macro Definition Documentation

◆ GET_ASSEMBLER_HEADER

#define GET_ASSEMBLER_HEADER

Definition at line 1179 of file AMDGPUAsmParser.cpp.

◆ GET_MATCHER_IMPLEMENTATION

#define GET_MATCHER_IMPLEMENTATION

Definition at line 8173 of file AMDGPUAsmParser.cpp.

◆ GET_MNEMONIC_CHECKER

#define GET_MNEMONIC_CHECKER

Definition at line 8175 of file AMDGPUAsmParser.cpp.

◆ GET_MNEMONIC_SPELL_CHECKER

#define GET_MNEMONIC_SPELL_CHECKER

Definition at line 8174 of file AMDGPUAsmParser.cpp.

◆ GET_REGISTER_MATCHER

#define GET_REGISTER_MATCHER

Definition at line 8172 of file AMDGPUAsmParser.cpp.

◆ PARSE_BITS_ENTRY

#define PARSE_BITS_ENTRY (   FIELD,
  ENTRY,
  VALUE,
  RANGE 
)
Value:
if (!isUInt<ENTRY##_WIDTH>(VALUE)) \
return OutOfRangeError(RANGE); \
AMDHSA_BITS_SET(FIELD, ENTRY, VALUE);

Function Documentation

◆ addOptionalImmOperand()

static void addOptionalImmOperand ( MCInst Inst,
const OperandVector Operands,
AMDGPUAsmParser::OptionalImmIndexMap &  OptionalIdx,
AMDGPUOperand::ImmTy  ImmT,
int64_t  Default = 0 
)
static

◆ AMDGPUCheckMnemonic()

static bool AMDGPUCheckMnemonic ( StringRef  Mnemonic,
const FeatureBitset AvailableFeatures,
unsigned  VariantID 
)
static

◆ AMDGPUMnemonicSpellCheck()

static std::string AMDGPUMnemonicSpellCheck ( StringRef  S,
const FeatureBitset FBS,
unsigned  VariantID = 0 
)
static

◆ canLosslesslyConvertToFPType()

static bool canLosslesslyConvertToFPType ( APFloat FPLiteral,
MVT  VT 
)
static

Definition at line 1747 of file AMDGPUAsmParser.cpp.

◆ ConvertBoundCtrl()

static bool ConvertBoundCtrl ( int64_t &  BoundCtrl)
static

Definition at line 7208 of file AMDGPUAsmParser.cpp.

◆ ConvertOmodDiv()

static bool ConvertOmodDiv ( int64_t &  Div)
static

Definition at line 7191 of file AMDGPUAsmParser.cpp.

◆ ConvertOmodMul()

static bool ConvertOmodMul ( int64_t &  Mul)
static

Definition at line 7183 of file AMDGPUAsmParser.cpp.

References llvm::Mul.

◆ encodeBitmaskPerm()

static LLVM_READNONE unsigned encodeBitmaskPerm ( const unsigned  AndMask,
const unsigned  OrMask,
const unsigned  XorMask 
)
static

◆ encodeCnt()

static bool encodeCnt ( const AMDGPU::IsaVersion  ISA,
int64_t &  IntVal,
int64_t  CntVal,
bool  Saturate,
unsigned(*)(const IsaVersion &Version, unsigned, unsigned)  encode,
unsigned(*)(const IsaVersion &Version, unsigned)  decode 
)
static

Definition at line 5895 of file AMDGPUAsmParser.cpp.

References decode(), llvm::encode(), llvm::Failed(), and llvm::tgtok::IntVal.

◆ getAllVariants()

static ArrayRef<unsigned> getAllVariants ( )
static

◆ getFltSemantics() [1/2]

static const fltSemantics* getFltSemantics ( MVT  VT)
static

Definition at line 1702 of file AMDGPUAsmParser.cpp.

◆ getFltSemantics() [2/2]

static const fltSemantics* getFltSemantics ( unsigned  Size)
static

Definition at line 1689 of file AMDGPUAsmParser.cpp.

◆ getOpFltSemantics()

static const fltSemantics* getOpFltSemantics ( uint8_t  OperandType)
static

Definition at line 1706 of file AMDGPUAsmParser.cpp.

◆ getRegClass()

static int getRegClass ( RegisterKind  Is,
unsigned  RegWidth 
)
static

◆ getRegNum()

static bool getRegNum ( StringRef  Str,
unsigned &  Num 
)
static

Definition at line 2381 of file AMDGPUAsmParser.cpp.

References llvm::StringRef::getAsInteger().

◆ getRegularRegInfo()

static const RegInfo* getRegularRegInfo ( StringRef  Str)
static

Definition at line 2374 of file AMDGPUAsmParser.cpp.

References Reg, RegularRegisters, and llvm::StringRef::startswith().

◆ getSpecialRegForName()

static unsigned getSpecialRegForName ( StringRef  RegName)
static

◆ IsAGPROperand()

static int IsAGPROperand ( const MCInst Inst,
uint16_t  NameIdx,
const MCRegisterInfo MRI 
)
static

◆ isInlineableLiteralOp16()

static bool isInlineableLiteralOp16 ( int64_t  Val,
MVT  VT,
bool  HasInv2Pi 
)
static

Definition at line 1769 of file AMDGPUAsmParser.cpp.

References llvm::Literal.

◆ isInlineValue()

static bool isInlineValue ( unsigned  Reg)
static

Definition at line 2149 of file AMDGPUAsmParser.cpp.

References Reg.

◆ IsMovrelsSDWAOpcode()

static bool IsMovrelsSDWAOpcode ( const unsigned  Opcode)
static

Definition at line 3507 of file AMDGPUAsmParser.cpp.

◆ isRegOrImmWithInputMods()

static bool isRegOrImmWithInputMods ( const MCInstrDesc Desc,
unsigned  OpNum 
)
static

◆ isRegularReg()

static bool isRegularReg ( RegisterKind  Kind)
static

Definition at line 2367 of file AMDGPUAsmParser.cpp.

◆ IsRevOpcode()

static bool IsRevOpcode ( const unsigned  Opcode)
static

Definition at line 3639 of file AMDGPUAsmParser.cpp.

◆ isSafeTruncation()

static bool isSafeTruncation ( int64_t  Val,
unsigned  Size 
)
static

Definition at line 1765 of file AMDGPUAsmParser.cpp.

◆ LLVMInitializeAMDGPUAsmParser()

LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAMDGPUAsmParser ( )

Force static initialization.

Definition at line 8167 of file AMDGPUAsmParser.cpp.

References B, llvm::getTheAMDGPUTarget(), and llvm::getTheGCNTarget().

Variable Documentation

◆ AMDGPUOptionalOperandTable

const OptionalOperand AMDGPUOptionalOperandTable[]
static

Definition at line 7217 of file AMDGPUAsmParser.cpp.

◆ RegularRegisters

constexpr RegInfo RegularRegisters[]
staticconstexpr
Initial value:
= {
{{"v"}, IS_VGPR},
{{"s"}, IS_SGPR},
{{"ttmp"}, IS_TTMP},
{{"acc"}, IS_AGPR},
{{"a"}, IS_AGPR},
}

Definition at line 2359 of file AMDGPUAsmParser.cpp.

Referenced by getRegularRegInfo().

FIELD
#define FIELD(name)
Definition: AMDKernelCodeTInfo.h:21
ENTRY
#define ENTRY(ASMNAME, ENUM)