xref: /freebsd/contrib/llvm-project/llvm/lib/Target/M68k/M68kMCInstLower.h (revision bdd1243df58e60e85101c09001d9812a789b6bc4)
104eeddc0SDimitry Andric //===-- M68kMCInstLower.h - Lower MachineInstr to MCInst --------*- C++ -*-===//
2fe6060f1SDimitry Andric //
3fe6060f1SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4fe6060f1SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5fe6060f1SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6fe6060f1SDimitry Andric //
7fe6060f1SDimitry Andric //===----------------------------------------------------------------------===//
8fe6060f1SDimitry Andric ///
9fe6060f1SDimitry Andric /// \file
10fe6060f1SDimitry Andric /// This file contains code to lower M68k MachineInstrs to their
11fe6060f1SDimitry Andric /// corresponding MCInst records.
12fe6060f1SDimitry Andric ///
13fe6060f1SDimitry Andric //===----------------------------------------------------------------------===//
14fe6060f1SDimitry Andric 
15fe6060f1SDimitry Andric #ifndef LLVM_LIB_TARGET_M68K_M68KMCINSTLOWER_H
16fe6060f1SDimitry Andric #define LLVM_LIB_TARGET_M68K_M68KMCINSTLOWER_H
17fe6060f1SDimitry Andric 
18fe6060f1SDimitry Andric #include "llvm/CodeGen/MachineOperand.h"
19fe6060f1SDimitry Andric #include "llvm/MC/MCAsmInfo.h"
20fe6060f1SDimitry Andric #include "llvm/Target/TargetMachine.h"
21fe6060f1SDimitry Andric 
22fe6060f1SDimitry Andric namespace llvm {
23fe6060f1SDimitry Andric class MCContext;
24fe6060f1SDimitry Andric class MCInst;
25fe6060f1SDimitry Andric class MCOperand;
26fe6060f1SDimitry Andric class MachineInstr;
27fe6060f1SDimitry Andric class MachineFunction;
28fe6060f1SDimitry Andric class M68kAsmPrinter;
29fe6060f1SDimitry Andric 
30fe6060f1SDimitry Andric /// This class is used to lower an MachineInstr into an MCInst.
31fe6060f1SDimitry Andric class M68kMCInstLower {
32fe6060f1SDimitry Andric   typedef MachineOperand::MachineOperandType MachineOperandType;
33fe6060f1SDimitry Andric   MCContext &Ctx;
34fe6060f1SDimitry Andric   MachineFunction &MF;
35fe6060f1SDimitry Andric   const TargetMachine &TM;
36fe6060f1SDimitry Andric   const MCAsmInfo &MAI;
37fe6060f1SDimitry Andric   M68kAsmPrinter &AsmPrinter;
38fe6060f1SDimitry Andric 
39fe6060f1SDimitry Andric public:
40fe6060f1SDimitry Andric   M68kMCInstLower(MachineFunction &MF, M68kAsmPrinter &AP);
41fe6060f1SDimitry Andric 
42fe6060f1SDimitry Andric   /// Lower an MO_GlobalAddress or MO_ExternalSymbol operand to an MCSymbol.
43fe6060f1SDimitry Andric   MCSymbol *GetSymbolFromOperand(const MachineOperand &MO) const;
44fe6060f1SDimitry Andric 
45fe6060f1SDimitry Andric   MCOperand LowerSymbolOperand(const MachineOperand &MO, MCSymbol *Sym) const;
46fe6060f1SDimitry Andric 
47*bdd1243dSDimitry Andric   std::optional<MCOperand> LowerOperand(const MachineInstr *MI,
48fe6060f1SDimitry Andric                                         const MachineOperand &MO) const;
49fe6060f1SDimitry Andric 
50fe6060f1SDimitry Andric   void Lower(const MachineInstr *MI, MCInst &OutMI) const;
51fe6060f1SDimitry Andric };
52fe6060f1SDimitry Andric } // namespace llvm
53fe6060f1SDimitry Andric 
5404eeddc0SDimitry Andric #endif // LLVM_LIB_TARGET_M68K_M68KMCINSTLOWER_H
55