• 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 
GetTargetInstructionFlags(const Instruction * instr) const13 int InstructionScheduler::GetTargetInstructionFlags(
14     const Instruction* instr) const {
15   switch (instr->arch_opcode()) {
16     case kS390_Abs32:
17     case kS390_Abs64:
18     case kS390_And32:
19     case kS390_And64:
20     case kS390_Or32:
21     case kS390_Or64:
22     case kS390_Xor32:
23     case kS390_Xor64:
24     case kS390_ShiftLeft32:
25     case kS390_ShiftLeft64:
26     case kS390_ShiftLeftPair:
27     case kS390_ShiftRight32:
28     case kS390_ShiftRight64:
29     case kS390_ShiftRightPair:
30     case kS390_ShiftRightArith32:
31     case kS390_ShiftRightArith64:
32     case kS390_ShiftRightArithPair:
33     case kS390_RotRight32:
34     case kS390_RotRight64:
35     case kS390_Not32:
36     case kS390_Not64:
37     case kS390_RotLeftAndClear64:
38     case kS390_RotLeftAndClearLeft64:
39     case kS390_RotLeftAndClearRight64:
40     case kS390_Lay:
41     case kS390_Add32:
42     case kS390_Add64:
43     case kS390_AddPair:
44     case kS390_AddFloat:
45     case kS390_AddDouble:
46     case kS390_Sub32:
47     case kS390_Sub64:
48     case kS390_SubPair:
49     case kS390_MulPair:
50     case kS390_SubFloat:
51     case kS390_SubDouble:
52     case kS390_Mul32:
53     case kS390_Mul32WithOverflow:
54     case kS390_Mul64:
55     case kS390_MulHigh32:
56     case kS390_MulHighU32:
57     case kS390_MulFloat:
58     case kS390_MulDouble:
59     case kS390_Div32:
60     case kS390_Div64:
61     case kS390_DivU32:
62     case kS390_DivU64:
63     case kS390_DivFloat:
64     case kS390_DivDouble:
65     case kS390_Mod32:
66     case kS390_Mod64:
67     case kS390_ModU32:
68     case kS390_ModU64:
69     case kS390_ModDouble:
70     case kS390_Neg32:
71     case kS390_Neg64:
72     case kS390_NegDouble:
73     case kS390_NegFloat:
74     case kS390_SqrtFloat:
75     case kS390_FloorFloat:
76     case kS390_CeilFloat:
77     case kS390_TruncateFloat:
78     case kS390_AbsFloat:
79     case kS390_SqrtDouble:
80     case kS390_FloorDouble:
81     case kS390_CeilDouble:
82     case kS390_TruncateDouble:
83     case kS390_RoundDouble:
84     case kS390_MaxFloat:
85     case kS390_MaxDouble:
86     case kS390_MinFloat:
87     case kS390_MinDouble:
88     case kS390_AbsDouble:
89     case kS390_Cntlz32:
90     case kS390_Cntlz64:
91     case kS390_Popcnt32:
92     case kS390_Popcnt64:
93     case kS390_Cmp32:
94     case kS390_Cmp64:
95     case kS390_CmpFloat:
96     case kS390_CmpDouble:
97     case kS390_Tst32:
98     case kS390_Tst64:
99     case kS390_SignExtendWord8ToInt32:
100     case kS390_SignExtendWord16ToInt32:
101     case kS390_SignExtendWord8ToInt64:
102     case kS390_SignExtendWord16ToInt64:
103     case kS390_SignExtendWord32ToInt64:
104     case kS390_Uint32ToUint64:
105     case kS390_Int64ToInt32:
106     case kS390_Int64ToFloat32:
107     case kS390_Int64ToDouble:
108     case kS390_Uint64ToFloat32:
109     case kS390_Uint64ToDouble:
110     case kS390_Int32ToFloat32:
111     case kS390_Int32ToDouble:
112     case kS390_Uint32ToFloat32:
113     case kS390_Uint32ToDouble:
114     case kS390_Float32ToInt32:
115     case kS390_Float32ToUint32:
116     case kS390_Float32ToUint64:
117     case kS390_Float32ToDouble:
118     case kS390_Float64SilenceNaN:
119     case kS390_DoubleToInt32:
120     case kS390_DoubleToUint32:
121     case kS390_Float32ToInt64:
122     case kS390_DoubleToInt64:
123     case kS390_DoubleToUint64:
124     case kS390_DoubleToFloat32:
125     case kS390_DoubleExtractLowWord32:
126     case kS390_DoubleExtractHighWord32:
127     case kS390_DoubleInsertLowWord32:
128     case kS390_DoubleInsertHighWord32:
129     case kS390_DoubleConstruct:
130     case kS390_BitcastInt32ToFloat32:
131     case kS390_BitcastFloat32ToInt32:
132     case kS390_BitcastInt64ToDouble:
133     case kS390_BitcastDoubleToInt64:
134     case kS390_LoadReverse16RR:
135     case kS390_LoadReverse32RR:
136     case kS390_LoadReverse64RR:
137     case kS390_LoadAndTestWord32:
138     case kS390_LoadAndTestWord64:
139     case kS390_LoadAndTestFloat32:
140     case kS390_LoadAndTestFloat64:
141       return kNoOpcodeFlags;
142 
143     case kS390_LoadWordS8:
144     case kS390_LoadWordU8:
145     case kS390_LoadWordS16:
146     case kS390_LoadWordU16:
147     case kS390_LoadWordS32:
148     case kS390_LoadWordU32:
149     case kS390_LoadWord64:
150     case kS390_LoadFloat32:
151     case kS390_LoadDouble:
152     case kS390_LoadReverse16:
153     case kS390_LoadReverse32:
154     case kS390_LoadReverse64:
155       return kIsLoadOperation;
156 
157     case kS390_StoreWord8:
158     case kS390_StoreWord16:
159     case kS390_StoreWord32:
160     case kS390_StoreWord64:
161     case kS390_StoreReverse16:
162     case kS390_StoreReverse32:
163     case kS390_StoreReverse64:
164     case kS390_StoreFloat32:
165     case kS390_StoreDouble:
166     case kS390_Push:
167     case kS390_PushFrame:
168     case kS390_StoreToStackSlot:
169     case kS390_StackClaim:
170       return kHasSideEffect;
171 
172 #define CASE(Name) case k##Name:
173       COMMON_ARCH_OPCODE_LIST(CASE)
174 #undef CASE
175       // Already covered in architecture independent code.
176       UNREACHABLE();
177   }
178 
179   UNREACHABLE();
180 }
181 
GetInstructionLatency(const Instruction * instr)182 int InstructionScheduler::GetInstructionLatency(const Instruction* instr) {
183   // TODO(all): Add instruction cost modeling.
184   return 1;
185 }
186 
187 }  // namespace compiler
188 }  // namespace internal
189 }  // namespace v8
190