LLVM  14.0.0git
Classes | Enumerations | Functions | Variables
llvm::WebAssembly Namespace Reference

Classes

class  ConcreteSortRegion
 
class  SortRegion
 
class  SortRegionInfo
 

Enumerations

enum  Tag { CPP_EXCEPTION = 0, C_LONGJMP = 1 }
 
enum  Fixups {
  fixup_sleb128_i32 = FirstTargetFixupKind, fixup_sleb128_i64, fixup_uleb128_i32, fixup_uleb128_i64,
  LastTargetFixupKind, NumTargetFixupKinds = LastTargetFixupKind - FirstTargetFixupKind
}
 
enum  OperandType {
  OPERAND_BASIC_BLOCK = MCOI::OPERAND_FIRST_TARGET, OPERAND_LOCAL, OPERAND_GLOBAL, OPERAND_I32IMM,
  OPERAND_I64IMM, OPERAND_F32IMM, OPERAND_F64IMM, OPERAND_VEC_I8IMM,
  OPERAND_VEC_I16IMM, OPERAND_VEC_I32IMM, OPERAND_VEC_I64IMM, OPERAND_FUNCTION32,
  OPERAND_OFFSET32, OPERAND_OFFSET64, OPERAND_P2ALIGN, OPERAND_SIGNATURE,
  OPERAND_TYPEINDEX, OPERAND_TAG, OPERAND_BRLIST, OPERAND_TABLE,
  OPERAND_HEAPTYPE
}
 
enum  BlockType : unsigned {
  BlockType::Invalid = 0x00, BlockType::Void = 0x40, BlockType::I32 = unsigned(wasm::ValType::I32), BlockType::I64 = unsigned(wasm::ValType::I64),
  BlockType::F32 = unsigned(wasm::ValType::F32), BlockType::F64 = unsigned(wasm::ValType::F64), BlockType::V128 = unsigned(wasm::ValType::V128), BlockType::Externref = unsigned(wasm::ValType::EXTERNREF),
  BlockType::Funcref = unsigned(wasm::ValType::FUNCREF), BlockType::Multivalue = 0xffff
}
 Used as immediate MachineOperands for block signatures. More...
 
enum  HeapType : unsigned { HeapType::Invalid = 0x00, HeapType::Externref = unsigned(wasm::ValType::EXTERNREF), HeapType::Funcref = unsigned(wasm::ValType::FUNCREF) }
 Used as immediate MachineOperands for heap types, e.g. for ref.null. More...
 
enum  WasmAddressSpace : unsigned { WASM_ADDRESS_SPACE_DEFAULT = 0, WASM_ADDRESS_SPACE_VAR = 1, WASM_ADDRESS_SPACE_EXTERNREF = 10, WASM_ADDRESS_SPACE_FUNCREF = 20 }
 
enum  TargetIndex {
  TI_LOCAL, TI_GLOBAL_FIXED, TI_OPERAND_STACK, TI_GLOBAL_RELOC,
  TI_LOCAL_INDIRECT
}
 

Functions

unsigned GetDefaultP2AlignAny (unsigned Opc)
 Return the default p2align value for a load or store with the given opcode. More...
 
unsigned GetDefaultP2Align (unsigned Opc)
 
bool isArgument (unsigned Opc)
 
bool isCopy (unsigned Opc)
 
bool isTee (unsigned Opc)
 
bool isCallDirect (unsigned Opc)
 
bool isCallIndirect (unsigned Opc)
 
bool isBrTable (const MachineInstr &MI)
 
bool isMarker (unsigned Opc)
 
bool isCatch (unsigned Opc)
 
int getStackOpcode (unsigned short Opcode)
 
int getRegisterOpcode (unsigned short Opcode)
 
int getWasm64Opcode (unsigned short Opcode)
 
Optional< wasm::ValTypeparseType (StringRef Type)
 
HeapType parseHeapType (StringRef Type)
 
BlockType parseBlockType (StringRef Type)
 
MVT parseMVT (StringRef Type)
 
const char * anyTypeToString (unsigned Type)
 
const char * typeToString (wasm::ValType Type)
 
std::string typeListToString (ArrayRef< wasm::ValType > List)
 
std::string signatureToString (const wasm::WasmSignature *Sig)
 
wasm::ValType toValType (MVT Type)
 
wasm::ValType regClassToValType (unsigned RC)
 
bool isDefaultAddressSpace (unsigned AS)
 
bool isWasmVarAddressSpace (unsigned AS)
 
bool isValidAddressSpace (unsigned AS)
 
bool isFuncrefType (const Type *Ty)
 
bool isExternrefType (const Type *Ty)
 
bool isRefType (const Type *Ty)
 
bool isChild (const MachineInstr &MI, const WebAssemblyFunctionInfo &MFI)
 Test whether MI is a child of some other node in an expression tree. More...
 
bool mayThrow (const MachineInstr &MI)
 
const MachineOperandgetCalleeOp (const MachineInstr &MI)
 Returns the operand number of a callee, assuming the argument is a call instruction. More...
 
MCSymbolWasmgetOrCreateFunctionTableSymbol (MCContext &Ctx, const WebAssemblySubtarget *Subtarget)
 Returns the __indirect_function_table, for use in call_indirect and in function bitcasts. More...
 
MCSymbolWasmgetOrCreateFuncrefCallTableSymbol (MCContext &Ctx, const WebAssemblySubtarget *Subtarget)
 Returns the __funcref_call_table, for use in funcref calls when lowered to table.set + call_indirect. More...
 
MachineInstrfindCatch (MachineBasicBlock *EHPad)
 Find a catch instruction from an EH pad. More...
 
int16_t getNamedOperandIdx (uint16_t Opcode, uint16_t NamedIndex)
 
FastISelcreateFastISel (FunctionLoweringInfo &funcInfo, const TargetLibraryInfo *libInfo)
 

Variables

static const unsigned Nop = 0x01
 Instruction opcodes emitted via means other than CodeGen. More...
 
static const unsigned End = 0x0b
 
const char *const ClangCallTerminateFn
 
const char *const CxaBeginCatchFn = "__cxa_begin_catch"
 
const char *const CxaRethrowFn = "__cxa_rethrow"
 
const char *const StdTerminateFn = "_ZSt9terminatev"
 
const char *const PersonalityWrapperFn
 

Enumeration Type Documentation

◆ BlockType

enum llvm::WebAssembly::BlockType : unsigned
strong

Used as immediate MachineOperands for block signatures.

Enumerator
Invalid 
Void 
I32 
I64 
F32 
F64 
V128 
Externref 
Funcref 
Multivalue 

Definition at line 26 of file WebAssemblyTypeUtilities.h.

◆ Fixups

Enumerator
fixup_sleb128_i32 
fixup_sleb128_i64 
fixup_uleb128_i32 
fixup_uleb128_i64 
LastTargetFixupKind 
NumTargetFixupKinds 

Definition at line 16 of file WebAssemblyFixupKinds.h.

◆ HeapType

enum llvm::WebAssembly::HeapType : unsigned
strong

Used as immediate MachineOperands for heap types, e.g. for ref.null.

Enumerator
Invalid 
Externref 
Funcref 

Definition at line 45 of file WebAssemblyTypeUtilities.h.

◆ OperandType

Enumerator
OPERAND_BASIC_BLOCK 

Basic block label in a branch construct.

OPERAND_LOCAL 

Local index.

OPERAND_GLOBAL 

Global index.

OPERAND_I32IMM 

32-bit integer immediates.

OPERAND_I64IMM 

64-bit integer immediates.

OPERAND_F32IMM 

32-bit floating-point immediates.

OPERAND_F64IMM 

64-bit floating-point immediates.

OPERAND_VEC_I8IMM 

8-bit vector lane immediate

OPERAND_VEC_I16IMM 

16-bit vector lane immediate

OPERAND_VEC_I32IMM 

32-bit vector lane immediate

OPERAND_VEC_I64IMM 

64-bit vector lane immediate

OPERAND_FUNCTION32 

32-bit unsigned function indices.

OPERAND_OFFSET32 

32-bit unsigned memory offsets.

OPERAND_OFFSET64 

64-bit unsigned memory offsets.

OPERAND_P2ALIGN 

p2align immediate for load and store address alignment.

OPERAND_SIGNATURE 

signature immediate for block/loop.

OPERAND_TYPEINDEX 

type signature immediate for call_indirect.

OPERAND_TAG 

Tag index.

OPERAND_BRLIST 

A list of branch targets for br_list.

OPERAND_TABLE 

32-bit unsigned table number.

OPERAND_HEAPTYPE 

heap type immediate for ref.null.

Definition at line 40 of file WebAssemblyMCTargetDesc.h.

◆ Tag

Enumerator
CPP_EXCEPTION 
C_LONGJMP 

Definition at line 27 of file WasmEHFuncInfo.h.

◆ TargetIndex

Enumerator
TI_LOCAL 
TI_GLOBAL_FIXED 
TI_OPERAND_STACK 
TI_GLOBAL_RELOC 
TI_LOCAL_INDIRECT 

Definition at line 91 of file WebAssembly.h.

◆ WasmAddressSpace

Enumerator
WASM_ADDRESS_SPACE_DEFAULT 
WASM_ADDRESS_SPACE_VAR 
WASM_ADDRESS_SPACE_EXTERNREF 
WASM_ADDRESS_SPACE_FUNCREF 

Definition at line 33 of file WebAssemblyUtilities.h.

Function Documentation

◆ anyTypeToString()

const char * llvm::WebAssembly::anyTypeToString ( unsigned  Type)

◆ createFastISel()

FastISel * llvm::WebAssembly::createFastISel ( FunctionLoweringInfo funcInfo,
const TargetLibraryInfo libInfo 
)

Definition at line 1431 of file WebAssemblyFastISel.cpp.

◆ findCatch()

MachineInstr * llvm::WebAssembly::findCatch ( MachineBasicBlock EHPad)

Find a catch instruction from an EH pad.

Returns null if no catch instruction found or the catch is in an invalid location.

Definition at line 145 of file WebAssemblyUtilities.cpp.

References assert(), llvm::MachineBasicBlock::begin(), llvm::MachineBasicBlock::end(), isCatch(), llvm::MachineBasicBlock::isEHPad(), and isMarker().

◆ getCalleeOp()

const MachineOperand & llvm::WebAssembly::getCalleeOp ( const MachineInstr MI)

Returns the operand number of a callee, assuming the argument is a call instruction.

Definition at line 83 of file WebAssemblyUtilities.cpp.

References llvm::AArch64ISD::CALL, llvm_unreachable, and MI.

Referenced by llvm::WebAssemblyInstrInfo::getCalleeOperand(), mayThrow(), and queryCallee().

◆ GetDefaultP2Align()

unsigned llvm::WebAssembly::GetDefaultP2Align ( unsigned  Opc)
inline

◆ GetDefaultP2AlignAny()

unsigned llvm::WebAssembly::GetDefaultP2AlignAny ( unsigned  Opc)
inline

Return the default p2align value for a load or store with the given opcode.

Definition at line 140 of file WebAssemblyMCTargetDesc.h.

References WASM_LOAD_STORE.

Referenced by GetDefaultP2Align().

◆ getNamedOperandIdx()

int16_t llvm::WebAssembly::getNamedOperandIdx ( uint16_t  Opcode,
uint16_t  NamedIndex 
)

◆ getOrCreateFuncrefCallTableSymbol()

MCSymbolWasm * llvm::WebAssembly::getOrCreateFuncrefCallTableSymbol ( MCContext Ctx,
const WebAssemblySubtarget Subtarget 
)

◆ getOrCreateFunctionTableSymbol()

MCSymbolWasm * llvm::WebAssembly::getOrCreateFunctionTableSymbol ( MCContext Ctx,
const WebAssemblySubtarget Subtarget 
)

◆ getRegisterOpcode()

int llvm::WebAssembly::getRegisterOpcode ( unsigned short  Opcode)

◆ getStackOpcode()

int llvm::WebAssembly::getStackOpcode ( unsigned short  Opcode)

Referenced by removeRegisterOperands().

◆ getWasm64Opcode()

int llvm::WebAssembly::getWasm64Opcode ( unsigned short  Opcode)

◆ isArgument()

bool llvm::WebAssembly::isArgument ( unsigned  Opc)
inline

◆ isBrTable()

bool llvm::WebAssembly::isBrTable ( const MachineInstr MI)
inline

Definition at line 377 of file WebAssemblyMCTargetDesc.h.

References MI.

◆ isCallDirect()

bool llvm::WebAssembly::isCallDirect ( unsigned  Opc)
inline

Definition at line 353 of file WebAssemblyMCTargetDesc.h.

References llvm::AArch64ISD::CALL.

◆ isCallIndirect()

bool llvm::WebAssembly::isCallIndirect ( unsigned  Opc)
inline

Definition at line 365 of file WebAssemblyMCTargetDesc.h.

Referenced by llvm::WebAssemblyMCInstLower::lower(), and mayThrow().

◆ isCatch()

bool llvm::WebAssembly::isCatch ( unsigned  Opc)
inline

Definition at line 409 of file WebAssemblyMCTargetDesc.h.

Referenced by findCatch(), and isSafeToMove().

◆ isChild()

bool llvm::WebAssembly::isChild ( const MachineInstr MI,
const WebAssemblyFunctionInfo MFI 
)

◆ isCopy()

bool llvm::WebAssembly::isCopy ( unsigned  Opc)
inline

Definition at line 309 of file WebAssemblyMCTargetDesc.h.

◆ isDefaultAddressSpace()

bool llvm::WebAssembly::isDefaultAddressSpace ( unsigned  AS)
inline

Definition at line 47 of file WebAssemblyUtilities.h.

References WASM_ADDRESS_SPACE_DEFAULT.

Referenced by isValidAddressSpace().

◆ isExternrefType()

bool llvm::WebAssembly::isExternrefType ( const Type Ty)
inline

Definition at line 61 of file WebAssemblyUtilities.h.

References llvm::Type::getPointerAddressSpace(), and WASM_ADDRESS_SPACE_EXTERNREF.

Referenced by isRefType().

◆ isFuncrefType()

bool llvm::WebAssembly::isFuncrefType ( const Type Ty)
inline

Definition at line 56 of file WebAssemblyUtilities.h.

References llvm::Type::getPointerAddressSpace(), and WASM_ADDRESS_SPACE_FUNCREF.

Referenced by isRefType().

◆ isMarker()

bool llvm::WebAssembly::isMarker ( unsigned  Opc)
inline

Definition at line 389 of file WebAssemblyMCTargetDesc.h.

References llvm::bitc::END_BLOCK, and llvm::AMDGPUISD::LOOP.

Referenced by findCatch().

◆ isRefType()

bool llvm::WebAssembly::isRefType ( const Type Ty)
inline

Definition at line 66 of file WebAssemblyUtilities.h.

References isExternrefType(), and isFuncrefType().

Referenced by IsWebAssemblyTable().

◆ isTee()

bool llvm::WebAssembly::isTee ( unsigned  Opc)
inline

Definition at line 331 of file WebAssemblyMCTargetDesc.h.

Referenced by unstackifyVRegsUsedInSplitBB().

◆ isValidAddressSpace()

bool llvm::WebAssembly::isValidAddressSpace ( unsigned  AS)
inline

Definition at line 53 of file WebAssemblyUtilities.h.

References isDefaultAddressSpace(), and isWasmVarAddressSpace().

◆ isWasmVarAddressSpace()

bool llvm::WebAssembly::isWasmVarAddressSpace ( unsigned  AS)
inline

◆ mayThrow()

bool llvm::WebAssembly::mayThrow ( const MachineInstr MI)

◆ parseBlockType()

WebAssembly::BlockType llvm::WebAssembly::parseBlockType ( StringRef  Type)

◆ parseHeapType()

WebAssembly::HeapType llvm::WebAssembly::parseHeapType ( StringRef  Type)

◆ parseMVT()

MVT llvm::WebAssembly::parseMVT ( StringRef  Type)

◆ parseType()

Optional< wasm::ValType > llvm::WebAssembly::parseType ( StringRef  Type)

◆ regClassToValType()

wasm::ValType llvm::WebAssembly::regClassToValType ( unsigned  RC)

◆ signatureToString()

std::string llvm::WebAssembly::signatureToString ( const wasm::WasmSignature Sig)

◆ toValType()

wasm::ValType llvm::WebAssembly::toValType ( MVT  Type)

◆ typeListToString()

std::string llvm::WebAssembly::typeListToString ( ArrayRef< wasm::ValType List)

◆ typeToString()

const char * llvm::WebAssembly::typeToString ( wasm::ValType  Type)

Variable Documentation

◆ ClangCallTerminateFn

const char* const llvm::WebAssembly::ClangCallTerminateFn

◆ CxaBeginCatchFn

const char *const llvm::WebAssembly::CxaBeginCatchFn = "__cxa_begin_catch"

Definition at line 21 of file WebAssemblyUtilities.cpp.

Referenced by mayThrow().

◆ CxaRethrowFn

const char *const llvm::WebAssembly::CxaRethrowFn = "__cxa_rethrow"

Definition at line 22 of file WebAssemblyUtilities.cpp.

◆ End

const unsigned llvm::WebAssembly::End = 0x0b
static

Definition at line 137 of file WebAssemblyMCTargetDesc.h.

◆ Nop

const unsigned llvm::WebAssembly::Nop = 0x01
static

◆ PersonalityWrapperFn

const char *const llvm::WebAssembly::PersonalityWrapperFn
Initial value:
=
"_Unwind_Wasm_CallPersonality"

Definition at line 24 of file WebAssemblyUtilities.cpp.

Referenced by mayThrow().

◆ StdTerminateFn

const char *const llvm::WebAssembly::StdTerminateFn = "_ZSt9terminatev"

Definition at line 23 of file WebAssemblyUtilities.cpp.

Referenced by mayThrow().