LLVM 23.0.0git
WebAssemblyFastISel.cpp File Reference

This file defines the WebAssembly-specific support for the FastISel class. More...

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "wasm-fastisel"

Functions

static unsigned getSExtLoadOpcode (unsigned LoadSize, bool I64Result, bool A64)
static unsigned getZExtLoadOpcode (unsigned LoadSize, bool I64Result, bool A64)
static bool isFoldableSExtOpcode (unsigned Opc)
static bool isI64SExtResult (unsigned Opc)
static unsigned getFoldedLoadOpcode (MachineInstr *MI, MachineRegisterInfo &MRI, const LoadInst *LI, bool A64)
static unsigned getFoldedI64LoadOpcode (Register DestReg, const LoadInst *LI, MachineRegisterInfo &MRI, bool A64, MachineInstr *&OuterUserMI, unsigned NarrowOpc)
static unsigned matchFoldableShift (MachineInstr *MI, const LoadInst *LI, MachineRegisterInfo &MRI, bool A64, MachineInstr *&UserMI, MachineInstr *&OuterUserMI)
 Matches a sign-extension pattern (shl + shr_s) to fold it into a signed load.
static unsigned matchFoldableSExtFromPromotedI32 (MachineInstr *MI, const LoadInst *LI, MachineRegisterInfo &MRI, bool A64, MachineInstr *&UserMI)
static unsigned matchFoldableCopyToI64Ext (MachineInstr *MI, const LoadInst *LI, MachineRegisterInfo &MRI, bool A64, MachineInstr *&OuterUserMI)
static unsigned matchFoldableAnd (MachineInstr *MI, const LoadInst *LI, MachineRegisterInfo &MRI, bool A64, MachineInstr *&OuterUserMI)

Detailed Description

This file defines the WebAssembly-specific support for the FastISel class.

Some of the target-specific code is generated by tablegen in the file WebAssemblyGenFastISel.inc, which is #included here.

TODO: kill flags

Definition in file WebAssemblyFastISel.cpp.

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "wasm-fastisel"

Definition at line 42 of file WebAssemblyFastISel.cpp.

Function Documentation

◆ getFoldedI64LoadOpcode()

◆ getFoldedLoadOpcode()

◆ getSExtLoadOpcode()

unsigned getSExtLoadOpcode ( unsigned LoadSize,
bool I64Result,
bool A64 )
static

◆ getZExtLoadOpcode()

unsigned getZExtLoadOpcode ( unsigned LoadSize,
bool I64Result,
bool A64 )
static

◆ isFoldableSExtOpcode()

bool isFoldableSExtOpcode ( unsigned Opc)
static

Definition at line 1339 of file WebAssemblyFastISel.cpp.

References Opc.

Referenced by getFoldedLoadOpcode().

◆ isI64SExtResult()

bool isI64SExtResult ( unsigned Opc)
static

Definition at line 1353 of file WebAssemblyFastISel.cpp.

References llvm_unreachable, and Opc.

Referenced by getFoldedLoadOpcode().

◆ matchFoldableAnd()

◆ matchFoldableCopyToI64Ext()

◆ matchFoldableSExtFromPromotedI32()

◆ matchFoldableShift()

unsigned matchFoldableShift ( MachineInstr * MI,
const LoadInst * LI,
MachineRegisterInfo & MRI,
bool A64,
MachineInstr *& UserMI,
MachineInstr *& OuterUserMI )
static

Matches a sign-extension pattern (shl + shr_s) to fold it into a signed load.

FastISel assumes that 'sext' from i8 or i16 will first be lowered to a 32-bit zero-extending load (i32.load8_u / i32.load16_u) followed by 32-bit shifts, even when extending to i64. Therefore, this function only matches 32-bit shifts (SHL_I32 / SHR_S_I32) and specifically checks if both shift amounts are identical, compile-time constants that match the exact extension size (32 - LoadBitWidth).

Definition at line 1408 of file WebAssemblyFastISel.cpp.

References getFoldedI64LoadOpcode(), llvm::Type::getIntegerBitWidth(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), getSExtLoadOpcode(), llvm::Value::getType(), llvm::MachineRegisterInfo::getUniqueVRegDef(), llvm::MachineRegisterInfo::hasOneNonDBGUse(), llvm::Type::isIntegerTy(), MI, Opc, and llvm::MachineRegisterInfo::use_instr_nodbg_begin().