14#ifndef LLVM_LIB_TARGET_WEBASSEMBLY_MCTARGETDESC_WEBASSEMBLYMCTARGETDESC_H
15#define LLVM_LIB_TARGET_WEBASSEMBLY_MCTARGETDESC_WEBASSEMBLYMCTARGETDESC_H
29class MCObjectTargetWriter;
37std::unique_ptr<MCObjectTargetWriter>
40namespace WebAssembly {
95namespace WebAssemblyII {
137#define GET_REGINFO_ENUM
138#include "WebAssemblyGenRegisterInfo.inc"
142#define GET_INSTRINFO_ENUM
143#define GET_INSTRINFO_MC_HELPER_DECLS
144#include "WebAssemblyGenInstrInfo.inc"
147namespace WebAssembly {
150static const unsigned Nop = 0x01;
151static const unsigned End = 0x0b;
156#define WASM_LOAD_STORE(NAME) \
157 case WebAssembly::NAME##_A32: \
158 case WebAssembly::NAME##_A64: \
159 case WebAssembly::NAME##_A32_S: \
160 case WebAssembly::NAME##_A64_S:
282#undef WASM_LOAD_STORE
295 case WebAssembly::CONST_I32:
296 case WebAssembly::CONST_I32_S:
297 case WebAssembly::CONST_I64:
298 case WebAssembly::CONST_I64_S:
299 case WebAssembly::CONST_F32:
300 case WebAssembly::CONST_F32_S:
301 case WebAssembly::CONST_F64:
302 case WebAssembly::CONST_F64_S:
303 case WebAssembly::CONST_V128_I8x16:
304 case WebAssembly::CONST_V128_I8x16_S:
305 case WebAssembly::CONST_V128_I16x8:
306 case WebAssembly::CONST_V128_I16x8_S:
307 case WebAssembly::CONST_V128_I32x4:
308 case WebAssembly::CONST_V128_I32x4_S:
309 case WebAssembly::CONST_V128_I64x2:
310 case WebAssembly::CONST_V128_I64x2_S:
311 case WebAssembly::CONST_V128_F32x4:
312 case WebAssembly::CONST_V128_F32x4_S:
313 case WebAssembly::CONST_V128_F64x2:
314 case WebAssembly::CONST_V128_F64x2_S:
323 case WebAssembly::CONST_I32:
324 case WebAssembly::CONST_I32_S:
325 case WebAssembly::CONST_I64:
326 case WebAssembly::CONST_I64_S:
327 case WebAssembly::CONST_F32:
328 case WebAssembly::CONST_F32_S:
329 case WebAssembly::CONST_F64:
330 case WebAssembly::CONST_F64_S:
339 case WebAssembly::ARGUMENT_i32:
340 case WebAssembly::ARGUMENT_i32_S:
341 case WebAssembly::ARGUMENT_i64:
342 case WebAssembly::ARGUMENT_i64_S:
343 case WebAssembly::ARGUMENT_f32:
344 case WebAssembly::ARGUMENT_f32_S:
345 case WebAssembly::ARGUMENT_f64:
346 case WebAssembly::ARGUMENT_f64_S:
347 case WebAssembly::ARGUMENT_v16i8:
348 case WebAssembly::ARGUMENT_v16i8_S:
349 case WebAssembly::ARGUMENT_v8i16:
350 case WebAssembly::ARGUMENT_v8i16_S:
351 case WebAssembly::ARGUMENT_v4i32:
352 case WebAssembly::ARGUMENT_v4i32_S:
353 case WebAssembly::ARGUMENT_v2i64:
354 case WebAssembly::ARGUMENT_v2i64_S:
355 case WebAssembly::ARGUMENT_v8f16:
356 case WebAssembly::ARGUMENT_v8f16_S:
357 case WebAssembly::ARGUMENT_v4f32:
358 case WebAssembly::ARGUMENT_v4f32_S:
359 case WebAssembly::ARGUMENT_v2f64:
360 case WebAssembly::ARGUMENT_v2f64_S:
361 case WebAssembly::ARGUMENT_funcref:
362 case WebAssembly::ARGUMENT_funcref_S:
363 case WebAssembly::ARGUMENT_externref:
364 case WebAssembly::ARGUMENT_externref_S:
365 case WebAssembly::ARGUMENT_exnref:
366 case WebAssembly::ARGUMENT_exnref_S:
375 case WebAssembly::COPY_I32:
376 case WebAssembly::COPY_I32_S:
377 case WebAssembly::COPY_I64:
378 case WebAssembly::COPY_I64_S:
379 case WebAssembly::COPY_F32:
380 case WebAssembly::COPY_F32_S:
381 case WebAssembly::COPY_F64:
382 case WebAssembly::COPY_F64_S:
383 case WebAssembly::COPY_V128:
384 case WebAssembly::COPY_V128_S:
385 case WebAssembly::COPY_FUNCREF:
386 case WebAssembly::COPY_FUNCREF_S:
387 case WebAssembly::COPY_EXTERNREF:
388 case WebAssembly::COPY_EXTERNREF_S:
389 case WebAssembly::COPY_EXNREF:
390 case WebAssembly::COPY_EXNREF_S:
399 case WebAssembly::TEE_I32:
400 case WebAssembly::TEE_I32_S:
401 case WebAssembly::TEE_I64:
402 case WebAssembly::TEE_I64_S:
403 case WebAssembly::TEE_F32:
404 case WebAssembly::TEE_F32_S:
405 case WebAssembly::TEE_F64:
406 case WebAssembly::TEE_F64_S:
407 case WebAssembly::TEE_V128:
408 case WebAssembly::TEE_V128_S:
409 case WebAssembly::TEE_FUNCREF:
410 case WebAssembly::TEE_FUNCREF_S:
411 case WebAssembly::TEE_EXTERNREF:
412 case WebAssembly::TEE_EXTERNREF_S:
413 case WebAssembly::TEE_EXNREF:
414 case WebAssembly::TEE_EXNREF_S:
423 case WebAssembly::CALL:
424 case WebAssembly::CALL_S:
425 case WebAssembly::RET_CALL:
426 case WebAssembly::RET_CALL_S:
435 case WebAssembly::CALL_INDIRECT:
436 case WebAssembly::CALL_INDIRECT_S:
437 case WebAssembly::RET_CALL_INDIRECT:
438 case WebAssembly::RET_CALL_INDIRECT_S:
447 case WebAssembly::BR_TABLE_I32:
448 case WebAssembly::BR_TABLE_I32_S:
449 case WebAssembly::BR_TABLE_I64:
450 case WebAssembly::BR_TABLE_I64_S:
459 case WebAssembly::BLOCK:
460 case WebAssembly::BLOCK_S:
461 case WebAssembly::END_BLOCK:
462 case WebAssembly::END_BLOCK_S:
463 case WebAssembly::LOOP:
464 case WebAssembly::LOOP_S:
465 case WebAssembly::END_LOOP:
466 case WebAssembly::END_LOOP_S:
467 case WebAssembly::TRY:
468 case WebAssembly::TRY_S:
469 case WebAssembly::END_TRY:
470 case WebAssembly::END_TRY_S:
471 case WebAssembly::TRY_TABLE:
472 case WebAssembly::TRY_TABLE_S:
473 case WebAssembly::END_TRY_TABLE:
474 case WebAssembly::END_TRY_TABLE_S:
483 case WebAssembly::END_BLOCK:
484 case WebAssembly::END_BLOCK_S:
485 case WebAssembly::END_LOOP:
486 case WebAssembly::END_LOOP_S:
487 case WebAssembly::END_TRY:
488 case WebAssembly::END_TRY_S:
489 case WebAssembly::END_TRY_TABLE:
490 case WebAssembly::END_TRY_TABLE_S:
499 case WebAssembly::TRY:
500 case WebAssembly::TRY_S:
501 case WebAssembly::TRY_TABLE:
502 case WebAssembly::TRY_TABLE_S:
511 case WebAssembly::CATCH_LEGACY:
512 case WebAssembly::CATCH_LEGACY_S:
513 case WebAssembly::CATCH_ALL_LEGACY:
514 case WebAssembly::CATCH_ALL_LEGACY_S:
515 case WebAssembly::CATCH:
516 case WebAssembly::CATCH_S:
517 case WebAssembly::CATCH_REF:
518 case WebAssembly::CATCH_REF_S:
519 case WebAssembly::CATCH_ALL:
520 case WebAssembly::CATCH_ALL_S:
521 case WebAssembly::CATCH_ALL_REF:
522 case WebAssembly::CATCH_ALL_REF_S:
531 case WebAssembly::CATCH_ALL_LEGACY:
532 case WebAssembly::CATCH_ALL_LEGACY_S:
533 case WebAssembly::CATCH_ALL:
534 case WebAssembly::CATCH_ALL_S:
535 case WebAssembly::CATCH_ALL_REF:
536 case WebAssembly::CATCH_ALL_REF_S:
545 case WebAssembly::LOCAL_GET_I32:
546 case WebAssembly::LOCAL_GET_I32_S:
547 case WebAssembly::LOCAL_GET_I64:
548 case WebAssembly::LOCAL_GET_I64_S:
549 case WebAssembly::LOCAL_GET_F32:
550 case WebAssembly::LOCAL_GET_F32_S:
551 case WebAssembly::LOCAL_GET_F64:
552 case WebAssembly::LOCAL_GET_F64_S:
553 case WebAssembly::LOCAL_GET_V128:
554 case WebAssembly::LOCAL_GET_V128_S:
555 case WebAssembly::LOCAL_GET_FUNCREF:
556 case WebAssembly::LOCAL_GET_FUNCREF_S:
557 case WebAssembly::LOCAL_GET_EXTERNREF:
558 case WebAssembly::LOCAL_GET_EXTERNREF_S:
559 case WebAssembly::LOCAL_GET_EXNREF:
560 case WebAssembly::LOCAL_GET_EXNREF_S:
569 case WebAssembly::LOCAL_SET_I32:
570 case WebAssembly::LOCAL_SET_I32_S:
571 case WebAssembly::LOCAL_SET_I64:
572 case WebAssembly::LOCAL_SET_I64_S:
573 case WebAssembly::LOCAL_SET_F32:
574 case WebAssembly::LOCAL_SET_F32_S:
575 case WebAssembly::LOCAL_SET_F64:
576 case WebAssembly::LOCAL_SET_F64_S:
577 case WebAssembly::LOCAL_SET_V128:
578 case WebAssembly::LOCAL_SET_V128_S:
579 case WebAssembly::LOCAL_SET_FUNCREF:
580 case WebAssembly::LOCAL_SET_FUNCREF_S:
581 case WebAssembly::LOCAL_SET_EXTERNREF:
582 case WebAssembly::LOCAL_SET_EXTERNREF_S:
583 case WebAssembly::LOCAL_SET_EXNREF:
584 case WebAssembly::LOCAL_SET_EXNREF_S:
593 case WebAssembly::LOCAL_TEE_I32:
594 case WebAssembly::LOCAL_TEE_I32_S:
595 case WebAssembly::LOCAL_TEE_I64:
596 case WebAssembly::LOCAL_TEE_I64_S:
597 case WebAssembly::LOCAL_TEE_F32:
598 case WebAssembly::LOCAL_TEE_F32_S:
599 case WebAssembly::LOCAL_TEE_F64:
600 case WebAssembly::LOCAL_TEE_F64_S:
601 case WebAssembly::LOCAL_TEE_V128:
602 case WebAssembly::LOCAL_TEE_V128_S:
603 case WebAssembly::LOCAL_TEE_FUNCREF:
604 case WebAssembly::LOCAL_TEE_FUNCREF_S:
605 case WebAssembly::LOCAL_TEE_EXTERNREF:
606 case WebAssembly::LOCAL_TEE_EXTERNREF_S:
607 case WebAssembly::LOCAL_TEE_EXNREF:
608 case WebAssembly::LOCAL_TEE_EXNREF_S:
620 return Reg & INT32_MAX;
626#define GET_SUBTARGETINFO_ENUM
627#include "WebAssemblyGenSubtargetInfo.inc"
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
#define WASM_LOAD_STORE(NAME)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
TOF
Target Operand Flag enum.
bool isLocalTee(unsigned Opc)
bool isArgument(unsigned Opc)
bool isCallIndirect(unsigned Opc)
unsigned GetDefaultP2Align(unsigned Opc)
bool isCatchAll(unsigned Opc)
bool isMarker(unsigned Opc)
bool isBrTable(unsigned Opc)
bool isEndMarker(unsigned Opc)
bool isCatch(unsigned Opc)
static const unsigned UnusedReg
static const unsigned Nop
Instruction opcodes emitted via means other than CodeGen.
cl::opt< bool > WasmEnableEH
bool isCopy(unsigned Opc)
cl::opt< bool > WasmEnableSjLj
static const unsigned End
bool isConst(unsigned Opc)
cl::opt< bool > WasmEnableExnref
cl::opt< bool > WasmEnableEmEH
@ OPERAND_GLOBAL
Global index.
@ OPERAND_CATCH_LIST
A list of catch clauses for try_table.
@ OPERAND_OFFSET64
64-bit unsigned memory offsets.
@ OPERAND_I32IMM
32-bit integer immediates.
@ OPERAND_P2ALIGN
p2align immediate for load and store address alignment.
@ OPERAND_TABLE
32-bit unsigned table number.
@ OPERAND_LOCAL
Local index.
@ OPERAND_VEC_I64IMM
64-bit vector lane immediate
@ OPERAND_VEC_I16IMM
16-bit vector lane immediate
@ OPERAND_TYPEINDEX
type signature immediate for call_indirect.
@ OPERAND_FUNCTION32
32-bit unsigned function indices.
@ OPERAND_F32IMM
32-bit floating-point immediates.
@ OPERAND_BASIC_BLOCK
Basic block label in a branch construct.
@ OPERAND_VEC_I32IMM
32-bit vector lane immediate
@ OPERAND_BRLIST
A list of branch targets for br_list.
@ OPERAND_F64IMM
64-bit floating-point immediates.
@ OPERAND_VEC_I8IMM
8-bit vector lane immediate
@ OPERAND_SIGNATURE
signature immediate for block/loop.
@ OPERAND_I64IMM
64-bit integer immediates.
@ OPERAND_OFFSET32
32-bit unsigned memory offsets.
unsigned GetDefaultP2AlignAny(unsigned Opc)
Return the default p2align value for a load or store with the given opcode.
cl::opt< bool > WasmEnableEmSjLj
bool isCallDirect(unsigned Opc)
bool isScalarConst(unsigned Opc)
unsigned getWARegStackId(unsigned Reg)
bool isLocalSet(unsigned Opc)
bool isLocalGet(unsigned Opc)
This is an optimization pass for GlobalISel generic memory operations.
MCCodeEmitter * createWebAssemblyMCCodeEmitter(const MCInstrInfo &MCII, MCContext &Ctx)
MCAsmBackend * createWebAssemblyAsmBackend(const Triple &TT)
std::unique_ptr< MCObjectTargetWriter > createWebAssemblyWasmObjectWriter(bool Is64Bit, bool IsEmscripten)
This struct is a compact representation of a valid (non-zero power of two) alignment.