LLVM 20.0.0git
AMDGPUMIRFormatter.h
Go to the documentation of this file.
1//===-- llvm/Target/AMDGPU/AMDGPUMIRFormatter.h -----------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
6// See https://llvm.org/LICENSE.txt for license information.
7// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8//
9//===----------------------------------------------------------------------===//
10//
11/// \file
12/// AMDGPU specific overrides of MIRFormatter.
13//
14//===----------------------------------------------------------------------===//
15
16#ifndef LLVM_LIB_TARGET_AMDGPUMIRFORMATTER_H
17#define LLVM_LIB_TARGET_AMDGPUMIRFORMATTER_H
18
20
21namespace llvm {
22
23class MachineFunction;
24struct PerFunctionMIParsingState;
25
26class AMDGPUMIRFormatter final : public MIRFormatter {
27public:
28 AMDGPUMIRFormatter() = default;
29 virtual ~AMDGPUMIRFormatter() = default;
30
31 /// Implement target specific printing for machine operand immediate value, so
32 /// that we can have more meaningful mnemonic than a 64-bit integer. Passing
33 /// None to OpIdx means the index is unknown.
34 virtual void printImm(raw_ostream &OS, const MachineInstr &MI,
35 std::optional<unsigned> OpIdx,
36 int64_t Imm) const override;
37
38 /// Implement target specific parsing of immediate mnemonics. The mnemonic is
39 /// a string with a leading dot.
40 virtual bool parseImmMnemonic(const unsigned OpCode, const unsigned OpIdx,
41 StringRef Src, int64_t &Imm,
42 ErrorCallbackType ErrorCallback) const override;
43
44 /// Implement target specific parsing of target custom pseudo source value.
45 bool
48 const PseudoSourceValue *&PSV,
49 ErrorCallbackType ErrorCallback) const override;
50
51private:
52 /// Print the string to represent s_delay_alu immediate value
53 void printSDelayAluImm(int64_t Imm, llvm::raw_ostream &OS) const;
54
55 /// Parse the immediate pseudo literal for s_delay_alu
56 bool parseSDelayAluImmMnemonic(
57 const unsigned int OpIdx, int64_t &Imm, llvm::StringRef &Src,
58 llvm::MIRFormatter::ErrorCallbackType &ErrorCallback) const;
59
60};
61
62} // end namespace llvm
63
64#endif
IRTranslator LLVM IR MI
raw_pwrite_stream & OS
virtual ~AMDGPUMIRFormatter()=default
bool parseCustomPseudoSourceValue(StringRef Src, MachineFunction &MF, PerFunctionMIParsingState &PFS, const PseudoSourceValue *&PSV, ErrorCallbackType ErrorCallback) const override
Implement target specific parsing of target custom pseudo source value.
virtual void printImm(raw_ostream &OS, const MachineInstr &MI, std::optional< unsigned > OpIdx, int64_t Imm) const override
Implement target specific printing for machine operand immediate value, so that we can have more mean...
virtual bool parseImmMnemonic(const unsigned OpCode, const unsigned OpIdx, StringRef Src, int64_t &Imm, ErrorCallbackType ErrorCallback) const override
Implement target specific parsing of immediate mnemonics.
MIRFormater - Interface to format MIR operand based on target.
Definition: MIRFormatter.h:32
Representation of each machine instruction.
Definition: MachineInstr.h:69
Special value supplied for machine level alias analysis.
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
An efficient, type-erasing, non-owning reference to a callable.
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18