blob: 41b4313bb38c5231f609384aa779545ae7fd0e80 [file] [log] [blame]
Dan Gohmane9361d52015-11-05 19:28:16 +00001//===-- WebAssemblyMCInstLower.h - Lower MachineInstr to MCInst -*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9///
10/// \file
Adrian Prantl5f8f34e42018-05-01 15:54:18 +000011/// This file declares the class to lower WebAssembly MachineInstrs to
Dan Gohmane9361d52015-11-05 19:28:16 +000012/// their corresponding MCInst records.
13///
14//===----------------------------------------------------------------------===//
15
16#ifndef LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYMCINSTLOWER_H
17#define LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYMCINSTLOWER_H
18
Dan Gohmand9b4cdb2015-12-21 17:19:31 +000019#include "llvm/MC/MCInst.h"
Dan Gohmane9361d52015-11-05 19:28:16 +000020#include "llvm/Support/Compiler.h"
21
22namespace llvm {
Dan Gohmand934cb82017-02-24 23:18:00 +000023class WebAssemblyAsmPrinter;
Dan Gohmane9361d52015-11-05 19:28:16 +000024class MCContext;
Dan Gohmane9361d52015-11-05 19:28:16 +000025class MCSymbol;
26class MachineInstr;
Dan Gohmane9361d52015-11-05 19:28:16 +000027class MachineOperand;
Dan Gohmane9361d52015-11-05 19:28:16 +000028
Dan Gohmand9b4cdb2015-12-21 17:19:31 +000029/// This class is used to lower an MachineInstr into an MCInst.
Dan Gohmane9361d52015-11-05 19:28:16 +000030class LLVM_LIBRARY_VISIBILITY WebAssemblyMCInstLower {
31 MCContext &Ctx;
Dan Gohmand934cb82017-02-24 23:18:00 +000032 WebAssemblyAsmPrinter &Printer;
Dan Gohmane9361d52015-11-05 19:28:16 +000033
Dan Gohmand9b4cdb2015-12-21 17:19:31 +000034 MCSymbol *GetGlobalAddressSymbol(const MachineOperand &MO) const;
35 MCSymbol *GetExternalSymbolSymbol(const MachineOperand &MO) const;
Dan Gohman26c67652016-01-11 23:38:05 +000036 MCOperand LowerSymbolOperand(MCSymbol *Sym, int64_t Offset,
37 bool IsFunc) const;
Dan Gohmand9b4cdb2015-12-21 17:19:31 +000038
Dan Gohmane9361d52015-11-05 19:28:16 +000039public:
Dan Gohmand934cb82017-02-24 23:18:00 +000040 WebAssemblyMCInstLower(MCContext &ctx, WebAssemblyAsmPrinter &printer)
Dan Gohmane9361d52015-11-05 19:28:16 +000041 : Ctx(ctx), Printer(printer) {}
42 void Lower(const MachineInstr *MI, MCInst &OutMI) const;
Dan Gohmane9361d52015-11-05 19:28:16 +000043};
Dan Gohmand9b4cdb2015-12-21 17:19:31 +000044} // end namespace llvm
Dan Gohmane9361d52015-11-05 19:28:16 +000045
46#endif