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