Dan Gohman | e9361d5 | 2015-11-05 19:28:16 +0000 | [diff] [blame] | 1 | //===-- WebAssemblyMCInstLower.h - Lower MachineInstr to MCInst -*- C++ -*-===// |
| 2 | // |
Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 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 |
Dan Gohman | e9361d5 | 2015-11-05 19:28:16 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | /// |
| 9 | /// \file |
Adrian Prantl | 5f8f34e4 | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 10 | /// This file declares the class to lower WebAssembly MachineInstrs to |
Dan Gohman | e9361d5 | 2015-11-05 19:28:16 +0000 | [diff] [blame] | 11 | /// 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 Gohman | d9b4cdb | 2015-12-21 17:19:31 +0000 | [diff] [blame] | 18 | #include "llvm/MC/MCInst.h" |
Dan Gohman | e9361d5 | 2015-11-05 19:28:16 +0000 | [diff] [blame] | 19 | #include "llvm/Support/Compiler.h" |
| 20 | |
| 21 | namespace llvm { |
Dan Gohman | d934cb8 | 2017-02-24 23:18:00 +0000 | [diff] [blame] | 22 | class WebAssemblyAsmPrinter; |
Dan Gohman | e9361d5 | 2015-11-05 19:28:16 +0000 | [diff] [blame] | 23 | class MCContext; |
Dan Gohman | e9361d5 | 2015-11-05 19:28:16 +0000 | [diff] [blame] | 24 | class MCSymbol; |
| 25 | class MachineInstr; |
Dan Gohman | e9361d5 | 2015-11-05 19:28:16 +0000 | [diff] [blame] | 26 | class MachineOperand; |
Dan Gohman | e9361d5 | 2015-11-05 19:28:16 +0000 | [diff] [blame] | 27 | |
Dan Gohman | d9b4cdb | 2015-12-21 17:19:31 +0000 | [diff] [blame] | 28 | /// This class is used to lower an MachineInstr into an MCInst. |
Dan Gohman | e9361d5 | 2015-11-05 19:28:16 +0000 | [diff] [blame] | 29 | class LLVM_LIBRARY_VISIBILITY WebAssemblyMCInstLower { |
| 30 | MCContext &Ctx; |
Dan Gohman | d934cb8 | 2017-02-24 23:18:00 +0000 | [diff] [blame] | 31 | WebAssemblyAsmPrinter &Printer; |
Dan Gohman | e9361d5 | 2015-11-05 19:28:16 +0000 | [diff] [blame] | 32 | |
Dan Gohman | d9b4cdb | 2015-12-21 17:19:31 +0000 | [diff] [blame] | 33 | MCSymbol *GetGlobalAddressSymbol(const MachineOperand &MO) const; |
| 34 | MCSymbol *GetExternalSymbolSymbol(const MachineOperand &MO) const; |
Heejin Ahn | f208f63 | 2018-09-05 01:27:38 +0000 | [diff] [blame] | 35 | MCOperand LowerSymbolOperand(MCSymbol *Sym, int64_t Offset, bool IsFunc, |
Heejin Ahn | da419bd | 2018-11-14 02:46:21 +0000 | [diff] [blame] | 36 | bool IsGlob, bool IsEvent) const; |
Dan Gohman | d9b4cdb | 2015-12-21 17:19:31 +0000 | [diff] [blame] | 37 | |
Dan Gohman | e9361d5 | 2015-11-05 19:28:16 +0000 | [diff] [blame] | 38 | public: |
Dan Gohman | d934cb8 | 2017-02-24 23:18:00 +0000 | [diff] [blame] | 39 | WebAssemblyMCInstLower(MCContext &ctx, WebAssemblyAsmPrinter &printer) |
Dan Gohman | e9361d5 | 2015-11-05 19:28:16 +0000 | [diff] [blame] | 40 | : Ctx(ctx), Printer(printer) {} |
| 41 | void Lower(const MachineInstr *MI, MCInst &OutMI) const; |
Dan Gohman | e9361d5 | 2015-11-05 19:28:16 +0000 | [diff] [blame] | 42 | }; |
Dan Gohman | d9b4cdb | 2015-12-21 17:19:31 +0000 | [diff] [blame] | 43 | } // end namespace llvm |
Dan Gohman | e9361d5 | 2015-11-05 19:28:16 +0000 | [diff] [blame] | 44 | |
| 45 | #endif |