blob: c25f900054809fd3a31175e6c52e0936e350e874 [file] [log] [blame]
Jia Liudd6c1cd2012-02-17 01:23:50 +00001//===-- MipsMCInstLower.h - Lower MachineInstr to MCInst -------*- C++ -*--===//
Akira Hatanaka77a9e6e2011-07-07 20:24:54 +00002//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
Benjamin Kramera7c40ef2014-08-13 16:26:38 +000010#ifndef LLVM_LIB_TARGET_MIPS_MIPSMCINSTLOWER_H
11#define LLVM_LIB_TARGET_MIPS_MIPSMCINSTLOWER_H
Sasa Stankovic7b061a42014-04-30 15:06:25 +000012#include "MCTargetDesc/MipsMCExpr.h"
Akira Hatanaka77a9e6e2011-07-07 20:24:54 +000013#include "llvm/CodeGen/MachineOperand.h"
14#include "llvm/Support/Compiler.h"
15
16namespace llvm {
Akira Hatanaka77a9e6e2011-07-07 20:24:54 +000017 class MCContext;
18 class MCInst;
19 class MCOperand;
Akira Hatanaka77a9e6e2011-07-07 20:24:54 +000020 class MachineInstr;
21 class MachineFunction;
Akira Hatanaka77a9e6e2011-07-07 20:24:54 +000022 class MipsAsmPrinter;
Jia Liuf54f60f2012-02-28 07:46:26 +000023
Akira Hatanaka77a9e6e2011-07-07 20:24:54 +000024/// MipsMCInstLower - This class is used to lower an MachineInstr into an
25// MCInst.
26class LLVM_LIBRARY_VISIBILITY MipsMCInstLower {
27 typedef MachineOperand::MachineOperandType MachineOperandType;
Akira Hatanaka34ee3ff2012-03-28 00:22:50 +000028 MCContext *Ctx;
Akira Hatanaka77a9e6e2011-07-07 20:24:54 +000029 MipsAsmPrinter &AsmPrinter;
30public:
Akira Hatanaka34ee3ff2012-03-28 00:22:50 +000031 MipsMCInstLower(MipsAsmPrinter &asmprinter);
Rafael Espindola7d78b2a2013-10-29 16:24:21 +000032 void Initialize(MCContext *C);
Akira Hatanaka77a9e6e2011-07-07 20:24:54 +000033 void Lower(const MachineInstr *MI, MCInst &OutMI) const;
Akira Hatanaka42a35242012-09-27 01:59:07 +000034 MCOperand LowerOperand(const MachineOperand& MO, unsigned offset = 0) const;
Jack Carterf6490432012-07-16 15:14:51 +000035
Akira Hatanaka77a9e6e2011-07-07 20:24:54 +000036private:
37 MCOperand LowerSymbolOperand(const MachineOperand &MO,
Akira Hatanaka6520b982011-08-16 02:15:03 +000038 MachineOperandType MOTy, unsigned Offset) const;
Sasa Stankovic7b061a42014-04-30 15:06:25 +000039 MCOperand createSub(MachineBasicBlock *BB1, MachineBasicBlock *BB2,
Daniel Sandersfe98b2f2016-05-03 13:35:44 +000040 MipsMCExpr::MipsExprKind Kind) const;
Sasa Stankovice41db2f2014-05-27 18:53:06 +000041 void lowerLongBranchLUi(const MachineInstr *MI, MCInst &OutMI) const;
Daniel Sandersfe98b2f2016-05-03 13:35:44 +000042 void lowerLongBranchADDiu(const MachineInstr *MI, MCInst &OutMI, int Opcode,
43 MipsMCExpr::MipsExprKind Kind) const;
Sasa Stankovic7b061a42014-04-30 15:06:25 +000044 bool lowerLongBranch(const MachineInstr *MI, MCInst &OutMI) const;
Akira Hatanaka77a9e6e2011-07-07 20:24:54 +000045};
Alexander Kornienkof00654e2015-06-23 09:49:53 +000046}
Akira Hatanaka77a9e6e2011-07-07 20:24:54 +000047
48#endif