• 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 kArmAdd:
18     case kArmAnd:
19     case kArmBic:
20     case kArmClz:
21     case kArmCmp:
22     case kArmCmn:
23     case kArmTst:
24     case kArmTeq:
25     case kArmOrr:
26     case kArmEor:
27     case kArmSub:
28     case kArmRsb:
29     case kArmMul:
30     case kArmMla:
31     case kArmMls:
32     case kArmSmmul:
33     case kArmSmmla:
34     case kArmUmull:
35     case kArmSdiv:
36     case kArmUdiv:
37     case kArmMov:
38     case kArmMvn:
39     case kArmBfc:
40     case kArmUbfx:
41     case kArmSbfx:
42     case kArmSxtb:
43     case kArmSxth:
44     case kArmSxtab:
45     case kArmSxtah:
46     case kArmUxtb:
47     case kArmUxth:
48     case kArmUxtab:
49     case kArmUxtah:
50     case kArmRbit:
51     case kArmAddPair:
52     case kArmSubPair:
53     case kArmMulPair:
54     case kArmLslPair:
55     case kArmLsrPair:
56     case kArmAsrPair:
57     case kArmVcmpF32:
58     case kArmVaddF32:
59     case kArmVsubF32:
60     case kArmVmulF32:
61     case kArmVmlaF32:
62     case kArmVmlsF32:
63     case kArmVdivF32:
64     case kArmVabsF32:
65     case kArmVnegF32:
66     case kArmVsqrtF32:
67     case kArmVcmpF64:
68     case kArmVaddF64:
69     case kArmVsubF64:
70     case kArmVmulF64:
71     case kArmVmlaF64:
72     case kArmVmlsF64:
73     case kArmVdivF64:
74     case kArmVmodF64:
75     case kArmVabsF64:
76     case kArmVnegF64:
77     case kArmVsqrtF64:
78     case kArmVrintmF32:
79     case kArmVrintmF64:
80     case kArmVrintpF32:
81     case kArmVrintpF64:
82     case kArmVrintzF32:
83     case kArmVrintzF64:
84     case kArmVrintaF64:
85     case kArmVrintnF32:
86     case kArmVrintnF64:
87     case kArmVcvtF32F64:
88     case kArmVcvtF64F32:
89     case kArmVcvtF32S32:
90     case kArmVcvtF32U32:
91     case kArmVcvtF64S32:
92     case kArmVcvtF64U32:
93     case kArmVcvtS32F32:
94     case kArmVcvtU32F32:
95     case kArmVcvtS32F64:
96     case kArmVcvtU32F64:
97     case kArmVmovU32F32:
98     case kArmVmovF32U32:
99     case kArmVmovLowU32F64:
100     case kArmVmovLowF64U32:
101     case kArmVmovHighU32F64:
102     case kArmVmovHighF64U32:
103     case kArmVmovF64U32U32:
104     case kArmFloat64Max:
105     case kArmFloat64Min:
106     case kArmFloat32Max:
107     case kArmFloat32Min:
108     case kArmFloat64SilenceNaN:
109       return kNoOpcodeFlags;
110 
111     case kArmVldrF32:
112     case kArmVldrF64:
113     case kArmLdrb:
114     case kArmLdrsb:
115     case kArmLdrh:
116     case kArmLdrsh:
117     case kArmLdr:
118       return kIsLoadOperation;
119 
120     case kArmVstrF32:
121     case kArmVstrF64:
122     case kArmStrb:
123     case kArmStrh:
124     case kArmStr:
125     case kArmPush:
126     case kArmPoke:
127       return kHasSideEffect;
128 
129 #define CASE(Name) case k##Name:
130     COMMON_ARCH_OPCODE_LIST(CASE)
131 #undef CASE
132       // Already covered in architecture independent code.
133       UNREACHABLE();
134   }
135 
136   UNREACHABLE();
137   return kNoOpcodeFlags;
138 }
139 
140 
GetInstructionLatency(const Instruction * instr)141 int InstructionScheduler::GetInstructionLatency(const Instruction* instr) {
142   // TODO(all): Add instruction cost modeling.
143   return 1;
144 }
145 
146 }  // namespace compiler
147 }  // namespace internal
148 }  // namespace v8
149