blob: 269190ffc0659c55c8feb1c37018e24616fbc1a7 [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
10#ifndef MIPSMCINSTLOWER_H
11#define MIPSMCINSTLOWER_H
Sasa Stankovic7b061a42014-04-30 15:06:25 +000012#include "MCTargetDesc/MipsMCExpr.h"
Bruno Cardoso Lopesd5edb382011-11-08 22:26:47 +000013#include "llvm/ADT/SmallVector.h"
Akira Hatanaka77a9e6e2011-07-07 20:24:54 +000014#include "llvm/CodeGen/MachineOperand.h"
15#include "llvm/Support/Compiler.h"
16
17namespace llvm {
Akira Hatanaka77a9e6e2011-07-07 20:24:54 +000018 class MCContext;
19 class MCInst;
20 class MCOperand;
Akira Hatanaka77a9e6e2011-07-07 20:24:54 +000021 class MachineInstr;
22 class MachineFunction;
Akira Hatanaka77a9e6e2011-07-07 20:24:54 +000023 class MipsAsmPrinter;
Jia Liuf54f60f2012-02-28 07:46:26 +000024
Akira Hatanaka77a9e6e2011-07-07 20:24:54 +000025/// MipsMCInstLower - This class is used to lower an MachineInstr into an
26// MCInst.
27class LLVM_LIBRARY_VISIBILITY MipsMCInstLower {
28 typedef MachineOperand::MachineOperandType MachineOperandType;
Akira Hatanaka34ee3ff2012-03-28 00:22:50 +000029 MCContext *Ctx;
Akira Hatanaka77a9e6e2011-07-07 20:24:54 +000030 MipsAsmPrinter &AsmPrinter;
31public:
Akira Hatanaka34ee3ff2012-03-28 00:22:50 +000032 MipsMCInstLower(MipsAsmPrinter &asmprinter);
Rafael Espindola7d78b2a2013-10-29 16:24:21 +000033 void Initialize(MCContext *C);
Akira Hatanaka77a9e6e2011-07-07 20:24:54 +000034 void Lower(const MachineInstr *MI, MCInst &OutMI) const;
Akira Hatanaka42a35242012-09-27 01:59:07 +000035 MCOperand LowerOperand(const MachineOperand& MO, unsigned offset = 0) const;
Jack Carterf6490432012-07-16 15:14:51 +000036
Akira Hatanaka77a9e6e2011-07-07 20:24:54 +000037private:
38 MCOperand LowerSymbolOperand(const MachineOperand &MO,
Akira Hatanaka6520b982011-08-16 02:15:03 +000039 MachineOperandType MOTy, unsigned Offset) const;
Sasa Stankovic7b061a42014-04-30 15:06:25 +000040 MCOperand createSub(MachineBasicBlock *BB1, MachineBasicBlock *BB2,
41 MCSymbolRefExpr::VariantKind Kind) const;
Sasa Stankovice41db2f2014-05-27 18:53:06 +000042 void lowerLongBranchLUi(const MachineInstr *MI, MCInst &OutMI) const;
Sasa Stankovic7b061a42014-04-30 15:06:25 +000043 void lowerLongBranchADDiu(const MachineInstr *MI, MCInst &OutMI,
44 int Opcode,
45 MCSymbolRefExpr::VariantKind Kind) const;
46 bool lowerLongBranch(const MachineInstr *MI, MCInst &OutMI) const;
Akira Hatanaka77a9e6e2011-07-07 20:24:54 +000047};
48}
49
50#endif