Revert " [LoongArch][ISel] Check the number of sign bits in `PatGprGpr_32` (#107432)"
[llvm-project.git] / llvm / lib / Target / AMDGPU / AMDGPUMIRFormatter.h
blobc5c947375252960f757b909cb9065c7ea68b8a30
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 //===----------------------------------------------------------------------===//
11 /// \file
12 /// AMDGPU specific overrides of MIRFormatter.
14 //===----------------------------------------------------------------------===//
16 #ifndef LLVM_LIB_TARGET_AMDGPUMIRFORMATTER_H
17 #define LLVM_LIB_TARGET_AMDGPUMIRFORMATTER_H
19 #include "llvm/CodeGen/MIRFormatter.h"
21 namespace llvm {
23 class MachineFunction;
24 struct PerFunctionMIParsingState;
26 class AMDGPUMIRFormatter final : public MIRFormatter {
27 public:
28 AMDGPUMIRFormatter() = default;
29 virtual ~AMDGPUMIRFormatter() = default;
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;
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;
44 /// Implement target specific parsing of target custom pseudo source value.
45 bool
46 parseCustomPseudoSourceValue(StringRef Src, MachineFunction &MF,
47 PerFunctionMIParsingState &PFS,
48 const PseudoSourceValue *&PSV,
49 ErrorCallbackType ErrorCallback) const override;
51 private:
52 /// Print the string to represent s_delay_alu immediate value
53 void printSDelayAluImm(int64_t Imm, llvm::raw_ostream &OS) const;
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;
62 } // end namespace llvm
64 #endif