blob: 2c375a01a7f5492a562b3a2898356ad8b86e9c55 [file] [log] [blame]
Dan Gohmane9361d52015-11-05 19:28:16 +00001//===-- WebAssemblyMCInstLower.h - Lower MachineInstr to MCInst -*- C++ -*-===//
2//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// 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
Dan Gohmane9361d52015-11-05 19:28:16 +00006//
7//===----------------------------------------------------------------------===//
8///
9/// \file
Adrian Prantl5f8f34e42018-05-01 15:54:18 +000010/// This file declares the class to lower WebAssembly MachineInstrs to
Dan Gohmane9361d52015-11-05 19:28:16 +000011/// their corresponding MCInst records.
12///
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYMCINSTLOWER_H
16#define LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYMCINSTLOWER_H
17
Dan Gohmand9b4cdb2015-12-21 17:19:31 +000018#include "llvm/MC/MCInst.h"
Dan Gohmane9361d52015-11-05 19:28:16 +000019#include "llvm/Support/Compiler.h"
20
21namespace llvm {
Dan Gohmand934cb82017-02-24 23:18:00 +000022class WebAssemblyAsmPrinter;
Dan Gohmane9361d52015-11-05 19:28:16 +000023class MCContext;
Dan Gohmane9361d52015-11-05 19:28:16 +000024class MCSymbol;
25class MachineInstr;
Dan Gohmane9361d52015-11-05 19:28:16 +000026class MachineOperand;
Dan Gohmane9361d52015-11-05 19:28:16 +000027
Dan Gohmand9b4cdb2015-12-21 17:19:31 +000028/// This class is used to lower an MachineInstr into an MCInst.
Dan Gohmane9361d52015-11-05 19:28:16 +000029class LLVM_LIBRARY_VISIBILITY WebAssemblyMCInstLower {
30 MCContext &Ctx;
Dan Gohmand934cb82017-02-24 23:18:00 +000031 WebAssemblyAsmPrinter &Printer;
Dan Gohmane9361d52015-11-05 19:28:16 +000032
Dan Gohmand9b4cdb2015-12-21 17:19:31 +000033 MCSymbol *GetGlobalAddressSymbol(const MachineOperand &MO) const;
34 MCSymbol *GetExternalSymbolSymbol(const MachineOperand &MO) const;
Sam Cleggef4c66c2019-04-03 00:17:29 +000035 MCOperand lowerSymbolOperand(const MachineOperand &MO, MCSymbol *Sym) const;
Dan Gohmand9b4cdb2015-12-21 17:19:31 +000036
Dan Gohmane9361d52015-11-05 19:28:16 +000037public:
Dan Gohmand934cb82017-02-24 23:18:00 +000038 WebAssemblyMCInstLower(MCContext &ctx, WebAssemblyAsmPrinter &printer)
Dan Gohmane9361d52015-11-05 19:28:16 +000039 : Ctx(ctx), Printer(printer) {}
Heejin Ahn18c56a02019-02-04 19:13:39 +000040 void lower(const MachineInstr *MI, MCInst &OutMI) const;
Dan Gohmane9361d52015-11-05 19:28:16 +000041};
Dan Gohmand9b4cdb2015-12-21 17:19:31 +000042} // end namespace llvm
Dan Gohmane9361d52015-11-05 19:28:16 +000043
44#endif