Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 1 | //===-- SystemZISelLowering.h - SystemZ 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 | // This file defines the interfaces that SystemZ 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_SYSTEMZ_SYSTEMZISELLOWERING_H |
| 16 | #define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZISELLOWERING_H |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 17 | |
| 18 | #include "SystemZ.h" |
Richard Sandiford | 0fb90ab | 2013-05-28 10:41:11 +0000 | [diff] [blame] | 19 | #include "llvm/CodeGen/MachineBasicBlock.h" |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 20 | #include "llvm/CodeGen/SelectionDAG.h" |
| 21 | #include "llvm/Target/TargetLowering.h" |
| 22 | |
| 23 | namespace llvm { |
| 24 | namespace SystemZISD { |
Richard Sandiford | c231269 | 2014-03-06 10:38:30 +0000 | [diff] [blame] | 25 | enum { |
| 26 | FIRST_NUMBER = ISD::BUILTIN_OP_END, |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 27 | |
Richard Sandiford | c231269 | 2014-03-06 10:38:30 +0000 | [diff] [blame] | 28 | // Return with a flag operand. Operand 0 is the chain operand. |
| 29 | RET_FLAG, |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 30 | |
Richard Sandiford | c231269 | 2014-03-06 10:38:30 +0000 | [diff] [blame] | 31 | // Calls a function. Operand 0 is the chain operand and operand 1 |
| 32 | // is the target address. The arguments start at operand 2. |
| 33 | // There is an optional glue operand at the end. |
| 34 | CALL, |
| 35 | SIBCALL, |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 36 | |
Ulrich Weigand | 7db6918 | 2015-02-18 09:13:27 +0000 | [diff] [blame] | 37 | // TLS calls. Like regular calls, except operand 1 is the TLS symbol. |
| 38 | // (The call target is implicitly __tls_get_offset.) |
| 39 | TLS_GDCALL, |
| 40 | TLS_LDCALL, |
| 41 | |
Richard Sandiford | c231269 | 2014-03-06 10:38:30 +0000 | [diff] [blame] | 42 | // Wraps a TargetGlobalAddress that should be loaded using PC-relative |
| 43 | // accesses (LARL). Operand 0 is the address. |
| 44 | PCREL_WRAPPER, |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 45 | |
Richard Sandiford | c231269 | 2014-03-06 10:38:30 +0000 | [diff] [blame] | 46 | // Used in cases where an offset is applied to a TargetGlobalAddress. |
| 47 | // Operand 0 is the full TargetGlobalAddress and operand 1 is a |
| 48 | // PCREL_WRAPPER for an anchor point. This is used so that we can |
| 49 | // cheaply refer to either the full address or the anchor point |
| 50 | // as a register base. |
| 51 | PCREL_OFFSET, |
Richard Sandiford | 54b3691 | 2013-09-27 15:14:04 +0000 | [diff] [blame] | 52 | |
Richard Sandiford | c231269 | 2014-03-06 10:38:30 +0000 | [diff] [blame] | 53 | // Integer absolute. |
| 54 | IABS, |
Richard Sandiford | 5748547 | 2013-12-13 15:35:00 +0000 | [diff] [blame] | 55 | |
Richard Sandiford | c231269 | 2014-03-06 10:38:30 +0000 | [diff] [blame] | 56 | // Integer comparisons. There are three operands: the two values |
| 57 | // to compare, and an integer of type SystemZICMP. |
| 58 | ICMP, |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 59 | |
Richard Sandiford | c231269 | 2014-03-06 10:38:30 +0000 | [diff] [blame] | 60 | // Floating-point comparisons. The two operands are the values to compare. |
| 61 | FCMP, |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 62 | |
Richard Sandiford | c231269 | 2014-03-06 10:38:30 +0000 | [diff] [blame] | 63 | // Test under mask. The first operand is ANDed with the second operand |
| 64 | // and the condition codes are set on the result. The third operand is |
| 65 | // a boolean that is true if the condition codes need to distinguish |
| 66 | // between CCMASK_TM_MIXED_MSB_0 and CCMASK_TM_MIXED_MSB_1 (which the |
| 67 | // register forms do but the memory forms don't). |
| 68 | TM, |
Richard Sandiford | 35b9be2 | 2013-08-28 10:31:43 +0000 | [diff] [blame] | 69 | |
Richard Sandiford | c231269 | 2014-03-06 10:38:30 +0000 | [diff] [blame] | 70 | // Branches if a condition is true. Operand 0 is the chain operand; |
| 71 | // operand 1 is the 4-bit condition-code mask, with bit N in |
| 72 | // big-endian order meaning "branch if CC=N"; operand 2 is the |
| 73 | // target block and operand 3 is the flag operand. |
| 74 | BR_CCMASK, |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 75 | |
Richard Sandiford | c231269 | 2014-03-06 10:38:30 +0000 | [diff] [blame] | 76 | // Selects between operand 0 and operand 1. Operand 2 is the |
| 77 | // mask of condition-code values for which operand 0 should be |
| 78 | // chosen over operand 1; it has the same form as BR_CCMASK. |
| 79 | // Operand 3 is the flag operand. |
| 80 | SELECT_CCMASK, |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 81 | |
Richard Sandiford | c231269 | 2014-03-06 10:38:30 +0000 | [diff] [blame] | 82 | // Evaluates to the gap between the stack pointer and the |
| 83 | // base of the dynamically-allocatable area. |
| 84 | ADJDYNALLOC, |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 85 | |
Richard Sandiford | c231269 | 2014-03-06 10:38:30 +0000 | [diff] [blame] | 86 | // Extracts the value of a 32-bit access register. Operand 0 is |
| 87 | // the number of the register. |
| 88 | EXTRACT_ACCESS, |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 89 | |
Ulrich Weigand | b401218 | 2015-03-31 12:56:33 +0000 | [diff] [blame] | 90 | // Count number of bits set in operand 0 per byte. |
| 91 | POPCNT, |
| 92 | |
Richard Sandiford | c231269 | 2014-03-06 10:38:30 +0000 | [diff] [blame] | 93 | // Wrappers around the ISD opcodes of the same name. The output and |
| 94 | // first input operands are GR128s. The trailing numbers are the |
| 95 | // widths of the second operand in bits. |
| 96 | UMUL_LOHI64, |
| 97 | SDIVREM32, |
| 98 | SDIVREM64, |
| 99 | UDIVREM32, |
| 100 | UDIVREM64, |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 101 | |
Richard Sandiford | c231269 | 2014-03-06 10:38:30 +0000 | [diff] [blame] | 102 | // Use a series of MVCs to copy bytes from one memory location to another. |
| 103 | // The operands are: |
| 104 | // - the target address |
| 105 | // - the source address |
| 106 | // - the constant length |
| 107 | // |
| 108 | // This isn't a memory opcode because we'd need to attach two |
| 109 | // MachineMemOperands rather than one. |
| 110 | MVC, |
Richard Sandiford | d131ff8 | 2013-07-08 09:35:23 +0000 | [diff] [blame] | 111 | |
Richard Sandiford | c231269 | 2014-03-06 10:38:30 +0000 | [diff] [blame] | 112 | // Like MVC, but implemented as a loop that handles X*256 bytes |
| 113 | // followed by straight-line code to handle the rest (if any). |
| 114 | // The value of X is passed as an additional operand. |
| 115 | MVC_LOOP, |
Richard Sandiford | 5e318f0 | 2013-08-27 09:54:29 +0000 | [diff] [blame] | 116 | |
Richard Sandiford | c231269 | 2014-03-06 10:38:30 +0000 | [diff] [blame] | 117 | // Similar to MVC and MVC_LOOP, but for logic operations (AND, OR, XOR). |
| 118 | NC, |
| 119 | NC_LOOP, |
| 120 | OC, |
| 121 | OC_LOOP, |
| 122 | XC, |
| 123 | XC_LOOP, |
Richard Sandiford | 178273a | 2013-09-05 10:36:45 +0000 | [diff] [blame] | 124 | |
Richard Sandiford | c231269 | 2014-03-06 10:38:30 +0000 | [diff] [blame] | 125 | // Use CLC to compare two blocks of memory, with the same comments |
| 126 | // as for MVC and MVC_LOOP. |
| 127 | CLC, |
| 128 | CLC_LOOP, |
Richard Sandiford | 761703a | 2013-08-12 10:17:33 +0000 | [diff] [blame] | 129 | |
Richard Sandiford | c231269 | 2014-03-06 10:38:30 +0000 | [diff] [blame] | 130 | // Use an MVST-based sequence to implement stpcpy(). |
| 131 | STPCPY, |
Richard Sandiford | bb83a50 | 2013-08-16 11:29:37 +0000 | [diff] [blame] | 132 | |
Richard Sandiford | c231269 | 2014-03-06 10:38:30 +0000 | [diff] [blame] | 133 | // Use a CLST-based sequence to implement strcmp(). The two input operands |
| 134 | // are the addresses of the strings to compare. |
| 135 | STRCMP, |
Richard Sandiford | ca23271 | 2013-08-16 11:21:54 +0000 | [diff] [blame] | 136 | |
Richard Sandiford | c231269 | 2014-03-06 10:38:30 +0000 | [diff] [blame] | 137 | // Use an SRST-based sequence to search a block of memory. The first |
| 138 | // operand is the end address, the second is the start, and the third |
| 139 | // is the character to search for. CC is set to 1 on success and 2 |
| 140 | // on failure. |
| 141 | SEARCH_STRING, |
Richard Sandiford | 0dec06a | 2013-08-16 11:41:43 +0000 | [diff] [blame] | 142 | |
Richard Sandiford | c231269 | 2014-03-06 10:38:30 +0000 | [diff] [blame] | 143 | // Store the CC value in bits 29 and 28 of an integer. |
| 144 | IPM, |
Richard Sandiford | 564681c | 2013-08-12 10:28:10 +0000 | [diff] [blame] | 145 | |
Richard Sandiford | c231269 | 2014-03-06 10:38:30 +0000 | [diff] [blame] | 146 | // Perform a serialization operation. (BCR 15,0 or BCR 14,0.) |
| 147 | SERIALIZE, |
Richard Sandiford | 9afe613 | 2013-12-10 10:36:34 +0000 | [diff] [blame] | 148 | |
Ulrich Weigand | 57c85f5 | 2015-04-01 12:51:43 +0000 | [diff] [blame^] | 149 | // Transaction begin. The first operand is the chain, the second |
| 150 | // the TDB pointer, and the third the immediate control field. |
| 151 | // Returns chain and glue. |
| 152 | TBEGIN, |
| 153 | TBEGIN_NOFLOAT, |
| 154 | |
| 155 | // Transaction end. Just the chain operand. Returns chain and glue. |
| 156 | TEND, |
| 157 | |
Richard Sandiford | c231269 | 2014-03-06 10:38:30 +0000 | [diff] [blame] | 158 | // Wrappers around the inner loop of an 8- or 16-bit ATOMIC_SWAP or |
| 159 | // ATOMIC_LOAD_<op>. |
| 160 | // |
| 161 | // Operand 0: the address of the containing 32-bit-aligned field |
| 162 | // Operand 1: the second operand of <op>, in the high bits of an i32 |
| 163 | // for everything except ATOMIC_SWAPW |
| 164 | // Operand 2: how many bits to rotate the i32 left to bring the first |
| 165 | // operand into the high bits |
| 166 | // Operand 3: the negative of operand 2, for rotating the other way |
| 167 | // Operand 4: the width of the field in bits (8 or 16) |
| 168 | ATOMIC_SWAPW = ISD::FIRST_TARGET_MEMORY_OPCODE, |
| 169 | ATOMIC_LOADW_ADD, |
| 170 | ATOMIC_LOADW_SUB, |
| 171 | ATOMIC_LOADW_AND, |
| 172 | ATOMIC_LOADW_OR, |
| 173 | ATOMIC_LOADW_XOR, |
| 174 | ATOMIC_LOADW_NAND, |
| 175 | ATOMIC_LOADW_MIN, |
| 176 | ATOMIC_LOADW_MAX, |
| 177 | ATOMIC_LOADW_UMIN, |
| 178 | ATOMIC_LOADW_UMAX, |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 179 | |
Richard Sandiford | c231269 | 2014-03-06 10:38:30 +0000 | [diff] [blame] | 180 | // A wrapper around the inner loop of an ATOMIC_CMP_SWAP. |
| 181 | // |
| 182 | // Operand 0: the address of the containing 32-bit-aligned field |
| 183 | // Operand 1: the compare value, in the low bits of an i32 |
| 184 | // Operand 2: the swap value, in the low bits of an i32 |
| 185 | // Operand 3: how many bits to rotate the i32 left to bring the first |
| 186 | // operand into the high bits |
| 187 | // Operand 4: the negative of operand 2, for rotating the other way |
| 188 | // Operand 5: the width of the field in bits (8 or 16) |
| 189 | ATOMIC_CMP_SWAPW, |
Richard Sandiford | 0348133 | 2013-08-23 11:36:42 +0000 | [diff] [blame] | 190 | |
Richard Sandiford | c231269 | 2014-03-06 10:38:30 +0000 | [diff] [blame] | 191 | // Prefetch from the second operand using the 4-bit control code in |
| 192 | // the first operand. The code is 1 for a load prefetch and 2 for |
| 193 | // a store prefetch. |
| 194 | PREFETCH |
| 195 | }; |
Richard Sandiford | 54b3691 | 2013-09-27 15:14:04 +0000 | [diff] [blame] | 196 | |
Richard Sandiford | c231269 | 2014-03-06 10:38:30 +0000 | [diff] [blame] | 197 | // Return true if OPCODE is some kind of PC-relative address. |
| 198 | inline bool isPCREL(unsigned Opcode) { |
| 199 | return Opcode == PCREL_WRAPPER || Opcode == PCREL_OFFSET; |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 200 | } |
Richard Sandiford | c231269 | 2014-03-06 10:38:30 +0000 | [diff] [blame] | 201 | } // end namespace SystemZISD |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 202 | |
Richard Sandiford | 5bc670b | 2013-09-06 11:51:39 +0000 | [diff] [blame] | 203 | namespace SystemZICMP { |
Richard Sandiford | c231269 | 2014-03-06 10:38:30 +0000 | [diff] [blame] | 204 | // Describes whether an integer comparison needs to be signed or unsigned, |
| 205 | // or whether either type is OK. |
| 206 | enum { |
| 207 | Any, |
| 208 | UnsignedOnly, |
| 209 | SignedOnly |
| 210 | }; |
| 211 | } // end namespace SystemZICMP |
Richard Sandiford | 5bc670b | 2013-09-06 11:51:39 +0000 | [diff] [blame] | 212 | |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 213 | class SystemZSubtarget; |
| 214 | class SystemZTargetMachine; |
| 215 | |
| 216 | class SystemZTargetLowering : public TargetLowering { |
| 217 | public: |
Eric Christopher | a673417 | 2015-01-31 00:06:45 +0000 | [diff] [blame] | 218 | explicit SystemZTargetLowering(const TargetMachine &TM, |
| 219 | const SystemZSubtarget &STI); |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 220 | |
| 221 | // Override TargetLowering. |
Richard Sandiford | b4d67b5 | 2014-03-06 12:03:36 +0000 | [diff] [blame] | 222 | MVT getScalarShiftAmountTy(EVT LHSTy) const override { |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 223 | return MVT::i32; |
| 224 | } |
Richard Sandiford | b4d67b5 | 2014-03-06 12:03:36 +0000 | [diff] [blame] | 225 | EVT getSetCCResultType(LLVMContext &, EVT) const override; |
| 226 | bool isFMAFasterThanFMulAndFAdd(EVT VT) const override; |
| 227 | bool isFPImmLegal(const APFloat &Imm, EVT VT) const override; |
Ulrich Weigand | 1f6666a | 2015-03-31 12:52:27 +0000 | [diff] [blame] | 228 | bool isLegalICmpImmediate(int64_t Imm) const override; |
| 229 | bool isLegalAddImmediate(int64_t Imm) const override; |
Richard Sandiford | b4d67b5 | 2014-03-06 12:03:36 +0000 | [diff] [blame] | 230 | bool isLegalAddressingMode(const AddrMode &AM, Type *Ty) const override; |
Matt Arsenault | 6f2a526 | 2014-07-27 17:46:40 +0000 | [diff] [blame] | 231 | bool allowsMisalignedMemoryAccesses(EVT VT, unsigned AS, |
| 232 | unsigned Align, |
| 233 | bool *Fast) const override; |
Richard Sandiford | b4d67b5 | 2014-03-06 12:03:36 +0000 | [diff] [blame] | 234 | bool isTruncateFree(Type *, Type *) const override; |
| 235 | bool isTruncateFree(EVT, EVT) const override; |
| 236 | const char *getTargetNodeName(unsigned Opcode) const override; |
| 237 | std::pair<unsigned, const TargetRegisterClass *> |
Eric Christopher | 11e4df7 | 2015-02-26 22:38:43 +0000 | [diff] [blame] | 238 | getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, |
| 239 | const std::string &Constraint, |
| 240 | MVT VT) const override; |
Richard Sandiford | b4d67b5 | 2014-03-06 12:03:36 +0000 | [diff] [blame] | 241 | TargetLowering::ConstraintType |
Craig Topper | 7315602 | 2014-03-02 09:09:27 +0000 | [diff] [blame] | 242 | getConstraintType(const std::string &Constraint) const override; |
Richard Sandiford | b4d67b5 | 2014-03-06 12:03:36 +0000 | [diff] [blame] | 243 | TargetLowering::ConstraintWeight |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 244 | getSingleConstraintMatchWeight(AsmOperandInfo &info, |
Craig Topper | 7315602 | 2014-03-02 09:09:27 +0000 | [diff] [blame] | 245 | const char *constraint) const override; |
Richard Sandiford | b4d67b5 | 2014-03-06 12:03:36 +0000 | [diff] [blame] | 246 | void LowerAsmOperandForConstraint(SDValue Op, |
| 247 | std::string &Constraint, |
| 248 | std::vector<SDValue> &Ops, |
| 249 | SelectionDAG &DAG) const override; |
Daniel Sanders | bf5b80f | 2015-03-16 13:13:41 +0000 | [diff] [blame] | 250 | |
| 251 | unsigned getInlineAsmMemConstraint( |
| 252 | const std::string &ConstraintCode) const override { |
Daniel Sanders | 2eeace2 | 2015-03-17 16:16:14 +0000 | [diff] [blame] | 253 | if (ConstraintCode.size() == 1) { |
| 254 | switch(ConstraintCode[0]) { |
| 255 | default: |
| 256 | break; |
| 257 | case 'Q': |
| 258 | return InlineAsm::Constraint_Q; |
| 259 | case 'R': |
| 260 | return InlineAsm::Constraint_R; |
| 261 | case 'S': |
| 262 | return InlineAsm::Constraint_S; |
| 263 | case 'T': |
| 264 | return InlineAsm::Constraint_T; |
| 265 | } |
| 266 | } |
| 267 | return TargetLowering::getInlineAsmMemConstraint(ConstraintCode); |
Daniel Sanders | bf5b80f | 2015-03-16 13:13:41 +0000 | [diff] [blame] | 268 | } |
| 269 | |
Richard Sandiford | b4d67b5 | 2014-03-06 12:03:36 +0000 | [diff] [blame] | 270 | MachineBasicBlock *EmitInstrWithCustomInserter(MachineInstr *MI, |
| 271 | MachineBasicBlock *BB) const |
| 272 | override; |
| 273 | SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override; |
| 274 | bool allowTruncateForTailCall(Type *, Type *) const override; |
| 275 | bool mayBeEmittedAsTailCall(CallInst *CI) const override; |
| 276 | SDValue LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv, |
| 277 | bool isVarArg, |
| 278 | const SmallVectorImpl<ISD::InputArg> &Ins, |
| 279 | SDLoc DL, SelectionDAG &DAG, |
| 280 | SmallVectorImpl<SDValue> &InVals) const override; |
| 281 | SDValue LowerCall(CallLoweringInfo &CLI, |
| 282 | SmallVectorImpl<SDValue> &InVals) const override; |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 283 | |
Richard Sandiford | b4d67b5 | 2014-03-06 12:03:36 +0000 | [diff] [blame] | 284 | SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool IsVarArg, |
| 285 | const SmallVectorImpl<ISD::OutputArg> &Outs, |
| 286 | const SmallVectorImpl<SDValue> &OutVals, |
| 287 | SDLoc DL, SelectionDAG &DAG) const override; |
| 288 | SDValue prepareVolatileOrAtomicLoad(SDValue Chain, SDLoc DL, |
| 289 | SelectionDAG &DAG) const override; |
Richard Sandiford | 95bc5f9 | 2014-03-07 11:34:35 +0000 | [diff] [blame] | 290 | SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override; |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 291 | |
| 292 | private: |
| 293 | const SystemZSubtarget &Subtarget; |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 294 | |
| 295 | // Implement LowerOperation for individual opcodes. |
Richard Sandiford | f722a8e30 | 2013-10-16 11:10:55 +0000 | [diff] [blame] | 296 | SDValue lowerSETCC(SDValue Op, SelectionDAG &DAG) const; |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 297 | SDValue lowerBR_CC(SDValue Op, SelectionDAG &DAG) const; |
| 298 | SDValue lowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const; |
| 299 | SDValue lowerGlobalAddress(GlobalAddressSDNode *Node, |
| 300 | SelectionDAG &DAG) const; |
Ulrich Weigand | 7db6918 | 2015-02-18 09:13:27 +0000 | [diff] [blame] | 301 | SDValue lowerTLSGetOffset(GlobalAddressSDNode *Node, |
| 302 | SelectionDAG &DAG, unsigned Opcode, |
| 303 | SDValue GOTOffset) const; |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 304 | SDValue lowerGlobalTLSAddress(GlobalAddressSDNode *Node, |
| 305 | SelectionDAG &DAG) const; |
| 306 | SDValue lowerBlockAddress(BlockAddressSDNode *Node, |
| 307 | SelectionDAG &DAG) const; |
| 308 | SDValue lowerJumpTable(JumpTableSDNode *JT, SelectionDAG &DAG) const; |
| 309 | SDValue lowerConstantPool(ConstantPoolSDNode *CP, SelectionDAG &DAG) const; |
| 310 | SDValue lowerVASTART(SDValue Op, SelectionDAG &DAG) const; |
| 311 | SDValue lowerVACOPY(SDValue Op, SelectionDAG &DAG) const; |
| 312 | SDValue lowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG) const; |
Richard Sandiford | 7d86e47 | 2013-08-21 09:34:56 +0000 | [diff] [blame] | 313 | SDValue lowerSMUL_LOHI(SDValue Op, SelectionDAG &DAG) const; |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 314 | SDValue lowerUMUL_LOHI(SDValue Op, SelectionDAG &DAG) const; |
| 315 | SDValue lowerSDIVREM(SDValue Op, SelectionDAG &DAG) const; |
| 316 | SDValue lowerUDIVREM(SDValue Op, SelectionDAG &DAG) const; |
| 317 | SDValue lowerBITCAST(SDValue Op, SelectionDAG &DAG) const; |
| 318 | SDValue lowerOR(SDValue Op, SelectionDAG &DAG) const; |
Ulrich Weigand | b401218 | 2015-03-31 12:56:33 +0000 | [diff] [blame] | 319 | SDValue lowerCTPOP(SDValue Op, SelectionDAG &DAG) const; |
Richard Sandiford | bef3d7a | 2013-12-10 10:49:34 +0000 | [diff] [blame] | 320 | SDValue lowerATOMIC_LOAD(SDValue Op, SelectionDAG &DAG) const; |
| 321 | SDValue lowerATOMIC_STORE(SDValue Op, SelectionDAG &DAG) const; |
| 322 | SDValue lowerATOMIC_LOAD_OP(SDValue Op, SelectionDAG &DAG, |
| 323 | unsigned Opcode) const; |
Richard Sandiford | 41350a5 | 2013-12-24 15:18:04 +0000 | [diff] [blame] | 324 | SDValue lowerATOMIC_LOAD_SUB(SDValue Op, SelectionDAG &DAG) const; |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 325 | SDValue lowerATOMIC_CMP_SWAP(SDValue Op, SelectionDAG &DAG) const; |
Richard Sandiford | 9afe613 | 2013-12-10 10:36:34 +0000 | [diff] [blame] | 326 | SDValue lowerLOAD_SEQUENCE_POINT(SDValue Op, SelectionDAG &DAG) const; |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 327 | SDValue lowerSTACKSAVE(SDValue Op, SelectionDAG &DAG) const; |
| 328 | SDValue lowerSTACKRESTORE(SDValue Op, SelectionDAG &DAG) const; |
Richard Sandiford | 0348133 | 2013-08-23 11:36:42 +0000 | [diff] [blame] | 329 | SDValue lowerPREFETCH(SDValue Op, SelectionDAG &DAG) const; |
Ulrich Weigand | 57c85f5 | 2015-04-01 12:51:43 +0000 | [diff] [blame^] | 330 | SDValue lowerINTRINSIC_W_CHAIN(SDValue Op, SelectionDAG &DAG) const; |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 331 | |
Richard Sandiford | 0fb90ab | 2013-05-28 10:41:11 +0000 | [diff] [blame] | 332 | // If the last instruction before MBBI in MBB was some form of COMPARE, |
| 333 | // try to replace it with a COMPARE AND BRANCH just before MBBI. |
| 334 | // CCMask and Target are the BRC-like operands for the branch. |
| 335 | // Return true if the change was made. |
| 336 | bool convertPrevCompareToBranch(MachineBasicBlock *MBB, |
| 337 | MachineBasicBlock::iterator MBBI, |
| 338 | unsigned CCMask, |
| 339 | MachineBasicBlock *Target) const; |
| 340 | |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 341 | // Implement EmitInstrWithCustomInserter for individual operation types. |
| 342 | MachineBasicBlock *emitSelect(MachineInstr *MI, |
| 343 | MachineBasicBlock *BB) const; |
Richard Sandiford | b86a834 | 2013-06-27 09:27:40 +0000 | [diff] [blame] | 344 | MachineBasicBlock *emitCondStore(MachineInstr *MI, |
| 345 | MachineBasicBlock *BB, |
Richard Sandiford | a68e6f5 | 2013-07-25 08:57:02 +0000 | [diff] [blame] | 346 | unsigned StoreOpcode, unsigned STOCOpcode, |
| 347 | bool Invert) const; |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 348 | MachineBasicBlock *emitExt128(MachineInstr *MI, |
| 349 | MachineBasicBlock *MBB, |
| 350 | bool ClearEven, unsigned SubReg) const; |
| 351 | MachineBasicBlock *emitAtomicLoadBinary(MachineInstr *MI, |
| 352 | MachineBasicBlock *BB, |
| 353 | unsigned BinOpcode, unsigned BitSize, |
| 354 | bool Invert = false) const; |
| 355 | MachineBasicBlock *emitAtomicLoadMinMax(MachineInstr *MI, |
| 356 | MachineBasicBlock *MBB, |
| 357 | unsigned CompareOpcode, |
| 358 | unsigned KeepOldMask, |
| 359 | unsigned BitSize) const; |
| 360 | MachineBasicBlock *emitAtomicCmpSwapW(MachineInstr *MI, |
| 361 | MachineBasicBlock *BB) const; |
Richard Sandiford | 564681c | 2013-08-12 10:28:10 +0000 | [diff] [blame] | 362 | MachineBasicBlock *emitMemMemWrapper(MachineInstr *MI, |
| 363 | MachineBasicBlock *BB, |
| 364 | unsigned Opcode) const; |
Richard Sandiford | ca23271 | 2013-08-16 11:21:54 +0000 | [diff] [blame] | 365 | MachineBasicBlock *emitStringWrapper(MachineInstr *MI, |
| 366 | MachineBasicBlock *BB, |
| 367 | unsigned Opcode) const; |
Ulrich Weigand | 57c85f5 | 2015-04-01 12:51:43 +0000 | [diff] [blame^] | 368 | MachineBasicBlock *emitTransactionBegin(MachineInstr *MI, |
| 369 | MachineBasicBlock *MBB, |
| 370 | unsigned Opcode, |
| 371 | bool NoFloat) const; |
Ulrich Weigand | 5f613df | 2013-05-06 16:15:19 +0000 | [diff] [blame] | 372 | }; |
| 373 | } // end namespace llvm |
| 374 | |
Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 375 | #endif |