1 //===-- M68kMCInstLower.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 contains code to lower M68k MachineInstrs to their
11 /// corresponding MCInst records.
12 ///
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_LIB_TARGET_M68K_M68KMCINSTLOWER_H
16 #define LLVM_LIB_TARGET_M68K_M68KMCINSTLOWER_H
17 
18 #include "llvm/CodeGen/MachineOperand.h"
19 #include "llvm/MC/MCAsmInfo.h"
20 #include "llvm/Target/TargetMachine.h"
21 
22 namespace llvm {
23 class MCContext;
24 class MCInst;
25 class MCOperand;
26 class MachineInstr;
27 class MachineFunction;
28 class M68kAsmPrinter;
29 
30 /// This class is used to lower an MachineInstr into an MCInst.
31 class M68kMCInstLower {
32   typedef MachineOperand::MachineOperandType MachineOperandType;
33   MCContext &Ctx;
34   MachineFunction &MF;
35   const TargetMachine &TM;
36   const MCAsmInfo &MAI;
37   M68kAsmPrinter &AsmPrinter;
38 
39 public:
40   M68kMCInstLower(MachineFunction &MF, M68kAsmPrinter &AP);
41 
42   /// Lower an MO_GlobalAddress or MO_ExternalSymbol operand to an MCSymbol.
43   MCSymbol *GetSymbolFromOperand(const MachineOperand &MO) const;
44 
45   MCOperand LowerSymbolOperand(const MachineOperand &MO, MCSymbol *Sym) const;
46 
47   std::optional<MCOperand> LowerOperand(const MachineInstr *MI,
48                                         const MachineOperand &MO) const;
49 
50   void Lower(const MachineInstr *MI, MCInst &OutMI) const;
51 };
52 } // namespace llvm
53 
54 #endif // LLVM_LIB_TARGET_M68K_M68KMCINSTLOWER_H
55