[InstCombine] Signed saturation tests. NFC
[llvm-complete.git] / lib / Target / WebAssembly / WebAssemblyMCInstLower.h
blobd79c54097eb76a8cdc0525549f73178caa20087a
1 //===-- WebAssemblyMCInstLower.h - Lower MachineInstr to MCInst -*- C++ -*-===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 ///
9 /// \file
10 /// This file declares the class to lower WebAssembly MachineInstrs to
11 /// their corresponding MCInst records.
12 ///
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYMCINSTLOWER_H
16 #define LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYMCINSTLOWER_H
18 #include "llvm/BinaryFormat/Wasm.h"
19 #include "llvm/MC/MCInst.h"
20 #include "llvm/Support/Compiler.h"
22 namespace llvm {
23 class WebAssemblyAsmPrinter;
24 class MCContext;
25 class MCSymbol;
26 class MachineInstr;
27 class MachineOperand;
29 /// This class is used to lower an MachineInstr into an MCInst.
30 class LLVM_LIBRARY_VISIBILITY WebAssemblyMCInstLower {
31 MCContext &Ctx;
32 WebAssemblyAsmPrinter &Printer;
34 MCSymbol *GetGlobalAddressSymbol(const MachineOperand &MO) const;
35 MCSymbol *GetExternalSymbolSymbol(const MachineOperand &MO) const;
36 MCOperand lowerSymbolOperand(const MachineOperand &MO, MCSymbol *Sym) const;
37 MCOperand lowerTypeIndexOperand(SmallVector<wasm::ValType, 1> &&,
38 SmallVector<wasm::ValType, 4> &&) const;
40 public:
41 WebAssemblyMCInstLower(MCContext &ctx, WebAssemblyAsmPrinter &printer)
42 : Ctx(ctx), Printer(printer) {}
43 void lower(const MachineInstr *MI, MCInst &OutMI) const;
45 } // end namespace llvm
47 #endif