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