instruction-scheduler-arm.cc 7.48 KB
Newer Older
1 2 3 4
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

5
#include "src/compiler/backend/instruction-scheduler.h"
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

namespace v8 {
namespace internal {
namespace compiler {

bool InstructionScheduler::SchedulerSupported() { return true; }

int InstructionScheduler::GetTargetInstructionFlags(
    const Instruction* instr) const {
  switch (instr->arch_opcode()) {
    case kArmAdd:
    case kArmAnd:
    case kArmBic:
    case kArmClz:
    case kArmCmp:
    case kArmCmn:
    case kArmTst:
    case kArmTeq:
    case kArmOrr:
    case kArmEor:
    case kArmSub:
    case kArmRsb:
    case kArmMul:
    case kArmMla:
    case kArmMls:
    case kArmSmmul:
32
    case kArmSmull:
33 34 35 36 37 38 39 40
    case kArmSmmla:
    case kArmUmull:
    case kArmSdiv:
    case kArmUdiv:
    case kArmMov:
    case kArmMvn:
    case kArmBfc:
    case kArmUbfx:
41
    case kArmSbfx:
42 43 44 45 46 47 48 49
    case kArmSxtb:
    case kArmSxth:
    case kArmSxtab:
    case kArmSxtah:
    case kArmUxtb:
    case kArmUxth:
    case kArmUxtab:
    case kArmUxtah:
50
    case kArmRbit:
51
    case kArmRev:
52
    case kArmAddPair:
53
    case kArmSubPair:
54
    case kArmMulPair:
55
    case kArmLslPair:
56 57
    case kArmLsrPair:
    case kArmAsrPair:
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
    case kArmVcmpF32:
    case kArmVaddF32:
    case kArmVsubF32:
    case kArmVmulF32:
    case kArmVmlaF32:
    case kArmVmlsF32:
    case kArmVdivF32:
    case kArmVabsF32:
    case kArmVnegF32:
    case kArmVsqrtF32:
    case kArmVcmpF64:
    case kArmVaddF64:
    case kArmVsubF64:
    case kArmVmulF64:
    case kArmVmlaF64:
    case kArmVmlsF64:
    case kArmVdivF64:
    case kArmVmodF64:
    case kArmVabsF64:
    case kArmVnegF64:
    case kArmVsqrtF64:
    case kArmVrintmF32:
    case kArmVrintmF64:
    case kArmVrintpF32:
    case kArmVrintpF64:
    case kArmVrintzF32:
    case kArmVrintzF64:
    case kArmVrintaF64:
    case kArmVrintnF32:
    case kArmVrintnF64:
    case kArmVcvtF32F64:
    case kArmVcvtF64F32:
90
    case kArmVcvtF32S32:
91
    case kArmVcvtF32U32:
92 93
    case kArmVcvtF64S32:
    case kArmVcvtF64U32:
94
    case kArmVcvtS32F32:
95
    case kArmVcvtU32F32:
96 97
    case kArmVcvtS32F64:
    case kArmVcvtU32F64:
98
    case kArmVmovU32F32:
99
    case kArmVmovF32U32:
100 101 102 103 104
    case kArmVmovLowU32F64:
    case kArmVmovLowF64U32:
    case kArmVmovHighU32F64:
    case kArmVmovHighF64U32:
    case kArmVmovF64U32U32:
105
    case kArmVmovU32U32F64:
106
    case kArmFloat32Max:
107
    case kArmFloat64Max:
108
    case kArmFloat32Min:
109
    case kArmFloat64Min:
110
    case kArmFloat64SilenceNaN:
111 112 113 114 115 116 117 118 119 120
    case kArmF32x4Splat:
    case kArmF32x4ExtractLane:
    case kArmF32x4ReplaceLane:
    case kArmF32x4SConvertI32x4:
    case kArmF32x4UConvertI32x4:
    case kArmF32x4Abs:
    case kArmF32x4Neg:
    case kArmF32x4RecipApprox:
    case kArmF32x4RecipSqrtApprox:
    case kArmF32x4Add:
121
    case kArmF32x4AddHoriz:
122 123
    case kArmF32x4Sub:
    case kArmF32x4Mul:
124
    case kArmF32x4Div:
125 126 127 128 129 130 131 132 133 134
    case kArmF32x4Min:
    case kArmF32x4Max:
    case kArmF32x4Eq:
    case kArmF32x4Ne:
    case kArmF32x4Lt:
    case kArmF32x4Le:
    case kArmI32x4Splat:
    case kArmI32x4ExtractLane:
    case kArmI32x4ReplaceLane:
    case kArmI32x4SConvertF32x4:
135 136
    case kArmI32x4SConvertI16x8Low:
    case kArmI32x4SConvertI16x8High:
137 138 139 140
    case kArmI32x4Neg:
    case kArmI32x4Shl:
    case kArmI32x4ShrS:
    case kArmI32x4Add:
141
    case kArmI32x4AddHoriz:
142 143 144 145 146 147
    case kArmI32x4Sub:
    case kArmI32x4Mul:
    case kArmI32x4MinS:
    case kArmI32x4MaxS:
    case kArmI32x4Eq:
    case kArmI32x4Ne:
148 149
    case kArmI32x4GtS:
    case kArmI32x4GeS:
150
    case kArmI32x4UConvertF32x4:
151 152
    case kArmI32x4UConvertI16x8Low:
    case kArmI32x4UConvertI16x8High:
153 154 155
    case kArmI32x4ShrU:
    case kArmI32x4MinU:
    case kArmI32x4MaxU:
156 157
    case kArmI32x4GtU:
    case kArmI32x4GeU:
158 159 160
    case kArmI16x8Splat:
    case kArmI16x8ExtractLane:
    case kArmI16x8ReplaceLane:
161 162
    case kArmI16x8SConvertI8x16Low:
    case kArmI16x8SConvertI8x16High:
163 164 165
    case kArmI16x8Neg:
    case kArmI16x8Shl:
    case kArmI16x8ShrS:
166
    case kArmI16x8SConvertI32x4:
167 168
    case kArmI16x8Add:
    case kArmI16x8AddSaturateS:
169
    case kArmI16x8AddHoriz:
170 171 172 173 174 175 176
    case kArmI16x8Sub:
    case kArmI16x8SubSaturateS:
    case kArmI16x8Mul:
    case kArmI16x8MinS:
    case kArmI16x8MaxS:
    case kArmI16x8Eq:
    case kArmI16x8Ne:
177 178
    case kArmI16x8GtS:
    case kArmI16x8GeS:
179 180 181 182
    case kArmI16x8UConvertI8x16Low:
    case kArmI16x8UConvertI8x16High:
    case kArmI16x8ShrU:
    case kArmI16x8UConvertI32x4:
183 184 185 186
    case kArmI16x8AddSaturateU:
    case kArmI16x8SubSaturateU:
    case kArmI16x8MinU:
    case kArmI16x8MaxU:
187 188
    case kArmI16x8GtU:
    case kArmI16x8GeU:
189 190 191 192 193 194
    case kArmI8x16Splat:
    case kArmI8x16ExtractLane:
    case kArmI8x16ReplaceLane:
    case kArmI8x16Neg:
    case kArmI8x16Shl:
    case kArmI8x16ShrS:
195
    case kArmI8x16SConvertI16x8:
196 197 198 199 200 201 202 203 204
    case kArmI8x16Add:
    case kArmI8x16AddSaturateS:
    case kArmI8x16Sub:
    case kArmI8x16SubSaturateS:
    case kArmI8x16Mul:
    case kArmI8x16MinS:
    case kArmI8x16MaxS:
    case kArmI8x16Eq:
    case kArmI8x16Ne:
205 206
    case kArmI8x16GtS:
    case kArmI8x16GeS:
207
    case kArmI8x16UConvertI16x8:
208 209 210 211 212
    case kArmI8x16AddSaturateU:
    case kArmI8x16SubSaturateU:
    case kArmI8x16ShrU:
    case kArmI8x16MinU:
    case kArmI8x16MaxU:
213 214
    case kArmI8x16GtU:
    case kArmI8x16GeU:
215
    case kArmS128Zero:
216
    case kArmS128Dup:
217 218 219 220 221
    case kArmS128And:
    case kArmS128Or:
    case kArmS128Xor:
    case kArmS128Not:
    case kArmS128Select:
222 223 224 225 226 227
    case kArmS32x4ZipLeft:
    case kArmS32x4ZipRight:
    case kArmS32x4UnzipLeft:
    case kArmS32x4UnzipRight:
    case kArmS32x4TransposeLeft:
    case kArmS32x4TransposeRight:
228
    case kArmS32x4Shuffle:
229 230 231 232 233 234 235 236 237 238 239 240 241
    case kArmS16x8ZipLeft:
    case kArmS16x8ZipRight:
    case kArmS16x8UnzipLeft:
    case kArmS16x8UnzipRight:
    case kArmS16x8TransposeLeft:
    case kArmS16x8TransposeRight:
    case kArmS8x16ZipLeft:
    case kArmS8x16ZipRight:
    case kArmS8x16UnzipLeft:
    case kArmS8x16UnzipRight:
    case kArmS8x16TransposeLeft:
    case kArmS8x16TransposeRight:
    case kArmS8x16Concat:
242
    case kArmS8x16Shuffle:
243 244 245 246 247 248
    case kArmS32x2Reverse:
    case kArmS16x4Reverse:
    case kArmS16x2Reverse:
    case kArmS8x8Reverse:
    case kArmS8x4Reverse:
    case kArmS8x2Reverse:
249 250 251 252 253 254
    case kArmS1x4AnyTrue:
    case kArmS1x4AllTrue:
    case kArmS1x8AnyTrue:
    case kArmS1x8AllTrue:
    case kArmS1x16AnyTrue:
    case kArmS1x16AllTrue:
255 256 257 258
      return kNoOpcodeFlags;

    case kArmVldrF32:
    case kArmVldrF64:
259
    case kArmVld1F64:
260
    case kArmVld1S128:
261 262 263 264 265
    case kArmLdrb:
    case kArmLdrsb:
    case kArmLdrh:
    case kArmLdrsh:
    case kArmLdr:
266
    case kArmPeek:
267
    case kArmWord32AtomicPairLoad:
268 269 270 271
      return kIsLoadOperation;

    case kArmVstrF32:
    case kArmVstrF64:
272
    case kArmVst1F64:
273
    case kArmVst1S128:
274 275 276 277 278
    case kArmStrb:
    case kArmStrh:
    case kArmStr:
    case kArmPush:
    case kArmPoke:
279
    case kArmDmbIsh:
280
    case kArmDsbIsb:
281 282 283 284 285 286 287 288
    case kArmWord32AtomicPairStore:
    case kArmWord32AtomicPairAdd:
    case kArmWord32AtomicPairSub:
    case kArmWord32AtomicPairAnd:
    case kArmWord32AtomicPairOr:
    case kArmWord32AtomicPairXor:
    case kArmWord32AtomicPairExchange:
    case kArmWord32AtomicPairCompareExchange:
289 290 291
      return kHasSideEffect;

#define CASE(Name) case k##Name:
292
      COMMON_ARCH_OPCODE_LIST(CASE)
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308
#undef CASE
      // Already covered in architecture independent code.
      UNREACHABLE();
  }

  UNREACHABLE();
}

int InstructionScheduler::GetInstructionLatency(const Instruction* instr) {
  // TODO(all): Add instruction cost modeling.
  return 1;
}

}  // namespace compiler
}  // namespace internal
}  // namespace v8