WebAssemblyMCInstLower.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. ///
  9. /// \file
  10. /// This file declares the class to lower WebAssembly MachineInstrs to
  11. /// their corresponding MCInst records.
  12. ///
  13. //===----------------------------------------------------------------------===//
  14. #ifndef LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYMCINSTLOWER_H
  15. #define LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYMCINSTLOWER_H
  16. #include "llvm/BinaryFormat/Wasm.h"
  17. #include "llvm/MC/MCInst.h"
  18. #include "llvm/Support/Compiler.h"
  19. namespace llvm {
  20. class WebAssemblyAsmPrinter;
  21. class MCContext;
  22. class MCSymbol;
  23. class MachineInstr;
  24. class MachineOperand;
  25. /// This class is used to lower an MachineInstr into an MCInst.
  26. class LLVM_LIBRARY_VISIBILITY WebAssemblyMCInstLower {
  27. MCContext &Ctx;
  28. WebAssemblyAsmPrinter &Printer;
  29. MCSymbol *GetGlobalAddressSymbol(const MachineOperand &MO) const;
  30. MCSymbol *GetExternalSymbolSymbol(const MachineOperand &MO) const;
  31. MCOperand lowerSymbolOperand(const MachineOperand &MO, MCSymbol *Sym) const;
  32. MCOperand lowerTypeIndexOperand(SmallVector<wasm::ValType, 1> &&,
  33. SmallVector<wasm::ValType, 4> &&) const;
  34. public:
  35. WebAssemblyMCInstLower(MCContext &ctx, WebAssemblyAsmPrinter &printer)
  36. : Ctx(ctx), Printer(printer) {}
  37. void lower(const MachineInstr *MI, MCInst &OutMI) const;
  38. };
  39. } // end namespace llvm
  40. #endif