• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2017 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 #ifndef V8_WASM_BASELINE_S390_LIFTOFF_ASSEMBLER_S390_H_
6 #define V8_WASM_BASELINE_S390_LIFTOFF_ASSEMBLER_S390_H_
7 
8 #include "src/wasm/baseline/liftoff-assembler.h"
9 
10 #define BAILOUT(reason) bailout("s390 " reason)
11 
12 namespace v8 {
13 namespace internal {
14 namespace wasm {
15 
PrepareStackFrame()16 int LiftoffAssembler::PrepareStackFrame() {
17   BAILOUT("PrepareStackFrame");
18   return 0;
19 }
20 
PatchPrepareStackFrame(int offset,uint32_t stack_slots)21 void LiftoffAssembler::PatchPrepareStackFrame(int offset,
22                                               uint32_t stack_slots) {
23   BAILOUT("PatchPrepareStackFrame");
24 }
25 
FinishCode()26 void LiftoffAssembler::FinishCode() {}
27 
AbortCompilation()28 void LiftoffAssembler::AbortCompilation() {}
29 
LoadConstant(LiftoffRegister reg,WasmValue value,RelocInfo::Mode rmode)30 void LiftoffAssembler::LoadConstant(LiftoffRegister reg, WasmValue value,
31                                     RelocInfo::Mode rmode) {
32   BAILOUT("LoadConstant");
33 }
34 
LoadFromInstance(Register dst,uint32_t offset,int size)35 void LiftoffAssembler::LoadFromInstance(Register dst, uint32_t offset,
36                                         int size) {
37   BAILOUT("LoadFromInstance");
38 }
39 
SpillInstance(Register instance)40 void LiftoffAssembler::SpillInstance(Register instance) {
41   BAILOUT("SpillInstance");
42 }
43 
FillInstanceInto(Register dst)44 void LiftoffAssembler::FillInstanceInto(Register dst) {
45   BAILOUT("FillInstanceInto");
46 }
47 
Load(LiftoffRegister dst,Register src_addr,Register offset_reg,uint32_t offset_imm,LoadType type,LiftoffRegList pinned,uint32_t * protected_load_pc,bool is_load_mem)48 void LiftoffAssembler::Load(LiftoffRegister dst, Register src_addr,
49                             Register offset_reg, uint32_t offset_imm,
50                             LoadType type, LiftoffRegList pinned,
51                             uint32_t* protected_load_pc, bool is_load_mem) {
52   BAILOUT("Load");
53 }
54 
Store(Register dst_addr,Register offset_reg,uint32_t offset_imm,LiftoffRegister src,StoreType type,LiftoffRegList pinned,uint32_t * protected_store_pc,bool is_store_mem)55 void LiftoffAssembler::Store(Register dst_addr, Register offset_reg,
56                              uint32_t offset_imm, LiftoffRegister src,
57                              StoreType type, LiftoffRegList pinned,
58                              uint32_t* protected_store_pc, bool is_store_mem) {
59   BAILOUT("Store");
60 }
61 
LoadCallerFrameSlot(LiftoffRegister dst,uint32_t caller_slot_idx,ValueType type)62 void LiftoffAssembler::LoadCallerFrameSlot(LiftoffRegister dst,
63                                            uint32_t caller_slot_idx,
64                                            ValueType type) {
65   BAILOUT("LoadCallerFrameSlot");
66 }
67 
MoveStackValue(uint32_t dst_index,uint32_t src_index,ValueType type)68 void LiftoffAssembler::MoveStackValue(uint32_t dst_index, uint32_t src_index,
69                                       ValueType type) {
70   BAILOUT("MoveStackValue");
71 }
72 
Move(Register dst,Register src,ValueType type)73 void LiftoffAssembler::Move(Register dst, Register src, ValueType type) {
74   BAILOUT("Move Register");
75 }
76 
Move(DoubleRegister dst,DoubleRegister src,ValueType type)77 void LiftoffAssembler::Move(DoubleRegister dst, DoubleRegister src,
78                             ValueType type) {
79   BAILOUT("Move DoubleRegister");
80 }
81 
Spill(uint32_t index,LiftoffRegister reg,ValueType type)82 void LiftoffAssembler::Spill(uint32_t index, LiftoffRegister reg,
83                              ValueType type) {
84   BAILOUT("Spill register");
85 }
86 
Spill(uint32_t index,WasmValue value)87 void LiftoffAssembler::Spill(uint32_t index, WasmValue value) {
88   BAILOUT("Spill value");
89 }
90 
Fill(LiftoffRegister reg,uint32_t index,ValueType type)91 void LiftoffAssembler::Fill(LiftoffRegister reg, uint32_t index,
92                             ValueType type) {
93   BAILOUT("Fill");
94 }
95 
FillI64Half(Register,uint32_t half_index)96 void LiftoffAssembler::FillI64Half(Register, uint32_t half_index) {
97   BAILOUT("FillI64Half");
98 }
99 
100 #define UNIMPLEMENTED_GP_BINOP(name)                             \
101   void LiftoffAssembler::emit_##name(Register dst, Register lhs, \
102                                      Register rhs) {             \
103     BAILOUT("gp binop: " #name);                                 \
104   }
105 #define UNIMPLEMENTED_I64_BINOP(name)                                          \
106   void LiftoffAssembler::emit_##name(LiftoffRegister dst, LiftoffRegister lhs, \
107                                      LiftoffRegister rhs) {                    \
108     BAILOUT("i64 binop: " #name);                                              \
109   }
110 #define UNIMPLEMENTED_GP_UNOP(name)                                \
111   bool LiftoffAssembler::emit_##name(Register dst, Register src) { \
112     BAILOUT("gp unop: " #name);                                    \
113     return true;                                                   \
114   }
115 #define UNIMPLEMENTED_FP_BINOP(name)                                         \
116   void LiftoffAssembler::emit_##name(DoubleRegister dst, DoubleRegister lhs, \
117                                      DoubleRegister rhs) {                   \
118     BAILOUT("fp binop: " #name);                                             \
119   }
120 #define UNIMPLEMENTED_FP_UNOP(name)                                            \
121   void LiftoffAssembler::emit_##name(DoubleRegister dst, DoubleRegister src) { \
122     BAILOUT("fp unop: " #name);                                                \
123   }
124 #define UNIMPLEMENTED_FP_UNOP_RETURN_TRUE(name)                                \
125   bool LiftoffAssembler::emit_##name(DoubleRegister dst, DoubleRegister src) { \
126     BAILOUT("fp unop: " #name);                                                \
127     return true;                                                               \
128   }
129 #define UNIMPLEMENTED_I32_SHIFTOP(name)                                        \
130   void LiftoffAssembler::emit_##name(Register dst, Register src,               \
131                                      Register amount, LiftoffRegList pinned) { \
132     BAILOUT("i32 shiftop: " #name);                                            \
133   }
134 #define UNIMPLEMENTED_I64_SHIFTOP(name)                                        \
135   void LiftoffAssembler::emit_##name(LiftoffRegister dst, LiftoffRegister src, \
136                                      Register amount, LiftoffRegList pinned) { \
137     BAILOUT("i64 shiftop: " #name);                                            \
138   }
139 
140 UNIMPLEMENTED_GP_BINOP(i32_add)
UNIMPLEMENTED_GP_BINOP(i32_sub)141 UNIMPLEMENTED_GP_BINOP(i32_sub)
142 UNIMPLEMENTED_GP_BINOP(i32_mul)
143 UNIMPLEMENTED_GP_BINOP(i32_and)
144 UNIMPLEMENTED_GP_BINOP(i32_or)
145 UNIMPLEMENTED_GP_BINOP(i32_xor)
146 UNIMPLEMENTED_I32_SHIFTOP(i32_shl)
147 UNIMPLEMENTED_I32_SHIFTOP(i32_sar)
148 UNIMPLEMENTED_I32_SHIFTOP(i32_shr)
149 UNIMPLEMENTED_I64_BINOP(i64_add)
150 UNIMPLEMENTED_I64_BINOP(i64_sub)
151 UNIMPLEMENTED_I64_BINOP(i64_mul)
152 #ifdef V8_TARGET_ARCH_S390X
153 UNIMPLEMENTED_I64_BINOP(i64_and)
154 UNIMPLEMENTED_I64_BINOP(i64_or)
155 UNIMPLEMENTED_I64_BINOP(i64_xor)
156 #endif
157 UNIMPLEMENTED_I64_SHIFTOP(i64_shl)
158 UNIMPLEMENTED_I64_SHIFTOP(i64_sar)
159 UNIMPLEMENTED_I64_SHIFTOP(i64_shr)
160 UNIMPLEMENTED_GP_UNOP(i32_clz)
161 UNIMPLEMENTED_GP_UNOP(i32_ctz)
162 UNIMPLEMENTED_GP_UNOP(i32_popcnt)
163 UNIMPLEMENTED_FP_BINOP(f32_add)
164 UNIMPLEMENTED_FP_BINOP(f32_sub)
165 UNIMPLEMENTED_FP_BINOP(f32_mul)
166 UNIMPLEMENTED_FP_BINOP(f32_div)
167 UNIMPLEMENTED_FP_BINOP(f32_min)
168 UNIMPLEMENTED_FP_BINOP(f32_max)
169 UNIMPLEMENTED_FP_UNOP(f32_abs)
170 UNIMPLEMENTED_FP_UNOP(f32_neg)
171 UNIMPLEMENTED_FP_UNOP(f32_ceil)
172 UNIMPLEMENTED_FP_UNOP(f32_floor)
173 UNIMPLEMENTED_FP_UNOP(f32_trunc)
174 UNIMPLEMENTED_FP_UNOP(f32_nearest_int)
175 UNIMPLEMENTED_FP_UNOP(f32_sqrt)
176 UNIMPLEMENTED_FP_BINOP(f64_add)
177 UNIMPLEMENTED_FP_BINOP(f64_sub)
178 UNIMPLEMENTED_FP_BINOP(f64_mul)
179 UNIMPLEMENTED_FP_BINOP(f64_div)
180 UNIMPLEMENTED_FP_BINOP(f64_min)
181 UNIMPLEMENTED_FP_BINOP(f64_max)
182 UNIMPLEMENTED_FP_UNOP(f64_abs)
183 UNIMPLEMENTED_FP_UNOP(f64_neg)
184 UNIMPLEMENTED_FP_UNOP_RETURN_TRUE(f64_ceil)
185 UNIMPLEMENTED_FP_UNOP_RETURN_TRUE(f64_floor)
186 UNIMPLEMENTED_FP_UNOP_RETURN_TRUE(f64_trunc)
187 UNIMPLEMENTED_FP_UNOP_RETURN_TRUE(f64_nearest_int)
188 UNIMPLEMENTED_FP_UNOP(f64_sqrt)
189 
190 #undef UNIMPLEMENTED_GP_BINOP
191 #undef UNIMPLEMENTED_I64_BINOP
192 #undef UNIMPLEMENTED_GP_UNOP
193 #undef UNIMPLEMENTED_FP_BINOP
194 #undef UNIMPLEMENTED_FP_UNOP
195 #undef UNIMPLEMENTED_FP_UNOP_RETURN_TRUE
196 #undef UNIMPLEMENTED_I32_SHIFTOP
197 #undef UNIMPLEMENTED_I64_SHIFTOP
198 
199 void LiftoffAssembler::emit_i32_divs(Register dst, Register lhs, Register rhs,
200                                      Label* trap_div_by_zero,
201                                      Label* trap_div_unrepresentable) {
202   BAILOUT("i32_divs");
203 }
204 
emit_i32_divu(Register dst,Register lhs,Register rhs,Label * trap_div_by_zero)205 void LiftoffAssembler::emit_i32_divu(Register dst, Register lhs, Register rhs,
206                                      Label* trap_div_by_zero) {
207   BAILOUT("i32_divu");
208 }
209 
emit_i32_rems(Register dst,Register lhs,Register rhs,Label * trap_div_by_zero)210 void LiftoffAssembler::emit_i32_rems(Register dst, Register lhs, Register rhs,
211                                      Label* trap_div_by_zero) {
212   BAILOUT("i32_rems");
213 }
214 
emit_i32_remu(Register dst,Register lhs,Register rhs,Label * trap_div_by_zero)215 void LiftoffAssembler::emit_i32_remu(Register dst, Register lhs, Register rhs,
216                                      Label* trap_div_by_zero) {
217   BAILOUT("i32_remu");
218 }
219 
emit_i64_divs(LiftoffRegister dst,LiftoffRegister lhs,LiftoffRegister rhs,Label * trap_div_by_zero,Label * trap_div_unrepresentable)220 bool LiftoffAssembler::emit_i64_divs(LiftoffRegister dst, LiftoffRegister lhs,
221                                      LiftoffRegister rhs,
222                                      Label* trap_div_by_zero,
223                                      Label* trap_div_unrepresentable) {
224   BAILOUT("i64_divs");
225   return true;
226 }
227 
emit_i64_divu(LiftoffRegister dst,LiftoffRegister lhs,LiftoffRegister rhs,Label * trap_div_by_zero)228 bool LiftoffAssembler::emit_i64_divu(LiftoffRegister dst, LiftoffRegister lhs,
229                                      LiftoffRegister rhs,
230                                      Label* trap_div_by_zero) {
231   BAILOUT("i64_divu");
232   return true;
233 }
234 
emit_i64_rems(LiftoffRegister dst,LiftoffRegister lhs,LiftoffRegister rhs,Label * trap_div_by_zero)235 bool LiftoffAssembler::emit_i64_rems(LiftoffRegister dst, LiftoffRegister lhs,
236                                      LiftoffRegister rhs,
237                                      Label* trap_div_by_zero) {
238   BAILOUT("i64_rems");
239   return true;
240 }
241 
emit_i64_remu(LiftoffRegister dst,LiftoffRegister lhs,LiftoffRegister rhs,Label * trap_div_by_zero)242 bool LiftoffAssembler::emit_i64_remu(LiftoffRegister dst, LiftoffRegister lhs,
243                                      LiftoffRegister rhs,
244                                      Label* trap_div_by_zero) {
245   BAILOUT("i64_remu");
246   return true;
247 }
248 
emit_i32_to_intptr(Register dst,Register src)249 void LiftoffAssembler::emit_i32_to_intptr(Register dst, Register src) {
250 #ifdef V8_TARGET_ARCH_S390X
251   BAILOUT("emit_i32_to_intptr");
252 #else
253 // This is a nop on s390.
254 #endif
255 }
256 
emit_type_conversion(WasmOpcode opcode,LiftoffRegister dst,LiftoffRegister src,Label * trap)257 bool LiftoffAssembler::emit_type_conversion(WasmOpcode opcode,
258                                             LiftoffRegister dst,
259                                             LiftoffRegister src, Label* trap) {
260   BAILOUT("emit_type_conversion");
261   return true;
262 }
263 
emit_jump(Label * label)264 void LiftoffAssembler::emit_jump(Label* label) { BAILOUT("emit_jump"); }
265 
emit_jump(Register target)266 void LiftoffAssembler::emit_jump(Register target) { BAILOUT("emit_jump"); }
267 
emit_cond_jump(Condition cond,Label * label,ValueType type,Register lhs,Register rhs)268 void LiftoffAssembler::emit_cond_jump(Condition cond, Label* label,
269                                       ValueType type, Register lhs,
270                                       Register rhs) {
271   BAILOUT("emit_cond_jump");
272 }
273 
emit_i32_eqz(Register dst,Register src)274 void LiftoffAssembler::emit_i32_eqz(Register dst, Register src) {
275   BAILOUT("emit_i32_eqz");
276 }
277 
emit_i32_set_cond(Condition cond,Register dst,Register lhs,Register rhs)278 void LiftoffAssembler::emit_i32_set_cond(Condition cond, Register dst,
279                                          Register lhs, Register rhs) {
280   BAILOUT("emit_i32_set_cond");
281 }
282 
emit_i64_eqz(Register dst,LiftoffRegister src)283 void LiftoffAssembler::emit_i64_eqz(Register dst, LiftoffRegister src) {
284   BAILOUT("emit_i64_eqz");
285 }
286 
emit_i64_set_cond(Condition cond,Register dst,LiftoffRegister lhs,LiftoffRegister rhs)287 void LiftoffAssembler::emit_i64_set_cond(Condition cond, Register dst,
288                                          LiftoffRegister lhs,
289                                          LiftoffRegister rhs) {
290   BAILOUT("emit_i64_set_cond");
291 }
292 
emit_f32_set_cond(Condition cond,Register dst,DoubleRegister lhs,DoubleRegister rhs)293 void LiftoffAssembler::emit_f32_set_cond(Condition cond, Register dst,
294                                          DoubleRegister lhs,
295                                          DoubleRegister rhs) {
296   BAILOUT("emit_f32_set_cond");
297 }
298 
emit_f64_set_cond(Condition cond,Register dst,DoubleRegister lhs,DoubleRegister rhs)299 void LiftoffAssembler::emit_f64_set_cond(Condition cond, Register dst,
300                                          DoubleRegister lhs,
301                                          DoubleRegister rhs) {
302   BAILOUT("emit_f64_set_cond");
303 }
304 
StackCheck(Label * ool_code,Register limit_address)305 void LiftoffAssembler::StackCheck(Label* ool_code, Register limit_address) {
306   BAILOUT("StackCheck");
307 }
308 
CallTrapCallbackForTesting()309 void LiftoffAssembler::CallTrapCallbackForTesting() {
310   BAILOUT("CallTrapCallbackForTesting");
311 }
312 
AssertUnreachable(AbortReason reason)313 void LiftoffAssembler::AssertUnreachable(AbortReason reason) {
314   BAILOUT("AssertUnreachable");
315 }
316 
PushRegisters(LiftoffRegList regs)317 void LiftoffAssembler::PushRegisters(LiftoffRegList regs) {
318   BAILOUT("PushRegisters");
319 }
320 
PopRegisters(LiftoffRegList regs)321 void LiftoffAssembler::PopRegisters(LiftoffRegList regs) {
322   BAILOUT("PopRegisters");
323 }
324 
DropStackSlotsAndRet(uint32_t num_stack_slots)325 void LiftoffAssembler::DropStackSlotsAndRet(uint32_t num_stack_slots) {
326   BAILOUT("DropStackSlotsAndRet");
327 }
328 
CallC(wasm::FunctionSig * sig,const LiftoffRegister * args,const LiftoffRegister * rets,ValueType out_argument_type,int stack_bytes,ExternalReference ext_ref)329 void LiftoffAssembler::CallC(wasm::FunctionSig* sig,
330                              const LiftoffRegister* args,
331                              const LiftoffRegister* rets,
332                              ValueType out_argument_type, int stack_bytes,
333                              ExternalReference ext_ref) {
334   BAILOUT("CallC");
335 }
336 
CallNativeWasmCode(Address addr)337 void LiftoffAssembler::CallNativeWasmCode(Address addr) {
338   BAILOUT("CallNativeWasmCode");
339 }
340 
CallIndirect(wasm::FunctionSig * sig,compiler::CallDescriptor * call_descriptor,Register target)341 void LiftoffAssembler::CallIndirect(wasm::FunctionSig* sig,
342                                     compiler::CallDescriptor* call_descriptor,
343                                     Register target) {
344   BAILOUT("CallIndirect");
345 }
346 
CallRuntimeStub(WasmCode::RuntimeStubId sid)347 void LiftoffAssembler::CallRuntimeStub(WasmCode::RuntimeStubId sid) {
348   BAILOUT("CallRuntimeStub");
349 }
350 
AllocateStackSlot(Register addr,uint32_t size)351 void LiftoffAssembler::AllocateStackSlot(Register addr, uint32_t size) {
352   BAILOUT("AllocateStackSlot");
353 }
354 
DeallocateStackSlot(uint32_t size)355 void LiftoffAssembler::DeallocateStackSlot(uint32_t size) {
356   BAILOUT("DeallocateStackSlot");
357 }
358 
Construct()359 void LiftoffStackSlots::Construct() {
360   asm_->BAILOUT("LiftoffStackSlots::Construct");
361 }
362 
363 }  // namespace wasm
364 }  // namespace internal
365 }  // namespace v8
366 
367 #undef BAILOUT
368 
369 #endif  // V8_WASM_BASELINE_S390_LIFTOFF_ASSEMBLER_S390_H_
370