Jia Liu | b22310f | 2012-02-18 12:03:15 +0000 | [diff] [blame] | 1 | //===-- HexagonISelLowering.h - Hexagon DAG Lowering Interface --*- C++ -*-===// |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 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 | // This file defines the interfaces that Hexagon uses to lower LLVM code into a |
| 11 | // selection DAG. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 15 | #ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGONISELLOWERING_H |
| 16 | #define LLVM_LIB_TARGET_HEXAGON_HEXAGONISELLOWERING_H |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 17 | |
Craig Topper | b25fda9 | 2012-03-17 18:46:09 +0000 | [diff] [blame] | 18 | #include "Hexagon.h" |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 19 | #include "llvm/CodeGen/CallingConvLower.h" |
Chandler Carruth | 9fb823b | 2013-01-02 11:36:10 +0000 | [diff] [blame] | 20 | #include "llvm/IR/CallingConv.h" |
Chandler Carruth | 802d755 | 2012-12-04 07:12:27 +0000 | [diff] [blame] | 21 | #include "llvm/Target/TargetLowering.h" |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 22 | |
| 23 | namespace llvm { |
Colin LeMahieu | 025f860 | 2014-12-08 21:19:18 +0000 | [diff] [blame] | 24 | |
| 25 | // Return true when the given node fits in a positive half word. |
| 26 | bool isPositiveHalfWord(SDNode *N); |
| 27 | |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 28 | namespace HexagonISD { |
Matthias Braun | d04893f | 2015-05-07 21:33:59 +0000 | [diff] [blame] | 29 | enum NodeType : unsigned { |
Krzysztof Parzyszek | 952d951 | 2015-04-22 21:17:00 +0000 | [diff] [blame] | 30 | OP_BEGIN = ISD::BUILTIN_OP_END, |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 31 | |
Krzysztof Parzyszek | 952d951 | 2015-04-22 21:17:00 +0000 | [diff] [blame] | 32 | CONST32 = OP_BEGIN, |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 33 | CONST32_GP, // For marking data present in GP. |
Krzysztof Parzyszek | 4fa2a9f | 2015-04-22 16:43:53 +0000 | [diff] [blame] | 34 | ALLOCA, |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 35 | |
Krzysztof Parzyszek | 21dc8bd | 2015-12-18 20:19:30 +0000 | [diff] [blame] | 36 | AT_GOT, // Index in GOT. |
| 37 | AT_PCREL, // Offset relative to PC. |
Colin LeMahieu | 60a99e6 | 2015-03-10 20:04:44 +0000 | [diff] [blame] | 38 | |
Krzysztof Parzyszek | be976d4 | 2016-08-12 11:12:02 +0000 | [diff] [blame] | 39 | CALL, // Function call. |
| 40 | CALLnr, // Function call that does not return. |
Colin LeMahieu | 2e3a26d | 2015-01-16 17:05:27 +0000 | [diff] [blame] | 41 | CALLR, |
| 42 | |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 43 | RET_FLAG, // Return with a flag operand. |
Krzysztof Parzyszek | 4211334 | 2015-03-19 16:33:08 +0000 | [diff] [blame] | 44 | BARRIER, // Memory barrier. |
| 45 | JT, // Jump table. |
| 46 | CP, // Constant pool. |
Krzysztof Parzyszek | 952d951 | 2015-04-22 21:17:00 +0000 | [diff] [blame] | 47 | |
Colin LeMahieu | 777abcb | 2015-01-07 20:07:28 +0000 | [diff] [blame] | 48 | POPCOUNT, |
Colin LeMahieu | 383c36e | 2014-12-05 18:24:06 +0000 | [diff] [blame] | 49 | COMBINE, |
Colin LeMahieu | bd8d0f3 | 2015-03-09 18:34:05 +0000 | [diff] [blame] | 50 | PACKHL, |
Krzysztof Parzyszek | 4211334 | 2015-03-19 16:33:08 +0000 | [diff] [blame] | 51 | VSPLATB, |
| 52 | VSPLATH, |
| 53 | SHUFFEB, |
| 54 | SHUFFEH, |
| 55 | SHUFFOB, |
| 56 | SHUFFOH, |
| 57 | VSXTBH, |
| 58 | VSXTBW, |
| 59 | VSRAW, |
| 60 | VSRAH, |
| 61 | VSRLW, |
| 62 | VSRLH, |
| 63 | VSHLW, |
| 64 | VSHLH, |
| 65 | VCMPBEQ, |
| 66 | VCMPBGT, |
| 67 | VCMPBGTU, |
| 68 | VCMPHEQ, |
| 69 | VCMPHGT, |
| 70 | VCMPHGTU, |
| 71 | VCMPWEQ, |
| 72 | VCMPWGT, |
| 73 | VCMPWGTU, |
Krzysztof Parzyszek | 952d951 | 2015-04-22 21:17:00 +0000 | [diff] [blame] | 74 | |
| 75 | INSERT, |
| 76 | INSERTRP, |
| 77 | EXTRACTU, |
| 78 | EXTRACTURP, |
Krzysztof Parzyszek | c168c01 | 2015-12-03 16:47:20 +0000 | [diff] [blame] | 79 | VCOMBINE, |
Krzysztof Parzyszek | 0bd55a7 | 2016-07-29 16:44:27 +0000 | [diff] [blame] | 80 | VPACK, |
Jyotsna Verma | 5ed5181 | 2013-05-01 21:37:34 +0000 | [diff] [blame] | 81 | TC_RETURN, |
Colin LeMahieu | 68b2e05 | 2015-01-06 19:03:20 +0000 | [diff] [blame] | 82 | EH_RETURN, |
Krzysztof Parzyszek | 952d951 | 2015-04-22 21:17:00 +0000 | [diff] [blame] | 83 | DCFETCH, |
| 84 | |
| 85 | OP_END |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 86 | }; |
Alexander Kornienko | f00654e | 2015-06-23 09:49:53 +0000 | [diff] [blame] | 87 | } |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 88 | |
Eric Christopher | d737b76 | 2015-02-02 22:11:36 +0000 | [diff] [blame] | 89 | class HexagonSubtarget; |
| 90 | |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 91 | class HexagonTargetLowering : public TargetLowering { |
| 92 | int VarArgsFrameOffset; // Frame offset to start of varargs area. |
| 93 | |
Krzysztof Parzyszek | 952d951 | 2015-04-22 21:17:00 +0000 | [diff] [blame] | 94 | bool CanReturnSmallStruct(const Function* CalleeFn, unsigned& RetSize) |
| 95 | const; |
Craig Topper | 18e69f4 | 2016-04-15 06:20:21 +0000 | [diff] [blame] | 96 | void promoteLdStType(MVT VT, MVT PromotedLdStVT); |
Krzysztof Parzyszek | 952d951 | 2015-04-22 21:17:00 +0000 | [diff] [blame] | 97 | const HexagonTargetMachine &HTM; |
| 98 | const HexagonSubtarget &Subtarget; |
Krzysztof Parzyszek | 4211334 | 2015-03-19 16:33:08 +0000 | [diff] [blame] | 99 | |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 100 | public: |
Eric Christopher | d737b76 | 2015-02-02 22:11:36 +0000 | [diff] [blame] | 101 | explicit HexagonTargetLowering(const TargetMachine &TM, |
Krzysztof Parzyszek | 952d951 | 2015-04-22 21:17:00 +0000 | [diff] [blame] | 102 | const HexagonSubtarget &ST); |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 103 | |
| 104 | /// IsEligibleForTailCallOptimization - Check whether the call is eligible |
| 105 | /// for tail call optimization. Targets which want to do tail call |
| 106 | /// optimization should implement this function. |
Krzysztof Parzyszek | 952d951 | 2015-04-22 21:17:00 +0000 | [diff] [blame] | 107 | bool IsEligibleForTailCallOptimization(SDValue Callee, |
| 108 | CallingConv::ID CalleeCC, bool isVarArg, bool isCalleeStructRet, |
| 109 | bool isCallerStructRet, const SmallVectorImpl<ISD::OutputArg> &Outs, |
| 110 | const SmallVectorImpl<SDValue> &OutVals, |
| 111 | const SmallVectorImpl<ISD::InputArg> &Ins, SelectionDAG& DAG) const; |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 112 | |
Craig Topper | 906c2cd | 2014-04-29 07:58:16 +0000 | [diff] [blame] | 113 | bool isTruncateFree(Type *Ty1, Type *Ty2) const override; |
| 114 | bool isTruncateFree(EVT VT1, EVT VT2) const override; |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 115 | |
Craig Topper | 906c2cd | 2014-04-29 07:58:16 +0000 | [diff] [blame] | 116 | bool allowTruncateForTailCall(Type *Ty1, Type *Ty2) const override; |
Tim Northover | a441585 | 2013-08-06 09:12:35 +0000 | [diff] [blame] | 117 | |
Krzysztof Parzyszek | bd8ef4b | 2016-08-19 13:34:31 +0000 | [diff] [blame^] | 118 | /// Return true if an FMA operation is faster than a pair of mul and add |
| 119 | /// instructions. fmuladd intrinsics will be expanded to FMAs when this |
| 120 | /// method returns true (and FMAs are legal), otherwise fmuladd is |
| 121 | /// expanded to mul + add. |
| 122 | bool isFMAFasterThanFMulAndFAdd(EVT) const override; |
| 123 | |
Krzysztof Parzyszek | 4211334 | 2015-03-19 16:33:08 +0000 | [diff] [blame] | 124 | // Should we expand the build vector with shuffles? |
| 125 | bool shouldExpandBuildVectorWithShuffles(EVT VT, |
Krzysztof Parzyszek | 952d951 | 2015-04-22 21:17:00 +0000 | [diff] [blame] | 126 | unsigned DefinedValues) const override; |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 127 | |
Krzysztof Parzyszek | 4211334 | 2015-03-19 16:33:08 +0000 | [diff] [blame] | 128 | SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override; |
Craig Topper | 906c2cd | 2014-04-29 07:58:16 +0000 | [diff] [blame] | 129 | const char *getTargetNodeName(unsigned Opcode) const override; |
Krzysztof Parzyszek | 4211334 | 2015-03-19 16:33:08 +0000 | [diff] [blame] | 130 | SDValue LowerCONCAT_VECTORS(SDValue Op, SelectionDAG &DAG) const; |
| 131 | SDValue LowerEXTRACT_VECTOR(SDValue Op, SelectionDAG &DAG) const; |
Krzysztof Parzyszek | 0bd55a7 | 2016-07-29 16:44:27 +0000 | [diff] [blame] | 132 | SDValue LowerEXTRACT_SUBVECTOR_HVX(SDValue Op, SelectionDAG &DAG) const; |
Krzysztof Parzyszek | 4211334 | 2015-03-19 16:33:08 +0000 | [diff] [blame] | 133 | SDValue LowerINSERT_VECTOR(SDValue Op, SelectionDAG &DAG) const; |
Krzysztof Parzyszek | 0bd55a7 | 2016-07-29 16:44:27 +0000 | [diff] [blame] | 134 | SDValue LowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG) const; |
| 135 | SDValue LowerVECTOR_SHIFT(SDValue Op, SelectionDAG &DAG) const; |
Krzysztof Parzyszek | 4211334 | 2015-03-19 16:33:08 +0000 | [diff] [blame] | 136 | SDValue LowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG) const; |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 137 | SDValue LowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG) const; |
| 138 | SDValue LowerINLINEASM(SDValue Op, SelectionDAG &DAG) const; |
Krzysztof Parzyszek | 6895b2c | 2016-02-18 13:58:38 +0000 | [diff] [blame] | 139 | SDValue LowerPREFETCH(SDValue Op, SelectionDAG &DAG) const; |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 140 | SDValue LowerEH_LABEL(SDValue Op, SelectionDAG &DAG) const; |
Jyotsna Verma | 5ed5181 | 2013-05-01 21:37:34 +0000 | [diff] [blame] | 141 | SDValue LowerEH_RETURN(SDValue Op, SelectionDAG &DAG) const; |
Benjamin Kramer | bdc4956 | 2016-06-12 15:39:02 +0000 | [diff] [blame] | 142 | SDValue |
| 143 | LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv, bool isVarArg, |
| 144 | const SmallVectorImpl<ISD::InputArg> &Ins, |
| 145 | const SDLoc &dl, SelectionDAG &DAG, |
| 146 | SmallVectorImpl<SDValue> &InVals) const override; |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 147 | SDValue LowerGLOBALADDRESS(SDValue Op, SelectionDAG &DAG) const; |
Jyotsna Verma | 2ba0c0b | 2013-03-07 19:10:28 +0000 | [diff] [blame] | 148 | SDValue LowerBlockAddress(SDValue Op, SelectionDAG &DAG) const; |
Krzysztof Parzyszek | 7a737d1 | 2016-02-18 15:42:57 +0000 | [diff] [blame] | 149 | SDValue LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const; |
| 150 | SDValue LowerToTLSGeneralDynamicModel(GlobalAddressSDNode *GA, |
| 151 | SelectionDAG &DAG) const; |
| 152 | SDValue LowerToTLSInitialExecModel(GlobalAddressSDNode *GA, |
| 153 | SelectionDAG &DAG) const; |
| 154 | SDValue LowerToTLSLocalExecModel(GlobalAddressSDNode *GA, |
| 155 | SelectionDAG &DAG) const; |
| 156 | SDValue GetDynamicTLSAddr(SelectionDAG &DAG, SDValue Chain, |
| 157 | GlobalAddressSDNode *GA, SDValue *InFlag, EVT PtrVT, |
| 158 | unsigned ReturnReg, unsigned char OperandFlags) const; |
Krzysztof Parzyszek | 21dc8bd | 2015-12-18 20:19:30 +0000 | [diff] [blame] | 159 | SDValue LowerGLOBAL_OFFSET_TABLE(SDValue Op, SelectionDAG &DAG) const; |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 160 | |
Justin Holewinski | aa58397 | 2012-05-25 16:35:28 +0000 | [diff] [blame] | 161 | SDValue LowerCall(TargetLowering::CallLoweringInfo &CLI, |
Krzysztof Parzyszek | 952d951 | 2015-04-22 21:17:00 +0000 | [diff] [blame] | 162 | SmallVectorImpl<SDValue> &InVals) const override; |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 163 | SDValue LowerCallResult(SDValue Chain, SDValue InFlag, |
Benjamin Kramer | bdc4956 | 2016-06-12 15:39:02 +0000 | [diff] [blame] | 164 | CallingConv::ID CallConv, bool isVarArg, |
| 165 | const SmallVectorImpl<ISD::InputArg> &Ins, |
| 166 | const SDLoc &dl, SelectionDAG &DAG, |
| 167 | SmallVectorImpl<SDValue> &InVals, |
| 168 | const SmallVectorImpl<SDValue> &OutVals, |
| 169 | SDValue Callee) const; |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 170 | |
Krzysztof Parzyszek | 4211334 | 2015-03-19 16:33:08 +0000 | [diff] [blame] | 171 | SDValue LowerSETCC(SDValue Op, SelectionDAG &DAG) const; |
| 172 | SDValue LowerVSELECT(SDValue Op, SelectionDAG &DAG) const; |
| 173 | SDValue LowerCTPOP(SDValue Op, SelectionDAG &DAG) const; |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 174 | SDValue LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const; |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 175 | SDValue LowerATOMIC_FENCE(SDValue Op, SelectionDAG& DAG) const; |
| 176 | SDValue LowerRETURNADDR(SDValue Op, SelectionDAG &DAG) const; |
Krzysztof Parzyszek | 4211334 | 2015-03-19 16:33:08 +0000 | [diff] [blame] | 177 | SDValue LowerLOAD(SDValue Op, SelectionDAG &DAG) const; |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 178 | |
Benjamin Kramer | bdc4956 | 2016-06-12 15:39:02 +0000 | [diff] [blame] | 179 | SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool isVarArg, |
| 180 | const SmallVectorImpl<ISD::OutputArg> &Outs, |
| 181 | const SmallVectorImpl<SDValue> &OutVals, |
| 182 | const SDLoc &dl, SelectionDAG &DAG) const override; |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 183 | |
Krzysztof Parzyszek | 952d951 | 2015-04-22 21:17:00 +0000 | [diff] [blame] | 184 | bool mayBeEmittedAsTailCall(CallInst *CI) const override; |
Duncan P. N. Exon Smith | e4f5e4f | 2016-06-30 22:52:52 +0000 | [diff] [blame] | 185 | MachineBasicBlock * |
| 186 | EmitInstrWithCustomInserter(MachineInstr &MI, |
| 187 | MachineBasicBlock *BB) const override; |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 188 | |
Joseph Tremoulet | f748c89 | 2015-11-07 01:11:31 +0000 | [diff] [blame] | 189 | /// If a physical register, this returns the register that receives the |
| 190 | /// exception address on entry to an EH pad. |
| 191 | unsigned |
| 192 | getExceptionPointerRegister(const Constant *PersonalityFn) const override { |
| 193 | return Hexagon::R0; |
| 194 | } |
| 195 | |
| 196 | /// If a physical register, this returns the register that receives the |
| 197 | /// exception typeid on entry to a landing pad. |
| 198 | unsigned |
| 199 | getExceptionSelectorRegister(const Constant *PersonalityFn) const override { |
| 200 | return Hexagon::R1; |
| 201 | } |
| 202 | |
Krzysztof Parzyszek | 952d951 | 2015-04-22 21:17:00 +0000 | [diff] [blame] | 203 | SDValue LowerVASTART(SDValue Op, SelectionDAG &DAG) const; |
| 204 | SDValue LowerConstantPool(SDValue Op, SelectionDAG &DAG) const; |
Krzysztof Parzyszek | 21dc8bd | 2015-12-18 20:19:30 +0000 | [diff] [blame] | 205 | SDValue LowerJumpTable(SDValue Op, SelectionDAG &DAG) const; |
Mehdi Amini | 44ede33 | 2015-07-09 02:09:04 +0000 | [diff] [blame] | 206 | EVT getSetCCResultType(const DataLayout &, LLVMContext &C, |
| 207 | EVT VT) const override { |
Juergen Ributzka | 34c652d | 2013-11-13 01:57:54 +0000 | [diff] [blame] | 208 | if (!VT.isVector()) |
| 209 | return MVT::i1; |
| 210 | else |
| 211 | return EVT::getVectorVT(C, MVT::i1, VT.getVectorNumElements()); |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 212 | } |
| 213 | |
Craig Topper | 906c2cd | 2014-04-29 07:58:16 +0000 | [diff] [blame] | 214 | bool getPostIndexedAddressParts(SDNode *N, SDNode *Op, |
| 215 | SDValue &Base, SDValue &Offset, |
| 216 | ISD::MemIndexedMode &AM, |
| 217 | SelectionDAG &DAG) const override; |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 218 | |
Krzysztof Parzyszek | ca3b532 | 2016-05-18 14:34:51 +0000 | [diff] [blame] | 219 | ConstraintType getConstraintType(StringRef Constraint) const override; |
| 220 | |
Eric Christopher | 11e4df7 | 2015-02-26 22:38:43 +0000 | [diff] [blame] | 221 | std::pair<unsigned, const TargetRegisterClass *> |
| 222 | getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, |
Benjamin Kramer | 9bfb627 | 2015-07-05 19:29:18 +0000 | [diff] [blame] | 223 | StringRef Constraint, MVT VT) const override; |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 224 | |
Benjamin Kramer | 9bfb627 | 2015-07-05 19:29:18 +0000 | [diff] [blame] | 225 | unsigned |
| 226 | getInlineAsmMemConstraint(StringRef ConstraintCode) const override { |
Daniel Sanders | 49f643c | 2015-03-17 14:37:39 +0000 | [diff] [blame] | 227 | if (ConstraintCode == "o") |
| 228 | return InlineAsm::Constraint_o; |
Daniel Sanders | 49f643c | 2015-03-17 14:37:39 +0000 | [diff] [blame] | 229 | return TargetLowering::getInlineAsmMemConstraint(ConstraintCode); |
Daniel Sanders | bf5b80f | 2015-03-16 13:13:41 +0000 | [diff] [blame] | 230 | } |
| 231 | |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 232 | // Intrinsics |
Craig Topper | 906c2cd | 2014-04-29 07:58:16 +0000 | [diff] [blame] | 233 | SDValue LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) const; |
Krzysztof Parzyszek | 6895b2c | 2016-02-18 13:58:38 +0000 | [diff] [blame] | 234 | SDValue LowerINTRINSIC_VOID(SDValue Op, SelectionDAG &DAG) const; |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 235 | /// isLegalAddressingMode - Return true if the addressing mode represented |
| 236 | /// by AM is legal for this target, for a load/store of the specified type. |
| 237 | /// The type may be VoidTy, in which case only return true if the addressing |
| 238 | /// mode is legal for a load/store of any legal type. |
| 239 | /// TODO: Handle pre/postinc as well. |
Mehdi Amini | 0cdec1e | 2015-07-09 02:09:40 +0000 | [diff] [blame] | 240 | bool isLegalAddressingMode(const DataLayout &DL, const AddrMode &AM, |
| 241 | Type *Ty, unsigned AS) const override; |
Krzysztof Parzyszek | 21dc8bd | 2015-12-18 20:19:30 +0000 | [diff] [blame] | 242 | /// Return true if folding a constant offset with the given GlobalAddress |
| 243 | /// is legal. It is frequently not legal in PIC relocation models. |
| 244 | bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const override; |
| 245 | |
Craig Topper | 906c2cd | 2014-04-29 07:58:16 +0000 | [diff] [blame] | 246 | bool isFPImmLegal(const APFloat &Imm, EVT VT) const override; |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 247 | |
| 248 | /// isLegalICmpImmediate - Return true if the specified immediate is legal |
| 249 | /// icmp immediate, that is the target has icmp instructions which can |
| 250 | /// compare a register against the immediate without having to materialize |
| 251 | /// the immediate into a register. |
Craig Topper | 906c2cd | 2014-04-29 07:58:16 +0000 | [diff] [blame] | 252 | bool isLegalICmpImmediate(int64_t Imm) const override; |
Krzysztof Parzyszek | feaf7b8 | 2015-07-09 14:51:21 +0000 | [diff] [blame] | 253 | |
Krzysztof Parzyszek | 3e409e1 | 2016-08-02 18:34:31 +0000 | [diff] [blame] | 254 | EVT getOptimalMemOpType(uint64_t Size, unsigned DstAlign, |
| 255 | unsigned SrcAlign, bool IsMemset, bool ZeroMemset, bool MemcpyStrSrc, |
| 256 | MachineFunction &MF) const override; |
| 257 | |
Krzysztof Parzyszek | 2d65ea7 | 2016-03-28 15:43:03 +0000 | [diff] [blame] | 258 | bool allowsMisalignedMemoryAccesses(EVT VT, unsigned AddrSpace, |
| 259 | unsigned Align, bool *Fast) const override; |
| 260 | |
Krzysztof Parzyszek | 21dc8bd | 2015-12-18 20:19:30 +0000 | [diff] [blame] | 261 | /// Returns relocation base for the given PIC jumptable. |
| 262 | SDValue getPICJumpTableRelocBase(SDValue Table, SelectionDAG &DAG) |
| 263 | const override; |
| 264 | |
Krzysztof Parzyszek | feaf7b8 | 2015-07-09 14:51:21 +0000 | [diff] [blame] | 265 | // Handling of atomic RMW instructions. |
Krzysztof Parzyszek | feaf7b8 | 2015-07-09 14:51:21 +0000 | [diff] [blame] | 266 | Value *emitLoadLinked(IRBuilder<> &Builder, Value *Addr, |
| 267 | AtomicOrdering Ord) const override; |
| 268 | Value *emitStoreConditional(IRBuilder<> &Builder, Value *Val, |
| 269 | Value *Addr, AtomicOrdering Ord) const override; |
Ahmed Bougacha | 5246867 | 2015-09-11 17:08:28 +0000 | [diff] [blame] | 270 | AtomicExpansionKind shouldExpandAtomicLoadInIR(LoadInst *LI) const override; |
Krzysztof Parzyszek | feaf7b8 | 2015-07-09 14:51:21 +0000 | [diff] [blame] | 271 | bool shouldExpandAtomicStoreInIR(StoreInst *SI) const override; |
Krzysztof Parzyszek | f228c95 | 2016-06-22 16:07:10 +0000 | [diff] [blame] | 272 | bool shouldExpandAtomicCmpXchgInIR(AtomicCmpXchgInst *AI) const override; |
| 273 | |
Ahmed Bougacha | 9d67713 | 2015-09-11 17:08:17 +0000 | [diff] [blame] | 274 | AtomicExpansionKind |
| 275 | shouldExpandAtomicRMWInIR(AtomicRMWInst *AI) const override { |
| 276 | return AtomicExpansionKind::LLSC; |
Krzysztof Parzyszek | feaf7b8 | 2015-07-09 14:51:21 +0000 | [diff] [blame] | 277 | } |
Krzysztof Parzyszek | 08ff888 | 2015-11-26 18:38:27 +0000 | [diff] [blame] | 278 | |
| 279 | protected: |
| 280 | std::pair<const TargetRegisterClass*, uint8_t> |
| 281 | findRepresentativeClass(const TargetRegisterInfo *TRI, MVT VT) |
| 282 | const override; |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 283 | }; |
| 284 | } // end namespace llvm |
| 285 | |
| 286 | #endif // Hexagon_ISELLOWERING_H |