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 |
| 11 | /// \brief This file declares the class to lower WebAssembly MachineInstrs to |
| 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 { |
| 23 | class AsmPrinter; |
| 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 | e9361d5 | 2015-11-05 19:28:16 +0000 | [diff] [blame] | 32 | AsmPrinter &Printer; |
| 33 | |
Dan Gohman | d9b4cdb | 2015-12-21 17:19:31 +0000 | [diff] [blame^] | 34 | MCOperand LowerSymbolOperand(const MachineOperand &MO, MCSymbol *Sym) const; |
| 35 | MCSymbol *GetGlobalAddressSymbol(const MachineOperand &MO) const; |
| 36 | MCSymbol *GetExternalSymbolSymbol(const MachineOperand &MO) const; |
| 37 | |
Dan Gohman | e9361d5 | 2015-11-05 19:28:16 +0000 | [diff] [blame] | 38 | public: |
| 39 | WebAssemblyMCInstLower(MCContext &ctx, AsmPrinter &printer) |
| 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 |