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