1 // Copyright 2015 the V8 project authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "src/compiler/instruction-scheduler.h" 6 7 namespace v8 { 8 namespace internal { 9 namespace compiler { 10 SchedulerSupported()11bool InstructionScheduler::SchedulerSupported() { return true; } 12 13 GetTargetInstructionFlags(const Instruction * instr) const14int InstructionScheduler::GetTargetInstructionFlags( 15 const Instruction* instr) const { 16 switch (instr->arch_opcode()) { 17 case kIA32Add: 18 case kIA32And: 19 case kIA32Cmp: 20 case kIA32Test: 21 case kIA32Or: 22 case kIA32Xor: 23 case kIA32Sub: 24 case kIA32Imul: 25 case kIA32ImulHigh: 26 case kIA32UmulHigh: 27 case kIA32Idiv: 28 case kIA32Udiv: 29 case kIA32Not: 30 case kIA32Neg: 31 case kIA32Shl: 32 case kIA32Shr: 33 case kIA32Sar: 34 case kIA32Ror: 35 case kIA32Lzcnt: 36 case kIA32Tzcnt: 37 case kIA32Popcnt: 38 case kIA32Lea: 39 case kSSEFloat32Cmp: 40 case kSSEFloat32Add: 41 case kSSEFloat32Sub: 42 case kSSEFloat32Mul: 43 case kSSEFloat32Div: 44 case kSSEFloat32Max: 45 case kSSEFloat32Min: 46 case kSSEFloat32Abs: 47 case kSSEFloat32Neg: 48 case kSSEFloat32Sqrt: 49 case kSSEFloat32Round: 50 case kSSEFloat64Cmp: 51 case kSSEFloat64Add: 52 case kSSEFloat64Sub: 53 case kSSEFloat64Mul: 54 case kSSEFloat64Div: 55 case kSSEFloat64Mod: 56 case kSSEFloat64Max: 57 case kSSEFloat64Min: 58 case kSSEFloat64Abs: 59 case kSSEFloat64Neg: 60 case kSSEFloat64Sqrt: 61 case kSSEFloat64Round: 62 case kSSEFloat32ToFloat64: 63 case kSSEFloat64ToFloat32: 64 case kSSEFloat64ToInt32: 65 case kSSEFloat64ToUint32: 66 case kSSEInt32ToFloat64: 67 case kSSEUint32ToFloat64: 68 case kSSEFloat64ExtractLowWord32: 69 case kSSEFloat64ExtractHighWord32: 70 case kSSEFloat64InsertLowWord32: 71 case kSSEFloat64InsertHighWord32: 72 case kSSEFloat64LoadLowWord32: 73 case kAVXFloat32Add: 74 case kAVXFloat32Sub: 75 case kAVXFloat32Mul: 76 case kAVXFloat32Div: 77 case kAVXFloat32Max: 78 case kAVXFloat32Min: 79 case kAVXFloat64Add: 80 case kAVXFloat64Sub: 81 case kAVXFloat64Mul: 82 case kAVXFloat64Div: 83 case kAVXFloat64Max: 84 case kAVXFloat64Min: 85 case kAVXFloat64Abs: 86 case kAVXFloat64Neg: 87 case kAVXFloat32Abs: 88 case kAVXFloat32Neg: 89 case kIA32BitcastFI: 90 case kIA32BitcastIF: 91 return (instr->addressing_mode() == kMode_None) 92 ? kNoOpcodeFlags 93 : kIsLoadOperation | kHasSideEffect; 94 95 case kIA32Movsxbl: 96 case kIA32Movzxbl: 97 case kIA32Movb: 98 case kIA32Movsxwl: 99 case kIA32Movzxwl: 100 case kIA32Movw: 101 case kIA32Movl: 102 case kIA32Movss: 103 case kIA32Movsd: 104 // Moves are used for memory load/store operations. 105 return instr->HasOutput() ? kIsLoadOperation : kHasSideEffect; 106 107 case kIA32StackCheck: 108 return kIsLoadOperation; 109 110 case kIA32Push: 111 case kIA32PushFloat32: 112 case kIA32PushFloat64: 113 case kIA32Poke: 114 return kHasSideEffect; 115 116 #define CASE(Name) case k##Name: 117 COMMON_ARCH_OPCODE_LIST(CASE) 118 #undef CASE 119 // Already covered in architecture independent code. 120 UNREACHABLE(); 121 } 122 123 UNREACHABLE(); 124 return kNoOpcodeFlags; 125 } 126 127 GetInstructionLatency(const Instruction * instr)128int InstructionScheduler::GetInstructionLatency(const Instruction* instr) { 129 // TODO(all): Add instruction cost modeling. 130 return 1; 131 } 132 133 } // namespace compiler 134 } // namespace internal 135 } // namespace v8 136