[InstCombine] Signed saturation patterns
[llvm-core.git] / lib / Target / Mips / MipsSEISelDAGToDAG.h
blob39f665be571e38da6e86009c37e3bdef8eead2cd
1 //===-- MipsSEISelDAGToDAG.h - A Dag to Dag Inst Selector for MipsSE -----===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Subclass of MipsDAGToDAGISel specialized for mips32/64.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_LIB_TARGET_MIPS_MIPSSEISELDAGTODAG_H
14 #define LLVM_LIB_TARGET_MIPS_MIPSSEISELDAGTODAG_H
16 #include "MipsISelDAGToDAG.h"
18 namespace llvm {
20 class MipsSEDAGToDAGISel : public MipsDAGToDAGISel {
22 public:
23 explicit MipsSEDAGToDAGISel(MipsTargetMachine &TM, CodeGenOpt::Level OL)
24 : MipsDAGToDAGISel(TM, OL) {}
26 private:
28 bool runOnMachineFunction(MachineFunction &MF) override;
30 void getAnalysisUsage(AnalysisUsage &AU) const override;
32 void addDSPCtrlRegOperands(bool IsDef, MachineInstr &MI,
33 MachineFunction &MF);
35 unsigned getMSACtrlReg(const SDValue RegIdx) const;
37 bool replaceUsesWithZeroReg(MachineRegisterInfo *MRI, const MachineInstr&);
39 std::pair<SDNode *, SDNode *> selectMULT(SDNode *N, unsigned Opc,
40 const SDLoc &dl, EVT Ty, bool HasLo,
41 bool HasHi);
43 void selectAddE(SDNode *Node, const SDLoc &DL) const;
45 bool selectAddrFrameIndex(SDValue Addr, SDValue &Base, SDValue &Offset) const;
46 bool selectAddrFrameIndexOffset(SDValue Addr, SDValue &Base, SDValue &Offset,
47 unsigned OffsetBits,
48 unsigned ShiftAmount) const;
50 bool selectAddrRegImm(SDValue Addr, SDValue &Base,
51 SDValue &Offset) const override;
53 bool selectAddrDefault(SDValue Addr, SDValue &Base,
54 SDValue &Offset) const override;
56 bool selectIntAddr(SDValue Addr, SDValue &Base,
57 SDValue &Offset) const override;
59 bool selectAddrRegImm9(SDValue Addr, SDValue &Base,
60 SDValue &Offset) const;
62 bool selectAddrRegImm11(SDValue Addr, SDValue &Base,
63 SDValue &Offset) const;
65 bool selectAddrRegImm12(SDValue Addr, SDValue &Base,
66 SDValue &Offset) const;
68 bool selectAddrRegImm16(SDValue Addr, SDValue &Base,
69 SDValue &Offset) const;
71 bool selectIntAddr11MM(SDValue Addr, SDValue &Base,
72 SDValue &Offset) const override;
74 bool selectIntAddr12MM(SDValue Addr, SDValue &Base,
75 SDValue &Offset) const override;
77 bool selectIntAddr16MM(SDValue Addr, SDValue &Base,
78 SDValue &Offset) const override;
80 bool selectIntAddrLSL2MM(SDValue Addr, SDValue &Base,
81 SDValue &Offset) const override;
83 bool selectIntAddrSImm10(SDValue Addr, SDValue &Base,
84 SDValue &Offset) const override;
86 bool selectIntAddrSImm10Lsl1(SDValue Addr, SDValue &Base,
87 SDValue &Offset) const override;
89 bool selectIntAddrSImm10Lsl2(SDValue Addr, SDValue &Base,
90 SDValue &Offset) const override;
92 bool selectIntAddrSImm10Lsl3(SDValue Addr, SDValue &Base,
93 SDValue &Offset) const override;
95 /// Select constant vector splats.
96 bool selectVSplat(SDNode *N, APInt &Imm,
97 unsigned MinSizeInBits) const override;
98 /// Select constant vector splats whose value fits in a given integer.
99 bool selectVSplatCommon(SDValue N, SDValue &Imm, bool Signed,
100 unsigned ImmBitSize) const;
101 /// Select constant vector splats whose value fits in a uimm1.
102 bool selectVSplatUimm1(SDValue N, SDValue &Imm) const override;
103 /// Select constant vector splats whose value fits in a uimm2.
104 bool selectVSplatUimm2(SDValue N, SDValue &Imm) const override;
105 /// Select constant vector splats whose value fits in a uimm3.
106 bool selectVSplatUimm3(SDValue N, SDValue &Imm) const override;
107 /// Select constant vector splats whose value fits in a uimm4.
108 bool selectVSplatUimm4(SDValue N, SDValue &Imm) const override;
109 /// Select constant vector splats whose value fits in a uimm5.
110 bool selectVSplatUimm5(SDValue N, SDValue &Imm) const override;
111 /// Select constant vector splats whose value fits in a uimm6.
112 bool selectVSplatUimm6(SDValue N, SDValue &Imm) const override;
113 /// Select constant vector splats whose value fits in a uimm8.
114 bool selectVSplatUimm8(SDValue N, SDValue &Imm) const override;
115 /// Select constant vector splats whose value fits in a simm5.
116 bool selectVSplatSimm5(SDValue N, SDValue &Imm) const override;
117 /// Select constant vector splats whose value is a power of 2.
118 bool selectVSplatUimmPow2(SDValue N, SDValue &Imm) const override;
119 /// Select constant vector splats whose value is the inverse of a
120 /// power of 2.
121 bool selectVSplatUimmInvPow2(SDValue N, SDValue &Imm) const override;
122 /// Select constant vector splats whose value is a run of set bits
123 /// ending at the most significant bit.
124 bool selectVSplatMaskL(SDValue N, SDValue &Imm) const override;
125 /// Select constant vector splats whose value is a run of set bits
126 /// starting at bit zero.
127 bool selectVSplatMaskR(SDValue N, SDValue &Imm) const override;
129 bool trySelect(SDNode *Node) override;
131 // Emits proper ABI for _mcount profiling calls.
132 void emitMCountABI(MachineInstr &MI, MachineBasicBlock &MBB,
133 MachineFunction &MF);
135 void processFunctionAfterISel(MachineFunction &MF) override;
137 bool SelectInlineAsmMemoryOperand(const SDValue &Op,
138 unsigned ConstraintID,
139 std::vector<SDValue> &OutOps) override;
142 FunctionPass *createMipsSEISelDag(MipsTargetMachine &TM,
143 CodeGenOpt::Level OptLevel);
146 #endif