Path: blob/main/contrib/llvm-project/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyInstPrinter.h
35294 views
// WebAssemblyInstPrinter.h - Print wasm MCInst to assembly syntax -*- C++ -*-//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7///8/// \file9/// This class prints an WebAssembly MCInst to wasm file syntax.10///11//===----------------------------------------------------------------------===//1213#ifndef LLVM_LIB_TARGET_WEBASSEMBLY_INSTPRINTER_WEBASSEMBLYINSTPRINTER_H14#define LLVM_LIB_TARGET_WEBASSEMBLY_INSTPRINTER_WEBASSEMBLYINSTPRINTER_H1516#include "llvm/ADT/SmallVector.h"17#include "llvm/BinaryFormat/Wasm.h"18#include "llvm/CodeGenTypes/MachineValueType.h"19#include "llvm/MC/MCInstPrinter.h"2021namespace llvm {2223class MCSubtargetInfo;2425class WebAssemblyInstPrinter final : public MCInstPrinter {26uint64_t ControlFlowCounter = 0;27SmallVector<std::pair<uint64_t, bool>, 4> ControlFlowStack;28SmallVector<uint64_t, 4> TryStack;2930enum EHInstKind { TRY, CATCH, CATCH_ALL };31SmallVector<EHInstKind, 4> EHInstStack;3233public:34WebAssemblyInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII,35const MCRegisterInfo &MRI);3637void printRegName(raw_ostream &OS, MCRegister Reg) const override;38void printInst(const MCInst *MI, uint64_t Address, StringRef Annot,39const MCSubtargetInfo &STI, raw_ostream &OS) override;4041// Used by tblegen code.42void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O,43bool IsVariadicDef = false);44void printBrList(const MCInst *MI, unsigned OpNo, raw_ostream &O);45void printWebAssemblyP2AlignOperand(const MCInst *MI, unsigned OpNo,46raw_ostream &O);47void printWebAssemblySignatureOperand(const MCInst *MI, unsigned OpNo,48raw_ostream &O);4950// Autogenerated by tblgen.51std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;52void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O);53static const char *getRegisterName(MCRegister Reg);54};5556} // end namespace llvm5758#endif596061