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 11 bool InstructionScheduler::SchedulerSupported() { return true; } 12 13 14 int InstructionScheduler::GetTargetInstructionFlags( 15 const Instruction* instr) const { 16 switch (instr->arch_opcode()) { 17 case kPPC_And: 18 case kPPC_AndComplement: 19 case kPPC_Or: 20 case kPPC_OrComplement: 21 case kPPC_Xor: 22 case kPPC_ShiftLeft32: 23 case kPPC_ShiftLeft64: 24 case kPPC_ShiftLeftPair: 25 case kPPC_ShiftRight32: 26 case kPPC_ShiftRight64: 27 case kPPC_ShiftRightPair: 28 case kPPC_ShiftRightAlg32: 29 case kPPC_ShiftRightAlg64: 30 case kPPC_ShiftRightAlgPair: 31 case kPPC_RotRight32: 32 case kPPC_RotRight64: 33 case kPPC_Not: 34 case kPPC_RotLeftAndMask32: 35 case kPPC_RotLeftAndClear64: 36 case kPPC_RotLeftAndClearLeft64: 37 case kPPC_RotLeftAndClearRight64: 38 case kPPC_Add: 39 case kPPC_AddWithOverflow32: 40 case kPPC_AddPair: 41 case kPPC_AddDouble: 42 case kPPC_Sub: 43 case kPPC_SubWithOverflow32: 44 case kPPC_SubPair: 45 case kPPC_SubDouble: 46 case kPPC_Mul32: 47 case kPPC_Mul64: 48 case kPPC_MulHigh32: 49 case kPPC_MulHighU32: 50 case kPPC_MulPair: 51 case kPPC_MulDouble: 52 case kPPC_Div32: 53 case kPPC_Div64: 54 case kPPC_DivU32: 55 case kPPC_DivU64: 56 case kPPC_DivDouble: 57 case kPPC_Mod32: 58 case kPPC_Mod64: 59 case kPPC_ModU32: 60 case kPPC_ModU64: 61 case kPPC_ModDouble: 62 case kPPC_Neg: 63 case kPPC_NegDouble: 64 case kPPC_SqrtDouble: 65 case kPPC_FloorDouble: 66 case kPPC_CeilDouble: 67 case kPPC_TruncateDouble: 68 case kPPC_RoundDouble: 69 case kPPC_MaxDouble: 70 case kPPC_MinDouble: 71 case kPPC_AbsDouble: 72 case kPPC_Cntlz32: 73 case kPPC_Cntlz64: 74 case kPPC_Popcnt32: 75 case kPPC_Popcnt64: 76 case kPPC_Cmp32: 77 case kPPC_Cmp64: 78 case kPPC_CmpDouble: 79 case kPPC_Tst32: 80 case kPPC_Tst64: 81 case kPPC_ExtendSignWord8: 82 case kPPC_ExtendSignWord16: 83 case kPPC_ExtendSignWord32: 84 case kPPC_Uint32ToUint64: 85 case kPPC_Int64ToInt32: 86 case kPPC_Int64ToFloat32: 87 case kPPC_Int64ToDouble: 88 case kPPC_Uint64ToFloat32: 89 case kPPC_Uint64ToDouble: 90 case kPPC_Int32ToFloat32: 91 case kPPC_Int32ToDouble: 92 case kPPC_Uint32ToFloat32: 93 case kPPC_Uint32ToDouble: 94 case kPPC_Float32ToDouble: 95 case kPPC_Float64SilenceNaN: 96 case kPPC_DoubleToInt32: 97 case kPPC_DoubleToUint32: 98 case kPPC_DoubleToInt64: 99 case kPPC_DoubleToUint64: 100 case kPPC_DoubleToFloat32: 101 case kPPC_DoubleExtractLowWord32: 102 case kPPC_DoubleExtractHighWord32: 103 case kPPC_DoubleInsertLowWord32: 104 case kPPC_DoubleInsertHighWord32: 105 case kPPC_DoubleConstruct: 106 case kPPC_BitcastInt32ToFloat32: 107 case kPPC_BitcastFloat32ToInt32: 108 case kPPC_BitcastInt64ToDouble: 109 case kPPC_BitcastDoubleToInt64: 110 return kNoOpcodeFlags; 111 112 case kPPC_LoadWordS8: 113 case kPPC_LoadWordU8: 114 case kPPC_LoadWordS16: 115 case kPPC_LoadWordU16: 116 case kPPC_LoadWordS32: 117 case kPPC_LoadWordU32: 118 case kPPC_LoadWord64: 119 case kPPC_LoadFloat32: 120 case kPPC_LoadDouble: 121 return kIsLoadOperation; 122 123 case kPPC_StoreWord8: 124 case kPPC_StoreWord16: 125 case kPPC_StoreWord32: 126 case kPPC_StoreWord64: 127 case kPPC_StoreFloat32: 128 case kPPC_StoreDouble: 129 case kPPC_Push: 130 case kPPC_PushFrame: 131 case kPPC_StoreToStackSlot: 132 return kHasSideEffect; 133 134 #define CASE(Name) case k##Name: 135 COMMON_ARCH_OPCODE_LIST(CASE) 136 #undef CASE 137 // Already covered in architecture independent code. 138 UNREACHABLE(); 139 } 140 141 UNREACHABLE(); 142 return kNoOpcodeFlags; 143 } 144 145 146 int InstructionScheduler::GetInstructionLatency(const Instruction* instr) { 147 // TODO(all): Add instruction cost modeling. 148 return 1; 149 } 150 151 } // namespace compiler 152 } // namespace internal 153 } // namespace v8 154