MipsSEISelLowering.h revision 9a1aaeb012e593fba977015c5d8b6b1aa41a908c
1//===-- MipsSEISelLowering.h - MipsSE DAG Lowering Interface ----*- C++ -*-===//
2//
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// Subclass of MipsTargetLowering specialized for mips32/64.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef MipsSEISELLOWERING_H
15#define MipsSEISELLOWERING_H
16
17#include "MipsISelLowering.h"
18#include "MipsRegisterInfo.h"
19
20namespace llvm {
21  class MipsSETargetLowering : public MipsTargetLowering  {
22  public:
23    explicit MipsSETargetLowering(MipsTargetMachine &TM);
24
25    /// \brief Enable MSA support for the given integer type and Register
26    /// class.
27    void addMSAIntType(MVT::SimpleValueType Ty, const TargetRegisterClass *RC);
28    /// \brief Enable MSA support for the given floating-point type and
29    /// Register class.
30    void addMSAFloatType(MVT::SimpleValueType Ty,
31                         const TargetRegisterClass *RC);
32
33    virtual bool allowsUnalignedMemoryAccesses(EVT VT, bool *Fast) const;
34
35    virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const;
36
37    virtual SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const;
38
39    virtual MachineBasicBlock *
40    EmitInstrWithCustomInserter(MachineInstr *MI, MachineBasicBlock *MBB) const;
41
42    virtual bool isShuffleMaskLegal(const SmallVectorImpl<int> &Mask,
43                                    EVT VT) const {
44      return false;
45    }
46
47    virtual const TargetRegisterClass *getRepRegClassFor(MVT VT) const {
48      if (VT == MVT::Untyped)
49        return Subtarget->hasDSP() ? &Mips::ACC64DSPRegClass :
50                                     &Mips::ACC64RegClass;
51
52      return TargetLowering::getRepRegClassFor(VT);
53    }
54
55  private:
56    virtual bool
57    isEligibleForTailCallOptimization(const MipsCC &MipsCCInfo,
58                                      unsigned NextStackOffset,
59                                      const MipsFunctionInfo& FI) const;
60
61    virtual void
62    getOpndList(SmallVectorImpl<SDValue> &Ops,
63                std::deque< std::pair<unsigned, SDValue> > &RegsToPass,
64                bool IsPICCall, bool GlobalOrExternal, bool InternalLinkage,
65                CallLoweringInfo &CLI, SDValue Callee, SDValue Chain) const;
66
67    SDValue lowerLOAD(SDValue Op, SelectionDAG &DAG) const;
68    SDValue lowerSTORE(SDValue Op, SelectionDAG &DAG) const;
69
70    SDValue lowerMulDiv(SDValue Op, unsigned NewOpc, bool HasLo, bool HasHi,
71                        SelectionDAG &DAG) const;
72
73    SDValue lowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) const;
74    SDValue lowerINTRINSIC_W_CHAIN(SDValue Op, SelectionDAG &DAG) const;
75    SDValue lowerINTRINSIC_VOID(SDValue Op, SelectionDAG &DAG) const;
76    SDValue lowerEXTRACT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const;
77    SDValue lowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG) const;
78
79    MachineBasicBlock *emitBPOSGE32(MachineInstr *MI,
80                                    MachineBasicBlock *BB) const;
81    MachineBasicBlock *emitMSACBranchPseudo(MachineInstr *MI,
82                                            MachineBasicBlock *BB,
83                                            unsigned BranchOp) const;
84  };
85}
86
87#endif // MipsSEISELLOWERING_H
88