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