49 lines · c
1//===-- WebAssemblyMCInstLower.h - Lower MachineInstr to MCInst -*- C++ -*-===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8///9/// \file10/// This file declares the class to lower WebAssembly MachineInstrs to11/// their corresponding MCInst records.12///13//===----------------------------------------------------------------------===//14 15#ifndef LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYMCINSTLOWER_H16#define LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYMCINSTLOWER_H17 18#include "llvm/BinaryFormat/Wasm.h"19#include "llvm/MC/MCInst.h"20#include "llvm/Support/Compiler.h"21 22namespace llvm {23class WebAssemblyAsmPrinter;24class MCContext;25class MCSymbol;26class MachineInstr;27class MachineOperand;28 29/// This class is used to lower an MachineInstr into an MCInst.30class LLVM_LIBRARY_VISIBILITY WebAssemblyMCInstLower {31 MCContext &Ctx;32 WebAssemblyAsmPrinter &Printer;33 34 MCSymbol *GetGlobalAddressSymbol(const MachineOperand &MO) const;35 MCSymbol *GetExternalSymbolSymbol(const MachineOperand &MO) const;36 MCOperand lowerSymbolOperand(const MachineOperand &MO, MCSymbol *Sym) const;37 MCOperand lowerTypeIndexOperand(SmallVectorImpl<wasm::ValType> &&,38 SmallVectorImpl<wasm::ValType> &&) const;39 MCOperand lowerEncodedFunctionSignature(const APInt &Sig) const;40 41public:42 WebAssemblyMCInstLower(MCContext &ctx, WebAssemblyAsmPrinter &printer)43 : Ctx(ctx), Printer(printer) {}44 void lower(const MachineInstr *MI, MCInst &OutMI) const;45};46} // end namespace llvm47 48#endif49