10b57cec5SDimitry Andric //===- MipsMCInstLower.h - Lower MachineInstr to MCInst --------*- C++ -*--===// 20b57cec5SDimitry Andric // 30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 60b57cec5SDimitry Andric // 70b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 80b57cec5SDimitry Andric 90b57cec5SDimitry Andric #ifndef LLVM_LIB_TARGET_MIPS_MIPSMCINSTLOWER_H 100b57cec5SDimitry Andric #define LLVM_LIB_TARGET_MIPS_MIPSMCINSTLOWER_H 110b57cec5SDimitry Andric 120b57cec5SDimitry Andric #include "MCTargetDesc/MipsMCExpr.h" 130b57cec5SDimitry Andric #include "llvm/CodeGen/MachineOperand.h" 140b57cec5SDimitry Andric #include "llvm/Support/Compiler.h" 150b57cec5SDimitry Andric 160b57cec5SDimitry Andric namespace llvm { 170b57cec5SDimitry Andric 180b57cec5SDimitry Andric class MachineBasicBlock; 190b57cec5SDimitry Andric class MachineInstr; 200b57cec5SDimitry Andric class MCContext; 210b57cec5SDimitry Andric class MCInst; 220b57cec5SDimitry Andric class MCOperand; 230b57cec5SDimitry Andric class MipsAsmPrinter; 240b57cec5SDimitry Andric 250b57cec5SDimitry Andric /// MipsMCInstLower - This class is used to lower an MachineInstr into an 260b57cec5SDimitry Andric /// MCInst. 270b57cec5SDimitry Andric class LLVM_LIBRARY_VISIBILITY MipsMCInstLower { 280b57cec5SDimitry Andric using MachineOperandType = MachineOperand::MachineOperandType; 290b57cec5SDimitry Andric 300b57cec5SDimitry Andric MCContext *Ctx; 310b57cec5SDimitry Andric MipsAsmPrinter &AsmPrinter; 320b57cec5SDimitry Andric 330b57cec5SDimitry Andric public: 340b57cec5SDimitry Andric MipsMCInstLower(MipsAsmPrinter &asmprinter); 350b57cec5SDimitry Andric 360b57cec5SDimitry Andric void Initialize(MCContext *C); 370b57cec5SDimitry Andric void Lower(const MachineInstr *MI, MCInst &OutMI) const; 38*480093f4SDimitry Andric MCOperand LowerOperand(const MachineOperand &MO, int64_t offset = 0) const; 390b57cec5SDimitry Andric 400b57cec5SDimitry Andric private: 410b57cec5SDimitry Andric MCOperand LowerSymbolOperand(const MachineOperand &MO, 42*480093f4SDimitry Andric MachineOperandType MOTy, int64_t Offset) const; 430b57cec5SDimitry Andric MCOperand createSub(MachineBasicBlock *BB1, MachineBasicBlock *BB2, 440b57cec5SDimitry Andric MipsMCExpr::MipsExprKind Kind) const; 450b57cec5SDimitry Andric void lowerLongBranchLUi(const MachineInstr *MI, MCInst &OutMI) const; 460b57cec5SDimitry Andric void lowerLongBranchADDiu(const MachineInstr *MI, MCInst &OutMI, 470b57cec5SDimitry Andric int Opcode) const; 480b57cec5SDimitry Andric bool lowerLongBranch(const MachineInstr *MI, MCInst &OutMI) const; 490b57cec5SDimitry Andric }; 500b57cec5SDimitry Andric 510b57cec5SDimitry Andric } // end namespace llvm 520b57cec5SDimitry Andric 530b57cec5SDimitry Andric #endif // LLVM_LIB_TARGET_MIPS_MIPSMCINSTLOWER_H 54