brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.3 KiB · 0804133 Raw
64 lines · c
1//===-- llvm/Target/AMDGPU/AMDGPUMIRFormatter.h -----------------*- C++ -*-===//2//3//                     The LLVM Compiler Infrastructure4//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-exception8//9//===----------------------------------------------------------------------===//10//11/// \file12/// AMDGPU specific overrides of MIRFormatter.13//14//===----------------------------------------------------------------------===//15 16#ifndef LLVM_LIB_TARGET_AMDGPUMIRFORMATTER_H17#define LLVM_LIB_TARGET_AMDGPUMIRFORMATTER_H18 19#include "llvm/CodeGen/MIRFormatter.h"20 21namespace llvm {22 23class MachineFunction;24struct PerFunctionMIParsingState;25 26class AMDGPUMIRFormatter final : public MIRFormatter {27public:28  AMDGPUMIRFormatter() = default;29  ~AMDGPUMIRFormatter() override = default;30 31  /// Implement target specific printing for machine operand immediate value, so32  /// that we can have more meaningful mnemonic than a 64-bit integer. Passing33  /// None to OpIdx means the index is unknown.34  void printImm(raw_ostream &OS, const MachineInstr &MI,35                std::optional<unsigned> OpIdx, int64_t Imm) const override;36 37  /// Implement target specific parsing of immediate mnemonics. The mnemonic is38  /// a string with a leading dot.39  bool parseImmMnemonic(const unsigned OpCode, const unsigned OpIdx,40                        StringRef Src, int64_t &Imm,41                        ErrorCallbackType ErrorCallback) const override;42 43  /// Implement target specific parsing of target custom pseudo source value.44  bool45  parseCustomPseudoSourceValue(StringRef Src, MachineFunction &MF,46                               PerFunctionMIParsingState &PFS,47                               const PseudoSourceValue *&PSV,48                               ErrorCallbackType ErrorCallback) const override;49 50private:51  /// Print the string to represent s_delay_alu immediate value52  void printSDelayAluImm(int64_t Imm, llvm::raw_ostream &OS) const;53 54  /// Parse the immediate pseudo literal for s_delay_alu55  bool parseSDelayAluImmMnemonic(56      const unsigned int OpIdx, int64_t &Imm, llvm::StringRef &Src,57      llvm::MIRFormatter::ErrorCallbackType &ErrorCallback) const;58 59};60 61} // end namespace llvm62 63#endif64