LLVM 19.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
}
 
enum class  BlockType : unsigned {
  Invalid = 0x00 , Void = 0x40 , I32 = unsigned(wasm::ValType::I32) , I64 = unsigned(wasm::ValType::I64) ,
  F32 = unsigned(wasm::ValType::F32) , F64 = unsigned(wasm::ValType::F64) , V128 = unsigned(wasm::ValType::V128) , Externref = unsigned(wasm::ValType::EXTERNREF) ,
  Funcref = unsigned(wasm::ValType::FUNCREF) , Multivalue = 0xffff
}
 Used as immediate MachineOperands for block signatures. 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.
 
unsigned GetDefaultP2Align (unsigned Opc)
 
bool isConst (unsigned Opc)
 
bool isScalarConst (unsigned Opc)
 
bool isArgument (unsigned Opc)
 
bool isCopy (unsigned Opc)
 
bool isTee (unsigned Opc)
 
bool isCallDirect (unsigned Opc)
 
bool isCallIndirect (unsigned Opc)
 
bool isBrTable (unsigned Opc)
 
bool isMarker (unsigned Opc)
 
bool isCatch (unsigned Opc)
 
bool isLocalGet (unsigned Opc)
 
bool isLocalSet (unsigned Opc)
 
bool isLocalTee (unsigned Opc)
 
unsigned getWARegStackId (unsigned Reg)
 
bool isRefType (wasm::ValType Type)
 
const charanyTypeToString (unsigned Type)
 
const chartypeToString (wasm::ValType Type)
 
std::string typeListToString (ArrayRef< wasm::ValType > List)
 
std::string signatureToString (const wasm::WasmSignature *Sig)
 
wasm::ValType regClassToValType (unsigned RC)
 
std::optional< wasm::ValTypeparseType (StringRef Type)
 
BlockType parseBlockType (StringRef Type)
 
int getStackOpcode (unsigned short Opcode)
 
int getRegisterOpcode (unsigned short Opcode)
 
int getWasm64Opcode (unsigned short Opcode)
 
bool isDefaultAddressSpace (unsigned AS)
 
bool isWasmVarAddressSpace (unsigned AS)
 
bool isValidAddressSpace (unsigned AS)
 
bool isWebAssemblyExternrefType (const Type *Ty)
 Return true if this is a WebAssembly Externref Type.
 
bool isWebAssemblyFuncrefType (const Type *Ty)
 Return true if this is a WebAssembly Funcref Type.
 
bool isWebAssemblyReferenceType (const Type *Ty)
 Return true if this is a WebAssembly Reference Type.
 
bool isWebAssemblyTableType (const Type *Ty)
 Return true if the table represents a WebAssembly table type.
 
MVT parseMVT (StringRef Type)
 
wasm::ValType toValType (MVT Type)
 
void wasmSymbolSetType (MCSymbolWasm *Sym, const Type *GlobalVT, const ArrayRef< MVT > &VTs)
 Sets a Wasm Symbol Type.
 
int16_t getNamedOperandIdx (uint16_t Opcode, uint16_t NamedIndex)
 
FastISelcreateFastISel (FunctionLoweringInfo &funcInfo, const TargetLibraryInfo *libInfo)
 
void getLibcallSignature (const WebAssemblySubtarget &Subtarget, RTLIB::Libcall LC, SmallVectorImpl< wasm::ValType > &Rets, SmallVectorImpl< wasm::ValType > &Params)
 
void getLibcallSignature (const WebAssemblySubtarget &Subtarget, StringRef Name, SmallVectorImpl< wasm::ValType > &Rets, SmallVectorImpl< wasm::ValType > &Params)
 
bool isChild (const MachineInstr &MI, const WebAssemblyFunctionInfo &MFI)
 Test whether MI is a child of some other node in an expression tree.
 
bool mayThrow (const MachineInstr &MI)
 
const MachineOperandgetCalleeOp (const MachineInstr &MI)
 Returns the operand number of a callee, assuming the argument is a call instruction.
 
MCSymbolWasmgetOrCreateFunctionTableSymbol (MCContext &Ctx, const WebAssemblySubtarget *Subtarget)
 Returns the __indirect_function_table, for use in call_indirect and in function bitcasts.
 
MCSymbolWasmgetOrCreateFuncrefCallTableSymbol (MCContext &Ctx, const WebAssemblySubtarget *Subtarget)
 Returns the __funcref_call_table, for use in funcref calls when lowered to table.set + call_indirect.
 
MachineInstrfindCatch (MachineBasicBlock *EHPad)
 Find a catch instruction from an EH pad.
 
unsigned getCopyOpcodeForRegClass (const TargetRegisterClass *RC)
 Returns the appropriate copy opcode for the given register class.
 

Variables

cl::opt< boolWasmEnableEmEH
 
cl::opt< boolWasmEnableEmSjLj
 
cl::opt< boolWasmEnableEH
 
cl::opt< boolWasmEnableSjLj
 
static const unsigned Nop = 0x01
 Instruction opcodes emitted via means other than CodeGen.
 
static const unsigned End = 0x0b
 
static const unsigned UnusedReg = -1u
 
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

Used as immediate MachineOperands for block signatures.

Enumerator
Invalid 
Void 
I32 
I64 
F32 
F64 
V128 
Externref 
Funcref 
Multivalue 

Definition at line 25 of file WebAssemblyMCTypeUtilities.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.

◆ 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.

Definition at line 48 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 90 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 20 of file WasmAddressSpaces.h.

Function Documentation

◆ anyTypeToString()

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

◆ createFastISel()

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

Definition at line 1436 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 148 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 86 of file WebAssemblyUtilities.cpp.

References llvm_unreachable, and MI.

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

◆ getCopyOpcodeForRegClass()

unsigned llvm::WebAssembly::getCopyOpcodeForRegClass ( const TargetRegisterClass RC)

Returns the appropriate copy opcode for the given register class.

Definition at line 161 of file WebAssemblyUtilities.cpp.

References assert(), llvm::TargetRegisterClass::getID(), and llvm_unreachable.

Referenced by llvm::WebAssemblyInstrInfo::copyPhysReg(), maybeRewriteToFallthrough(), and unstackifyVRegsUsedInSplitBB().

◆ 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 147 of file WebAssemblyMCTargetDesc.h.

References WASM_LOAD_STORE.

Referenced by GetDefaultP2Align().

◆ getLibcallSignature() [1/2]

void llvm::WebAssembly::getLibcallSignature ( const WebAssemblySubtarget Subtarget,
RTLIB::Libcall  LC,
SmallVectorImpl< wasm::ValType > &  Rets,
SmallVectorImpl< wasm::ValType > &  Params 
)

◆ getLibcallSignature() [2/2]

void llvm::WebAssembly::getLibcallSignature ( const WebAssemblySubtarget Subtarget,
StringRef  Name,
SmallVectorImpl< wasm::ValType > &  Rets,
SmallVectorImpl< wasm::ValType > &  Params 
)

◆ getNamedOperandIdx()

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

◆ getOrCreateFuncrefCallTableSymbol()

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

Returns the __funcref_call_table, for use in funcref calls when lowered to table.set + call_indirect.

Definition at line 122 of file WebAssemblyUtilities.cpp.

References llvm::MCContext::getOrCreateSymbol(), llvm::WebAssemblySubtarget::hasReferenceTypes(), llvm::MCContext::lookupSymbol(), Name, llvm::MCContext::reportError(), Sym, and llvm::wasm::WASM_SYMBOL_TYPE_TABLE.

Referenced by LowerCallResults().

◆ getOrCreateFunctionTableSymbol()

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

Returns the __indirect_function_table, for use in call_indirect and in function bitcasts.

Definition at line 103 of file WebAssemblyUtilities.cpp.

References llvm::MCContext::getOrCreateSymbol(), llvm::WebAssemblySubtarget::hasReferenceTypes(), llvm::MCContext::lookupSymbol(), Name, llvm::MCContext::reportError(), and Sym.

Referenced by llvm::WebAssemblyAsmPrinter::emitEndOfAsmFile(), and LowerCallResults().

◆ getRegisterOpcode()

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

◆ getStackOpcode()

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

Referenced by removeRegisterOperands().

◆ getWARegStackId()

unsigned llvm::WebAssembly::getWARegStackId ( unsigned  Reg)
inline

Definition at line 541 of file WebAssemblyMCTargetDesc.h.

References assert(), and Reg.

Referenced by llvm::WebAssemblyInstPrinter::printOperand().

◆ getWasm64Opcode()

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

◆ isArgument()

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

◆ isBrTable()

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

Definition at line 428 of file WebAssemblyMCTargetDesc.h.

◆ isCallDirect()

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

Definition at line 404 of file WebAssemblyMCTargetDesc.h.

◆ isCallIndirect()

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

Definition at line 416 of file WebAssemblyMCTargetDesc.h.

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

◆ isCatch()

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

Definition at line 460 of file WebAssemblyMCTargetDesc.h.

Referenced by findCatch(), and isSafeToMove().

◆ isChild()

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

◆ isConst()

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

Definition at line 284 of file WebAssemblyMCTargetDesc.h.

◆ isCopy()

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

Definition at line 360 of file WebAssemblyMCTargetDesc.h.

◆ isDefaultAddressSpace()

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

Definition at line 34 of file WasmAddressSpaces.h.

References WASM_ADDRESS_SPACE_DEFAULT.

Referenced by isValidAddressSpace().

◆ isLocalGet()

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

Definition at line 472 of file WebAssemblyMCTargetDesc.h.

◆ isLocalSet()

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

◆ isLocalTee()

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

◆ isMarker()

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

Definition at line 440 of file WebAssemblyMCTargetDesc.h.

Referenced by findCatch().

◆ isRefType()

bool llvm::WebAssembly::isRefType ( wasm::ValType  Type)
inline

Definition at line 43 of file WebAssemblyMCTypeUtilities.h.

References llvm::wasm::EXTERNREF, and llvm::wasm::FUNCREF.

◆ isScalarConst()

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

Definition at line 312 of file WebAssemblyMCTargetDesc.h.

Referenced by isSameScalarConst().

◆ isTee()

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

Definition at line 382 of file WebAssemblyMCTargetDesc.h.

Referenced by unstackifyVRegsUsedInSplitBB().

◆ isValidAddressSpace()

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

Definition at line 40 of file WasmAddressSpaces.h.

References isDefaultAddressSpace(), and isWasmVarAddressSpace().

◆ isWasmVarAddressSpace()

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

◆ isWebAssemblyExternrefType()

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

◆ isWebAssemblyFuncrefType()

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

◆ isWebAssemblyReferenceType()

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

Return true if this is a WebAssembly Reference Type.

Definition at line 44 of file WebAssemblyTypeUtilities.h.

References isWebAssemblyExternrefType(), and isWebAssemblyFuncrefType().

Referenced by isWebAssemblyTableType().

◆ isWebAssemblyTableType()

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

Return true if the table represents a WebAssembly table type.

Definition at line 49 of file WebAssemblyTypeUtilities.h.

References llvm::Type::getArrayElementType(), llvm::Type::isArrayTy(), and isWebAssemblyReferenceType().

Referenced by wasmSymbolSetType().

◆ mayThrow()

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

◆ parseBlockType()

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

◆ parseMVT()

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

◆ parseType()

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

Definition at line 20 of file WebAssemblyMCTypeUtilities.cpp.

◆ 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)

Definition at line 39 of file WebAssemblyTypeUtilities.cpp.

References llvm_unreachable.

Referenced by llvm::valTypesFromMVTs(), and wasmSymbolSetType().

◆ typeListToString()

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

◆ typeToString()

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

◆ wasmSymbolSetType()

void llvm::WebAssembly::wasmSymbolSetType ( MCSymbolWasm Sym,
const Type GlobalVT,
const ArrayRef< MVT > &  VTs 
)

Variable Documentation

◆ ClangCallTerminateFn

const char* const llvm::WebAssembly::ClangCallTerminateFn
extern

◆ CxaBeginCatchFn

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

Definition at line 24 of file WebAssemblyUtilities.cpp.

Referenced by mayThrow().

◆ CxaRethrowFn

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

Definition at line 25 of file WebAssemblyUtilities.cpp.

◆ End

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

Definition at line 144 of file WebAssemblyMCTargetDesc.h.

◆ Nop

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

Instruction opcodes emitted via means other than CodeGen.

Definition at line 143 of file WebAssemblyMCTargetDesc.h.

◆ PersonalityWrapperFn

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

Definition at line 27 of file WebAssemblyUtilities.cpp.

Referenced by mayThrow().

◆ StdTerminateFn

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

Definition at line 26 of file WebAssemblyUtilities.cpp.

Referenced by mayThrow().

◆ UnusedReg

const unsigned llvm::WebAssembly::UnusedReg = -1u
static

◆ WasmEnableEH

cl::opt< bool > llvm::WebAssembly::WasmEnableEH
extern

◆ WasmEnableEmEH

cl::opt< bool > llvm::WebAssembly::WasmEnableEmEH
extern

◆ WasmEnableEmSjLj

cl::opt< bool > llvm::WebAssembly::WasmEnableEmSjLj
extern

◆ WasmEnableSjLj

cl::opt< bool > llvm::WebAssembly::WasmEnableSjLj
extern